/* MiniGit site
   Graphite neutrals + one accent (signal lime). Geist / Geist Mono.
   Radius rule: tags 6px, controls 8px, panels 12px. */

:root {
    /* Palette A: midnight and parchment
       Color Hunt #010736 #0D1C42 #22396F #FCF1D0, neutrals tuned after Radix slate.
       Every text pair checked against WCAG AA (lowest 5.2:1). */
    --bg: #0a1128;
    --surface: #0f1834;
    --raised: #16234a;
    --line: #1f2d55;
    --line-strong: #2d3d6b;
    --text: #f3efe3;
    --muted: #a9b1c8;
    --subtle: #8a93ae;
    --accent: #f0dfb1;          /* fills, focus, diagrams */
    --accent-text: #f0dfb1;     /* accent used as text */
    --accent-soft: rgb(240 223 177 / 0.07);
    --on-accent: #0a1128;
    --danger: #f4a39a;
    --term-bg: #060b1c;
    --term-accent: #f0dfb1;
    --glow: rgb(34 57 111 / 0.5);
    --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 24px 48px -28px rgb(2 4 14 / 0.9);

    --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", monospace;

    --r-tag: 6px;
    --r-control: 8px;
    --r-panel: 12px;
    --max: 1200px;
    --header-h: 64px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #fbf8f0;
    --surface: #ffffff;
    --raised: #f2eee3;
    --line: #e4dfd1;
    --line-strong: #cdc7b6;
    --text: #0d1c42;
    --muted: #4a5576;
    --subtle: #5f6886;
    --accent: #22396f;
    --accent-text: #22396f;
    --accent-soft: rgb(34 57 111 / 0.06);
    --on-accent: #fbf8f0;
    --danger: #a3302a;
    --term-bg: #0d1c42;
    --term-accent: #f0dfb1;
    --glow: rgb(240 223 177 / 0.5);
    --shadow: 0 24px 48px -30px rgb(13 28 66 / 0.35);
    color-scheme: light;
}

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

html { scroll-padding-top: calc(var(--header-h) + 16px); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; }
code, kbd, pre { font-family: var(--font-mono); }
:where(p, li, span) code {
    font-size: 0.88em;
    padding: 0.05em 0.3em;
    border-radius: var(--r-tag);
    background: var(--raised);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    padding: 10px 14px;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: var(--r-control);
    font-weight: 600;
    z-index: 100;
}
.skip-link:focus { top: 12px; }

.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.site-header.scrolled {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: var(--line);
}

.nav-container {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 650;
    letter-spacing: -0.01em;
    font-size: 1.06rem;
    flex-shrink: 0;
}
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: var(--r-control);
    background: var(--accent);
    color: var(--on-accent);
    display: grid;
    place-items: center;
    font-size: 17px;
}
.brand small {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.72rem;
    color: var(--subtle);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}
.nav-link {
    padding: 8px 11px;
    border-radius: var(--r-control);
    text-decoration: none;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--raised); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
    content: "";
    display: block;
    height: 2px;
    margin-top: 3px;
    border-radius: 2px;
    background: var(--accent);
}
.nav-menu .nav-download { display: none; }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-control);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--raised); border-color: var(--line-strong); }
.menu-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--r-control);
    border: 1px solid transparent;
    font: 600 0.95rem/1 var(--font-sans);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn i { font-size: 1.15em; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-secondary { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-secondary:hover { background: var(--raised); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.86rem; }
.btn-text {
    min-height: auto;
    padding: 0;
    color: var(--accent-text);
    background: none;
    border: 0;
}
.btn-text:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Section rhythm ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head h2 {
    margin: 0 0 12px;
    font-size: clamp(1.65rem, 2.8vw, 2.2rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
    font-weight: 600;
}
.section-head p { margin: 0; color: var(--muted); font-size: 1.06rem; }
.eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-text);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    isolation: isolate;
    padding: clamp(56px, 8vw, 104px) 0 clamp(64px, 9vw, 112px);
}
/* Ambient light behind the hero: one soft radial wash, not a decorative orb */
.hero::before {
    content: "";
    position: absolute;
    inset: calc(var(--header-h) * -1) 0 auto 0;
    height: 720px;
    background:
        radial-gradient(48% 60% at 78% 18%, var(--glow), transparent 70%),
        radial-gradient(40% 50% at 8% 0%, var(--accent-soft), transparent 70%);
    z-index: -1;
    pointer-events: none;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 56px;
    align-items: start;
    margin-top: 40px;
}
.hero h1 {
    margin: 0;
    max-width: 22ch;
    font-size: clamp(2.3rem, 5vw, 4.35rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
    font-weight: 600;
}
.hero h1 em {
    font-style: normal;
    color: var(--accent-text);
}
.hero-sub {
    margin: 4px 0 32px;
    max-width: 36ch;
    font-size: 1.18rem;
    line-height: 1.55;
    color: var(--muted);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.transcript {
    margin: 0;
    background: var(--term-bg);
    color: #e6e8eb;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.transcript-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgb(255 255 255 / 0.07);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #9aa3bd;
}
.transcript pre {
    margin: 0;
    padding: 18px 20px 20px;
    font-size: 0.86rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.transcript .p { color: var(--term-accent); user-select: none; }
.transcript .out { color: #9aa1a9; }

/* ---------- Problem / solution ---------- */
.compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    overflow: hidden;
}
.compare > div { padding: 32px; }
.compare > div + div { border-left: 1px solid var(--line); background: var(--surface); }
.compare h3 { margin: 0 0 8px; font-size: 1.15rem; letter-spacing: -0.01em; }
.compare p { margin: 0 0 22px; color: var(--muted); }
.folder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    display: grid;
    gap: 8px;
}
.folder-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--subtle);
    text-decoration: line-through;
    text-decoration-color: var(--danger);
}
.mini-term {
    margin: 0;
    padding: 16px 18px;
    border-radius: var(--r-control);
    background: var(--term-bg);
    color: #e6e8eb;
    font-size: 0.86rem;
    line-height: 1.75;
    overflow-x: auto;
}
.mini-term .p { color: var(--term-accent); user-select: none; }

/* ---------- Data structures bento ---------- */
.bento {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 16px;
}
.cell {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    background: var(--surface);
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cell h3 { margin: 0; font-size: 1.12rem; letter-spacing: -0.01em; }
.cell p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.cell .owner { margin-top: auto; padding-top: 6px; font-size: 0.85rem; color: var(--subtle); }
.cell-trie { grid-column: span 4; }
.cell-set { grid-column: span 2; }
.cell-deque { grid-column: span 3; }
.cell-dll { grid-column: span 3; }
.cell-bin { grid-column: span 6; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px 32px; }
.cell-bin > div { flex: 1 1 420px; display: grid; gap: 8px; }
.cell-tint { background: var(--raised); border-color: color-mix(in srgb, var(--accent-text) 35%, var(--line)); }
.cx {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-text);
}

/* Typographic structure diagrams (the page's signature) */
.diagram {
    margin: 4px 0 0;
    padding: 16px;
    border-radius: var(--r-control);
    background: var(--bg);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--muted);
    overflow-x: auto;
    white-space: pre;
}
.diagram b { color: var(--accent-text); font-weight: 600; }

/* ---------- Architecture (interactive diagram) ---------- */
:root {
    --a-cli: #8fb0ec; --a-cli-bg: rgb(120 160 230 / 0.07); --a-cli-line: rgb(120 160 230 / 0.2);
    --a-mod: #b9a3ec; --a-mod-bg: rgb(170 140 230 / 0.07); --a-mod-line: rgb(170 140 230 / 0.2);
    --a-ds: #7cc8a4;  --a-ds-bg: rgb(110 200 160 / 0.06);  --a-ds-line: rgb(110 200 160 / 0.2);
    --a-st: #e0a26a;  --a-st-bg: rgb(230 160 100 / 0.06);  --a-st-line: rgb(230 160 100 / 0.2);
    --a-node: #0a1128;
    --a-call: #b8c7ea;
    --a-file: #e8a065;
    --a-look: #8a93ae;
    --a-plan: #6c7593;
    --a-plan-text: #8a93ae;
}
:root[data-theme="light"] {
    --a-cli: #2f5aa8; --a-cli-bg: #eef3fb; --a-cli-line: #c9d6ee;
    --a-mod: #6b4fa8; --a-mod-bg: #f4f0fb; --a-mod-line: #ddd2f1;
    --a-ds: #2e7d5b;  --a-ds-bg: #ecf6f1;  --a-ds-line: #c6e2d5;
    --a-st: #a8642a;  --a-st-bg: #fcf4ea;  --a-st-line: #efdcc2;
    --a-node: #ffffff;
    --a-call: #22396f;
    --a-file: #b2581c;
    --a-look: #6b7280;
    --a-plan: #9aa1ad;
    --a-plan-text: #6b7280;
}

.arch {
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    background: var(--surface);
    overflow: hidden;
}
.arch-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.arch-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.arch-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.arch-pick {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    background: var(--bg);
    color: var(--text);
    font: 500 0.85rem var(--font-mono);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.arch-pick:hover { border-color: var(--accent); }
.arch-pick.planned { border-style: dashed; color: var(--muted); }
.arch-pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.arch-all { margin-left: auto; font-family: var(--font-sans); }
.arch-tour {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.arch-tour[hidden] { display: none; }
.arch-tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.arch-scroll { overflow-x: auto; padding: 8px 8px 0; }
#archSvg { display: block; width: 100%; height: auto; min-width: 960px; font-family: var(--font-sans); }

#archSvg .band { stroke-width: 1; }
#archSvg .band-cli { fill: var(--a-cli-bg); stroke: var(--a-cli-line); }
#archSvg .band-mod { fill: var(--a-mod-bg); stroke: var(--a-mod-line); }
#archSvg .band-ds { fill: var(--a-ds-bg); stroke: var(--a-ds-line); }
#archSvg .band-st { fill: var(--a-st-bg); stroke: var(--a-st-line); }
#archSvg .band-name { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-anchor: middle; }
#archSvg .bn-cli { fill: var(--a-cli); }
#archSvg .bn-mod { fill: var(--a-mod); }
#archSvg .bn-ds { fill: var(--a-ds); }
#archSvg .bn-st { fill: var(--a-st); }
#archSvg .sep { stroke: var(--line-strong); stroke-dasharray: 2 4; }
#archSvg .ptag, #archSvg .ntag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; fill: var(--a-plan-text); }

#archSvg .box { fill: var(--a-node); stroke-width: 1.5; }
#archSvg .an-cli .box { stroke: var(--a-cli); }
#archSvg .an-mod .box { stroke: var(--a-mod); }
#archSvg .an-ds .box { stroke: var(--a-ds); }
#archSvg .an-st .box { stroke: var(--a-st); }
#archSvg .an.planned .box { stroke: var(--a-plan); stroke-dasharray: 6 5; }
#archSvg .nt { font-size: 15px; font-weight: 600; fill: var(--text); }
#archSvg .ns { font-size: 12px; fill: var(--muted); }
#archSvg .mono { font-family: var(--font-mono); }
#archSvg .an.planned .nt, #archSvg .an.planned .ns { fill: var(--a-plan-text); }
#archSvg [data-pick] { cursor: pointer; }
#archSvg [data-pick]:hover .box { stroke-width: 2.25; }
#archSvg [data-pick]:focus { outline: none; }
#archSvg [data-pick]:focus-visible .box { stroke: var(--accent); stroke-width: 2.5; }

#archSvg .edge { fill: none; stroke-width: 1.6; }
#archSvg .e-call { stroke: var(--a-call); }
#archSvg .e-file { stroke: var(--a-file); }
#archSvg .e-look { stroke: var(--a-look); stroke-dasharray: 5 4; stroke-width: 1.5; }
#archSvg .e-plan { stroke: var(--a-plan); stroke-dasharray: 6 5; stroke-width: 1.5; }
#archSvg .mk-call { fill: var(--a-call); }
#archSvg .mk-file { fill: var(--a-file); }
#archSvg .mk-look { fill: var(--a-look); }
#archSvg .mk-plan { fill: var(--a-plan); }
#archSvg .elbl { font-size: 11.5px; fill: var(--muted); }
#archSvg .elbl-file { fill: var(--a-file); }

/* tracing: the chosen path stays, everything else steps back */
#archSvg .an, #archSvg .ae { transition: opacity 0.2s; }
#archSvg.tracing .an:not(.on), #archSvg.tracing .ae:not(.on) { opacity: 0.2; }
#archSvg.tracing .ae.on .edge { stroke-width: 2.4; }
#archSvg .ae.only:not(.on) { display: none; }
#archSvg .an.hot .box { stroke-width: 2.75; }
#archSvg .an.hot:not(.planned) .box { stroke-dasharray: none; }
#archSvg .an.focus .box { stroke: var(--accent); stroke-width: 3; }

.arch-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
    padding: 6px 20px 14px;
    list-style: none;
    color: var(--muted);
    font-size: 0.85rem;
}
.arch-legend li { display: flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 28px; height: 0; border-top: 2px solid; }
.key-call { border-color: var(--a-call); }
.key-file { border-color: var(--a-file); }
.key-look { border-top-style: dashed; border-color: var(--a-look); }
.key-plan { border-top-style: dashed; border-color: var(--a-plan); }

.arch-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 24px 40px;
    padding: 22px 20px 24px;
    border-top: 1px solid var(--line);
}
.arch-kicker {
    margin: 0 0 4px;
    font: 500 0.78rem var(--font-mono);
    color: var(--accent-text);
}
.arch-kicker.planned { color: var(--subtle); }
.arch-steps h3 { margin: 0 0 6px; font-size: 1.05rem; }
.arch-steps h3.mono { font-family: var(--font-mono); }
.arch-steps > p { margin: 0 0 14px; color: var(--muted); font-size: 0.93rem; max-width: 70ch; }
.arch-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 2px; }
.arch-steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 7px 10px 7px 6px;
    border-radius: var(--r-control);
    font-size: 0.93rem;
    color: var(--muted);
    cursor: default;
}
.arch-steps li::before {
    content: counter(step);
    font: 500 0.8rem var(--font-mono);
    color: var(--subtle);
    padding-top: 2px;
}
.arch-steps li:hover, .arch-steps li:focus-visible { background: var(--raised); color: var(--text); outline: none; }
.arch-facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-content: start; }
.arch-facts dt { color: var(--subtle); font-size: 0.85rem; }
.arch-facts dd { margin: 0; font: 500 0.85rem var(--font-mono); overflow-wrap: break-word; }

@media (max-width: 960px) {
    .arch-detail { grid-template-columns: minmax(0, 1fr); }
    .arch-all { margin-left: 0; }
}

/* ---------- Simulator ---------- */
.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}
.presets span { color: var(--subtle); font-size: 0.9rem; margin-right: 4px; }
.sim {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    overflow: hidden;
    background: var(--surface);
    min-height: 560px;
}
.term {
    display: flex;
    flex-direction: column;
    background: var(--term-bg);
    color: #e6e8eb;
    min-width: 0;
}
.term-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgb(255 255 255 / 0.07);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #9aa3bd;
}
.term-bar button {
    background: none;
    border: 1px solid rgb(255 255 255 / 0.12);
    color: #c8cdd2;
    border-radius: var(--r-tag);
    font: inherit;
    padding: 4px 10px;
    cursor: pointer;
}
.term-bar button:hover { border-color: rgb(255 255 255 / 0.3); }
.term-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.65;
    max-height: 520px;
}
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.cmd { color: #f1f3f5; margin-top: 10px; }
.term-line.cmd::before { content: "$ "; color: var(--term-accent); }
.term-line.out { color: #aab1b8; }
.term-line.err { color: #f2837a; }
.term-line.note { color: #9aa3bd; }
.term-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-top: 1px solid rgb(255 255 255 / 0.07);
}
.term-chips button {
    background: rgb(255 255 255 / 0.05);
    border: 1px solid rgb(255 255 255 / 0.1);
    color: #d4d8dc;
    border-radius: var(--r-tag);
    font: 0.78rem var(--font-mono);
    padding: 5px 9px;
    cursor: pointer;
}
.term-chips button:hover { border-color: var(--term-accent); color: #fff; }
.term-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgb(255 255 255 / 0.07);
}
.term-input label { font-family: var(--font-mono); font-size: 0.84rem; color: var(--term-accent); white-space: nowrap; }
.term-input input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    background: transparent;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: var(--r-control);
    color: #f1f3f5;
    font: 0.88rem var(--font-mono);
    padding: 0 12px;
}
.term-input input::placeholder { color: #9aa3bd; }
.term-input input:focus-visible { outline: 2px solid var(--term-accent); outline-offset: 0; border-color: transparent; }

.term-input .btn-primary { background: var(--term-accent); color: #0a1128; }
.term-input .btn-primary:hover { background: #fcf1d0; }
.viz { display: flex; flex-direction: column; min-width: 0; }
.viz-tabs {
    display: flex;
    gap: 2px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: thin;
}
.viz-tab {
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--r-control);
    background: transparent;
    color: var(--muted);
    font: 500 0.86rem var(--font-sans);
    cursor: pointer;
}
.viz-tab:hover { color: var(--text); background: var(--raised); }
.viz-tab[aria-selected="true"] { color: var(--on-accent); background: var(--accent); }
.viz-view { display: none; padding: 20px; overflow: auto; flex: 1; }
.viz-view.active { display: block; }
.viz-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: 0.86rem;
    color: var(--subtle);
}
.viz-meta strong { color: var(--text); font-weight: 600; }
.empty {
    padding: 28px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-panel);
    color: var(--muted);
    font-size: 0.93rem;
    text-align: center;
}
.empty code { font-size: 0.85rem; color: var(--accent-text); }

.dll { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.node {
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    padding: 10px 12px;
    background: var(--bg);
    min-width: 132px;
    max-width: 200px;
}
.node.head { border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.node code { font-size: 0.8rem; color: var(--accent-text); }
.node p { margin: 4px 0 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.node small { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--subtle); font-family: var(--font-mono); }
.link { font-family: var(--font-mono); color: var(--subtle); font-size: 0.95rem; }

.set-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-family: var(--font-mono); font-size: 0.85rem; }
.set-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--bg);
}
.set-list li span { color: var(--subtle); }

.tries { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tries h4, .deques h4 { margin: 0 0 8px; font-size: 0.86rem; font-weight: 600; }
.tries h4 span, .deques h4 span { color: var(--subtle); font-weight: 400; }
.trie-tree {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--bg);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--muted);
    white-space: pre;
    overflow-x: auto;
    min-height: 80px;
}
.trie-tree b { color: var(--accent-text); }
.rules { margin: 16px 0 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 0.82rem; display: grid; gap: 4px; }
.rules li span { color: var(--subtle); display: inline-block; min-width: 4.5ch; }

.deques { display: grid; gap: 18px; }
.lane {
    display: flex;
    gap: 6px;
    padding: 10px;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: var(--bg);
    overflow-x: auto;
    align-items: stretch;
}
.lane-item {
    flex-shrink: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-tag);
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.45;
    background: var(--surface);
}
.lane-item.back { border-color: var(--accent-text); }
.lane-item small { display: block; color: var(--subtle); }
.lane-ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.72rem; color: var(--subtle); margin-top: 4px; }

.fs { margin: 0; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.85; white-space: pre; overflow-x: auto; color: var(--muted); }
.fs b { color: var(--text); font-weight: 500; }
.fs i { font-style: normal; color: var(--accent-text); }
.fs s { color: var(--subtle); text-decoration: none; }

/* ---------- Commands ---------- */
.cmd-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px 48px;
    align-items: start;
}
.cmd-col { display: grid; gap: 40px; }
.cmd-group h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.cmd-group > p { margin: 0 0 14px; color: var(--subtle); font-size: 0.9rem; }
.cmd-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.cmd-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.cmd-row > code { font-size: 0.9rem; font-weight: 500; color: var(--text); overflow-wrap: anywhere; background: none; padding: 0; }
.cmd-row p { grid-column: 1; margin: 0; color: var(--muted); font-size: 0.9rem; }
.cmd-row .run {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: var(--r-control);
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text);
    font: 500 0.8rem var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
}
.cmd-row .run:hover { border-color: var(--accent-text); color: var(--accent-text); }
.cmd-note { margin-top: 28px; color: var(--subtle); font-size: 0.9rem; }

/* ---------- Downloads ---------- */
.downloads {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 16px;
}
.dl-main {
    padding: 32px;
    border-radius: var(--r-panel);
    border: 1px solid color-mix(in srgb, var(--accent-text) 40%, var(--line));
    background: var(--surface);
}
.dl-main h3 { margin: 0 0 8px; font-size: 1.4rem; letter-spacing: -0.02em; }
.dl-main > p { margin: 0 0 20px; color: var(--muted); }
.specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
    margin: 0 0 26px;
}
.specs div { display: flex; flex-direction: column; gap: 2px; }
.specs dt { font-size: 0.8rem; color: var(--subtle); }
.specs dd { margin: 0; font-weight: 500; font-size: 0.95rem; }
.dl-side { display: grid; gap: 16px; }
.dl-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    text-decoration: none;
    background: var(--surface);
    transition: border-color 0.15s;
}
.dl-link:hover { border-color: var(--line-strong); }
.dl-link > i:first-child { font-size: 24px; color: var(--accent-text); }
.dl-link strong { display: block; font-weight: 600; }
.dl-link span { color: var(--muted); font-size: 0.9rem; }
.dl-link > i:last-child { color: var(--subtle); }

/* ---------- Roadmap & scope ---------- */
.phases {
    list-style: none;
    margin: 0 0 56px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.phases li { padding: 22px 24px 0 0; position: relative; }
/* track: each phase owns the segment after its dot, filled once the phase is delivered */
.phases li::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--line);
}
.phases li.done::after { background: var(--accent); }
.phases li:last-child:not(.done)::after { background: linear-gradient(90deg, var(--line), transparent); }
.phases li::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--line-strong);
    z-index: 1;
}
.phases li.done::before { background: var(--accent); border-color: var(--accent); }
.phases li.next::before { border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.phases li.next .phase-status { color: var(--text); }
.phase-status { font-family: var(--font-mono); font-size: 0.78rem; color: var(--subtle); }
.phases li.done .phase-status { color: var(--accent-text); }
.phases h3 { margin: 6px 0 8px; font-size: 1.08rem; letter-spacing: -0.01em; }
.phases p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.phase-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font-size: 0.88rem; }
.phase-links a { color: var(--accent-text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.phase-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

.scope { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scope > div { padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--r-panel); }
.scope h3 { margin: 0 0 12px; font-size: 1rem; }
.scope ul { margin: 0; padding-left: 1.1em; color: var(--muted); display: grid; gap: 6px; font-size: 0.94rem; }

/* ---------- Team ---------- */
.team { display: grid; gap: 0; border-top: 1px solid var(--line); }
.member {
    display: grid;
    grid-template-columns: minmax(180px, 0.9fr) minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 24px;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}
.member h3 { margin: 0; font-size: 1.12rem; letter-spacing: -0.01em; }
.member .role { margin: 2px 0 10px; color: var(--muted); font-size: 0.9rem; }
.member .cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.member .cmds code {
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: var(--r-tag);
    border: 1px solid var(--line-strong);
}
.member .ds { font-weight: 600; margin: 0 0 6px; }
.member p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.member .integ { color: var(--subtle); font-size: 0.9rem; }
.member.lead .ds { color: var(--accent-text); }

/* ---------- Reports ---------- */
.pdf {
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    overflow: hidden;
    background: var(--surface);
}
.pdf-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}
.pdf-pickers { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pdf-sep { width: 1px; height: 20px; background: var(--line-strong); }
.pdf-tabs { display: flex; gap: 4px; }
.pdf-tab {
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--r-control);
    border: 0;
    background: transparent;
    color: var(--muted);
    font: 500 0.88rem var(--font-sans);
    cursor: pointer;
}
.pdf-tab[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.pdf-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pdf-actions[hidden], .pdf-frame-wrap iframe[hidden] { display: none; }
.pdf-empty {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 8px;
    min-height: min(52vh, 480px);
    padding: 32px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-control);
    text-align: center;
}
.pdf-empty[hidden] { display: none; }
.pdf-empty i { font-size: 2rem; color: var(--subtle); }
.pdf-empty p { margin: 0 0 8px; color: var(--muted); font-size: 0.93rem; max-width: 46ch; }
.pdf-meta { padding: 18px 20px 0; }
.pdf-meta h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pdf-meta p { margin: 0; color: var(--muted); font-size: 0.93rem; max-width: 70ch; }
.pdf-frame-wrap { padding: 16px 20px 20px; }
.pdf-frame-wrap iframe {
    width: 100%;
    height: min(78vh, 760px);
    border: 1px solid var(--line);
    border-radius: var(--r-control);
    background: #fff;
}

.refs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.refs a {
    display: block;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    text-decoration: none;
    transition: border-color 0.15s;
}
.refs a:hover { border-color: var(--line-strong); }
.refs strong { display: block; margin-bottom: 4px; }
.refs span { color: var(--muted); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--subtle); font-size: 0.9rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-grid p { margin: 0 0 4px; }
.footer-grid strong { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    transform: translate(-50%, 16px);
    opacity: 0;
    padding: 10px 16px;
    border-radius: var(--r-control);
    background: var(--text);
    color: var(--bg);
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.25s var(--ease), opacity 0.25s;
    pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Motion (entrance + reveal), off for reduced motion ---------- */
@media (prefers-reduced-motion: no-preference) {
    .rise { animation: rise 0.7s var(--ease) both; }
    .rise-2 { animation-delay: 0.08s; }
    .rise-3 { animation-delay: 0.16s; }
    .rise-4 { animation-delay: 0.26s; }
    @keyframes rise {
        from { opacity: 0; transform: translateY(14px); }
        to { opacity: 1; transform: none; }
    }
    .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
    .reveal.in { opacity: 1; transform: none; }
}

/* Hover feedback for clickable and featured surfaces (skipped with reduced motion) */
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
    .cell, .dl-link, .refs a {
        transition: transform 0.45s var(--ease), border-color 0.25s;
    }
    .cell:hover, .dl-link:hover, .refs a:hover { transform: translateY(-3px); border-color: var(--line-strong); }
    .cell-tint:hover { border-color: color-mix(in srgb, var(--accent-text) 50%, var(--line)); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .nav-link { padding: 8px 8px; font-size: 0.88rem; }
}

@media (max-width: 960px) {
    .menu-toggle { display: inline-grid; }
    .nav-menu {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 12px 16px 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        display: none;
    }
    .nav-menu.open { display: flex; }
    .nav-link { padding: 12px; font-size: 1rem; }
    .nav-link.active::after { display: none; }
    .nav-link.active { background: var(--raised); }
    .nav-menu .nav-download { display: flex; margin-top: 8px; }
    .nav-actions { margin-left: auto; }

    .hero-grid, .downloads { grid-template-columns: minmax(0, 1fr); gap: 36px; }
    .sim { grid-template-columns: minmax(0, 1fr); }
    .viz { border-top: 1px solid var(--line); }
    .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cell-trie, .cell-bin { grid-column: span 2; }
    .cell-set, .cell-deque, .cell-dll { grid-column: span 1; }
    .member { grid-template-columns: 1fr 1.6fr; }
    .member .integ { grid-column: 2; }
}

@media (max-width: 767px) {
    .container { padding: 0 16px; }
    .hero-sub { max-width: none; }
    .hero-cta .btn { flex: 1 1 100%; }
    .compare, .scope, .tries, .refs, .cmd-groups, .specs { grid-template-columns: minmax(0, 1fr); }
    .compare > div { padding: 24px 20px; }
    .compare > div + div { border-left: 0; border-top: 1px solid var(--line); }
    .bento { grid-template-columns: minmax(0, 1fr); }
    .cell-trie, .cell-set, .cell-deque, .cell-dll, .cell-bin { grid-column: auto; }
    .cell-bin { flex-direction: column; align-items: flex-start; }
    .phases { grid-template-columns: 1fr; padding-left: 26px; gap: 28px; }
    .phases li { padding: 0; }
    .phases li::before { top: 4px; left: -26px; }
    .phases li::after { top: 4px; bottom: -32px; left: -21px; right: auto; width: 2px; height: auto; }
    .phases li:last-child:not(.done)::after { background: linear-gradient(180deg, var(--line), transparent); }
    .member { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .member .integ { grid-column: auto; }
    .term-body { max-height: 380px; }
    .dl-main { padding: 24px 20px; }
    .term-input label { display: none; }
    .diagram, .transcript pre { font-size: 0.76rem; }
}
