/* blog-common.css - Shared styles for saba.link/blog */

:root {
    --bg: #0a0a10;
    --card-bg: rgba(20, 20, 30, 0.7);
    --card-bg-hover: rgba(26, 26, 38, 0.8);
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.08);
    --accent-highlight: rgba(167, 139, 250, 0.08);
    --border: rgba(255, 255, 255, 0.06);
    --glow: rgba(99, 102, 241, 0.2);
}
[data-theme="light"] {
    --bg: #fafafa;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-bg-hover: rgba(255, 255, 255, 0.95);
    --text: #1a1a2e;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-soft: rgba(79, 70, 229, 0.06);
    --accent-highlight: rgba(139, 92, 246, 0.06);
    --border: rgba(0, 0, 0, 0.06);
    --glow: rgba(79, 70, 229, 0.12);
}

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

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    z-index: 100;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

/* Body & Background */
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60vh;
    background: radial-gradient(ellipse at 30% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 0%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
[data-theme="light"] body::before {
    background: radial-gradient(ellipse at 30% 0%, rgba(79, 70, 229, 0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 0%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* Hero Image */
.hero {
    width: 100%;
    max-height: 520px;
    overflow: hidden;
    position: relative;
}
.hero img {
    width: 100%;
    height: 520px;
    object-fit: cover;
    object-position: center;
    display: block;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 25%;
    background: linear-gradient(to top, transparent, rgba(10, 10, 16, 0.2));
    pointer-events: none;
    z-index: 1;
}
[data-theme="light"] .hero::after {
    background: linear-gradient(to bottom, transparent, var(--bg));
}
[data-theme="light"] .hero::before {
    background: linear-gradient(to top, transparent, rgba(250, 250, 250, 0.2));
}
@media (min-width: 1400px) {
    .hero, .hero img { height: 700px; max-height: 700px; }
}
@media (max-width: 640px) {
    .hero, .hero img { height: 350px; max-height: 350px; }
}

/* Article Header */
.article-header {
    padding: 2rem 1.5rem 3rem;
    max-width: 720px;
    margin: 0 auto;
}
.article-header.has-hero {
    margin-top: -5rem;
}
.header-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.back-link, .about-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
    letter-spacing: 0.02em;
}
.back-link:hover, .about-link:hover { color: var(--accent); }

.tag {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    background: var(--accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
    opacity: 0.95;
}
[data-theme="light"] .tag { border-color: rgba(79, 70, 229, 0.2); }

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.03em;
}
.excerpt {
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1.8;
    font-weight: 300;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.article-meta .meta-date,
.article-meta .meta-read {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.article-meta svg {
    width: 14px;
    height: 14px;
    fill: var(--text-muted);
    opacity: 0.7;
}
.article-meta .meta-dot {
    opacity: 0.4;
    font-size: 0.5rem;
}

/* Divider */
.divider {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.divider hr {
    border: none;
    height: 1px;
    background: var(--border);
}

/* Content Area */
.content {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Prose Styles */
.prose h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 3.5rem 0 1.25rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    letter-spacing: -0.02em;
    color: var(--text);
}
.prose h2:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.prose h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 2.25rem 0 0.75rem;
    letter-spacing: -0.01em;
    color: var(--text);
    opacity: 0.9;
}
.prose p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.8;
}
.prose .drop-cap::first-letter {
    float: left;
    font-size: 3.6em;
    line-height: 0.85;
    font-weight: 700;
    margin-right: 0.12em;
    margin-top: 0.05em;
    padding-right: 0.05em;
    color: var(--accent);
    font-family: Georgia, 'Times New Roman', serif;
}
.prose ul, .prose ol {
    margin: 1rem 0 1.5rem 1.5rem;
    line-height: 1.8;
}
.prose li {
    margin-bottom: 0.6rem;
    line-height: 1.75;
}
/* Nested list visual depth cues */
.prose ul { list-style-type: disc; }
.prose ul ul { list-style-type: none; }
.prose ul ul > li::before {
    content: '–';
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 0.5rem;
    margin-left: -1.1rem;
}
.prose ul ul ul > li::before { content: '·'; }
/* Slightly more breathing room in nested lists */
.prose li > ul,
.prose li > ol {
    margin-top: 0.4rem;
    margin-bottom: 0.1rem;
}
/* Footnote / small text in prose */
.prose small, .prose p > small {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.8;
    display: block;
    margin-top: 0.5rem;
}
/* First paragraph after a section heading — slightly more prominent */
.prose h2 + p {
    font-size: 1.02em;
    color: var(--text);
    opacity: 0.92;
}
.prose strong {
    font-weight: 600;
    color: var(--text);
}
.prose em {
    font-style: italic;
    color: var(--text-muted);
}

/* Code blocks */
.prose code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.15em 0.45em;
    color: var(--accent);
    word-break: break-word;
}
.prose pre {
    position: relative;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    padding-top: 2.4rem;
    margin: 1.5rem 0 2rem;
    overflow-x: auto;
}
.prose pre code {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.85rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}

/* Article end ornament */
.prose > *:last-child {
    padding-bottom: 1.5rem;
}
.prose > *:last-child::after {
    content: '· · ·';
    display: block;
    text-align: center;
    color: var(--text-muted);
    opacity: 0.35;
    font-size: 1.2rem;
    letter-spacing: 0.5em;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Copy button for code blocks */
.copy-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    padding: 0.28rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.03em;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}
.copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.copy-btn.copied {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

/* Code block language label */
.code-lang-label {
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    opacity: 0.55;
    pointer-events: none;
    font-family: inherit;
}

/* Tables */
.prose table {
    width: fit-content;
    max-width: 100%;
    margin: 1.5rem auto 2rem;
    border-collapse: collapse;
    font-size: 0.9rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.prose thead th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
    padding: 0.9rem 1.15rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    text-align: left;
}
.prose tbody td {
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: top;
    line-height: 1.5;
}
.prose tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
[data-theme="light"] .prose tbody tr:nth-child(even) td { background: rgba(0,0,0,0.025); }
.prose tbody tr:hover td { color: var(--text); background: var(--accent-soft); }
.prose tbody tr:last-child td { border-bottom: none; }

/* h4 in prose */
.prose h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: var(--text);
}

/* Blockquote */
.prose blockquote {
    border-left: 3px solid var(--accent);
    margin: 2rem 0;
    padding: 0.75rem 0.75rem 0.75rem 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.7;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 0 6px 6px 0;
}
[data-theme="light"] .prose blockquote {
    background: rgba(79, 70, 229, 0.04);
}
.prose blockquote p { margin-bottom: 0; }

/* Pullquote */
.pullquote {
    border-left: 3px solid var(--accent);
    margin: 2.5rem 0;
    padding: 1.25rem 0 1.25rem 1.75rem;
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
    letter-spacing: -0.01em;
    position: relative;
}
.pullquote::before {
    content: '\201C';
    position: absolute;
    left: 0.75rem;
    top: -0.75rem;
    font-size: 4rem;
    color: var(--accent);
    opacity: 0.2;
    font-family: Georgia, serif;
    line-height: 1;
}

/* Prose links */
.prose a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.35);
    transition: border-color 0.2s, color 0.2s;
}
.prose a:hover {
    color: #818cf8;
    border-bottom-color: rgba(129, 140, 248, 0.7);
}
[data-theme="light"] .prose a { color: var(--accent); border-bottom-color: rgba(79, 70, 229, 0.3); }
[data-theme="light"] .prose a:hover { color: #4338ca; border-bottom-color: rgba(67, 56, 202, 0.6); }

/* Resource list links — URL line after <br> in a list item */
.prose li br + a {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: none;
    margin-top: 0.15rem;
    word-break: break-all;
    opacity: 0.7;
}
.prose li br + a:hover {
    color: var(--accent);
    opacity: 1;
    border-bottom: none;
}

/* Prose horizontal rule */
.prose hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 3.5rem 0 0;
}
/* HR before H2: H2 already has its own border-top — suppress duplicate divider + spacing */
.prose hr + h2 {
    margin-top: 1.5rem;
    border-top: none;
    padding-top: 0;
}

/* Table of Contents */
.toc {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 0 0 3rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.toc-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-counter;
}
.toc-list li {
    counter-increment: toc-counter;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.3rem 0;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
[data-theme="light"] .toc-list li { border-bottom-color: rgba(0,0,0,0.04); }
.toc-list li:last-child { border-bottom: none; }
.toc-list li::before {
    content: counter(toc-counter);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.7;
    min-width: 1.2rem;
    text-align: right;
    flex-shrink: 0;
}
.toc-list a {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    transition: color 0.2s;
    line-height: 1.5;
}
.toc-list a:hover {
    color: var(--text);
    border: none;
}
.toc-list a.toc-active {
    color: var(--accent);
    font-weight: 600;
}
.toc-list li:has(a.toc-active)::before {
    opacity: 1;
}

/* Section separator headings */
.prose h2 {
    scroll-margin-top: 2rem;
}

/* Inline Highlight */
.hl {
    background: var(--accent-highlight);
    padding: 0.1em 0.3em;
    margin: -0.1em -0.3em;
    border-radius: 3px;
    font-weight: inherit;
    border-bottom: 1px solid var(--accent);
    text-decoration: none;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Active Section Indicator (Audio Player) - Headset icon with pulsing glow */
.section-heading-active {
    position: relative;
}
.section-heading-active::before {
    content: '🎧';
    position: absolute;
    left: -2.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    background: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 var(--accent);
}
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
        border-color: var(--accent);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(99, 102, 241, 0.3);
        border-color: #8b5cf6;
    }
}
@media (max-width: 640px) {
    .section-heading-active::before {
        left: -2rem;
        width: 1.6rem;
        height: 1.6rem;
        font-size: 0.8rem;
    }
}

/* Callout Box */
.callout-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 2rem 2rem 1.5rem;
    margin: 2.5rem 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.callout-box .callout-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.callout-box .callout-title svg {
    width: 20px;
    height: 20px;
    fill: var(--accent);
}
.callout-box ul, .callout-box ol {
    margin: 0 0 0 1.25rem;
}
.callout-box li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}
.callout-box li:last-child {
    margin-bottom: 0;
}

/* Data Table */
.data-table {
    width: 100%;
    margin: 1.5rem 0 2rem;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    font-weight: 600;
    color: var(--text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table td {
    color: var(--text-muted);
}
.data-table tr:hover td {
    color: var(--text);
}
.data-table .highlight-row td {
    color: var(--text);
    background: var(--accent-soft);
}

/* Series Navigation */
.series-nav {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.series-nav .series-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}
.series-nav .series-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.series-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}
.series-nav a:hover { color: var(--accent); }
.series-nav a.current {
    color: var(--accent);
    font-weight: 500;
}
.series-nav a.upcoming {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Other Posts */
.other-posts {
    margin-top: 3rem;
}
.other-posts h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}
.post-link {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.post-link:hover {
    background: var(--card-bg-hover);
    border-color: var(--accent);
    transform: translateX(4px);
}
.post-link .arrow {
    color: var(--text-muted);
    float: right;
    transition: color 0.2s;
}
.post-link:hover .arrow { color: var(--accent); }

/* Footer */
footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}
footer a { color: var(--accent); text-decoration: none; }

/* Theme Toggle */
.theme-toggle {
    position: fixed; top: 1.5rem; right: 1.5rem; z-index: 10;
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--card-bg);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--glow); transform: scale(1.1); }
.theme-toggle svg { width: 18px; height: 18px; fill: var(--text); transition: transform 0.3s ease; }
.theme-toggle:hover svg { transform: rotate(15deg); }
.sun-icon { display: block; } .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Sticky Audio Player */
.sticky-player {
    position: fixed;
    right: 20px;
    bottom: 20px;
    top: auto;
    width: 260px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 50;
    transition: all 0.3s;
}
.sticky-player.mini {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
}
.sticky-player.mini .sp-content { display: none; }
.sticky-player.mini .sp-toggle {
    position: static;
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.sp-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-soft);
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-right: 30px;
}
.sp-chapters {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}
.sp-ch {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    margin: 0.15rem 0;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.78rem;
}
.sp-ch:hover, .sp-ch.active { background: var(--accent-soft); }
.sp-ch-time {
    color: var(--text-muted);
    min-width: 36px;
    font-size: 0.7rem;
}
.sp-auto {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}
.sp-auto input { width: 14px; height: 14px; }
/* When chapter list is empty (share pages without chapters): hide via CSS too */
.sp-chapters:empty { display: none; }
.sp-chapters:empty + .sp-auto { display: none; }

/* ── Custom player controls (share pages) ── */
/* Toggle button: two children — close-dash (normal) and icon (mini) */
.sp-toggle-close { pointer-events: none; }
.sp-toggle-icon  { display: none; pointer-events: none; }
.sticky-player.mini .sp-toggle-close { display: none; }
.sticky-player.mini .sp-toggle-icon  { display: block; width: 16px; height: 16px; }

/* Seekbar */
.sp-seekbar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    cursor: pointer;
    margin: 0.75rem 0 0.4rem;
    position: relative;
    transition: height 0.1s;
}
.sp-seekbar:hover, .sp-seekbar.dragging { height: 9px; }
.sp-seekbar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
    transition: width 0.1s linear;
}
.sp-seekbar.dragging .sp-seekbar-fill { transition: none; }

/* Controls row: time — buttons — duration */
.sp-ctrl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.25rem;
}
.sp-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 34px;
}
.sp-time:last-child { text-align: right; }
.sp-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    justify-content: center;
}
.sp-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.sp-play-btn:hover { opacity: 0.85; }
.sp-skip {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.sp-skip:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 1200px) {
    .sticky-player {
        position: fixed;
        bottom: 15px;
        right: 15px;
        top: auto;
        transform: none;
        width: 320px;
    }
    .sticky-player.mini {
        bottom: 15px;
        right: 15px;
    }
}
@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    .article-header { padding: 3rem 1.25rem 2rem; }
    .callout-box { padding: 1.5rem 1.25rem 1.25rem; }
    .pullquote { font-size: 1.05rem; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.75rem; }
    .prose table { font-size: 0.82rem; }
    .prose thead th, .prose tbody td { padding: 0.5rem 0.75rem; }
    .prose pre { padding: 1rem; border-radius: 8px; }
    .prose pre code { font-size: 0.8rem; }
    .sticky-player {
        width: calc(100% - 30px);
        right: 15px;
        max-width: none;
    }
}

/* ── Share article figures ───────────────────────────────────────────────── */
.prose figure {
    margin: 2rem auto;
    max-width: 62%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,0.13);
    cursor: zoom-in;
    transition: box-shadow 0.2s, transform 0.2s;
}
.prose figure:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.22);
    transform: translateY(-1px);
}
.prose figure img {
    width: 100%;
    display: block;
}
.prose figcaption {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.5rem 0.85rem 0.6rem;
    background: var(--card-bg, #f5f5f5);
    line-height: 1.4;
}
@media (max-width: 800px) {
    .prose figure { max-width: 85%; }
}
@media (max-width: 480px) {
    .prose figure { max-width: 100%; border-radius: 8px; }
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lb {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
}
.lb.open { display: flex; }
.lb-img {
    max-width: min(90vw, 720px);
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    user-select: none;
}
.lb-caption {
    color: rgba(255,255,255,0.65);
    font-size: 0.78rem;
    margin-top: 0.75rem;
    text-align: center;
    max-width: min(90vw, 680px);
    line-height: 1.4;
}
.lb-close {
    position: fixed;
    top: 1rem;
    right: 1.25rem;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    opacity: 0.7;
    padding: 0.4rem 0.6rem;
    transition: opacity 0.15s;
}
.lb-close:hover { opacity: 1; }
.lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    opacity: 0.55;
    padding: 1rem 1.25rem;
    transition: opacity 0.15s;
    user-select: none;
}
.lb-nav:hover { opacity: 1; }
.lb-prev { left: 0.25rem; }
.lb-next { right: 0.25rem; }
.lb-counter {
    position: fixed;
    top: 1.1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 0.78rem;
}
