/* Reins Blog — Editorial CSS
   Dark mode + light mode, Instrument Serif + Satoshi typography
   Vanilla JS: TOC auto-gen, reading time, syntax highlighting
   ─────────────────────────────────────────── */

/* ── Google Fonts ──────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

/* ── Design Tokens ─────────────────────────── */
:root {
    /* Light mode (default) */
    --bg:           #f8f7f4;
    --bg-sub:       #f0ede8;
    --bg-card:      #ffffff;
    --bg-nav:       #ffffff;
    --text:         #18160f;
    --text-2:       #524d42;
    --text-3:       #8a8478;
    --accent:       #e8621a;
    --accent-dim:    rgba(232, 98, 26, 0.1);
    --border:       #e0dbd4;
    --border-dark:  #18160f;
    --green:        #3a7d5a;
    --red:          #c0392b;
    --yellow:       #b8860b;
    --purple:       #6b4fa0;
    --code-bg:      #f0ede8;
    --code-border:  #d8d3cc;
    --shadow:       rgba(24, 22, 15, 0.06);
    --shadow-strong:rgba(24, 22, 15, 0.12);

    /* Typography */
    --font-serif:   'Instrument Serif', Georgia, serif;
    --font-sans:     'DM Sans', system-ui, sans-serif;
    --font-mono:     'DM Mono', 'SF Mono', 'Monaco', monospace;

    /* Shadows */
    --shadow-card:  0 1px 2px var(--shadow);
}

[data-theme="dark"] {
    --bg:           #111009;
    --bg-sub:       #1c1a14;
    --bg-card:      #1c1a14;
    --bg-nav:       #111009;
    --text:         #e8e5de;
    --text-2:       #a8a39a;
    --text-3:       #6b665c;
    --accent:       #f07035;
    --accent-dim:    rgba(240, 112, 53, 0.12);
    --border:       #2e2b22;
    --border-dark:  #e8e5de;
    --green:        #4a9e72;
    --red:          #e74c3c;
    --yellow:       #e0a832;
    --purple:       #9b72e0;
    --code-bg:      #1c1a14;
    --code-border:  #2e2b22;
    --shadow:       rgba(0, 0, 0, 0.25);
    --shadow-strong:rgba(0, 0, 0, 0.45);
    --shadow-card:  0 2px 8px rgba(0,0,0,0.3);
}

/* ── Base ──────────────────────────────────── */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s, color 0.3s;
}

/* ── Navigation ────────────────────────────── */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 18px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s, border-color 0.3s;
}

.logo {
    font-size: 17px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.04em;
    text-decoration: none;
    font-family: var(--font-sans);
}
.logo-dot { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 28px; }

.nav-link {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-3);
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }

.nav-cta {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--border);
    transition: border-color 0.2s, color 0.2s;
    letter-spacing: 0;
}
.nav-cta:hover { border-color: var(--accent); color: var(--accent); }

/* ── Dark Mode Toggle ─────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-3);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    flex-shrink: 0;
    border-radius: 2px;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}
.theme-toggle svg { display: block; }

/* ── Blog Layout ─────────────────────────── */
.blog-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 48px 96px;
}

/* ── Page Header ──────────────────────────── */
.page-header {
    padding: 140px 48px 64px;
    max-width: 760px;
    margin: 0 auto;
}

.page-header .eyebrow {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 16px;
}

.page-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 18px;
    color: var(--text);
}

.page-header p {
    font-size: 17px;
    color: var(--text-2);
    max-width: 520px;
    line-height: 1.65;
    font-weight: 300;
}

/* ── Featured Grid ────────────────────────── */
.featured-grid {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 80px;
}

.featured-post {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
    text-decoration: none;
    transition: box-shadow 0.25s, border-color 0.25s;
    box-shadow: var(--shadow-card);
}
.featured-post:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px var(--shadow-strong);
}

.featured-post-img {
    background: var(--bg-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    border-right: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}
.featured-post-img .img-placeholder {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 24px;
    text-align: center;
    line-height: 1.8;
}

.featured-post-body { padding: 32px; }

.post-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 3px 8px;
    margin-bottom: 14px;
    transition: border-color 0.2s, color 0.2s;
}

.featured-post h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 12px;
    color: var(--text);
}

.featured-post p {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.65;
    margin-bottom: 16px;
}

.post-meta {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    gap: 16px;
}

/* ── Post Grid ───────────────────────────── */
.posts-section-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.posts-grid {
    max-width: 760px;
    margin: 0 auto;
}

.post-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 28px 24px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    box-shadow: var(--shadow-card);
}
.post-card:last-child { border-bottom: 1px solid var(--border); }
.post-card:hover { background: var(--bg-sub); border-color: var(--accent); }

.post-card .post-tag { margin-bottom: 10px; }

.post-card h2 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--text);
    transition: color 0.2s;
}

.post-card:hover h2 { color: var(--accent); }

.post-card p {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.65;
    margin-bottom: 12px;
}

.post-card .meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Article Page ────────────────────────── */
.article-hero {
    padding: 120px 48px 0;
    max-width: 760px;
    margin: 0 auto;
}

.article-hero .eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.read-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.article-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(28px, 4.5vw, 48px);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 20px;
    color: var(--text);
}

.article-hero .subtitle {
    font-size: 18px;
    color: var(--text-2);
    line-height: 1.65;
    font-weight: 300;
    font-style: italic;
    margin-bottom: 32px;
}

.article-hero .byline {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-sub);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 16px;
    color: var(--accent);
    flex-shrink: 0;
    font-weight: 400;
}

.author-info .author-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
.author-info .author-title {
    font-size: 12px;
    color: var(--text-3);
}
.article-hero .byline-sep { color: var(--text-3); font-size: 12px; }
.article-hero .byline-date { font-size: 12px; color: var(--text-3); }

/* ── Article Layout: TOC + Content ───────── */
.article-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 48px 96px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 64px;
    align-items: start;
}

/* TOC Sidebar */
.toc-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.toc-title {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-bottom: 14px;
}

.toc-list { list-style: none; }

.toc-item { margin-bottom: 2px; }

.toc-link {
    display: block;
    font-size: 12.5px;
    color: var(--text-3);
    text-decoration: none;
    padding: 4px 8px 4px 0;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1.5;
}
.toc-link:hover { color: var(--text); border-left-color: var(--border); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc-link.h3 { padding-left: 22px; font-size: 12px; }

/* Article Content */
.article-content-wrap {}

.article-content h2 {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 400;
    margin: 56px 0 20px;
    letter-spacing: -0.02em;
    color: var(--text);
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 100px;
}

.article-content h3 {
    font-size: 18px;
    font-weight: 500;
    margin: 36px 0 14px;
    color: var(--text);
    scroll-margin-top: 100px;
}

.article-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 24px 0 10px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-sans);
}

.article-content p {
    margin-bottom: 20px;
    color: var(--text-2);
    line-height: 1.8;
    font-size: 16px;
}

.article-content strong { color: var(--text); font-weight: 600; }
.article-content em { font-style: italic; color: var(--text-2); }

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}
.article-content a:hover { opacity: 0.8; }

.article-content ul,
.article-content ol {
    margin: 0 0 20px 24px;
    color: var(--text-2);
}

.article-content li {
    margin-bottom: 10px;
    line-height: 1.75;
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 16px 24px;
    margin: 32px 0;
    background: var(--accent-dim);
    font-style: italic;
    color: var(--text-2);
}
.article-content blockquote p { margin: 0; }

/* ── Inline CTA Card ──────────────────────── */
.inline-cta {
    background: var(--bg-sub);
    border: 1px solid var(--border);
    padding: 28px 32px;
    margin: 40px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.inline-cta-body h4 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 6px;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}

.inline-cta-body p {
    font-size: 13px;
    color: var(--text-3);
    margin: 0;
    line-height: 1.5;
}

.inline-cta-btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s;
    border-radius: 2px;
}
.inline-cta-btn:hover { opacity: 0.85; }

/* ── Callout Block ─────────────────────────── */
.callout {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-left-width: 3px;
    padding: 18px 22px;
    margin: 32px 0;
}
.callout p { margin: 0; font-size: 14px; color: var(--text-2); }
.callout strong { color: var(--text); }
.callout.callout-warn { border-color: var(--yellow); background: rgba(212, 160, 23, 0.08); }
.callout.callout-info { border-color: var(--green); background: rgba(58, 125, 90, 0.08); }
.callout.callout-danger { border-color: var(--red); background: rgba(192, 57, 43, 0.08); }

/* ── Code Blocks ──────────────────────────── */
.article-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 2px 6px;
    color: var(--accent);
    border-radius: 2px;
}

.article-content pre {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 20px 24px;
    overflow-x: auto;
    margin: 28px 0;
    line-height: 1.65;
    border-radius: 2px;
    position: relative;
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Syntax highlighting via JS spans */
.syn-kw  { color: #c084fc; } /* keyword - purple */
.syn-str { color: #86efac; } /* string - green */
.syn-num { color: #fbbf24; } /* number - amber */
.syn-cmt { color: #6b7280; font-style: italic; } /* comment - gray */
.syn-fn  { color: #67e8f9; } /* function - cyan */
.syn-opr { color: #f472b6; } /* operator - pink */
.syn-punc { color: #94a3b8; } /* punctuation - slate */
.syn-type { color: #fb923c; } /* type - orange */
.syn-eq  { color: #f9fafb; } /* equals - white */
.syn-pln { color: var(--text-2); } /* plain - text-2 */

[data-theme="dark"] .syn-kw  { color: #c084fc; }
[data-theme="dark"] .syn-str { color: #86efac; }
[data-theme="dark"] .syn-num { color: #fbbf24; }
[data-theme="dark"] .syn-cmt { color: #6b7280; }
[data-theme="dark"] .syn-fn  { color: #67e8f9; }
[data-theme="dark"] .syn-opr { color: #f472b6; }
[data-theme="dark"] .syn-punc { color: #94a3b8; }
[data-theme="dark"] .syn-type { color: #fb923c; }

/* Code block language label */
.code-block-wrapper {
    position: relative;
}
.code-lang-label {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Stats Grid ───────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    margin: 32px 0;
}

.stat-card {
    padding: 24px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    text-align: center;
}
.stat-card:last-child { border-right: none; }

.stat-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    color: var(--accent);
    display: block;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Step List ────────────────────────────── */
.step-list {
    list-style: none;
    margin: 0 0 24px 0;
    padding: 0;
    counter-reset: steps;
}

.step-list li {
    counter-increment: steps;
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.step-list li::before {
    content: counter(steps);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-mono);
    border-radius: 50%;
    margin-top: 2px;
}

/* ── Disaster Log ─────────────────────────── */
.disaster-log {
    border: 1px solid var(--border);
    margin: 32px 0;
    overflow: hidden;
}

.disaster-log-header {
    background: var(--red);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.disaster-log-body { background: var(--bg-sub); }

.call-log-entry {
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
}
.call-log-entry:last-child { border-bottom: none; }

.call-log-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.call-log-timestamp {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
}

.call-log-speaker {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 2px;
}
.call-log-speaker.ai { background: var(--accent-dim); color: var(--accent); }
.call-log-speaker.api { background: rgba(58, 125, 90, 0.12); color: var(--green); }
.call-log-speaker.sys { background: rgba(107, 79, 160, 0.12); color: var(--purple); }

.call-log-text {
    font-size: 13.5px;
    color: var(--text-2);
    line-height: 1.65;
    font-family: var(--font-mono);
}

.call-log-cost {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--red);
}

.disaster-log-footer {
    background: #fef2f2;
    padding: 14px 20px;
    border-top: 1px solid rgba(192, 57, 43, 0.2);
}
[data-theme="dark"] .disaster-log-footer { background: rgba(192, 57, 43, 0.08); }

.disaster-log-footer p {
    font-size: 13px;
    color: var(--red);
    margin: 0;
    font-weight: 500;
}

/* ── Comparison Table ─────────────────────── */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    border: 1px solid var(--border);
    font-size: 14px;
}

.article-content table thead tr {
    background: var(--bg-sub);
}

.article-content table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.article-content table thead th:last-child { border-right: none; }

.article-content table tbody tr { border-bottom: 1px solid var(--border); }
.article-content table tbody tr:last-child { border-bottom: none; }
.article-content table tbody tr:hover { background: var(--bg-sub); }

.article-content table td {
    padding: 11px 16px;
    color: var(--text-2);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
}
.article-content table td:last-child { border-right: none; }
.article-content table td:first-child {
    font-weight: 500;
    color: var(--text);
    background: var(--bg-sub);
}

/* ── Author Byline Block ─────────────────── */
.author-block {
    border-top: 1px solid var(--border);
    padding-top: 32px;
    margin-top: 56px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.author-block-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-sub);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--accent);
    flex-shrink: 0;
}

.author-block-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    font-family: var(--font-sans);
}

.author-block-info .title {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.author-block-info p {
    font-size: 13.5px;
    color: var(--text-3);
    line-height: 1.6;
    margin: 0;
}

/* ── Related Posts ────────────────────────── */
.related-posts {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.related-posts h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border: 1px solid var(--border);
}

.related-card {
    display: block;
    background: var(--bg-card);
    padding: 20px 22px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.2s;
}
.related-card:nth-child(even) { border-right: none; }
.related-card:nth-last-child(-n+2) { border-bottom: none; }
.related-card:hover { background: var(--bg-sub); }

.related-card .post-tag { margin-bottom: 8px; }

.related-card h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
    transition: color 0.2s;
}
.related-card:hover h3 { color: var(--accent); }

.related-card p {
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.5;
    margin: 0;
}

/* ── Breadcrumb ───────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-3);
    padding: 18px 48px 0;
    max-width: 760px;
    margin: 0 auto;
}

.breadcrumb a {
    color: var(--text-3);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); }

/* ── Back link ──────────────────────────────── */
.back-link {
    display: inline-block;
    font-size: 12px;
    color: var(--text-3);
    text-decoration: none;
    padding: 4px 0;
    margin: 0 0 32px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ── FAQ Section ─────────────────────────── */
.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}
.faq-item:last-child { border-bottom: none; }

.faq-q {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 10px;
    cursor: pointer;
}

.faq-a {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.7;
    padding-left: 0;
}

/* ── Bottom CTA ──────────────────────────── */
.bottom-cta {
    margin-top: 64px;
    padding: 48px 40px;
    background: var(--bg-sub);
    border: 1px solid var(--border);
    text-align: center;
}

.bottom-cta h2 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.bottom-cta p {
    font-size: 15px;
    color: var(--text-2);
    margin-bottom: 24px;
    line-height: 1.6;
}

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: white;
    text-decoration: none;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
    border-radius: 2px;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border-dark);
    transition: border-color 0.2s, color 0.2s;
    border-radius: 2px;
    margin-left: 12px;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Footer ──────────────────────────────── */
footer {
    padding: 64px 48px 80px;
    border-top: 1px solid var(--border);
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-3);
    flex-wrap: wrap;
    gap: 16px;
}
footer a { color: var(--text-3); text-decoration: none; margin: 0 4px; transition: color 0.2s; }
footer a:hover { color: var(--text); }
.footer-credit { font-size: 11px; color: var(--text-3); font-weight: 300; }

/* ── Back to top ─────────────────────────── */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 40px; height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-3);
    font-size: 16px;
    cursor: pointer;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, border-color 0.2s, color 0.2s;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    border-radius: 2px;
    box-shadow: var(--shadow-card);
}
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top.visible { opacity: 1; visibility: visible; }

/* ── Progress bar ─────────────────────────── */
.reading-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    background: var(--accent);
    z-index: 200;
    width: 0%;
    transition: width 0.1s;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 180px 1fr;
        gap: 40px;
    }
}

@media (max-width: 900px) {
    .article-layout {
        grid-template-columns: 1fr;
        padding: 32px 32px 80px;
    }
    .toc-sidebar { display: none; }
    .featured-grid { max-width: 100%; padding: 0 0 56px; }
    .featured-post { grid-template-columns: 1fr; }
    .featured-post-img { border-right: none; border-bottom: 1px solid var(--border); min-height: 160px; }
    .posts-grid { max-width: 100%; }
}

@media (max-width: 768px) {
    nav { padding: 16px 20px; }
    .nav-links { gap: 12px; }
    .blog-layout { padding: 0 20px 64px; }
    .page-header { padding: 120px 20px 44px; }
    .article-hero { padding: 100px 20px 0; }
    .article-layout { padding: 32px 20px 64px; }
    .featured-post-body { padding: 24px; }
    .article-content h2 { font-size: 22px; margin: 40px 0 16px; }
    .article-content h3 { font-size: 16px; }
    .inline-cta { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { border-right: none; border-bottom: 1px solid var(--border); }
    .stat-card:last-child { border-bottom: none; }
    .related-grid { grid-template-columns: 1fr; }
    .related-card { border-right: none !important; border-bottom: 1px solid var(--border) !important; }
    .related-card:last-child { border-bottom: none !important; }
    .article-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    footer { padding: 40px 20px 56px; flex-direction: column; gap: 12px; text-align: center; }
    .bottom-cta { padding: 36px 20px; }
    .author-block { flex-direction: column; }
    .breadcrumb { padding: 18px 20px 0; }
}

@media (max-width: 480px) {
    .nav-links .nav-link:not(:last-child) { display: none; }
    .page-header h1 { font-size: 28px; }
    .article-hero h1 { font-size: 26px; }
    .article-content p { font-size: 15px; }
    .btn-secondary { margin-left: 0; margin-top: 10px; display: block; text-align: center; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}