/* ============================================================
   TURING THEME v2.0 - Editorial Tech Aesthetic
   Refined minimalism with precision and purpose
   ============================================================ */

/* ==========================================================================
   1. DESIGN TOKENS - CSS Custom Properties
   ========================================================================== */

:root {
    /* --- Color Palette: Cool Minimal Slate --- */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    --accent: #334155;
    --accent-hover: #1e293b;
    --accent-subtle: #f1f5f9;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* --- Code Colors: Dark Mode Editor --- */
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --code-comment: #64748b;
    --code-keyword: #38bdf8;
    --code-string: #4ade80;
    --code-function: #c084fc;

    /* --- Typography Scale --- */
    --font-display: 'Fraunces', serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 2rem;        /* 32px */
    --text-4xl: 2.5rem;      /* 40px */
    --text-5xl: 3.5rem;      /* 56px */
    --text-6xl: 4.5rem;      /* 72px */

    /* --- Spacing Scale --- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* --- Animation --- */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* --- Layout --- */
    --max-width: 1200px;
    --max-width-content: 720px;
    --max-width-narrow: 600px;
    --header-height: 72px;
    --progress-height: 3px;

    /* --- Header --- */
    --header-bg: rgba(255, 255, 255, 0.95);

    /* --- Shadows --- */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 24px 64px rgba(15, 23, 42, 0.12);
}

/* --- Dark Mode: Manual Override --- */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-elevated: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --accent: #94a3b8;
    --accent-hover: #cbd5e1;
    --accent-subtle: #334155;

    --border: #334155;
    --border-strong: #475569;

    --code-bg: #0f172a;

    --header-bg: rgba(15, 23, 42, 0.95);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
}

/* --- Dark Mode: System Preference (when no manual override) --- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --bg-elevated: #1e293b;

        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --text-inverse: #0f172a;

        --accent: #94a3b8;
        --accent-hover: #cbd5e1;
        --accent-subtle: #334155;

        --border: #334155;
        --border-strong: #475569;

        --code-bg: #0f172a;

        --header-bg: rgba(15, 23, 42, 0.95);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
        --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
    }
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

body.nav-open {
    overflow: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Selection styling */
::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-6);
    line-height: 1.75;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--accent);
}

strong, b {
    font-weight: 600;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-8);
}

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ==========================================================================
   5. READING PROGRESS BAR
   ========================================================================== */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--progress-height);
    background: var(--bg-tertiary);
    z-index: 1001;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.reading-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--progress, 0%);
    height: 100%;
    background: var(--accent);
    transition: width 100ms linear;
}

body.post-template .reading-progress {
    opacity: 1;
}

/* ==========================================================================
   6. HEADER & NAVIGATION
   ========================================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    transform: translateY(0);
    transition:
        transform var(--duration-slow) var(--ease-out),
        background var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.site-header.is-sticky {
    box-shadow: var(--shadow-sm);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-8);
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.site-logo {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    position: relative;
    padding-bottom: var(--space-1);
}

.site-logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transform: scaleX(1);
    transform-origin: left;
    transition: transform var(--duration-normal) var(--ease-out);
}

.site-logo:hover::after {
    transform: scaleX(0.6);
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.site-nav a {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
}

.site-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--text-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--duration-normal) var(--ease-out);
}

.site-nav a:hover {
    color: var(--text-primary);
}

.site-nav a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Mobile Nav Toggle */
.nav-toggle {
    display: none;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1002;
}

.nav-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    position: absolute;
    left: 6px;
    transition:
        transform var(--duration-normal) var(--ease-out),
        opacity var(--duration-fast) var(--ease-out);
}

.nav-toggle__bar:nth-child(1) { top: 10px; }
.nav-toggle__bar:nth-child(2) { top: 15px; }
.nav-toggle__bar:nth-child(3) { top: 20px; }

.nav-toggle.is-active .nav-toggle__bar:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition:
        color var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        background-color var(--duration-normal) var(--ease-out);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-secondary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform var(--duration-normal) var(--ease-out);
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

/* Sun icon visible in dark mode, moon in light mode */
.theme-toggle__sun {
    display: none;
}

.theme-toggle__moon {
    display: block;
}

[data-theme="dark"] .theme-toggle__sun {
    display: block;
}

[data-theme="dark"] .theme-toggle__moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle__sun {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle__moon {
        display: none;
    }
}

/* ==========================================================================
   7. HERO SECTION
   ========================================================================== */

.hero {
    padding: calc(var(--header-height) + var(--space-24)) 0 var(--space-20);
    max-width: var(--max-width-content);
    margin: 0 auto;
}

.hero__eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.hero__title {
    font-size: var(--text-6xl);
    font-weight: 400;
    line-height: 1.05;
    margin-bottom: var(--space-6);
    letter-spacing: -0.03em;
}

.hero__description {
    font-size: var(--text-xl);
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: var(--space-10);
}

.hero__code {
    background: var(--code-bg);
    border-radius: 8px;
    padding: var(--space-6);
    overflow-x: auto;
}

.hero__code pre {
    margin: 0;
    background: none;
}

.hero__code code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--code-text);
    line-height: 1.7;
}

/* Code syntax colors */
.hero__code .comment { color: var(--code-comment); }
.hero__code .keyword { color: var(--code-keyword); }
.hero__code .string { color: var(--code-string); }
.hero__code .function { color: var(--code-function); }

/* ==========================================================================
   8. POST CARDS
   ========================================================================== */

.post-feed {
    padding: var(--space-16) 0;
}

.post-feed__header {
    margin-bottom: var(--space-12);
}

.post-feed__title {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
}

/* Post Card */
.post-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity var(--duration-slow) var(--ease-out),
        transform var(--duration-slow) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.post-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.post-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

/* Featured Card */
.post-card--featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    border: none;
    background: var(--bg-secondary);
}

.post-card--featured .post-card__image-wrapper {
    aspect-ratio: 4 / 3;
}

/* Card Image */
.post-card__image-link {
    display: block;
    overflow: hidden;
}

.post-card__image-wrapper {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.post-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.02);
    transition:
        opacity var(--duration-slow) var(--ease-out),
        transform var(--duration-slow) var(--ease-out);
}

.post-card__image.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.post-card:hover .post-card__image {
    transform: scale(1.05);
}

/* Card Content */
.post-card__content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card--featured .post-card__content {
    padding: var(--space-10);
    justify-content: center;
}

/* Card Meta */
.post-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

.post-card__badge {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: var(--space-1) var(--space-3);
    border-radius: 4px;
    transition: background var(--duration-fast) var(--ease-out);
}

.post-card__badge:hover {
    background: var(--border);
}

.post-card__reading-time {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Card Title */
.post-card__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: var(--space-3);
    letter-spacing: -0.01em;
}

.post-card__title a {
    display: block;
}

.post-card--featured .post-card__title {
    font-size: var(--text-3xl);
}

/* Card Excerpt */
.post-card__excerpt {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.post-card--featured .post-card__excerpt {
    font-size: var(--text-base);
    -webkit-line-clamp: 4;
}

/* Card Footer */
.post-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.post-card__author {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.post-card__author-image {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.post-card__author span {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.post-card__date {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================================================
   9. SINGLE POST
   ========================================================================== */

.post {
    padding-top: calc(var(--header-height) + var(--space-16));
}

/* Post Hero */
.post-hero {
    max-width: var(--max-width-content);
    margin: 0 auto var(--space-12);
    text-align: center;
    padding: 0 var(--space-8);
}

.post-hero__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.post-hero__badge {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: var(--space-1) var(--space-3);
    border-radius: 4px;
}

.post-hero__reading-time {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.post-hero__title {
    font-size: var(--text-5xl);
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: var(--space-6);
    letter-spacing: -0.03em;
}

.post-hero__excerpt {
    font-size: var(--text-xl);
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-8);
}

.post-hero__author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

.post-hero__author-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.post-hero__author-info {
    text-align: left;
}

.post-hero__author-info a {
    font-weight: 600;
    display: block;
    margin-bottom: var(--space-1);
}

.post-hero__author-info a:hover {
    color: var(--accent);
}

.post-hero__author-info time {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Feature Image */
.post-feature-image {
    margin-bottom: var(--space-16);
}

.post-feature-image img {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 12px;
}

.post-feature-image figcaption {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-4);
}

/* Post Layout with ToC */
.post-layout {
    max-width: calc(var(--max-width-content) + 280px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--max-width-content) 200px;
    gap: var(--space-16);
    padding: 0 var(--space-8);
}

/* Post Body */
.post-body {
    max-width: var(--max-width-content);
    font-size: var(--text-lg);
    line-height: 1.8;
}

.post-body h2 {
    font-size: var(--text-3xl);
    margin-top: var(--space-16);
    margin-bottom: var(--space-6);
}

.post-body h3 {
    font-size: var(--text-2xl);
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
}

.post-body h4 {
    font-size: var(--text-xl);
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
}

.post-body p {
    margin-bottom: var(--space-6);
}

.post-body ul,
.post-body ol {
    margin-bottom: var(--space-6);
    padding-left: var(--space-6);
}

.post-body li {
    margin-bottom: var(--space-2);
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: var(--space-6);
    margin: var(--space-8) 0;
    font-style: italic;
    color: var(--text-secondary);
}

.post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-body a:hover {
    color: var(--accent-hover);
}

/* ==========================================================================
   10. TABLE OF CONTENTS
   ========================================================================== */

.toc {
    position: sticky;
    top: calc(var(--header-height) + var(--space-8));
    align-self: start;
}

.toc__title {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.toc__list {
    list-style: none;
}

.toc__item {
    margin-bottom: var(--space-2);
}

.toc__item--h3 {
    padding-left: var(--space-4);
}

.toc__link {
    font-size: var(--text-sm);
    color: var(--text-muted);
    display: block;
    padding: var(--space-1) 0;
    border-left: 2px solid transparent;
    padding-left: var(--space-3);
    margin-left: -2px;
    transition:
        color var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}

.toc__link:hover,
.toc__link.is-active {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

/* ==========================================================================
   11. AUTHOR CARD
   ========================================================================== */

.post-footer {
    max-width: var(--max-width-content);
    margin: var(--space-20) auto;
    padding: 0 var(--space-8);
}

.author-card {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-8);
    background: var(--bg-secondary);
    border-radius: 12px;
}

.author-card__image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-card__content {
    flex: 1;
}

.author-card__name {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.author-card__name a:hover {
    color: var(--accent);
}

.author-card__bio {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}

/* ==========================================================================
   12. RELATED POSTS
   ========================================================================== */

.related-posts {
    background: var(--bg-secondary);
    padding: var(--space-20) 0;
    margin-top: var(--space-20);
}

.related-posts__title {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-10);
}

.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
}

/* Compact Card Variant */
.post-card--compact {
    border: none;
    background: var(--bg-primary);
}

.post-card--compact .post-card__footer {
    border-top: none;
    padding-top: 0;
}

/* ==========================================================================
   13. FOOTER
   ========================================================================== */

.site-footer {
    background: var(--bg-secondary);
    padding: var(--space-20) 0 var(--space-8);
    margin-top: var(--space-24);
}

.site-footer__grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-16);
    margin-bottom: var(--space-16);
    padding-bottom: var(--space-8);
    border-bottom: 1px solid var(--border);
}

.site-footer__brand a {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    display: inline-block;
    margin-bottom: var(--space-3);
}

.site-footer__brand p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 300px;
    margin-bottom: 0;
}

.site-footer__nav {
    display: flex;
    gap: var(--space-6);
}

.site-footer__nav a {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.site-footer__nav a:hover {
    color: var(--text-primary);
}

.site-footer__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-footer__bottom p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 0;
}

.site-footer__bottom a {
    color: var(--text-muted);
}

.site-footer__bottom a:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   14. CODE BLOCKS
   ========================================================================== */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

p code,
li code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}

pre {
    background: var(--code-bg);
    padding: var(--space-6);
    border-radius: 8px;
    overflow-x: auto;
    margin: var(--space-8) 0;
}

pre code {
    background: none;
    padding: 0;
    font-size: var(--text-sm);
    color: var(--code-text);
    line-height: 1.7;
}

/* Syntax Highlighting */
.hljs-comment { color: var(--code-comment); }
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in { color: var(--code-keyword); }
.hljs-string,
.hljs-attr { color: var(--code-string); }
.hljs-title,
.hljs-function { color: var(--code-function); }

/* ==========================================================================
   15. GHOST KOENIG EDITOR CARDS
   ========================================================================== */

/* Image Cards */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: var(--space-10) auto;
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
    height: auto;
}

/* Gallery Card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: var(--space-8) auto;
    max-width: 1200px;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
}

/* Bookmark Card */
.kg-bookmark-card {
    width: 100%;
    margin: var(--space-8) 0;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--duration-normal) var(--ease-out);
}

.kg-bookmark-container:hover {
    border-color: var(--border-strong);
}

.kg-bookmark-content {
    flex-grow: 1;
    padding: var(--space-6);
}

.kg-bookmark-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-base);
    line-height: 1.4;
    color: var(--text-primary);
}

.kg-bookmark-description {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: var(--space-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    margin-top: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.kg-bookmark-thumbnail {
    min-width: 200px;
    max-height: 200px;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   16. PAGE TEMPLATE
   ========================================================================== */

.page {
    padding-top: calc(var(--header-height) + var(--space-16));
    padding-bottom: var(--space-20);
}

.page-content {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 0 var(--space-8);
}

.page-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.page-title {
    font-size: var(--text-5xl);
    font-weight: 400;
    margin-bottom: var(--space-6);
}

.page-body {
    font-size: var(--text-lg);
    line-height: 1.8;
}

.page-body p {
    margin-bottom: var(--space-6);
}

/* ==========================================================================
   17. TAG & AUTHOR ARCHIVES
   ========================================================================== */

.archive {
    padding-top: calc(var(--header-height) + var(--space-16));
}

.archive-header {
    text-align: center;
    margin-bottom: var(--space-16);
    padding: 0 var(--space-8);
}

.archive-title {
    font-size: var(--text-4xl);
    font-weight: 400;
    margin-bottom: var(--space-4);
}

.archive-description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Author Archive */
.author-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: var(--space-16);
    padding: calc(var(--header-height) + var(--space-16)) var(--space-8) var(--space-16);
}

.author-header__image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--space-6);
}

.author-header__name {
    font-size: var(--text-4xl);
    font-weight: 400;
    margin-bottom: var(--space-4);
}

.author-header__bio {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 500px;
}

/* ==========================================================================
   18. ERROR PAGE
   ========================================================================== */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: var(--space-8);
}

.error-code {
    font-family: var(--font-mono);
    font-size: var(--text-6xl);
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.error-message {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-8);
}

.error-code-block {
    background: var(--code-bg);
    padding: var(--space-6);
    border-radius: 8px;
    margin-bottom: var(--space-8);
}

.error-code-block code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--code-text);
}

.error-link {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ==========================================================================
   19. PAGINATION
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-16) 0;
}

.pagination a {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition:
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}

.pagination a:hover {
    background: var(--bg-secondary);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.pagination .page-number {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ==========================================================================
   20. RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --text-5xl: 3rem;
        --text-6xl: 3.5rem;
    }

    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-card--featured {
        grid-template-columns: 1fr;
    }

    .related-posts__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-layout {
        grid-template-columns: 1fr;
    }

    .toc {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --text-4xl: 2rem;
        --text-5xl: 2.5rem;
        --text-6xl: 3rem;
        --space-8: 1.5rem;
    }

    .container {
        padding: 0 var(--space-5);
    }

    /* Mobile Navigation */
    .nav-toggle {
        display: block;
    }

    .site-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-8);
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%);
        transition:
            opacity var(--duration-slow) var(--ease-out),
            visibility var(--duration-slow) var(--ease-out),
            transform var(--duration-slow) var(--ease-out);
    }

    .site-nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    .site-nav a {
        font-size: var(--text-2xl);
        letter-spacing: 0.02em;
    }

    .post-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .related-posts__grid {
        grid-template-columns: 1fr;
    }

    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .site-footer__bottom {
        flex-direction: column;
        gap: var(--space-2);
    }

    .hero {
        padding: calc(var(--header-height) + var(--space-12)) var(--space-5) var(--space-12);
    }

    .hero__title {
        font-size: var(--text-4xl);
    }

    .hero__description {
        font-size: var(--text-base);
    }

    .post-hero {
        padding: 0 var(--space-5);
    }

    .post-hero__title {
        font-size: var(--text-3xl);
    }

    .post-layout {
        padding: 0 var(--space-5);
    }

    .post-footer {
        padding: 0 var(--space-5);
    }

    .author-card {
        flex-direction: column;
        text-align: center;
    }

    .author-card__image {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    :root {
        --text-3xl: 1.75rem;
        --text-4xl: 2rem;
        --text-5xl: 2.25rem;
    }

    .post-card__content {
        padding: var(--space-5);
    }

    .post-card--featured .post-card__content {
        padding: var(--space-6);
    }

    .post-card__title {
        font-size: var(--text-lg);
    }

    .post-card--featured .post-card__title {
        font-size: var(--text-2xl);
    }
}

/* ==========================================================================
   21. PRINT STYLES
   ========================================================================== */

@media print {
    .site-header,
    .site-footer,
    .toc,
    .reading-progress,
    .related-posts {
        display: none;
    }

    .post {
        padding-top: 0;
    }

    .post-body {
        font-size: 12pt;
    }
}
