/* ============================================
   sys4net Ghost Theme — DARK MODE
   Brand palette: #5CEA80 / #E6E6E6 / #2D2E2A
   Typography: Space Grotesk
   ============================================ */

/* ---------- Font ---------- */
@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/SpaceGrotesk-Variable.ttf") format("truetype-variations"),
         url("../fonts/SpaceGrotesk-Variable.ttf") format("truetype");
}

/* ---------- Design Tokens (Dark) ---------- */
:root {
    /* Brand */
    --brand-green: #5CEA80;
    --brand-white: #E6E6E6;
    --brand-black: #2D2E2A;
    --brand-green-hover: #3FD968;
    --brand-green-soft: rgba(92, 234, 128, 0.14);

    /* Semantic - DARK MODE */
    --color-bg: #1F1F1D;
    --color-bg-elev: #2D2E2A;
    --color-bg-section: #272725;
    --color-bg-code: #141512;
    --color-fg: var(--brand-white);
    --color-fg-muted: #B5B6B0;
    --color-fg-subtle: #898A84;
    --color-border: #3A3B36;
    --color-border-strong: #4A4B45;

    /* Header / Footer - slightly darker than body for layered look */
    --color-dark: #161614;
    --color-dark-soft: #232321;
    --color-dark-fg: var(--brand-white);
    --color-dark-fg-muted: #A9AAA4;

    /* Accent */
    --color-accent: var(--brand-green);
    --color-accent-hover: var(--brand-green-hover);
    --color-accent-soft: var(--brand-green-soft);

    /* Typography */
    --font-sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

    /* Type scale */
    --fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-base: 1rem;
    --fs-md: 1.125rem; --fs-lg: 1.25rem; --fs-xl: 1.5rem;
    --fs-2xl: 2rem; --fs-3xl: 2.5rem; --fs-4xl: 3.25rem; --fs-5xl: 4.5rem;

    /* Spacing */
    --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
    --sp-5: 1.5rem; --sp-6: 2rem; --sp-8: 3rem; --sp-10: 4rem;
    --sp-12: 6rem; --sp-16: 8rem;

    /* Layout */
    --container-max: 1200px;
    --container-narrow: 720px;
    --radius-sm: 4px; --radius-md: 8px; --radius-lg: 16px;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--color-bg); }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--color-fg);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "ss01", "ss02";
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-accent); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0;
    color: var(--color-fg);
}
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--sp-8) 0; }
::selection { background: var(--color-accent); color: var(--brand-black); }

/* ---------- Layout ---------- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--sp-5); }
.container-narrow { max-width: var(--container-narrow); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    font-weight: 600; font-size: var(--fs-sm);
    transition: all var(--transition);
    cursor: pointer; white-space: nowrap;
    border: 1px solid transparent;
}
.btn-primary { background: var(--color-accent); color: var(--brand-black); }
.btn-primary:hover {
    background: var(--color-accent-hover); color: var(--brand-black);
    transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.btn-ghost { color: var(--color-fg); background: transparent; }
.btn-ghost:hover { color: var(--color-fg); background: var(--color-bg-elev); }

/* ---------- Header ---------- */
.site-header {
    background: var(--color-dark);
    color: var(--color-dark-fg);
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(180%) blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); height: 72px; }
.site-brand { display: flex; align-items: center; font-weight: 700; font-size: var(--fs-md); color: var(--color-dark-fg); letter-spacing: -0.02em; }
.site-brand img { max-height: 32px; width: auto; }
.site-nav { flex: 1; display: flex; justify-content: center; }
.nav-list { display: flex; gap: var(--sp-6); }
.nav-item a { color: var(--color-dark-fg-muted); font-size: var(--fs-sm); font-weight: 500; transition: color var(--transition); position: relative; }
.nav-item a:hover { color: var(--color-dark-fg); }
.nav-item a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -8px;
    height: 2px; background: var(--color-accent);
    transform: scaleX(0); transform-origin: left;
    transition: transform var(--transition);
}
.nav-item a:hover::after { transform: scaleX(1); }
.header-actions { display: flex; align-items: center; gap: var(--sp-3); }
.header-actions .btn-ghost { color: var(--color-dark-fg-muted); }
.header-actions .btn-ghost:hover { color: var(--color-dark-fg); background: var(--color-dark-soft); }
.header-actions .btn-primary { background: var(--color-accent); color: var(--brand-black); }
.header-actions .btn-primary:hover { background: var(--color-accent-hover); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: var(--sp-2); }
.nav-toggle span { width: 22px; height: 1.5px; background: var(--color-dark-fg); transition: var(--transition); }

/* ---------- Hero ---------- */
.hero {
    padding: var(--sp-12) 0 var(--sp-8);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: relative; overflow: hidden;
}
.hero::before {
    content: ""; position: absolute;
    top: -200px; right: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--color-accent-soft) 0%, transparent 60%);
    pointer-events: none;
}
.hero > .container { position: relative; }
.hero-eyebrow {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--color-fg); margin-bottom: var(--sp-4);
    display: inline-flex; align-items: center; gap: var(--sp-2);
}
.hero-eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--color-accent); border-radius: 50%; display: inline-block; }
.hero-title { font-size: clamp(var(--fs-3xl), 5vw, var(--fs-5xl)); font-weight: 600; letter-spacing: -0.04em; line-height: 1; max-width: 900px; }
.hero-title .title-accent {
    background: linear-gradient(135deg, var(--color-fg) 30%, var(--color-accent));
    -webkit-background-clip: text; background-clip: text;
    color: transparent; font-weight: 700;
}
.hero-title .title-subtle { color: var(--color-fg-muted); font-weight: 400; }
.hero-meta {
    display: flex; align-items: center; gap: var(--sp-3);
    margin-top: var(--sp-6);
    font-family: var(--font-mono); font-size: var(--fs-xs);
    color: var(--color-fg-subtle);
    text-transform: uppercase; letter-spacing: 0.1em;
}
.dot { color: var(--color-border-strong); }

/* ---------- Featured post ---------- */
.featured-post { padding: var(--sp-8) 0; }
.post-featured { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--sp-8); align-items: center; }
.post-featured-media {
    aspect-ratio: 4/3; overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--color-bg-elev); position: relative;
}
.post-featured-media::after {
    content: ""; position: absolute; inset: 0;
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
    opacity: 0; transition: opacity var(--transition); pointer-events: none;
}
.post-featured-media:hover::after { opacity: 1; }
.post-featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.post-featured-media:hover img { transform: scale(1.04); }
.post-featured-title {
    font-size: clamp(var(--fs-2xl), 3.5vw, var(--fs-4xl));
    font-weight: 600; margin: var(--sp-4) 0; line-height: 1.1; letter-spacing: -0.035em;
}
.post-featured-title a { color: var(--color-fg); }
.post-featured-title a:hover { color: var(--color-fg); border-bottom: 3px solid var(--color-accent); }
.post-featured-excerpt { font-size: var(--fs-md); color: var(--color-fg-muted); line-height: 1.6; margin-bottom: var(--sp-5); }

/* ---------- Section heading ---------- */
.section-heading { display: flex; align-items: center; gap: var(--sp-5); margin-bottom: var(--sp-8); }
.section-heading h2 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.025em; flex-shrink: 0; }
.section-divider { flex: 1; height: 1px; background: linear-gradient(to right, var(--color-border), transparent); }

/* ---------- Post grid ---------- */
.posts-section { padding: var(--sp-8) 0 var(--sp-12); }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-8) var(--sp-6); }

/* ---------- Post card ---------- */
.post-card { display: flex; flex-direction: column; gap: var(--sp-4); transition: transform var(--transition); }
.post-card:hover { transform: translateY(-3px); }
.post-card-media { aspect-ratio: 16/10; overflow: hidden; border-radius: var(--radius-md); background: var(--color-bg-elev); display: block; position: relative; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.post-card:hover .post-card-media img { transform: scale(1.05); }
.post-card-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.post-card-tag {
    align-self: flex-start;
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--brand-black);
    padding: 4px 10px;
    background: var(--color-accent);
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.post-card-title { font-size: var(--fs-xl); font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; }
.post-card-title a { color: var(--color-fg); transition: color var(--transition); }
.post-card-title a:hover { color: var(--color-fg); border-bottom: 2px solid var(--color-accent); }
.post-card-excerpt { color: var(--color-fg-muted); font-size: var(--fs-sm); line-height: 1.55; }
.post-card-meta {
    display: flex; align-items: center; gap: var(--sp-2);
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--color-fg-subtle); margin-top: auto; padding-top: var(--sp-2);
}

/* ---------- Single post ---------- */
.post-header { padding: var(--sp-12) var(--sp-5) var(--sp-6); }
.post-tag {
    display: inline-block;
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--brand-black);
    background: var(--color-accent);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-4); font-weight: 500;
}
.post-title { font-size: clamp(var(--fs-2xl), 5vw, var(--fs-4xl)); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; margin-bottom: var(--sp-5); }
.post-excerpt {
    font-size: var(--fs-lg); color: var(--color-fg-muted); line-height: 1.5;
    font-weight: 400; margin-bottom: var(--sp-6);
    border-left: 3px solid var(--color-accent); padding-left: var(--sp-4);
}
.post-meta { margin-top: var(--sp-5); }
.post-author { display: flex; align-items: center; gap: var(--sp-3); }
.author-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-accent); }
.author-name { font-weight: 600; font-size: var(--fs-sm); color: var(--color-fg); }
.post-meta-time { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-fg-subtle); margin-top: 2px; }
.post-feature-image { margin: var(--sp-6) auto var(--sp-6); max-width: var(--container-max); padding: 0 var(--sp-5); }
.post-feature-image img { width: 100%; border-radius: var(--radius-lg); }
.post-feature-image figcaption { text-align: center; font-size: var(--fs-sm); color: var(--color-fg-muted); margin-top: var(--sp-3); font-style: italic; }

/* ---------- Post content (rich text) ---------- */
.post-content { font-size: var(--fs-md); line-height: 1.75; color: var(--color-fg); counter-reset: body-section; }
.post-content > * + * { margin-top: var(--sp-5); }

/* Lead paragraph: first paragraph stands out as editorial intro */
.post-content > p:first-of-type {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--color-fg);
    font-weight: 400;
    letter-spacing: -0.005em;
}

.post-content h2 {
    counter-increment: body-section;
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
    font-size: var(--fs-2xl);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-top: var(--sp-10);
    margin-bottom: var(--sp-4);
    scroll-margin-top: 90px;
}
.post-content h2::before {
    content: counter(body-section);
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.55em;
    font-weight: 700;
    color: var(--color-accent);
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    line-height: 1;
    align-self: center;
    letter-spacing: 0;
}
.post-content h3 { font-size: var(--fs-xl); font-weight: 600; margin-top: var(--sp-8); margin-bottom: var(--sp-3); scroll-margin-top: 90px; }
.post-content h4 { font-size: var(--fs-lg); font-weight: 600; margin-top: var(--sp-6); }
.post-content p { margin: 0; }
.post-content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: all var(--transition);
}
.post-content a:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.post-content strong { font-weight: 700; color: var(--color-fg); }
.post-content em { font-style: italic; }
.post-content blockquote {
    margin: var(--sp-6) 0; padding: var(--sp-4) var(--sp-6);
    border-left: 4px solid var(--color-accent);
    font-size: var(--fs-lg); color: var(--color-fg-muted);
    background: var(--color-bg-elev);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
}
.post-content ul, .post-content ol { padding-left: var(--sp-6); }
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: var(--sp-2); }
.post-content li::marker { color: var(--color-accent); }
.post-content code {
    font-family: var(--font-mono); font-size: 0.9em;
    padding: 2px 6px;
    background: var(--color-bg-elev);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-accent);
}
.post-content pre {
    background: var(--color-bg-code);
    color: var(--color-fg);
    padding: var(--sp-5);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    line-height: 1.6;
    margin: var(--sp-6) 0;
    border-left: 3px solid var(--color-accent);
    border-top: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.post-content pre code { background: transparent; border: none; padding: 0; color: inherit; font-size: inherit; }
.post-content img { border-radius: var(--radius-md); margin: var(--sp-6) auto; }
.post-content figure { margin: var(--sp-6) 0; }
.post-content figure figcaption { text-align: center; font-size: var(--fs-sm); color: var(--color-fg-muted); margin-top: var(--sp-2); font-style: italic; }
.post-content table { width: 100%; border-collapse: collapse; margin: var(--sp-6) 0; font-size: var(--fs-sm); }
.post-content th, .post-content td { padding: var(--sp-3); text-align: left; border-bottom: 1px solid var(--color-border); }
.post-content th { font-weight: 700; background: var(--color-bg-elev); color: var(--color-fg); }
.post-content tbody tr:hover { background: var(--color-bg-section); }
.post-content hr { border: 0; height: 2px; background: var(--color-accent); margin: var(--sp-8) auto; max-width: 80px; border-radius: 2px; }

/* Ghost-specific card styles */
.kg-card { margin: var(--sp-6) 0; }
.kg-image { border-radius: var(--radius-md); }

/* TOC box */
.toc-box {
    background: var(--color-bg-elev);
    border-left: 4px solid var(--color-accent);
    padding: var(--sp-5) var(--sp-6);
    margin: 0 0 var(--sp-6) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.toc-box .toc-title {
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-fg);
    margin: 0 0 var(--sp-4) 0;
    font-weight: 600;
}
.toc-box .toc-title strong { font-weight: 600; color: var(--color-fg); }
.toc-box ol {
    margin: 0; padding-left: var(--sp-6);
    line-height: 1.8; font-size: var(--fs-sm); list-style: decimal;
}
.toc-box ol li { margin-bottom: var(--sp-1); padding-left: var(--sp-1); }
.toc-box ol li::marker { color: var(--color-accent); font-weight: 600; }
.toc-box ol li a {
    color: var(--color-fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}
.toc-box ol li a:hover { color: var(--color-accent); border-bottom-color: var(--color-accent); }

/* ---------- Post layout with sticky sidebar TOC ---------- */
.post-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--sp-5);
    display: grid;
    grid-template-columns: minmax(0, var(--container-narrow)) 260px;
    gap: var(--sp-8);
    align-items: start;
    justify-content: center;
}
.post-layout > .post-content {
    grid-column: 1;
    align-self: start;
    max-width: var(--container-narrow);
    margin: 0;
    padding: 0;
}
.post-content > *:first-child {
    margin-top: 0 !important;
}
.post-layout > .post-toc-sidebar {
    grid-column: 2;
    position: sticky;
    top: 90px;
    max-width: 260px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}
.post-toc-sidebar::-webkit-scrollbar { width: 4px; }
.post-toc-sidebar::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 2px; }
/* Hide sidebar TOC when JS hasn't activated it (no headings, manual TOC, etc.) */
.post-toc-sidebar:not(.is-active) { display: none; }

/* Auto-generated TOC compact styling for sidebar */
.toc-box.toc-auto {
    padding: var(--sp-4) var(--sp-5);
    margin: 0;
    font-size: var(--fs-sm);
}
.toc-box.toc-auto .toc-title {
    font-size: 0.7rem;
    margin-bottom: var(--sp-3);
}
.toc-box.toc-auto ol {
    padding-left: 0;
    line-height: 1.45;
    list-style: none;
    counter-reset: toc-counter;
}
.toc-box.toc-auto ol li {
    margin-bottom: 2px;
    padding-left: 0;
    counter-increment: toc-counter;
    position: relative;
}
.toc-box.toc-auto ol li::marker { content: none; }
.toc-box.toc-auto ol li a {
    display: block;
    padding: 6px 10px 6px 28px;
    border-radius: var(--radius-sm);
    border-bottom: none;
    color: var(--color-fg-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    position: relative;
    transition: var(--transition);
}
.toc-box.toc-auto ol li a::before {
    content: counter(toc-counter);
    position: absolute;
    left: 8px;
    top: 6px;
    font-size: 0.7rem;
    color: var(--color-fg-subtle);
    font-family: var(--font-mono);
    font-weight: 600;
    line-height: 1.4;
    transition: var(--transition);
}
.toc-box.toc-auto ol li a:hover {
    color: var(--color-fg);
    background: var(--color-bg-section);
    border-bottom: none;
}
.toc-box.toc-auto ol li a.is-active {
    color: var(--color-accent);
    background: var(--color-accent-soft);
    font-weight: 600;
}
.toc-box.toc-auto ol li a.is-active::before {
    color: var(--color-accent);
}

/* Responsive: collapse TOC to inline on smaller screens */
@media (max-width: 1080px) {
    .post-layout {
        display: block;
        max-width: var(--container-narrow);
        padding: 0 var(--sp-5);
    }
    .post-layout > .post-toc-sidebar {
        position: static;
        max-width: 100%;
        max-height: none;
        margin-bottom: var(--sp-6);
        overflow: visible;
    }
    .toc-box.toc-auto {
        padding: var(--sp-5) var(--sp-6);
    }
    .toc-box.toc-auto ol li a {
        font-size: 0.95rem;
        padding: 8px 12px 8px 36px;
    }
    .toc-box.toc-auto ol li a::before {
        left: 12px;
        top: 9px;
        font-size: 0.8rem;
    }
}

/* Image width variants */
.kg-width-wide { position: relative; width: 85vw; max-width: 1140px; left: 50%; transform: translateX(-50%); margin: var(--sp-8) 0; }
.kg-width-wide img { width: 100%; border-radius: var(--radius-md); }
.kg-width-full { position: relative; width: 100vw; left: 50%; transform: translateX(-50%); margin: var(--sp-8) 0; }
.kg-width-full img { width: 100%; border-radius: 0; }
@media (max-width: 1140px) { .kg-width-wide { width: 100%; left: 0; transform: none; } }

.kg-bookmark-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    text-decoration: none;
    background: var(--color-bg-elev);
    transition: var(--transition);
}
.kg-bookmark-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.kg-bookmark-content { padding: var(--sp-4); flex: 1; }
.kg-bookmark-title { font-weight: 700; margin-bottom: var(--sp-2); color: var(--color-fg); }
.kg-bookmark-description {
    color: var(--color-fg-muted); font-size: var(--fs-sm);
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.kg-bookmark-thumbnail { width: 200px; }
.kg-bookmark-thumbnail img { height: 100%; object-fit: cover; }

/* ---------- Post footer / tags ---------- */
.post-footer {
    margin-top: var(--sp-10); padding-bottom: var(--sp-8);
    border-top: 1px solid var(--color-border); padding-top: var(--sp-6);
}
.post-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.post-tag-small {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    color: var(--color-fg-muted);
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.post-tag-small:hover { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-accent-soft); }

/* ---------- Subscribe CTA ---------- */
.subscribe-cta { margin: var(--sp-10) auto; }
.cta-box {
    background: var(--color-bg-elev);
    color: var(--color-fg);
    padding: var(--sp-8) var(--sp-6);
    border-radius: var(--radius-lg);
    text-align: center;
    position: relative; overflow: hidden;
    border: 1px solid var(--color-border);
}
.cta-box::before {
    content: ""; position: absolute;
    top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, var(--color-accent-soft) 0%, transparent 70%);
    pointer-events: none;
}
.cta-box > * { position: relative; }
.cta-box h3 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); color: var(--color-fg); font-weight: 600; }
.cta-box p { color: var(--color-fg-muted); margin-bottom: var(--sp-5); max-width: 480px; margin-left: auto; margin-right: auto; }
.cta-box .btn-primary { background: var(--color-accent); color: var(--brand-black); }
.cta-box .btn-primary:hover { background: var(--color-accent-hover); color: var(--brand-black); }

/* ---------- Related posts ---------- */
.related-posts { padding: var(--sp-10) var(--sp-5); border-top: 1px solid var(--color-border); margin-top: var(--sp-8); }

/* ---------- Archive pages ---------- */
.archive-header { padding: var(--sp-12) var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--color-border); }
.archive-eyebrow {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--color-fg); margin-bottom: var(--sp-3);
    display: inline-flex; align-items: center; gap: var(--sp-2);
}
.archive-eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--color-accent); border-radius: 50%; }
.archive-title { font-size: clamp(var(--fs-3xl), 5vw, var(--fs-5xl)); font-weight: 600; letter-spacing: -0.04em; }
.archive-description { font-size: var(--fs-md); color: var(--color-fg-muted); margin-top: var(--sp-4); max-width: 640px; }
.archive-count { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-fg-subtle); margin-top: var(--sp-4); }
.author-avatar-lg { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: var(--sp-4); border: 3px solid var(--color-accent); }
.author-links { display: flex; gap: var(--sp-4); margin-top: var(--sp-4); }
.author-links a {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--brand-black); padding: 4px 10px;
    background: var(--color-accent); border-radius: var(--radius-sm); font-weight: 500;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: var(--sp-10); padding-top: var(--sp-6);
    border-top: 1px solid var(--color-border);
    font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: 0.05em;
}
.pagination-link {
    color: var(--color-fg); padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: var(--transition); font-weight: 500;
}
.pagination-link:hover:not(.disabled) {
    background: var(--color-accent);
    color: var(--brand-black);
    border-color: var(--color-accent);
}
.pagination-link.disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-meta { color: var(--color-fg-muted); text-transform: uppercase; font-size: var(--fs-xs); }

/* ---------- Error page ---------- */
.error-page { padding: var(--sp-16) 0; text-align: center; }
.error-code {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: 0.2em;
    color: var(--brand-black); background: var(--color-accent);
    display: inline-block; padding: 6px 14px;
    border-radius: var(--radius-sm); margin-bottom: var(--sp-4); font-weight: 500;
}
.error-title { font-size: clamp(var(--fs-3xl), 6vw, var(--fs-5xl)); font-weight: 600; letter-spacing: -0.04em; margin-bottom: var(--sp-4); }
.error-text { color: var(--color-fg-muted); font-size: var(--fs-md); max-width: 480px; margin: 0 auto var(--sp-6); }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--color-dark);
    color: var(--color-dark-fg);
    padding: var(--sp-10) 0 var(--sp-6);
    margin-top: var(--sp-12);
    border-top: 1px solid var(--color-border);
}
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-8); }
.footer-brand-link { display: inline-flex; align-items: center; margin-bottom: var(--sp-3); }
.footer-brand-link img { max-height: 24px; }
.footer-tagline { color: var(--color-dark-fg-muted); font-size: var(--fs-sm); max-width: 360px; line-height: 1.55; }
.footer-nav ul { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-nav a { font-size: var(--fs-sm); color: var(--color-dark-fg-muted); transition: color var(--transition); }
.footer-nav a:hover { color: var(--color-accent); }
.footer-meta {
    font-family: var(--font-mono); font-size: var(--fs-xs);
    color: var(--color-dark-fg-muted);
    text-transform: uppercase; letter-spacing: 0.08em;
    grid-column: 1 / -1;
    padding-top: var(--sp-6); margin-top: var(--sp-6);
    border-top: 1px solid var(--color-dark-soft);
    display: flex; justify-content: space-between; align-items: center;
}
.footer-meta a { color: var(--color-accent); }
.powered { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .post-featured { grid-template-columns: 1fr; gap: var(--sp-5); }
    .footer-inner { grid-template-columns: 1fr; gap: var(--sp-6); }
    .footer-meta { flex-direction: column; gap: var(--sp-3); text-align: center; }
}
@media (max-width: 700px) {
    .site-nav { display: none; }
    .nav-toggle { display: flex; }
    .header-actions .btn { display: none; }
    .hero { padding: var(--sp-8) 0 var(--sp-6); }
    .post-header { padding: var(--sp-8) var(--sp-5) var(--sp-4); }
    .post-grid { grid-template-columns: 1fr; gap: var(--sp-6); }
    .pagination { flex-direction: column; gap: var(--sp-3); align-items: stretch; }
    .pagination-link { text-align: center; }
}

/* ---------- Print ---------- */
@media print {
    body { background: white; color: black; }
    .site-header, .site-footer, .subscribe-cta, .related-posts, .pagination { display: none; }
    .post-content { font-size: 11pt; color: black; }
    .post-content h1, .post-content h2, .post-content h3 { color: black; }
}
