/**
 * Greenify Template - CSS
 * Nature-inspired minimalist blog with forest green accents,
 * Inter typography, and clean "notebook" aesthetics.
 */

/* ========== 1. CSS Variables ========== */
:root {
    /* Colors — Material Design 3 Forest Green */
    --gfy-bg: #fbf9f8;
    --gfy-surface: #f6f3f2;
    --gfy-surface-dim: #f0eded;
    --gfy-card: #ffffff;
    --gfy-border: #c2c9bb;
    --gfy-border-soft: #e4e2e1;
    --gfy-text: #1b1c1c;
    --gfy-text-secondary: #42493e;
    --gfy-text-muted: #72796e;
    --gfy-accent: #2d5a27;
    --gfy-accent-hover: #23501e;
    --gfy-accent-light: #dee5d6;
    --gfy-accent-soft: #bcf0ae;

    /* Spacing */
    --gfy-gap-xs: 4px;
    --gfy-gap-sm: 8px;
    --gfy-gap-md: 16px;
    --gfy-gap-lg: 24px;
    --gfy-gap-xl: 32px;
    --gfy-gap-2xl: 64px;
    --gfy-container: 1140px;

    /* Radius */
    --gfy-radius-sm: 4px;
    --gfy-radius-md: 8px;
    --gfy-radius-lg: 12px;
    --gfy-radius-xl: 16px;
    --gfy-radius-full: 9999px;

    /* Shadows */
    --gfy-shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.05);
    --gfy-shadow-md: 0 4px 12px rgba(0,0,0,.06);

    /* Transitions */
    --gfy-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --gfy-duration: 200ms;
}

/* ========== 2. Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--gfy-text);
    background-color: var(--gfy-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--gfy-accent); text-decoration: none; transition: color var(--gfy-duration) var(--gfy-ease); }
a:hover { color: var(--gfy-accent-hover); }

/* ========== 3. Typography ========== */
h1, h2, h3, h4, h5, h6 {
    margin: 0; font-weight: 700; line-height: 1.25; color: var(--gfy-text);
}

/* ========== 4. Layout ========== */
.gfy-container {
    width: 100%; max-width: var(--gfy-container);
    margin: 0 auto; padding: 0 var(--gfy-gap-md);
}
@media (min-width: 768px) { .gfy-container { padding: 0 var(--gfy-gap-lg); } }

.gfy-layout {
    display: grid; grid-template-columns: 1fr; gap: var(--gfy-gap-lg);
}
.gfy-layout.gfy-has-sidebar {
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .gfy-layout.gfy-has-sidebar { grid-template-columns: 1fr 320px; }
}
.gfy-main { min-height: 60vh; }
.gfy-page-content { padding: var(--gfy-gap-2xl) 0; }

/* ========== 5. Header / Navigation ========== */
.gfy-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--gfy-bg);
    border-bottom: 1px solid var(--gfy-border);
    transition: box-shadow var(--gfy-duration) var(--gfy-ease);
}
.gfy-header.scrolled {
    box-shadow: var(--gfy-shadow-sm);
}
.gfy-nav {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.gfy-brand {
    font-size: 24px; font-weight: 700; color: var(--gfy-accent);
    text-decoration: none; line-height: 1.3;
}
.gfy-brand:hover { color: var(--gfy-accent-hover); }
.gfy-nav-links {
    display: none; align-items: center; gap: var(--gfy-gap-lg);
}
@media (min-width: 768px) { .gfy-nav-links { display: flex; } }
.gfy-nav-link {
    font-size: 16px; color: var(--gfy-text-secondary);
    text-decoration: none; padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: all var(--gfy-duration) var(--gfy-ease);
}
.gfy-nav-link:hover, .gfy-nav-link.active {
    color: var(--gfy-accent); border-bottom-color: var(--gfy-accent);
}
.gfy-nav-actions { display: flex; align-items: center; gap: var(--gfy-gap-sm); }

/* Search */
.gfy-search-form {
    position: relative; display: none;
}
@media (min-width: 640px) { .gfy-search-form { display: block; } }
.gfy-search-input {
    width: 200px;
    padding: 6px 36px 6px 14px;
    border: 1px solid var(--gfy-border);
    border-radius: var(--gfy-radius-full);
    background: var(--gfy-surface);
    font-size: 14px; font-family: inherit; color: var(--gfy-text);
    outline: none; transition: all var(--gfy-duration) var(--gfy-ease);
}
.gfy-search-input:focus {
    border-color: var(--gfy-accent); width: 260px;
    box-shadow: 0 0 0 3px rgba(45,90,39,.1);
}
.gfy-search-icon {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gfy-text-muted); pointer-events: none;
}
/* Large search (search page) */
.gfy-search-form-lg .gfy-search-input {
    width: 100%; padding: 14px 48px 14px 16px;
    font-size: 18px; border-radius: var(--gfy-radius-lg);
}
.gfy-search-form-lg .gfy-search-icon { right: 16px; }
.gfy-search-form-lg { display: block; }
.gfy-search-form-wrap { margin-bottom: var(--gfy-gap-xl); }

/* Mobile nav toggle */
.gfy-nav-toggle {
    display: flex; flex-direction: column; gap: 5px; padding: 8px;
    background: none; border: none; cursor: pointer;
}
.gfy-nav-toggle span {
    display: block; width: 20px; height: 2px; background: var(--gfy-text-secondary);
    border-radius: 1px; transition: all var(--gfy-duration) var(--gfy-ease);
}
@media (min-width: 768px) { .gfy-nav-toggle { display: none; } }

/* Mobile overlay */
.gfy-nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--gfy-bg); padding: var(--gfy-gap-xl);
    z-index: 40; gap: var(--gfy-gap-md);
}
.gfy-nav-links.open .gfy-nav-link { font-size: 18px; padding: var(--gfy-gap-sm) 0; }

/* ========== 6. Hero Section ========== */
.gfy-hero-card {
    display: grid; grid-template-columns: 1fr;
    border: 1px solid var(--gfy-border);
    border-radius: var(--gfy-radius-xl); overflow: hidden;
    background: var(--gfy-card); transition: all 300ms var(--gfy-ease);
    margin-bottom: var(--gfy-gap-xl);
}
.gfy-hero-card:hover { border-color: var(--gfy-accent); box-shadow: var(--gfy-shadow-md); }
@media (min-width: 768px) {
    .gfy-hero-card { grid-template-columns: 2fr 3fr; }
}
.gfy-hero-img-wrap {
    overflow: hidden; height: 260px;
}
@media (min-width: 768px) { .gfy-hero-img-wrap { height: auto; min-height: 320px; } }
.gfy-hero-img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 500ms var(--gfy-ease);
}
.gfy-hero-card:hover .gfy-hero-img-wrap img { transform: scale(1.05); }
.gfy-hero-body { padding: var(--gfy-gap-lg); display: flex; flex-direction: column; justify-content: center; gap: var(--gfy-gap-sm); }
.gfy-hero-title { font-size: 28px; line-height: 1.25; }
.gfy-hero-title a { color: var(--gfy-accent); text-decoration: none; }
.gfy-hero-title a:hover { color: var(--gfy-accent-hover); }
.gfy-hero-excerpt { color: var(--gfy-text-secondary); line-height: 1.6; }

/* ========== 7. Post Cards ========== */
.gfy-section-header { border-bottom: 1px solid var(--gfy-border); padding-bottom: var(--gfy-gap-md); margin-bottom: var(--gfy-gap-lg); }
.gfy-section-title { font-size: 22px; color: var(--gfy-accent); }

.gfy-post-feed { display: grid; gap: var(--gfy-gap-lg); margin-bottom: var(--gfy-gap-xl); }

.gfy-post-card {
    display: grid; grid-template-columns: 1fr;
    border: 1px solid var(--gfy-border-soft);
    border-radius: var(--gfy-radius-lg); overflow: hidden;
    background: var(--gfy-card); transition: all 300ms var(--gfy-ease);
}
.gfy-post-card:hover { border-color: var(--gfy-accent); box-shadow: var(--gfy-shadow-md); }
@media (min-width: 768px) {
    .gfy-post-card { grid-template-columns: 2fr 3fr; }
}
.gfy-post-card-img {
    overflow: hidden; height: 200px;
}
@media (min-width: 768px) { .gfy-post-card-img { height: auto; min-height: 200px; } }
.gfy-post-card-img img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 500ms var(--gfy-ease);
}
.gfy-post-card:hover .gfy-post-card-img img { transform: scale(1.05); }
.gfy-post-card-body {
    padding: var(--gfy-gap-md); display: flex; flex-direction: column; justify-content: space-between; gap: var(--gfy-gap-sm);
}
.gfy-post-card-title { font-size: 20px; font-weight: 600; margin-top: var(--gfy-gap-xs); }
.gfy-post-card-title a { color: var(--gfy-text); }
.gfy-post-card:hover .gfy-post-card-title a { color: var(--gfy-accent); }
.gfy-post-card-excerpt { color: var(--gfy-text-secondary); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Chip / Badge */
.gfy-chip {
    display: inline-block;
    background: var(--gfy-accent-light); color: var(--gfy-accent);
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 3px 10px; border-radius: var(--gfy-radius-full);
    transition: all var(--gfy-duration) var(--gfy-ease);
}
.gfy-chip:hover { background: var(--gfy-accent); color: #fff; }
.gfy-chip-sm { font-size: 11px; padding: 2px 8px; }

/* Meta line */
.gfy-meta {
    display: flex; align-items: center; gap: var(--gfy-gap-sm);
    font-size: 13px; color: var(--gfy-text-muted);
}
.gfy-meta-sm { font-size: 12px; color: var(--gfy-text-muted); }

/* Empty state */
.gfy-empty {
    text-align: center; padding: var(--gfy-gap-2xl) 0;
    color: var(--gfy-text-secondary);
}

/* ========== 8. Single Post Styles ========== */
.gfy-article { max-width: 720px; }
.gfy-layout.gfy-has-sidebar .gfy-article { max-width: none; }

.gfy-article-title {
    font-size: 36px; line-height: 1.2; letter-spacing: -0.02em;
    color: var(--gfy-accent); margin: var(--gfy-gap-sm) 0 var(--gfy-gap-md);
}
.gfy-article-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: var(--gfy-gap-sm);
    font-size: 14px; color: var(--gfy-text-muted); margin-bottom: var(--gfy-gap-lg);
}
.gfy-article-author { font-weight: 600; color: var(--gfy-text-secondary); }
.gfy-article-image {
    border-radius: var(--gfy-radius-lg); overflow: hidden;
    margin: 0 0 var(--gfy-gap-xl); border: 1px solid var(--gfy-border-soft);
}
.gfy-article-image img { width: 100%; height: auto; }

/* Tags */
.gfy-tags { display: flex; flex-wrap: wrap; gap: var(--gfy-gap-sm); margin-top: var(--gfy-gap-xl); padding-top: var(--gfy-gap-lg); border-top: 1px solid var(--gfy-border-soft); }
.gfy-tag { font-size: 13px; color: var(--gfy-accent); font-weight: 600; }

/* Share */
.gfy-share { margin-top: var(--gfy-gap-lg); padding-top: var(--gfy-gap-lg); border-top: 1px solid var(--gfy-border-soft); display: flex; align-items: center; gap: var(--gfy-gap-md); }
.gfy-share-label { font-size: 14px; font-weight: 600; color: var(--gfy-text-secondary); }
.gfy-share-btns { display: flex; gap: var(--gfy-gap-sm); }
.gfy-share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--gfy-border); border-radius: var(--gfy-radius-full);
    font-size: 12px; font-weight: 700; color: var(--gfy-text-secondary);
    transition: all var(--gfy-duration) var(--gfy-ease);
}
.gfy-share-btn:hover { border-color: var(--gfy-accent); color: var(--gfy-accent); background: var(--gfy-accent-light); }

/* Related */
.gfy-related { margin-top: var(--gfy-gap-2xl); padding-top: var(--gfy-gap-xl); border-top: 1px solid var(--gfy-border); }
.gfy-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gfy-gap-lg); margin-top: var(--gfy-gap-lg); }
.gfy-related-card {
    border-radius: var(--gfy-radius-lg); overflow: hidden;
    border: 1px solid var(--gfy-border-soft); background: var(--gfy-card);
    text-decoration: none; transition: all 300ms var(--gfy-ease);
}
.gfy-related-card:hover { border-color: var(--gfy-accent); box-shadow: var(--gfy-shadow-sm); transform: translateY(-2px); }
.gfy-related-img { width: 100%; height: 160px; object-fit: cover; }
.gfy-related-body { padding: var(--gfy-gap-md); }
.gfy-related-title { font-size: 15px; font-weight: 600; color: var(--gfy-text); margin-top: var(--gfy-gap-xs); }
.gfy-related-card:hover .gfy-related-title { color: var(--gfy-accent); }

/* ========== 9. Archive/Category Styles ========== */
.gfy-archive-header {
    margin-bottom: var(--gfy-gap-xl); padding-bottom: var(--gfy-gap-lg);
    border-bottom: 1px solid var(--gfy-border);
}
.gfy-archive-label {
    display: flex; align-items: center; gap: var(--gfy-gap-sm);
    font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--gfy-accent); margin-bottom: var(--gfy-gap-sm);
}
.gfy-archive-title {
    font-size: 42px; letter-spacing: -0.02em; color: var(--gfy-accent);
    line-height: 1.2; margin-bottom: var(--gfy-gap-sm);
}
.gfy-archive-desc { font-size: 18px; color: var(--gfy-text-secondary); line-height: 1.6; }
.gfy-archive-count { font-size: 13px; color: var(--gfy-text-muted); }

/* ========== 10. Search Styles ========== */
/* (uses shared archive + search form components) */

/* ========== 11. 404 Page Styles ========== */
.gfy-error-page {
    text-align: center; padding: 80px var(--gfy-gap-md); max-width: 560px; margin: 0 auto;
}
.gfy-error-code {
    font-size: 120px; font-weight: 700; color: var(--gfy-accent-light);
    line-height: 1; margin-bottom: var(--gfy-gap-md);
}
.gfy-error-title { font-size: 28px; color: var(--gfy-accent); margin-bottom: var(--gfy-gap-md); }
.gfy-error-desc { color: var(--gfy-text-secondary); margin-bottom: var(--gfy-gap-xl); }
.gfy-btn {
    display: inline-block;
    padding: 10px 24px; border-radius: var(--gfy-radius-full);
    background: var(--gfy-accent); color: #fff;
    font-weight: 600; font-size: 14px;
    transition: all var(--gfy-duration) var(--gfy-ease);
}
.gfy-btn:hover { background: var(--gfy-accent-hover); color: #fff; transform: translateY(-1px); }

/* ========== 12. Footer ========== */
.gfy-footer {
    background: var(--gfy-bg); border-top: 1px solid var(--gfy-border);
    margin-top: var(--gfy-gap-2xl);
}
.gfy-footer-grid {
    display: grid; grid-template-columns: 1fr;
    gap: var(--gfy-gap-xl); padding: var(--gfy-gap-xl) 0;
}
@media (min-width: 768px) {
    .gfy-footer-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
.gfy-footer-title {
    font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--gfy-accent); margin-bottom: var(--gfy-gap-sm);
}
.gfy-footer-desc { font-size: 13px; color: var(--gfy-text-muted); }
.gfy-footer-bottom {
    display: flex; flex-direction: column; align-items: center;
    gap: var(--gfy-gap-xs); padding: var(--gfy-gap-md) 0;
    border-top: 1px solid var(--gfy-border-soft);
    font-size: 13px; color: var(--gfy-text-muted);
}
@media (min-width: 768px) {
    .gfy-footer-bottom { flex-direction: row; justify-content: space-between; }
}
.gfy-footer-powered { opacity: .6; }

/* ========== 13. Sidebar / Widgets ========== */
.gfy-sidebar { display: flex; flex-direction: column; gap: var(--gfy-gap-lg); }
.gfy-sidebar .widget {
    background: var(--gfy-card); border: 1px solid var(--gfy-border-soft);
    border-radius: var(--gfy-radius-lg); padding: var(--gfy-gap-md);
}
.gfy-sidebar .widget-title {
    font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--gfy-accent); margin-bottom: var(--gfy-gap-md);
    display: flex; align-items: center; gap: var(--gfy-gap-sm);
    padding-bottom: var(--gfy-gap-sm); border-bottom: 1px solid var(--gfy-border-soft);
}
.gfy-sidebar .widget-content { font-size: 14px; color: var(--gfy-text-secondary); }
.gfy-sidebar .widget-content ul { list-style: none; padding: 0; margin: 0; }
.gfy-sidebar .widget-content li { padding: 8px 0; border-bottom: 1px solid var(--gfy-border-soft); }
.gfy-sidebar .widget-content li:last-child { border-bottom: none; }
.gfy-sidebar .widget-content a { color: var(--gfy-text); font-weight: 500; }
.gfy-sidebar .widget-content a:hover { color: var(--gfy-accent); }
.gfy-sidebar .widget-recent-posts li a { font-weight: 500; color: var(--gfy-text); font-size: 14px; }
.gfy-sidebar .widget-recent-posts li a:hover { color: var(--gfy-accent); }

/* ========== 14. Utility Classes ========== */
.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* ========== 15. Prose/Content Styles ========== */
.gfy-prose {
    font-size: 18px; line-height: 1.7; color: var(--gfy-text);
}
.gfy-prose p { margin: 0 0 1.5em; }
.gfy-prose h2 {
    font-size: 24px; font-weight: 600; color: var(--gfy-accent);
    margin: 2.5em 0 0.75em; line-height: 1.3;
}
.gfy-prose h3 { font-size: 20px; font-weight: 600; color: var(--gfy-text); margin: 2em 0 0.5em; }
.gfy-prose h4 { font-size: 17px; font-weight: 600; margin: 1.5em 0 0.5em; }
.gfy-prose ul, .gfy-prose ol { padding-left: 1.5em; margin: 0 0 1.5em; }
.gfy-prose li { margin-bottom: 0.5em; }
.gfy-prose blockquote {
    margin: 1.5em 0; padding: var(--gfy-gap-lg);
    background: rgba(222,229,214,.3);
    border-left: 4px solid var(--gfy-accent);
    border-radius: 0 var(--gfy-radius-lg) var(--gfy-radius-lg) 0;
    font-style: italic; color: var(--gfy-text-secondary);
}
.gfy-prose blockquote p:last-child { margin-bottom: 0; }
.gfy-prose code {
    background: var(--gfy-surface-dim); padding: 2px 6px;
    border-radius: var(--gfy-radius-sm); font-size: 0.9em;
    font-family: 'SFMono-Regular', Consolas, monospace;
}
.gfy-prose pre {
    background: #1b1c1c; color: #e4e2e1; padding: var(--gfy-gap-lg);
    border-radius: var(--gfy-radius-lg); overflow-x: auto;
    margin: 1.5em 0; font-size: 14px; line-height: 1.5;
}
.gfy-prose pre code { background: none; padding: 0; color: inherit; }
.gfy-prose img { border-radius: var(--gfy-radius-lg); margin: 1.5em 0; }
.gfy-prose a { color: var(--gfy-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.gfy-prose a:hover { text-decoration-thickness: 2px; }
.gfy-prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.gfy-prose th, .gfy-prose td { padding: 10px 14px; border: 1px solid var(--gfy-border-soft); text-align: left; }
.gfy-prose th { background: var(--gfy-surface); font-weight: 600; }
.gfy-prose hr { border: none; border-top: 1px solid var(--gfy-border); margin: 2em 0; }

/* ========== 16. Responsive ========== */
@media (max-width: 767px) {
    .gfy-hero-title { font-size: 22px; }
    .gfy-article-title { font-size: 28px; }
    .gfy-archive-title { font-size: 32px; }
    .gfy-hero-body { padding: var(--gfy-gap-md); }
    .gfy-post-card-body { padding: var(--gfy-gap-md); }
    .gfy-page-content { padding: var(--gfy-gap-xl) 0; }
    .gfy-error-code { font-size: 80px; }
    .gfy-prose { font-size: 16px; }
    .gfy-related-grid { grid-template-columns: 1fr; }
}

/* Animation — scroll reveal */
.gfy-reveal {
    opacity: 0; transform: translateY(16px);
    transition: opacity 600ms var(--gfy-ease), transform 600ms var(--gfy-ease);
}
.gfy-reveal.visible { opacity: 1; transform: translateY(0); }

/* Pagination override styling */
.pagination { margin: var(--gfy-gap-xl) 0; }
