/* ============================================================
   synop.stream — Static Site Stylesheet
   Editorial reading-room redesign.

   Theme resolution:
     1. html[data-theme="light" | "dark"] — explicit user choice
     2. (prefers-color-scheme: dark) — OS default
     3. Fallback — light
   ============================================================ */

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

:root {
    /* -- Type scale -- */
    --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif:   "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --font-mono:    ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    /* -- Dimensions -- */
    --max-w:        1600px;     /* shell cap */
    --max-w-wide:   1100px;     /* grid cap */
    --max-w-prose:  680px;      /* reading column */
    --page-px:      clamp(16px, 4vw, 56px);
    --radius-sm:    6px;
    --radius:       12px;
    --radius-lg:    16px;

    /* -- Palette: light (default) -- */
    --bg:           #fbf9f4;
    --bg-alt:       #f4f1ea;
    --surface:      #ffffff;
    --surface-alt:  #f7f4ee;
    --ink:          #111112;
    --ink-2:        #3d3d40;
    --ink-3:        #76767a;
    --rule:         #e5e1d7;
    --rule-strong:  #cfcabc;
    --accent:       #1d4ed8;           /* confident blue */
    --accent-ink:   #ffffff;
    --accent-soft:  #eef2ff;
    --accent-hover: #1e40af;
    --badge-bg:     #ece7dc;
    --badge-ink:    #5a544a;
    --tldr-ink:     #1e40af;

    --shadow-sm:    0 1px 2px rgba(15,15,10,.05);
    --shadow:       0 2px 8px rgba(15,15,10,.06);
    --shadow-lg:    0 12px 32px rgba(15,15,10,.08);

    --trans:        160ms cubic-bezier(.4,0,.2,1);
}

/* Explicit dark — chosen by user via the header toggle */
:root[data-theme="dark"] {
    --bg:           #0e1013;
    --bg-alt:       #16191e;
    --surface:      #161a20;
    --surface-alt:  #1d222a;
    --ink:          #ecebe6;
    --ink-2:        #c4c2ba;
    --ink-3:        #8a8984;
    --rule:         #262b33;
    --rule-strong:  #363c46;
    --accent:       #93b3ff;
    --accent-ink:   #0e1013;
    --accent-soft:  #1b2340;
    --accent-hover: #b4c8ff;
    --badge-bg:     #242932;
    --badge-ink:    #b4b3ad;
    --tldr-ink:     #b4c8ff;

    --shadow-sm:    0 1px 2px rgba(0,0,0,.5);
    --shadow:       0 4px 16px rgba(0,0,0,.5);
    --shadow-lg:    0 18px 48px rgba(0,0,0,.55);
}

/* System default when user hasn't explicitly picked light */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:           #0e1013;
        --bg-alt:       #16191e;
        --surface:      #161a20;
        --surface-alt:  #1d222a;
        --ink:          #ecebe6;
        --ink-2:        #c4c2ba;
        --ink-3:        #8a8984;
        --rule:         #262b33;
        --rule-strong:  #363c46;
        --accent:       #93b3ff;
        --accent-ink:   #0e1013;
        --accent-soft:  #1b2340;
        --accent-hover: #b4c8ff;
        --badge-bg:     #242932;
        --badge-ink:    #b4b3ad;
        --tldr-ink:     #b4c8ff;

        --shadow-sm:    0 1px 2px rgba(0,0,0,.5);
        --shadow:       0 4px 16px rgba(0,0,0,.5);
        --shadow-lg:    0 18px 48px rgba(0,0,0,.55);
    }
}

/* ============================================================
   Base
   ============================================================ */

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light dark;
}
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.65;
    font-size: 16px;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    transition: background-color var(--trans), color var(--trans);
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="tab"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

h1, h2, h3, h4, p, li, span, a { overflow-wrap: break-word; }

/* ============================================================
   Skip link
   ============================================================ */

.skip-link {
    position: absolute; left: -9999px; top: 8px;
    background: var(--accent); color: var(--accent-ink);
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: .875rem; font-weight: 600; z-index: 1000;
}
.skip-link:focus, .skip-link:focus-visible { left: 8px; }

/* ============================================================
   Header
   ============================================================ */

.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--rule);
}
.header-inner {
    padding: 0 var(--page-px); height: 56px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.site-brand {
    display: flex; align-items: baseline; gap: 10px;
    text-decoration: none; color: inherit; min-width: 0;
}
.brand-name {
    font-family: var(--font-serif);
    font-size: 1.0625rem; font-weight: 600;
    color: var(--ink); letter-spacing: -.005em;
    white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.brand-tag {
    font-size: .6875rem; color: var(--ink-3); font-weight: 500;
    text-transform: uppercase; letter-spacing: .08em;
    white-space: nowrap;
}
.header-right {
    display: flex; align-items: center; gap: 14px;
    min-width: 0;
}
.header-stats {
    display: flex; gap: 14px; color: var(--ink-3); font-size: .75rem;
}

.theme-toggle,
.header-about {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 999px;
    border: 1px solid var(--rule); background: transparent;
    color: var(--ink-2); cursor: pointer;
    transition: background var(--trans), border-color var(--trans), color var(--trans);
    flex-shrink: 0;
}
.theme-toggle:hover,
.header-about:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--rule-strong); }
.header-about svg { width: 16px; height: 16px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Breadcrumb, inline in the header */
.header-crumb {
    display: flex; align-items: center; gap: 8px;
    font-size: .8125rem; color: var(--ink-3);
    min-width: 0; overflow: hidden;
}
.header-crumb a { color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.header-crumb a:hover { color: var(--accent); }
.header-crumb svg { width: 12px; height: 12px; flex-shrink: 0; }
.header-crumb .current {
    color: var(--ink);
    font-weight: 500; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    min-width: 0; max-width: 36ch;
}
@media (max-width: 640px) {
    .header-crumb a,
    .header-crumb svg { display: none; }
    .header-crumb .current { max-width: 22ch; font-size: .75rem; }
    .brand-tag { display: none; }
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    border-top: 1px solid var(--rule);
    margin-top: clamp(60px, 10vw, 120px);
}
.footer-inner {
    max-width: var(--max-w); margin: 0 auto;
    padding: 28px var(--page-px);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    font-size: .8125rem; color: var(--ink-3);
}
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--ink-2); font-weight: 500; }
.footer-links a:hover { color: var(--accent); }

/* ============================================================
   External-link affordance
   ============================================================ */

.ext-icon {
    display: inline-block; margin-left: 4px;
    font-size: .85em; opacity: .55;
    transform: translateY(-1px);
    transition: opacity var(--trans), transform var(--trans);
}
a.ext:hover .ext-icon { opacity: 1; transform: translate(1px, -2px); }

/* ============================================================
   Landing (index hero + merged overview)
   ============================================================ */

.landing {
    max-width: var(--max-w-wide); margin: 0 auto;
    padding: clamp(48px, 7vw, 88px) var(--page-px) clamp(32px, 5vw, 56px);
    text-align: left;
}
/* Banner-backed variant: clip the banner bleed and add vertical room so
   the image has presence without fighting the text. */
.landing.has-banner,
.hero.has-banner {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.landing.has-banner {
    padding-top: clamp(96px, 14vw, 180px);
    padding-bottom: clamp(48px, 7vw, 72px);
}
.hero.has-banner {
    padding-top: clamp(72px, 10vw, 140px);
    padding-bottom: clamp(32px, 5vw, 56px);
}
/* Inner fills the same 1100px column as the grid + quickstart + toolbar
   below, so there's no visual width seam between the landing and the
   content that follows. */
.landing-inner { max-width: 100%; }
.landing.has-banner > .landing-inner,
.hero.has-banner > .hero-inner {
    position: relative;
    z-index: 2;
}

/* Banner image itself — covers the hero background, gently blurred +
   saturated so it reads as atmosphere rather than a photo competing for
   attention. Scales to cover whatever aspect ratio the hero ends up
   with. */
.hero-banner {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
    opacity: .28;
    filter: blur(3px) saturate(1.12);
    transform: scale(1.06);
    pointer-events: none;
    user-select: none;
}
:root[data-theme="dark"] .hero-banner { opacity: .22; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .hero-banner { opacity: .22; }
}

/* Overlay fades from the bg at the very top (soft entry under the
   sticky header) through transparent mid-band (where the banner shows
   most) to bg again near the bottom (soft handoff to the content grid).
   Keeps text legible over any dominant color in the banner. */
.hero-banner-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(
            to bottom,
            var(--bg) 0%,
            rgba(0, 0, 0, 0) 40%,
            rgba(0, 0, 0, 0) 55%,
            var(--bg) 100%
        ),
        linear-gradient(
            to right,
            var(--bg) 0%,
            rgba(0, 0, 0, 0) 12%,
            rgba(0, 0, 0, 0) 88%,
            var(--bg) 100%
        );
    background-blend-mode: normal;
}
/* Slight text-shadow in the banner variant so small labels (eyebrow,
   meta row) remain readable if a banner happens to land a bright
   region behind them. */
.landing.has-banner .landing-eyebrow,
.hero.has-banner .overview-eyebrow,
.landing.has-banner .landing-meta,
.hero.has-banner .overview-meta {
    text-shadow: 0 1px 0 var(--bg);
}
.landing-eyebrow {
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--accent);
    margin: 0 0 16px;
}
.landing-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 600; letter-spacing: -.02em;
    line-height: 1.08; margin: 0 0 14px;
    color: var(--ink);
}
.landing-desc {
    font-size: clamp(1rem, 1.6vw, 1.125rem);
    color: var(--ink-2); line-height: 1.55;
    margin: 0 0 28px;
}
.landing-tldr {
    font-size: clamp(.9375rem, 1.4vw, 1.0625rem);
    color: var(--ink); line-height: 1.7;
    padding: 22px 26px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    margin: 0 0 20px;
}
.landing-tldr p { margin: 0; }
.landing-tldr p + p { margin-top: 10px; }
.landing-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
    font-size: .75rem; color: var(--ink-3);
    margin: 0 0 24px;
}
.landing-meta span + span::before {
    content: "·"; margin-right: 18px; color: var(--ink-3);
}
.landing-actions { display: flex; gap: 10px; }

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 20px;
    background: var(--ink); color: var(--bg);
    font-size: .875rem; font-weight: 600;
    border-radius: 999px; border: 1px solid var(--ink);
    transition: background var(--trans), transform var(--trans);
    text-decoration: none;
}
.btn-primary:hover {
    background: var(--ink-2); border-color: var(--ink-2);
    color: var(--bg); transform: translateY(-1px);
}

.btn-original {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--rule); border-radius: 999px;
    font-size: .8125rem; font-weight: 500;
    color: var(--ink-2); background: var(--surface);
    transition: all var(--trans);
    text-decoration: none;
}
.btn-original:hover {
    border-color: var(--ink);
    color: var(--ink);
}
.btn-original svg { width: 13px; height: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* ============================================================
   Toolbar — filter tabs + search
   ============================================================ */

.toolbar {
    position: sticky; top: 56px; z-index: 90;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
}
.toolbar-inner {
    max-width: var(--max-w-wide); margin: 0 auto;
    padding: 14px var(--page-px);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}

/* Tabs — underline active state, not pill. Quieter & more editorial. */
.filter-tabs { display: flex; gap: 24px; border-bottom: 0; }
.filter-tab {
    position: relative;
    padding: 4px 0 8px;
    font-size: .875rem; font-weight: 500;
    color: var(--ink-3); background: transparent; border: 0;
    cursor: pointer;
    transition: color var(--trans);
    display: inline-flex; align-items: baseline; gap: 6px;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { color: var(--ink); }
.filter-tab.active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0;
    height: 2px; background: var(--ink); border-radius: 2px;
}
.tab-count {
    font-size: .6875rem; font-weight: 500; color: var(--ink-3);
    padding: 1px 7px; border-radius: 999px;
    background: var(--bg-alt);
}

.search-box { position: relative; flex: 0 1 320px; min-width: 200px; }
.search-icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--ink-3); pointer-events: none;
}
.search-box input {
    width: 100%; padding: 9px 14px 9px 38px;
    border: 1px solid var(--rule); border-radius: 999px;
    font-size: .875rem; font-family: inherit;
    background: var(--surface); color: var(--ink);
    transition: border-color var(--trans), box-shadow var(--trans);
}
.search-box input::placeholder { color: var(--ink-3); }
.search-box input:focus {
    outline: 0; border-color: var(--ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
}

/* ============================================================
   Content grid + cards
   ============================================================ */

.content-grid-wrapper {
    max-width: var(--max-w-wide); margin: 0 auto;
    padding: clamp(28px, 4vw, 56px) var(--page-px) 64px;
}
.content-grid {
    display: grid; grid-template-columns: 1fr;
    gap: clamp(20px, 2.5vw, 36px);
}
@media (min-width: 640px)  { .content-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .content-grid { grid-template-columns: repeat(3, 1fr); } }

.no-results {
    text-align: center; padding: 64px 0;
    color: var(--ink-3); font-size: .9375rem;
}
.no-results[hidden] { display: none; }

/* Flatter cards. Content-first, no shadow, subtle hover lift via rule color.
   The thumbnail carries the visual weight. */
.card {
    background: transparent;
    border-radius: var(--radius);
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: 360px 380px;
    transition: transform var(--trans);
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-2px); }
.card-link { display: block; text-decoration: none; color: inherit; }

.card-thumb {
    position: relative; aspect-ratio: 16/9;
    border-radius: var(--radius);
    background: var(--surface-alt); overflow: hidden;
    border: 1px solid var(--rule);
}
.card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 400ms ease;
}
.card:hover .card-thumb img { transform: scale(1.02); }
.card-duration {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,.75); color: #fff;
    font-size: .6875rem; font-weight: 600;
    font-family: var(--font-mono);
    padding: 3px 7px; border-radius: 4px;
    letter-spacing: .02em;
}

.card-body { padding: 16px 2px 0; }
.card-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
    font-size: .6875rem; color: var(--ink-3);
    text-transform: uppercase; letter-spacing: .08em;
}
.card-top .type-badge { display: none; }
.card:not(:has(.card-thumb)) .card-top .type-badge { display: inline-block; }
.card-meta-inline { font-size: inherit; color: var(--ink-3); }
.card-title {
    font-family: var(--font-serif);
    font-size: 1.125rem; font-weight: 600;
    line-height: 1.3; letter-spacing: -.01em;
    color: var(--ink);
    margin: 4px 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex; flex-wrap: wrap; gap: 4px 12px;
    margin-bottom: 10px;
    font-size: .75rem; color: var(--ink-3);
}
.card-meta span + span::before {
    content: "·"; margin-right: 12px;
}
.card-tldr {
    font-size: .875rem; color: var(--ink-2);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-tldr p { margin: 0; }

/* ============================================================
   Type badge (for detail pages; hidden on cards when thumbnail present)
   ============================================================ */

.type-badge {
    display: inline-block;
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    padding: 3px 10px; border-radius: 999px;
    background: var(--badge-bg); color: var(--badge-ink);
}

/* ============================================================
   Article (content detail page)
   ============================================================ */

/* ---- Shared article shell — TOC rail + single column for everything else.
   All interior elements (pager, hero, header, TLDR, body, footer) flow
   inside .article-main and share the same alignment. ---- */
.article-shell {
    max-width: var(--max-w-wide);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px) var(--page-px) clamp(40px, 5vw, 72px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
}
@media (min-width: 960px) {
    .article-shell {
        grid-template-columns: 200px minmax(0, var(--max-w-prose));
        column-gap: 56px;
        justify-content: center;
    }
}
.article-main { min-width: 0; }
/* Every immediate child of .article-main takes full column width so
   alignment is uniform from pager → hero → header → TLDR → body → footer. */
.article-main > * { margin-left: 0; margin-right: 0; max-width: 100%; }

.article-hero {
    margin: 0 0 24px;
}
.article-hero-frame {
    position: relative; display: block;
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-alt);
    border: 1px solid var(--rule);
    transition: transform var(--trans);
}
.article-hero-frame:hover { transform: scale(1.005); }
.article-hero-frame img {
    width: 100%; height: 100%; object-fit: cover;
}
.article-hero-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,.25) 0%, transparent 45%);
}
.article-hero-play svg {
    width: 76px; height: 76px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.35));
    opacity: .92; transition: transform var(--trans), opacity var(--trans);
}
.article-hero-frame:hover .article-hero-play svg { transform: scale(1.05); opacity: 1; }
.article-hero-duration {
    position: absolute; bottom: 12px; right: 12px;
    background: rgba(0,0,0,.75); color: #fff;
    font-size: .75rem; font-weight: 600; font-family: var(--font-mono);
    padding: 3px 8px; border-radius: 4px;
}

/* Inline YouTube player. Thumbnail state reuses .article-hero-frame sizing;
   playing state becomes sticky so the viewer stays visible while the reader
   scrolls through the summary. */
.video-player { cursor: default; }
.video-thumb {
    /* Reset the button defaults so it looks identical to the old <a> frame. */
    appearance: none;
    width: 100%; height: 100%;
    display: block;
    padding: 0; margin: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    position: absolute; inset: 0;
}
.video-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-thumb[hidden] { display: none; }

.video-iframe-wrap {
    width: 100%; height: 100%;
    position: absolute; inset: 0;
    background: #000;
}
.video-iframe-wrap iframe,
.video-iframe-wrap #yt-player-host {
    width: 100%; height: 100%;
    display: block;
    border: 0;
}

.video-player-close {
    position: absolute;
    top: 8px; right: 8px;
    z-index: 3;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    border: 0; border-radius: 50%;
    cursor: pointer;
    transition: background var(--trans), transform var(--trans);
}
.video-player-close[hidden] { display: none; }
.video-player-close:hover { background: rgba(0, 0, 0, .9); transform: scale(1.08); }
.video-player-close svg { width: 14px; height: 14px; }

/* Playing state — the iframe sits in the article-hero slot in normal
   flow. No sticky here; the PiP mode below handles the off-screen case. */
.video-player.playing { transform: none; }
.video-player.playing:hover { transform: none; }

/* Picture-in-picture mode — activated by JS (IntersectionObserver on
   article-hero) once the natural player position scrolls off the top
   of the viewport. Size is capped so it never dominates the layout. */
.video-player.pip {
    position: fixed;
    top: 72px;          /* clear the 56px sticky site header */
    right: 16px;
    width: min(360px, 40vw);
    aspect-ratio: 16 / 9;
    height: auto;
    z-index: 40;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 12px 38px rgba(0, 0, 0, .4);
    animation: video-pip-in 180ms ease-out;
}
@keyframes video-pip-in {
    from { opacity: 0; transform: translateY(-10px) scale(.94); }
    to   { opacity: 1; transform: none; }
}
/* Keep the close button hit-target comfortable in the small PiP. */
.video-player.pip .video-player-close {
    top: 6px; right: 6px;
    width: 26px; height: 26px;
}

/* Mobile — PiP is smaller and stays in the corner but shrinks so it
   doesn't obscure more than a slice of the reading column. */
@media (max-width: 640px) {
    .video-player.pip {
        top: 64px;
        right: 8px;
        width: min(240px, 55vw);
    }
}

/* Placeholder — reserves the hero's 16:9 slot while the player is in
   PiP. Keeps article content from jumping up when the iframe goes
   position: fixed. Styled to look like a disabled hero frame. */
.video-placeholder {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    background: var(--surface-alt);
    border: 1px dashed var(--rule);
}
.video-placeholder[hidden] { display: none; }

/* On print, the player is replaced by the thumbnail only. */
@media print {
    .video-player-close,
    .video-placeholder { display: none !important; }
    .video-iframe-wrap { display: none !important; }
    .video-thumb[hidden] { display: block !important; }
    .video-player.pip,
    .video-player.playing { position: static !important; width: auto !important; }
}

.article-header { padding: 16px 0 36px; }
.article-header .type-badge { margin-bottom: 14px; }
.article-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.625rem, 3.2vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -.02em; line-height: 1.15;
    color: var(--ink);
    margin: 0 0 18px;
}
.article-meta {
    list-style: none;
    display: flex; flex-wrap: wrap; gap: 4px 12px;
    font-size: .8125rem; color: var(--ink-3);
}
.article-meta li + li::before {
    content: "·"; margin-right: 12px; color: var(--ink-3);
}
@media (max-width: 520px) {
    .article-meta li + li::before { content: none; }
}

/* ============================================================
   TLDR + callouts
   ============================================================ */

.callout {
    margin: 0 0 32px;
    padding: 20px clamp(18px, 3vw, 28px);
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
}
.callout-label {
    font-size: .6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--tldr-ink);
    margin-bottom: 10px;
}

/* ============================================================
   TOC (part of .article-shell grid — positioned by the shell,
   hidden on small screens since it mostly duplicates scrolling.)
   ============================================================ */

.toc { display: none; }
@media (min-width: 960px) { .toc { display: block; } }
.toc-inner { position: sticky; top: 80px; }
.toc-heading {
    display: block;
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--ink-3); margin-bottom: 14px;
}
.toc-nav { display: flex; flex-direction: column; }
.toc-link {
    font-size: .8125rem; line-height: 1.45;
    color: var(--ink-3); padding: 6px 10px;
    margin-left: -10px;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    transition: all var(--trans);
    text-decoration: none;
}
.toc-link:hover { color: var(--ink); background: var(--surface-alt); }
.toc-link.active {
    color: var(--ink); border-left-color: var(--ink);
    font-weight: 500;
}

.article-body { min-width: 0; }

.article-section { margin-bottom: 52px; scroll-margin-top: 80px; }
.article-section:last-child { margin-bottom: 0; }
.article-section h2 {
    font-family: var(--font-serif);
    font-size: 1.375rem; font-weight: 600;
    letter-spacing: -.01em; color: var(--ink);
    line-height: 1.25;
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
    display: flex; align-items: center; gap: 12px;
}
.section-anchor {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px;
    color: var(--ink-3); text-decoration: none;
    font-size: 1rem; line-height: 1;
    opacity: 0; transition: opacity var(--trans), background var(--trans), color var(--trans);
    flex-shrink: 0;
}
.article-section:hover .section-anchor,
.section-anchor:focus-visible { opacity: 1; }
.section-anchor:hover { background: var(--surface-alt); color: var(--accent); }
.section-anchor.copied { color: var(--accent); }

/* Collapsible YouTube-chapters export panel. Sits between the article
   body and the pager. Most readers never expand it — it's a utility for
   the video uploader or anyone posting a timestamped index in comments. */
.yt-chapters {
    margin: 44px 0 16px;
    padding: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.yt-chapters > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    color: var(--ink-2);
    font-size: .875rem;
}
.yt-chapters > summary::-webkit-details-marker { display: none; }
.yt-chapters > summary::marker { content: ""; }
.yt-chapters-icon {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--ink-3);
    flex-shrink: 0;
}
.yt-chapters-icon svg { width: 16px; height: 16px; }
.yt-chapters-summary-text { display: flex; flex-direction: column; min-width: 0; }
.yt-chapters-summary-text strong {
    font-family: var(--font-serif);
    font-size: 1rem; font-weight: 600;
    color: var(--ink); letter-spacing: -.005em;
}
.yt-chapters-sub {
    font-size: .75rem;
    color: var(--ink-3);
    line-height: 1.45;
    margin-top: 2px;
}
.yt-chapters > summary:hover .yt-chapters-summary-text strong,
.yt-chapters[open] > summary .yt-chapters-summary-text strong {
    color: var(--accent);
}

.yt-chapters-body {
    position: relative;
    padding: 0 0 20px;
}
.yt-chapters-text {
    margin: 0;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--ink);
    white-space: pre;
    overflow-x: auto;
    max-height: 360px;
    overflow-y: auto;
}
.yt-chapters-copy {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: .8125rem; font-weight: 500;
    cursor: pointer;
    transition: background var(--trans), border-color var(--trans), color var(--trans);
}
.yt-chapters-copy:hover {
    background: var(--surface-alt);
    border-color: var(--rule-strong);
    color: var(--ink);
}
.yt-chapters-copy svg { width: 15px; height: 15px; flex-shrink: 0; }
.yt-chapters-copy.copied {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.article-footer {
    margin: 56px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--rule);
}
.gen-meta {
    display: flex; flex-wrap: wrap; gap: 4px 16px;
    font-size: .75rem; color: var(--ink-3);
}
.gen-meta span + span::before {
    content: "·"; margin-right: 16px;
}

/* ============================================================
   Prose (LLM-rendered HTML inside sections, TLDR, overview)
   ============================================================ */

.prose, .overview-section-body, .landing-tldr, .overview-tldr-body, .overview-card-body {
    font-size: 1rem; line-height: 1.75; color: var(--ink);
}
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol,
.overview-section-body ul, .overview-section-body ol {
    margin: 0 0 14px; padding-left: 22px;
}
.prose li, .overview-section-body li { margin-bottom: 6px; }
.prose li::marker, .overview-section-body li::marker { color: var(--ink-3); }
.prose strong, .overview-section-body strong { font-weight: 600; color: var(--ink); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }

/* Inline video-timestamp chips. Distinct from prose links — these jump
   back to the source video at a specific offset. */
.prose a.ts-link,
.overview-section-body a.ts-link {
    display: inline-block;
    margin: 0 2px;
    padding: 0 6px;
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--rule-strong, var(--rule));
    border-radius: 4px;
    transition: background var(--trans), color var(--trans), border-color var(--trans);
    vertical-align: baseline;
}
.prose a.ts-link:hover,
.overview-section-body a.ts-link:hover {
    background: var(--accent);
    color: var(--bg, #fff);
    border-color: var(--accent);
    text-decoration: none;
}
.prose h3 { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 600; margin: 24px 0 10px; color: var(--ink); letter-spacing: -.005em; }
.prose h4 { font-size: .9375rem; font-weight: 600; margin: 20px 0 8px; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.prose blockquote {
    border-left: 3px solid var(--rule-strong);
    padding-left: 18px; color: var(--ink-2);
    margin: 16px 0; font-style: italic;
    font-family: var(--font-serif);
}

.prose table {
    width: 100%; border-collapse: collapse;
    margin: 18px 0; font-size: .875rem;
}
.prose th, .prose td {
    text-align: left; padding: 10px 14px;
    border-bottom: 1px solid var(--rule);
}
.prose th { font-weight: 600; background: var(--surface-alt); font-size: .8125rem; color: var(--ink-2); }

.prose code {
    font-family: var(--font-mono); font-size: .85em;
    background: var(--surface-alt); padding: 2px 6px;
    border-radius: 4px; color: var(--ink);
}
.prose pre {
    background: var(--surface-alt); color: var(--ink);
    padding: 18px 22px; border-radius: var(--radius);
    border: 1px solid var(--rule);
    overflow-x: auto; margin: 18px 0;
    font-size: .8125rem; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

/* ============================================================
   Pager (prev/next)
   ============================================================ */

.pager {
    margin: 0 0 32px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px; align-items: stretch;
}
.pager-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--rule); border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink); text-decoration: none;
    min-height: 64px;
    transition: border-color var(--trans), background var(--trans);
}
.pager-link:hover:not(.pager-disabled) {
    border-color: var(--ink);
    background: var(--surface-alt);
}
.pager-prev { text-align: left; }
.pager-next { text-align: right; flex-direction: row; justify-content: flex-end; }
.pager-up { text-align: center; justify-content: center; min-width: 120px; }
.pager-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pager-next .pager-body { align-items: flex-end; }
.pager-up .pager-body { align-items: center; }
.pager-label {
    font-size: .625rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--ink-3);
}
.pager-title {
    font-size: .875rem; font-weight: 500;
    line-height: 1.35; color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.pager-date { font-size: .6875rem; color: var(--ink-3); }
.pager-arrow { font-size: 1rem; color: var(--ink-3); flex-shrink: 0; }
.pager-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

@media (max-width: 640px) {
    .pager { grid-template-columns: 1fr 1fr; gap: 8px; }
    .pager .pager-up { display: none; }
    .pager-link { min-height: 52px; padding: 10px 12px; gap: 8px; }
    .pager-title { -webkit-line-clamp: 1; font-size: .8125rem; }
    .pager-date { display: none; }
}

/* ============================================================
   Overview page
   ============================================================ */

.overview-eyebrow {
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--accent); margin: 0 0 12px;
}
.overview-meta {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 16px; margin-top: 20px;
    font-size: .75rem; color: var(--ink-3);
}
.overview-meta span + span::before { content: "·"; margin-right: 16px; }

.overview-top-nav {
    max-width: var(--max-w-prose); margin: 0 auto;
    padding: 20px var(--page-px) 0;
    font-size: .8125rem;
}
.overview-top-nav a { color: var(--ink-2); font-weight: 500; }
.overview-top-nav a:hover { color: var(--accent); }

.overview-tldr {
    max-width: var(--max-w-prose); margin: 16px auto 0;
    padding: 0 var(--page-px);
}
.overview-tldr h2 {
    font-size: .6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--tldr-ink); margin: 0 0 12px;
}
.overview-tldr-body {
    font-size: 1.0625rem; line-height: 1.75; color: var(--ink);
    padding-left: 16px; border-left: 3px solid var(--accent);
}

.overview-body {
    max-width: var(--max-w-prose); margin: 48px auto 0;
    padding: 0 var(--page-px);
    display: flex; flex-direction: column; gap: 40px;
}
.overview-section { scroll-margin-top: 80px; }
.overview-section h2 {
    font-family: var(--font-serif);
    font-size: 1.375rem; font-weight: 600;
    letter-spacing: -.01em; color: var(--ink);
    margin: 0 0 18px; padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
    display: flex; align-items: center; gap: 12px;
}
.overview-nav {
    max-width: var(--max-w-prose); margin: 48px auto;
    padding: 0 var(--page-px);
}
.overview-nav-link {
    font-size: .8125rem; color: var(--ink-2); font-weight: 500;
}
.overview-nav-link:hover { color: var(--accent); }

/* Hide legacy overview card — folded into landing block */
section.overview-card { display: none; }

/* Hero section on overview page */
.hero { padding: clamp(32px, 5vw, 72px) var(--page-px) 0; text-align: left; }
.hero-inner { max-width: var(--max-w-prose); margin: 0 auto; }
.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600; letter-spacing: -.02em;
    line-height: 1.1; color: var(--ink); margin: 0;
}
.hero-desc {
    margin-top: 12px;
    font-size: clamp(.9375rem, 1.5vw, 1.0625rem);
    color: var(--ink-2); line-height: 1.55;
}
.empty-hero {
    text-align: center; padding: 120px var(--page-px);
    color: var(--ink-3); font-size: .9375rem;
}

/* ============================================================
   Raw comments + chat pages
   ============================================================ */

.back-to-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    margin: 24px 0 0;
    font-size: .8125rem; font-weight: 500;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 999px;
    text-decoration: none;
    transition: background var(--trans), color var(--trans), border-color var(--trans), transform var(--trans);
}
.back-to-summary:hover {
    background: var(--surface-alt);
    color: var(--ink);
    border-color: var(--rule-strong);
    transform: translateX(-2px);
}
.back-to-summary svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
}
/* Pull the top link up from page-shell padding so it sits just below the
   site header without a large gap. */
.article > .back-to-summary { margin-left: var(--page-px); }

.raw-footer {
    margin: 40px 0 16px;
    padding: 18px 0 0;
    border-top: 1px solid var(--rule);
    text-align: center;
}
.raw-footer .back-to-summary { margin: 0; }

.raw-body {
    max-width: var(--max-w-prose); margin: 0 auto;
    padding: 0 var(--page-px);
}
.raw-comments {
    list-style: none; display: flex; flex-direction: column; gap: 14px;
}
.raw-comment {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.raw-comment-pinned {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--rule));
}
.raw-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    font-size: .75rem; color: var(--ink-3);
    margin-bottom: 8px;
}
.raw-author { font-weight: 600; color: var(--ink-2); }
.raw-date { margin-left: auto; }
.raw-text {
    font-size: .9375rem; color: var(--ink);
    line-height: 1.6;
    white-space: pre-line; overflow-wrap: break-word;
}
.raw-tag {
    display: inline-flex; align-items: center;
    font-size: .625rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    padding: 2px 7px; border-radius: 4px;
}
.raw-tag-pinned { background: var(--accent); color: var(--accent-ink); }
.raw-tag-super  { background: var(--ink); color: var(--bg); }

.raw-chat {
    list-style: none; display: flex; flex-direction: column; gap: 2px;
    font-size: .9rem;
}
.raw-chat-item {
    display: grid; grid-template-columns: 52px 1fr; gap: 12px;
    padding: 8px 10px; border-radius: var(--radius-sm);
}
.raw-chat-item:hover { background: var(--surface-alt); }
.raw-chat-superchat {
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--rule));
}
.raw-ts {
    font-family: var(--font-mono);
    font-size: .6875rem; color: var(--ink-3);
    padding-top: 3px;
}

.empty {
    color: var(--ink-3); text-align: center;
    padding: 64px 0; font-size: .9375rem;
}

/* ============================================================
   Print
   ============================================================ */

@media print {
    .site-header, .site-footer, .toolbar, .toc, .btn-original, .pager,
    .theme-toggle, .section-anchor, .skip-link { display: none; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .article-layout { display: block; }
    .article-header, .callout, .article-body, .article-footer { max-width: 100%; padding: 0; margin: 0 0 14pt; }
    .card { break-inside: avoid; }
    .content-grid { display: block; }
    .card + .card { margin-top: 14pt; }
    a { color: inherit; text-decoration: underline; }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   Quickstart / orientation strip (index page)
   ============================================================ */

.quickstart {
    max-width: var(--max-w-wide);
    margin: 0 auto;
    padding: 0 var(--page-px) clamp(32px, 4vw, 56px);
}

.qs-actions {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    counter-reset: qs-step;
}
@media (min-width: 720px) {
    .qs-actions { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

.qs-card {
    counter-increment: qs-step;
    position: relative;
    display: flex; flex-direction: column; gap: 6px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    transition: border-color var(--trans), transform var(--trans), background var(--trans);
    min-height: 120px;
}
.qs-card::before {
    content: counter(qs-step);
    position: absolute; top: 14px; right: 16px;
    font-family: var(--font-serif);
    font-size: 1.25rem; font-weight: 600;
    color: var(--ink-3);
    line-height: 1;
}
.qs-card:hover {
    border-color: var(--ink);
    transform: translateY(-2px);
}
.qs-eyebrow {
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--accent);
}
.qs-card strong {
    font-family: var(--font-serif);
    font-size: 1.0625rem; font-weight: 600;
    color: var(--ink); letter-spacing: -.005em;
    margin: 2px 0;
}
.qs-sub {
    font-size: .8125rem; color: var(--ink-2);
    line-height: 1.45;
}

/* Split card — Stay Current holds two stacked actions (RSS + request a
   site). Outer <li> wears .qs-card for the frame + numeric counter;
   the hover-lift and default flex gap get tuned so the two inner rows
   each feel like their own hit target. */
.qs-card-split {
    gap: 10px;
    padding-bottom: 16px;
    cursor: default;
}
.qs-card-split:hover {
    transform: none;
    border-color: var(--rule-strong);
}
.qs-card-row {
    display: block;
    padding: 6px 0;
    text-decoration: none;
    color: var(--ink);
    transition: color var(--trans);
}
.qs-card-row + .qs-card-row {
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px dashed var(--rule);
}
.qs-card-row strong {
    /* Inherits the .qs-card strong serif/size treatment already defined
       above; nothing to repeat here. */
    display: block;
    transition: color var(--trans);
}
.qs-card-row .qs-sub { display: block; }
.qs-card-row:hover strong { color: var(--accent); }

/* CTA row — accent color on the title to mark it as the active
   invitation rather than just another navigation target. */
.qs-card-row-cta strong { color: var(--accent); }
.qs-card-row-cta:hover strong {
    color: var(--accent-hover, var(--ink));
    text-decoration: underline;
    text-underline-offset: 3px;
}

.qs-sources {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
}
.qs-sources-label {
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--ink-3);
    margin-right: 4px;
}
.qs-chips {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 8px;
}
.qs-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    font-size: .8125rem; color: var(--ink-2);
    background: var(--surface-alt);
    border: 1px solid var(--rule);
    border-radius: 999px;
    text-decoration: none;
    transition: border-color var(--trans), color var(--trans);
}
.qs-chip:hover { border-color: var(--ink); color: var(--ink); }
.qs-chip-count {
    font-size: .6875rem; font-weight: 600;
    padding: 1px 6px; border-radius: 999px;
    background: var(--bg-alt); color: var(--ink-3);
}

.qs-disclosure {
    border-top: 1px solid var(--rule);
    padding: 14px 0 0;
    font-size: .8125rem; color: var(--ink-2);
}
.qs-disclosure summary {
    list-style: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ink-3); font-weight: 500;
    padding: 2px 0;
}
.qs-disclosure summary::-webkit-details-marker { display: none; }
.qs-disclosure summary::before {
    content: "+"; font-family: var(--font-mono); font-size: 1rem;
    color: var(--ink-3); width: 12px;
    transition: transform var(--trans);
}
.qs-disclosure[open] summary::before { content: "−"; }
.qs-disclosure summary:hover { color: var(--ink); }
.qs-disclosure-body {
    padding: 10px 0 2px;
    max-width: 680px;
    line-height: 1.65;
}
.qs-disclosure-body p { margin: 0; }

/* ============================================================
   Collapsible project summary (below quickstart cards)
   ============================================================ */

.project-summary {
    max-width: var(--max-w-wide);
    margin: 0 auto;
    padding: 0 var(--page-px) clamp(36px, 5vw, 64px);
    scroll-margin-top: 72px;
}

.ps-panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--trans), box-shadow var(--trans);
}
.ps-panel:hover { border-color: var(--rule-strong); }
.ps-panel[open] { box-shadow: var(--shadow-sm); }

.ps-summary-row {
    list-style: none;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 20px;
    cursor: pointer;
    transition: background var(--trans);
}
.ps-summary-row::-webkit-details-marker { display: none; }
.ps-summary-row::marker { content: ""; }
.ps-summary-row:hover { background: var(--surface-alt); }
.ps-panel[open] .ps-summary-row {
    border-bottom: 1px solid var(--rule);
}

.ps-label {
    display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.ps-eyebrow {
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--accent);
}
.ps-hint {
    font-size: .9375rem; font-weight: 500; color: var(--ink);
    font-family: var(--font-serif);
    letter-spacing: -.005em;
}

.ps-chevron {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--ink-2);
    transition: transform var(--trans), background var(--trans), color var(--trans);
    flex-shrink: 0;
}
.ps-chevron svg { width: 16px; height: 16px; }
.ps-summary-row:hover .ps-chevron { background: var(--bg-alt); color: var(--ink); }
.ps-panel[open] .ps-chevron { transform: rotate(180deg); }

.ps-body {
    padding: 22px 26px 26px;
    border-left: 3px solid var(--accent);
}
.ps-prose {
    font-size: clamp(.9375rem, 1.3vw, 1.0625rem);
    line-height: 1.75; color: var(--ink);
}
.ps-prose p { margin: 0; }
.ps-prose p + p { margin-top: 10px; }

.ps-more {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 18px;
    font-size: .875rem; font-weight: 600;
    color: var(--accent); text-decoration: none;
    transition: gap var(--trans);
}
.ps-more:hover {
    color: var(--accent-hover);
    text-decoration: underline; text-underline-offset: 4px;
    gap: 10px;
}

/* Leaner hero now that the TLDR has moved below. */
.landing-meta {
    margin-top: 8px;
}

/* ============================================================
   Intro modal — auto-opens on first visit (localStorage-gated),
   re-openable via the "?" button in the header.
   ============================================================ */

.modal-overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(8, 10, 14, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: modal-fade-in var(--trans) ease-out;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Lock body scroll while modal open. Toggled by site.js. */
body.modal-open { overflow: hidden; }

.modal-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    padding: 28px clamp(20px, 4vw, 36px) 24px;
    animation: modal-slide-in 180ms ease-out;
}

.modal-close {
    position: absolute; top: 12px; right: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid transparent; background: transparent;
    color: var(--ink-3); cursor: pointer;
    transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.modal-close:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--rule); }
.modal-close svg { width: 16px; height: 16px; }

.modal-header { margin: 0 0 14px; padding-right: 32px; }
.modal-eyebrow {
    display: block;
    font-size: .6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--ink-3); margin-bottom: 6px;
}
#intro-modal-title {
    font-family: var(--font-serif);
    font-size: 1.5rem; font-weight: 600;
    letter-spacing: -.01em; color: var(--ink);
    line-height: 1.2; margin: 0;
}
.modal-tagline {
    margin: 8px 0 0; color: var(--ink-2);
    font-size: .9375rem; line-height: 1.5;
}

.modal-body {
    padding: 16px 0 0;
    border-top: 1px solid var(--rule);
    font-size: .9375rem; line-height: 1.65; color: var(--ink-2);
}
.modal-body p { margin: 0 0 12px; }
.modal-body p:last-of-type { margin-bottom: 18px; }
.modal-body code {
    font-size: .875em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-alt);
    color: var(--ink);
    border: 1px solid var(--rule);
    font-variant-numeric: tabular-nums;
}

/* Reuse quickstart card styling inside the modal, with a tighter top margin
   so the cards sit right under the prose intro. */
.modal-actions { margin-top: 20px; }
.modal-sources {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--rule);
}

.modal-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    flex-wrap: wrap;
}
.modal-remember {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .875rem; color: var(--ink-2); cursor: pointer;
    user-select: none;
}
.modal-remember input { accent-color: var(--accent); width: 16px; height: 16px; }

.modal-primary {
    padding: 9px 18px; border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--bg);
    font-size: .875rem; font-weight: 600;
    cursor: pointer;
    transition: background var(--trans), border-color var(--trans), transform var(--trans);
}
.modal-primary:hover {
    background: var(--accent-hover, var(--accent));
    border-color: var(--accent-hover, var(--accent));
    transform: translateY(-1px);
}

/* Never print the modal. */
@media print {
    .modal-overlay, .header-about { display: none !important; }
}
