/* adorn website — shared styles. Tokens first; every color is a token so dark mode is one override. */

:root {
  --bg: #f6f3ec;
  --bg-deep: #ece6d9;
  --surface: #fffdf9;
  --surface-2: #f9f5ec;
  --ink: #1d1a26;
  --ink-soft: #4a4558;
  --ink-faint: #767085;
  --line: rgba(29, 26, 38, 0.12);
  --line-strong: rgba(29, 26, 38, 0.24);

  --accent: #6a3fd6;        /* violet — the "declaration" */
  --accent-ink: #4d27b0;
  --accent-soft: #ece5fc;
  --brass: #b0711a;         /* brass — the "derived artifacts" */
  --brass-soft: #f8ecd7;
  --ok: #1d7a55;
  --ok-soft: #e1f3ea;
  --warn: #a2560f;
  --warn-soft: #fbead6;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;

  --code-bg: #1c1a24;
  --code-ink: #e9e5f5;
  --code-dim: #8f88a8;
  --code-kw: #c3a6ff;
  --code-dec: #ffc66d;
  --code-str: #9fe0b5;
  --code-num: #ffa98a;
  --code-key: #8fd3ff;
  --code-line: rgba(255, 255, 255, 0.08);

  --shadow-sm: 0 6px 20px rgba(29, 26, 38, 0.06);
  --shadow-md: 0 18px 50px rgba(29, 26, 38, 0.1);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --container: 1160px;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131219;
    --bg-deep: #0d0c12;
    --surface: #1b1a23;
    --surface-2: #211f2b;
    --ink: #eeeaf7;
    --ink-soft: #bcb6cc;
    --ink-faint: #8d87a0;
    --line: rgba(238, 234, 247, 0.1);
    --line-strong: rgba(238, 234, 247, 0.2);
    --accent: #a98bff;
    --accent-ink: #c7b5ff;
    --accent-soft: #2a2343;
    --brass: #e1a54f;
    --brass-soft: #33281a;
    --ok: #5fd39f;
    --ok-soft: #173126;
    --warn: #f0a85e;
    --warn-soft: #35261a;
    --bad: #ff8a80;
    --bad-soft: #3a1e1e;
    --code-bg: #0e0d14;
    --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131219;
  --bg-deep: #0d0c12;
  --surface: #1b1a23;
  --surface-2: #211f2b;
  --ink: #eeeaf7;
  --ink-soft: #bcb6cc;
  --ink-faint: #8d87a0;
  --line: rgba(238, 234, 247, 0.1);
  --line-strong: rgba(238, 234, 247, 0.2);
  --accent: #a98bff;
  --accent-ink: #c7b5ff;
  --accent-soft: #2a2343;
  --brass: #e1a54f;
  --brass-soft: #33281a;
  --ok: #5fd39f;
  --ok-soft: #173126;
  --warn: #f0a85e;
  --warn-soft: #35261a;
  --bad: #ff8a80;
  --bad-soft: #3a1e1e;
  --code-bg: #0e0d14;
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ---------- base ---------- */

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

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 6px;
  padding: 0.08em 0.36em;
  white-space: nowrap;
}
:where(a, button, select, input, textarea, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.22rem; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }

.skip-link {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100;
  transform: translateY(-200%);
  background: var(--ink); color: var(--bg);
  padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { transform: none; }

.container { width: min(var(--container), 100% - 2rem); margin-inline: auto; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1.25rem; min-height: 4rem; }
.logo { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
.logo-mark { width: 2rem; height: 2rem; flex: none; }
.logo-version { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; color: var(--ink-faint); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.05rem 0.45rem; letter-spacing: 0; }

.site-nav { display: flex; gap: 0.25rem; margin-left: auto; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.94rem; font-weight: 500;
  padding: 0.45rem 0.75rem; border-radius: 999px;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }

.header-actions { display: flex; align-items: center; gap: 0.4rem; }
.icon-button {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-button:hover { border-color: var(--ink-faint); }
.icon-button svg { width: 1.1rem; height: 1.1rem; }
.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }
  .site-nav {
    display: none; position: absolute; inset: 100% 0 auto 0;
    flex-direction: column; gap: 0; padding: 0.5rem 1rem 1rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.75rem 0.5rem; border-radius: var(--radius-sm); }
  .header-actions { margin-left: auto; }
}

/* ---------- sections ---------- */

.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-alt { background: var(--surface-2); }
.section-head { max-width: 46rem; margin-bottom: 2.5rem; }
.section-head p { color: var(--ink-soft); font-size: 1.08rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brass); margin: 0 0 1rem;
}
.eyebrow::before { content: ""; width: 1.4rem; height: 2px; background: currentColor; border-radius: 2px; }
.lede { font-size: clamp(1.08rem, 1.6vw, 1.24rem); color: var(--ink-soft); max-width: 40rem; }

/* ---------- hero ---------- */

.hero { padding-top: clamp(3rem, 7vw, 5.5rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 1.25rem; }
.status-note { font-size: 0.9rem; color: var(--ink-faint); max-width: 36rem; }
.status-note strong { color: var(--ink-soft); }
.hero-grid > * { min-width: 0; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; } }

.button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.72rem 1.15rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.button:hover { transform: translateY(-1px); text-decoration: none; }
.button.primary { background: var(--ink); color: var(--bg); }
.button.accent { background: var(--accent); color: #fff; }
.button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.button.small { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

/* "one declaration → artifacts" figure */
.derive { display: grid; gap: 0.9rem; }
.derive-arrow { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.78rem; padding-left: 1rem; }
.derive-arrow svg { width: 1.1rem; height: 1.1rem; color: var(--brass); }
.derive-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.6rem; }
.derive-tabs button {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.82rem; font-weight: 500; cursor: pointer;
}
.derive-tabs button[aria-selected="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--ink); }
.derive-panel[hidden] { display: none; }

/* ---------- code ---------- */

.code {
  position: relative; margin: 0;
  background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--code-line);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--code-dim);
}
.code-head .dots { display: inline-flex; gap: 0.35rem; }
.code-head .dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--code-line); }
.code pre { margin: 0; padding: 1rem 1.1rem 1.15rem; overflow-x: auto; font-size: 0.84rem; line-height: 1.6; tab-size: 4; }
.code .copy {
  border: 1px solid var(--code-line); background: transparent; color: var(--code-dim);
  border-radius: 6px; padding: 0.15rem 0.5rem; font-size: 0.72rem; cursor: pointer; font-family: var(--font-mono);
}
.code .copy:hover { color: var(--code-ink); }
.tok-kw { color: var(--code-kw); }
.tok-dec { color: var(--code-dec); }
.tok-str { color: var(--code-str); }
.tok-num { color: var(--code-num); }
.tok-key { color: var(--code-key); }
.tok-com { color: var(--code-dim); font-style: italic; }
.tok-hl { background: rgba(255, 198, 109, 0.14); border-radius: 4px; box-shadow: 0 0 0 2px rgba(255, 198, 109, 0.14); }

/* ---------- cards & grids ---------- */

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm); min-width: 0;
}
.card h3 { margin-bottom: 0.45rem; }
.card p { color: var(--ink-soft); font-size: 0.96rem; }
.card p:last-child { margin-bottom: 0; }
.card .num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--brass); font-weight: 600; letter-spacing: 0.05em; display: block; margin-bottom: 0.65rem; }
.card .code { margin-top: 1rem; box-shadow: none; }
.card-link { text-decoration: none; color: inherit; display: block; transition: border-color 0.15s ease, transform 0.15s ease; }
.card-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-link .go { color: var(--accent-ink); font-weight: 600; font-size: 0.9rem; }

.feature-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; margin-top: 3rem; }
.feature-strip > div { background: var(--surface); padding: 1.1rem 1.2rem; }
.feature-strip strong { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 0.2rem; }
.feature-strip span { color: var(--ink-soft); font-size: 0.88rem; }
@media (max-width: 860px) { .feature-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .feature-strip { grid-template-columns: 1fr; } }

/* projection list */
.projections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 900px) { .projections { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .projections { grid-template-columns: 1fr; } }
.projection { border-left: 3px solid var(--brass); }
.projection .where { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.05rem 0.5rem; margin-bottom: 0.6rem; }
.projection code { white-space: normal; }

/* pipeline */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: stage; margin-bottom: 2.5rem; }
.pipeline li { list-style: none; position: relative; padding: 1.1rem 1.2rem 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); margin-left: -1px; }
.pipeline li:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; }
.pipeline li:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--brass-soft); }
.pipeline li::before { counter-increment: stage; content: "0" counter(stage); display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--brass); font-weight: 600; margin-bottom: 0.35rem; }
.pipeline strong { display: block; font-family: var(--font-display); font-size: 1.08rem; }
.pipeline span { display: block; color: var(--ink-soft); font-size: 0.88rem; margin-top: 0.2rem; }
.pipeline { padding: 0; }
@media (max-width: 860px) {
  .pipeline { grid-template-columns: 1fr; }
  .pipeline li, .pipeline li:first-child, .pipeline li:last-child { margin-left: 0; margin-top: -1px; border-radius: 0; }
  .pipeline li:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .pipeline li:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
}

/* compare */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .compare { grid-template-columns: 1fr; } }

/* callout */
.callout { border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin: 1.5rem 0; }
.callout.warn { border-left-color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }
.callout p:last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 0.25rem; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.95rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 500; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td code { white-space: normal; }

.pill { display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.55rem; letter-spacing: 0.02em; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.brass { background: var(--brass-soft); color: var(--brass); }

/* ---------- playground ---------- */

.playground { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.1rem; }
@media (max-width: 960px) { .playground { grid-template-columns: 1fr; } }
.pg-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.pg-toolbar label { font-size: 0.88rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 0.45rem; }
.pg-toolbar select { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 0.4rem 0.8rem; }
.pg-pane { display: flex; flex-direction: column; min-width: 0; }
.pg-pane + .pg-pane { gap: 1.1rem; }
.pg-editor {
  width: 100%; min-height: 15rem; resize: vertical; border: 0; outline: none;
  background: transparent; color: var(--code-ink);
  font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.6; padding: 1rem 1.1rem; tab-size: 4;
  white-space: pre; overflow-x: auto;
}
.pg-editor.small { min-height: 7.5rem; }
.pg-out { margin: 0; padding: 1rem 1.1rem; overflow: auto; max-height: 24rem; font-size: 0.82rem; line-height: 1.55; }
.verdict { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.9rem; font-family: var(--font-mono); font-size: 0.78rem; border-top: 1px solid var(--code-line); }
.verdict.ok { color: #7fe0ae; }
.verdict.bad { color: #ff9d94; }
.pg-note { font-size: 0.86rem; color: var(--ink-faint); margin-top: 1rem; }
.switch { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 1rem; height: 1rem; }

/* ---------- status filter ---------- */

.filter { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 1.5rem; }
.filter button { border: 0; background: transparent; color: var(--ink-soft); padding: 0.4rem 0.9rem; border-radius: 999px; font-weight: 500; font-size: 0.9rem; cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.status-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding: 0; margin: 0; }
@media (max-width: 720px) { .status-list { grid-template-columns: 1fr; } }
.status-list li { list-style: none; display: flex; gap: 0.8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem 1rem; }
.status-list li[hidden] { display: none; }
.status-list .pill { margin-top: 0.15rem; }
.status-list strong { display: block; font-size: 0.96rem; }
.status-list span { color: var(--ink-soft); font-size: 0.9rem; }

.two-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 2rem; }
@media (max-width: 720px) { .two-lists { grid-template-columns: 1fr; } }
.two-lists ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); }
.two-lists li { margin-bottom: 0.35rem; }

/* ---------- evidence ---------- */

.evidence-row td:nth-child(n+2) { white-space: nowrap; }

/* ---------- CTA band & footer ---------- */

.cta-band { text-align: center; }
.cta-band .hero-actions { justify-content: center; }
.cta-band p { margin-inline: auto; }

.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--ink-faint); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- docs layout (architecture / reference) ---------- */

.doc-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; padding: 2.5rem 0 4rem; }
.toc { position: sticky; top: 5.5rem; max-height: calc(100vh - 7rem); overflow-y: auto; font-size: 0.9rem; padding-right: 0.5rem; }
.toc p { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); margin-bottom: 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 0.3rem; border: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; margin: 0; }
}

.doc { max-width: 50rem; min-width: 0; }
.doc > section { padding: 2.25rem 0; border-bottom: 1px solid var(--line); }
.doc > section:first-child { padding-top: 0; }
.doc > section:last-child { border-bottom: 0; }
.doc h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.doc h3 { margin-top: 1.75rem; }
.doc .card h3 { margin-top: 0; }
.doc p, .doc li { color: var(--ink-soft); }
.doc ul, .doc ol { padding-left: 1.2rem; }
.doc li { margin-bottom: 0.4rem; }
.doc .code { margin: 1.25rem 0; box-shadow: var(--shadow-sm); }
.doc .table-wrap { margin: 1.25rem 0; }
.doc-hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 1rem; border-bottom: 1px solid var(--line); }
.doc-hero .lede { max-width: 46rem; }

/* flow diagram (architecture) */
.flow { display: grid; gap: 0.5rem; margin: 1.5rem 0; }
.flow-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem 1rem; }
.flow-row b { font-family: var(--font-mono); font-size: 0.78rem; color: var(--brass); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.flow-row span { color: var(--ink-soft); font-size: 0.93rem; }
.flow-arrow { text-align: center; color: var(--ink-faint); font-size: 0.9rem; line-height: 1; }
.flow-fan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.flow-fan div { background: var(--brass-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; font-size: 0.86rem; }
.flow-fan code { white-space: normal; }
@media (max-width: 600px) { .flow-row { grid-template-columns: 1fr; gap: 0.2rem; } .flow-fan { grid-template-columns: 1fr 1fr; } }

/* ---------- searchable reference ---------- */

.ref-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0 1.25rem; }
.ref-search { flex: 1 1 16rem; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 0.6rem 1rem; }
.ref-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint); }
.ref-cats { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.25rem; }
.ref-cats button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; cursor: pointer; }
.ref-cats button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.ref-list { display: grid; gap: 0.6rem; padding: 0; margin: 0; }
.ref-item { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem 1rem; }
.ref-item header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 0.75rem; margin-bottom: 0.25rem; }
.ref-item h3 { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; margin: 0; letter-spacing: 0; color: var(--ink); }
.ref-item .sig { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint); overflow-wrap: anywhere; }
.ref-item p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.ref-item .meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.ref-empty { color: var(--ink-faint); padding: 1rem 0; }

/* ---------- motion ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .button, .card-link { transition: none; }
}
.no-js .reveal { opacity: 1; transform: none; }
