/**
 * Chronicle Template - CSS
 * A premium editorial news template (100% CSS, no Tailwind)
 * Design System: Material 3 inspired, deep blue palette
 */

/* ─── CSS Variables ──────────────────────────────────────────────────────── */
:root {
    /* Primary */
    --primary: #003d9b;
    --primary-container: #0052cc;
    --on-primary: #fff;
    --on-primary-container: #c4d2ff;
    --primary-fixed: #dae2ff;
    --primary-fixed-dim: #b2c5ff;

    /* Secondary */
    --secondary: #505f76;
    --secondary-container: #d0e1fb;
    --on-secondary: #fff;
    --on-secondary-container: #54647a;

    /* Tertiary */
    --tertiary: #7b2600;
    --tertiary-container: #a33500;
    --on-tertiary-container: #ffc6b2;

    /* Surface */
    --surface: #faf8ff;
    --surface-dim: #d2d9f4;
    --surface-container-lowest: #fff;
    --surface-container-low: #f2f3ff;
    --surface-container: #eaedff;
    --surface-container-high: #e2e7ff;
    --surface-container-highest: #dae2fd;
    --surface-variant: #dae2fd;

    /* On-surface */
    --on-surface: #131b2e;
    --on-surface-variant: #434654;
    --on-background: #131b2e;
    --background: #faf8ff;

    /* Outline */
    --outline: #737685;
    --outline-variant: #c3c6d6;

    /* Inverse */
    --inverse-surface: #283044;
    --inverse-on-surface: #eef0ff;

    /* Error */
    --error: #ba1a1a;
    --error-container: #ffdad6;

    /* Spacing */
    --stack-sm: 8px;
    --stack-md: 16px;
    --stack-lg: 32px;
    --stack-xl: 64px;
    --gutter: 24px;
    --margin-desktop: 48px;
    --margin-mobile: 20px;
    --container-max: 1200px;

    /* Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-size: 18px;
    line-height: 28px;
    color: var(--on-surface);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-container); }
ul, ol { list-style: none; }

/* ─── Typography ─────────────────────────────────────────────────────────── */
.display-lg {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 48px; line-height: 56px; font-weight: 800;
    letter-spacing: -0.02em;
}
.headline-md {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; line-height: 32px; font-weight: 700;
}
.headline-sm {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
}
.body-lg {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px; line-height: 32px; font-weight: 400;
}
.body-md {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px; line-height: 28px; font-weight: 400;
}
.label-md {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; line-height: 20px; font-weight: 600;
    letter-spacing: 0.05em;
}
.caption {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px; line-height: 18px; font-weight: 400;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--margin-desktop);
}
.container-narrow { max-width: 720px; margin: 0 auto; }

.site-main {
    padding: var(--stack-xl) 0;
}
.grid-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gutter);
}
.grid-main.has-sidebar {
    grid-template-columns: 1fr 320px;
}

/* 12-col Grid (8 main + 4 sidebar) — matches reference design */
.home-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gutter);
}
@media (min-width: 1025px) {
    .home-grid {
        grid-template-columns: 1fr 320px;
    }
}
.home-main {
    display: flex;
    flex-direction: column;
    gap: var(--stack-xl);
    min-width: 0;
}
.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--stack-xl);
}
@media (min-width: 1025px) {
    .home-sidebar {
        border-left: 1px solid var(--outline-variant);
        padding-left: var(--gutter);
    }
}

/* ─── Header / Nav ───────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--outline-variant);
    transition: background 0.3s, box-shadow 0.3s;
}
.site-header.scrolled {
    background: rgba(250,248,255,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}
.nav-brand {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
}
.nav-brand img {
    height: 36px; width: auto; object-fit: contain; display: block;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--stack-md);
}
.nav-link {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--secondary);
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.2s;
}
.nav-link:hover, .nav-link.active {
    color: var(--primary);
}
.nav-link.active {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 2px;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--stack-md);
}
.search-form {
    display: flex;
    align-items: center;
    background: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: 4px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,61,155,0.12);
}
.search-input {
    border: none;
    background: transparent;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    color: var(--on-surface);
    outline: none;
    width: 180px;
    padding: 4px 0;
}
.search-input::placeholder {
    color: var(--on-surface-variant);
}
.search-form-lg {
    max-width: 480px;
    margin: 0 auto var(--stack-lg);
    padding: 8px 16px;
}
.search-form-lg .search-input {
    width: 100%;
    font-size: 16px;
    padding: 8px 0;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--on-surface);
    border-radius: 2px;
    transition: transform 0.3s;
}

/* ─── Hero Section ───────────────────────────────────────────────────────── */
.hero-featured {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--stack-xl);
    background: var(--inverse-surface);
    cursor: pointer;
}
.hero-featured img {
    width: 100%;
    aspect-ratio: 21/9;
    object-fit: cover;
    opacity: 0.8;
    transition: transform 0.7s;
}
.hero-featured:hover img {
    transform: scale(1.05);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--inverse-surface) 10%, rgba(40,48,68,0.2) 50%, transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--stack-xl);
}
.hero-badge {
    display: inline-block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--primary);
    color: var(--on-primary);
    padding: 4px var(--stack-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--stack-sm);
    width: fit-content;
}
.hero-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 48px; line-height: 56px; font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    margin-bottom: var(--stack-md);
}
.hero-excerpt {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px; line-height: 32px;
    color: var(--surface-variant);
    max-width: 640px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-meta {
    display: flex;
    align-items: center;
    gap: var(--stack-md);
    margin-top: var(--stack-lg);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--surface-dim);
}

/* ─── Section Headers ────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: var(--stack-sm);
    margin-bottom: var(--stack-lg);
}
.section-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; line-height: 32px; font-weight: 700;
    color: var(--on-surface);
}
.section-link {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--primary);
}
.section-link:hover { text-decoration: underline; }

/* ─── Post Cards ─────────────────────────────────────────────────────────── */
.posts-feed { display: flex; flex-direction: column; gap: var(--stack-lg); }

.post-card {
    display: flex;
    flex-direction: column;
    gap: var(--gutter);
    padding: var(--stack-sm);
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: var(--stack-lg);
    transition: background 0.2s;
}
.post-card:hover { background: var(--surface-container-lowest); }
.post-card.horizontal {
    flex-direction: row;
}
.post-card-image {
    overflow: hidden;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}
.post-card.horizontal .post-card-image {
    width: 256px;
    height: 176px;
}
.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.post-card:hover .post-card-image img {
    transform: scale(1.1);
}
.post-card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 4px;
}
.post-card-category {
    display: inline-block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--primary);
    background: var(--primary-fixed);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--stack-sm);
    width: fit-content;
    text-decoration: none;
}
.post-card-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    color: var(--on-surface);
    margin-bottom: var(--stack-sm);
    transition: color 0.2s;
}
.post-card-title a {
    color: inherit;
    text-decoration: none;
}
.post-card:hover .post-card-title,
.post-card:hover .post-card-title a {
    color: var(--primary);
}
.post-card-excerpt {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px; line-height: 28px;
    color: var(--on-surface-variant);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card-meta {
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
    margin-top: var(--stack-md);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px; font-weight: 600;
    color: var(--outline);
}
.post-card-meta a { color: var(--outline); }
.post-card-meta a:hover { color: var(--primary); }

/* ─── Posts Grid (Category/Homepage cards) ───────────────────────────────── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--stack-xl);
}
.posts-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.posts-grid .post-card {
    flex-direction: column;
    border-bottom: none;
    padding-bottom: 0;
}
.posts-grid .post-card-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg);
}
.posts-grid .post-card-image img {
    width: 100%;
    height: 100%;
}

/* ─── Archive / Category Header ──────────────────────────────────────────── */
.archive-header {
    margin-bottom: var(--stack-xl);
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: var(--stack-lg);
}
.archive-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
    display: block;
    margin-bottom: var(--stack-sm);
}
.archive-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 48px; line-height: 56px; font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--on-surface);
    margin-bottom: var(--stack-sm);
}
.archive-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px; line-height: 32px;
    color: var(--on-surface-variant);
    max-width: 720px;
}
.archive-count {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--outline);
    display: block;
    margin-top: var(--stack-sm);
}

/* ─── Single Post ────────────────────────────────────────────────────────── */
.single-post { margin-bottom: var(--stack-xl); }
.post-header { margin-bottom: var(--stack-lg); }
.post-category-badge {
    display: inline-block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(0,61,155,0.05);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: var(--stack-md);
    text-decoration: none;
}
.post-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 32px; line-height: 40px; font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--on-surface);
}
.post-meta {
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
    padding: var(--stack-md) 0;
    border-top: 1px solid var(--outline-variant);
    border-bottom: 1px solid var(--outline-variant);
    margin-top: var(--stack-md);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    color: var(--on-surface-variant);
}
.post-meta .author-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.post-meta .author-name {
    font-weight: 600;
    color: var(--on-surface);
}
.post-featured-image {
    margin: var(--stack-lg) 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.post-featured-image img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

/* Single post meta: byline + share inline */
.single-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--stack-md);
    border-top: 1px solid var(--outline-variant);
    border-bottom: 1px solid var(--outline-variant);
    padding: var(--stack-md) 0;
    margin-top: var(--stack-md);
}
.single-meta-author {
    display: flex;
    align-items: center;
    gap: 12px;
}
.single-meta-author .author-name {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--on-surface);
    display: block;
}
.single-meta-author .caption {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px; line-height: 18px;
    color: var(--on-surface-variant);
}
.post-share-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Single post title override (display-lg) */
.single-post .post-title {
    font-size: 32px; line-height: 40px;
}
@media (min-width: 768px) {
    .single-post .post-title {
        font-size: 48px; line-height: 56px;
    }
}

/* ─── Prose (Post Content) ───────────────────────────────────────────────── */
.prose {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px; line-height: 32px;
    color: var(--on-surface);
    max-width: 720px;
}
.prose p { margin-bottom: 24px; }
.prose h2 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; line-height: 32px; font-weight: 700;
    margin: 40px 0 16px;
    color: var(--on-surface);
}
.prose h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    margin: 32px 0 12px;
    color: var(--on-surface);
}
.prose ul, .prose ol {
    margin: 16px 0 24px;
    padding-left: 24px;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 8px; }
.prose blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--secondary);
}
.prose img {
    border-radius: var(--radius-lg);
    margin: 24px 0;
}
.prose a { color: var(--primary); text-decoration: underline; }
.prose code {
    background: var(--surface-container);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.prose pre {
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin: 24px 0;
    font-size: 15px;
    line-height: 1.6;
}

/* ─── Post Share ─────────────────────────────────────────────────────────── */
.post-share {
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
    margin-top: var(--stack-xl);
    padding-top: var(--stack-md);
    border-top: 1px solid var(--outline-variant);
}
.share-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--on-surface-variant);
    margin-right: var(--stack-sm);
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    color: var(--on-surface-variant);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px; font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}
.share-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-container-low);
}

/* ─── Post Tags ──────────────────────────────────────────────────────────── */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--stack-sm);
    margin-top: var(--stack-lg);
}
.post-tags span {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--on-surface-variant);
    background: var(--surface-container);
    padding: 4px 12px;
    border-radius: 4px;
}

/* ─── Related Posts ──────────────────────────────────────────────────────── */
.related-posts {
    margin-top: var(--stack-xl);
    padding-top: var(--stack-xl);
    border-top: 1px solid var(--outline-variant);
}
.related-posts .section-title {
    margin-bottom: var(--stack-lg);
}
.related-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
}
.related-card .related-image {
    aspect-ratio: 16/9;
    width: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--outline-variant);
    transition: box-shadow 0.3s;
}
.related-card:hover .related-image {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.related-card .related-cat {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px; font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
}
.related-card .related-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    color: var(--on-surface);
    transition: color 0.2s;
}
.related-card:hover .related-title { color: var(--primary); }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.site-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--stack-xl);
}
.sidebar-card {
    padding: var(--stack-md);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    background: var(--surface-container-low);
}
.sidebar-card h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--stack-md);
}
.sidebar-cta {
    padding: var(--stack-lg);
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-xl);
}
.sidebar-cta h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; font-weight: 700;
    margin-bottom: var(--stack-sm);
}
.sidebar-cta p {
    font-size: 14px; margin-bottom: var(--stack-md);
    opacity: 0.9;
}
.sidebar-cta .btn-subscribe {
    display: block;
    width: 100%;
    background: #fff;
    color: var(--primary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    padding: 10px;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: opacity 0.2s;
}
.sidebar-cta .btn-subscribe:hover { opacity: 0.9; }

/* Widget overrides */
.site-sidebar .widget { margin-bottom: var(--stack-lg); }
.site-sidebar .widget h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: var(--stack-md);
    padding-bottom: var(--stack-sm);
    border-bottom: 1px solid var(--outline-variant);
}
.site-sidebar .widget ul { list-style: none; padding: 0; }
.site-sidebar .widget li {
    padding: var(--stack-sm) 0;
    border-bottom: 1px solid var(--outline-variant);
}
.site-sidebar .widget li:last-child { border-bottom: none; }
.site-sidebar .widget a {
    color: var(--on-surface);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px; font-weight: 600;
    text-decoration: none;
}
.site-sidebar .widget a:hover { color: var(--primary); }

/* ─── Static Page ────────────────────────────────────────────────────────── */
.single-page {
    padding: var(--stack-xl) 0;
}
.page-header {
    max-width: 720px;
    margin-bottom: var(--stack-xl);
}
.page-header h1 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 32px; line-height: 40px; font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--stack-md);
}
.page-header p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px; line-height: 32px;
    color: var(--on-surface-variant);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    margin-top: var(--stack-xl);
    border-top: 1px solid var(--outline-variant);
    background: var(--surface-container-highest);
    padding: var(--stack-xl) 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gutter);
}
.footer-heading {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; font-weight: 800;
    color: var(--on-surface);
    margin-bottom: var(--stack-md);
}
.footer-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px; line-height: 28px;
    color: var(--on-secondary-container);
}
.footer-col h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    margin-bottom: var(--stack-md);
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: var(--stack-sm); }
.footer-col a {
    color: var(--on-secondary-container);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
    margin-top: var(--stack-lg);
    padding-top: var(--stack-md);
    border-top: 1px solid rgba(195,198,214,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-bottom p {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    color: var(--on-secondary-container);
}
.footer-powered { opacity: 0.5; font-size: 12px !important; }

/* ─── Empty States ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}
.empty-state svg { color: var(--outline); margin: 0 auto 16px; }
.empty-state h2 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; font-weight: 700;
    margin-bottom: 12px;
}
.empty-state p { color: var(--on-surface-variant); }

/* ─── 404 Page ───────────────────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 120px 20px;
}
.error-code {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 96px; font-weight: 800;
    color: var(--primary-fixed-dim);
    line-height: 1;
}
.error-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 32px; font-weight: 800;
    margin: 16px 0 12px;
}
.error-desc { color: var(--on-surface-variant); margin-bottom: 32px; }
.btn-home {
    display: inline-block;
    background: var(--primary);
    color: var(--on-primary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn-home:hover { opacity: 0.9; color: var(--on-primary); }

/* ─── Pagination (override inline styles with higher specificity) ────────── */
nav.pagination { margin: var(--stack-xl) 0; }
nav.pagination ul {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
nav.pagination li { list-style: none !important; }
nav.pagination a {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md) !important;
    border-color: var(--outline-variant) !important;
    color: var(--secondary) !important;
    text-decoration: none;
    transition: all 0.15s;
}
nav.pagination a:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}
nav.pagination li.active a {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--on-primary) !important;
}

/* ─── Post List (Search results) ─────────────────────────────────────────── */
.posts-list { display: flex; flex-direction: column; gap: var(--stack-lg); }
.post-list-item {
    padding-bottom: var(--stack-lg);
    border-bottom: 1px solid var(--outline-variant);
}
.post-list-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; font-weight: 700;
    margin-bottom: 8px;
}
.post-list-title a { color: var(--on-surface); text-decoration: none; }
.post-list-title a:hover { color: var(--primary); }
.post-list-excerpt {
    color: var(--on-surface-variant);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

/* ─── Category Page Layout (Discovery Sidebar + Content) ─────────────────── */
.cat-layout {
    display: flex;
    gap: var(--gutter);
}

/* Discovery Sidebar (Left) */
.discovery-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--stack-md);
    padding: var(--stack-lg) var(--stack-md);
    width: 256px;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    background: var(--surface-container-low);
    border-right: 1px solid var(--outline-variant);
    height: fit-content;
    position: sticky;
    top: 80px;
}
.discovery-header {
    margin-bottom: var(--stack-md);
}
.discovery-header h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.discovery-header p {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
}
.discovery-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.discovery-link {
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
    padding: var(--stack-sm);
    color: var(--on-surface-variant);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}
.discovery-link:hover {
    background: var(--surface-container-high);
    color: var(--on-surface);
}
.discovery-link.active {
    color: var(--primary);
    font-weight: 700;
    border-right: 4px solid var(--primary);
    background: var(--surface-container-high);
}
.discovery-link svg {
    width: 20px; height: 20px;
    flex-shrink: 0;
}
.discovery-cta {
    margin-top: var(--stack-xl);
    padding: var(--stack-md);
    background: var(--primary-container);
    border-radius: var(--radius-lg);
}
.discovery-cta h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 20px; line-height: 28px; font-weight: 700;
    color: var(--on-primary-container);
    margin-bottom: var(--stack-sm);
}
.discovery-cta .btn-subscribe {
    display: block;
    width: 100%;
    background: var(--on-primary);
    color: var(--primary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    padding: 8px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity 0.2s;
}
.discovery-cta .btn-subscribe:hover { opacity: 0.9; }

/* Category Content Area */
.cat-content { flex: 1; min-width: 0; }

/* Featured Article (Horizontal) */
.cat-featured {
    display: flex;
    flex-direction: row;
    gap: var(--gutter);
    margin-bottom: var(--stack-xl);
    padding-bottom: var(--stack-xl);
    border-bottom: 1px solid var(--outline-variant);
}
.cat-featured-image {
    width: 50%;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
}
.cat-featured-image img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    transition: transform 0.5s;
}
.cat-featured:hover .cat-featured-image img {
    transform: scale(1.05);
}
.cat-featured-body {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--stack-sm);
}
.cat-featured-meta-top {
    display: flex;
    align-items: center;
    gap: var(--stack-sm);
}
.cat-featured-meta-top .reading-time {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px; line-height: 18px;
    color: var(--on-surface-variant);
}
.cat-featured-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px; line-height: 32px; font-weight: 700;
    color: var(--on-surface);
    transition: color 0.2s;
}
.cat-featured-title a {
    color: inherit;
    text-decoration: none;
}
.cat-featured-title a:hover,
.cat-featured:hover .cat-featured-title a {
    color: var(--primary);
}
.cat-featured-excerpt {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px; line-height: 28px;
    color: var(--on-surface-variant);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category Card Grid */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--stack-xl);
}
.cat-card {
    display: flex;
    flex-direction: column;
    gap: var(--stack-md);
}
.cat-card-image {
    overflow: hidden;
    border-radius: var(--radius-lg);
    aspect-ratio: 16/9;
}
.cat-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.cat-card:hover .cat-card-image img {
    transform: scale(1.05);
}
.cat-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--stack-sm);
}
.cat-card:hover .post-card-title,
.cat-card:hover .post-card-title a {
    color: var(--primary);
}
.cat-card .post-card-excerpt {
    -webkit-line-clamp: 2;
}
.cat-card .post-card-meta {
    margin-top: 0;
    font-size: 13px;
}

/* Full-width Horizontal List Item (col-span-2) */
.cat-list-item {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    gap: var(--gutter);
    border-top: 1px solid var(--outline-variant);
    padding-top: var(--stack-xl);
}
.cat-list-image {
    width: 33.333%;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    aspect-ratio: 16/9;
}
.cat-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.cat-list-item:hover .cat-list-image img {
    transform: scale(1.05);
}
.cat-list-body {
    width: 66.666%;
    display: flex;
    flex-direction: column;
    gap: var(--stack-sm);
}
.cat-list-body .post-card-excerpt {
    -webkit-line-clamp: unset;
}
.cat-list-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: var(--stack-md);
}
.cat-list-footer .post-card-meta {
    margin-top: 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.read-story {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-decoration: none;
}
.read-story:hover { text-decoration: underline; }

/* ─── Admin Bar ──────────────────────────────────────────────────────────── */
.admin-bar { z-index: 9999; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-main.has-sidebar {
        grid-template-columns: 1fr;
    }
    .site-sidebar {
        margin-top: var(--stack-xl);
    }
    .posts-grid { grid-template-columns: 1fr 1fr; }
    .posts-grid-3 { grid-template-columns: 1fr 1fr; }

    /* Category layout */
    .discovery-sidebar { display: none; }
    .cat-layout { flex-direction: column; }
}

@media (max-width: 768px) {
    .container { padding: 0 var(--margin-mobile); }
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 64px; left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--outline-variant);
        padding: var(--stack-md);
        gap: var(--stack-sm);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }
    .nav-toggle { display: flex; }
    .search-form { display: none; }

    .hero-title,
    .archive-title { font-size: 32px; line-height: 40px; }
    .post-title { font-size: 28px; line-height: 36px; }
    .hero-overlay { padding: var(--stack-lg) var(--margin-mobile); }

    .post-card.horizontal { flex-direction: column; }
    .post-card.horizontal .post-card-image { width: 100%; height: 200px; }

    .posts-grid,
    .posts-grid-3 { grid-template-columns: 1fr; }

    /* Category layout mobile */
    .cat-featured { flex-direction: column; }
    .cat-featured-image { width: 100%; }
    .cat-featured-image img { height: 220px; }
    .cat-featured-body { width: 100%; }
    .cat-grid { grid-template-columns: 1fr; }
    .cat-list-item { flex-direction: column; }
    .cat-list-image { width: 100%; }
    .cat-list-body { width: 100%; }

    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero-featured img { aspect-ratio: 16/9; }
}
