/* Ferrite site — one stylesheet, light and dark.
   Palette is the app's own: deep indigo ink, a violet accent, and the ember
   (orange → magenta) of the icon used sparingly for emphasis. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/Inter-Regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/Inter-Medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/Inter-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/Inter-Bold.woff2") format("woff2"); }

:root {
  --bg: #fbfaff;
  --bg-soft: #f3f1ff;
  --surface: #ffffff;
  --surface-2: #f6f4ff;
  --line: #e4e0f7;
  --line-strong: #cfc9ee;
  --text: #16123a;
  --text-2: #4b4772;
  --text-3: #7a7699;
  --accent: #5b45f0;
  --accent-2: #7c6dff;
  --accent-soft: rgba(91, 69, 240, 0.09);
  --ember-a: #ff7a3d;
  --ember-b: #e2447a;
  --good: #0f8a5f;
  --good-soft: rgba(15, 138, 95, 0.10);
  --warn: #b45d00;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --bad: #c4264a;
  --bad-soft: rgba(196, 38, 74, 0.09);
  --code-bg: #f1eefe;
  --shadow: 0 1px 2px rgba(22, 18, 58, 0.05), 0 8px 30px rgba(60, 40, 160, 0.08);
  --shadow-lg: 0 2px 4px rgba(22, 18, 58, 0.06), 0 24px 60px rgba(60, 40, 160, 0.16);
  --hero-glow-1: rgba(124, 109, 255, 0.22);
  --hero-glow-2: rgba(255, 122, 61, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* Dark tokens, declared once and applied for both the OS preference and the toggle. */
:root[data-theme="dark"] {
  --bg: #0b0920;
  --bg-soft: #100d2b;
  --surface: #14112f;
  --surface-2: #1a1640;
  --line: #2a2554;
  --line-strong: #3a3470;
  --text: #ecebf9;
  --text-2: #b4b1d6;
  --text-3: #8a86b0;
  --accent: #8b7cff;
  --accent-2: #a89cff;
  --accent-soft: rgba(139, 124, 255, 0.14);
  --good: #3ddc9a;
  --good-soft: rgba(61, 220, 154, 0.12);
  --warn: #ffb35c;
  --warn-soft: rgba(255, 179, 92, 0.12);
  --bad: #ff6b8b;
  --bad-soft: rgba(255, 107, 139, 0.12);
  --code-bg: #181442;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);
  --hero-glow-1: rgba(124, 109, 255, 0.28);
  --hero-glow-2: rgba(226, 68, 122, 0.20);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0920; --bg-soft: #100d2b; --surface: #14112f; --surface-2: #1a1640;
    --line: #2a2554; --line-strong: #3a3470; --text: #ecebf9; --text-2: #b4b1d6; --text-3: #8a86b0;
    --accent: #8b7cff; --accent-2: #a89cff; --accent-soft: rgba(139, 124, 255, 0.14);
    --good: #3ddc9a; --good-soft: rgba(61, 220, 154, 0.12);
    --warn: #ffb35c; --warn-soft: rgba(255, 179, 92, 0.12);
    --bad: #ff6b8b; --bad-soft: rgba(255, 107, 139, 0.12);
    --code-bg: #181442;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);
    --hero-glow-1: rgba(124, 109, 255, 0.28); --hero-glow-2: rgba(226, 68, 122, 0.20);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3, h4 { line-height: 1.18; letter-spacing: -0.022em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2.3rem, 4.7vw, 3.55rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.015em; font-weight: 650; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); padding: 0.12em 0.4em; border-radius: 6px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
/* A gradient underline, not gradient text: `background-clip: text` is not
   supported by every engine (Servo, which Ferrite renders with, fills the whole
   box and hides the words), and a heading must stay readable in all of them. */
.grad { background: linear-gradient(100deg, var(--ember-a), var(--ember-b) 55%, var(--accent-2)) 0 94% / 100% 0.12em no-repeat; padding-bottom: 0.04em; }
.muted { color: var(--text-2); }
.tiny { font-size: 0.82rem; color: var(--text-3); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--ember-a), var(--ember-b)); }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.nav { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-links { display: flex; gap: 4px; margin-left: 12px; }
.nav-links a { color: var(--text-2); font-weight: 500; font-size: 0.94rem; padding: 7px 12px; border-radius: 8px; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
.menu-btn { display: none; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font: inherit; font-weight: 600; font-size: 0.97rem; padding: 12px 20px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; text-decoration: none !important; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 38%, transparent); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 48%, transparent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 8px 14px; font-size: 0.9rem; border-radius: 9px; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; padding: 84px 0 64px; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto -10%; height: 90%; background: radial-gradient(600px 380px at 18% 28%, var(--hero-glow-1), transparent 70%), radial-gradient(520px 340px at 84% 12%, var(--hero-glow-2), transparent 70%); pointer-events: none; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 56px 56px; opacity: 0.35; mask-image: radial-gradient(ellipse at 50% 20%, #000, transparent 72%); -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000, transparent 72%); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr); gap: 48px; align-items: center; }
.hero h1 { margin: 18px 0 20px; }
.lede { font-size: clamp(1.06rem, 1.6vw, 1.22rem); color: var(--text-2); max-width: 58ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 18px; }
.hero-note { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-3); font-size: 0.86rem; }
.hero-note span { display: inline-flex; align-items: center; gap: 7px; }
.hero-note svg { width: 15px; height: 15px; color: var(--good); }

/* Hero figure: the attack, step by step */
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.stage-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.stage-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.stage-bar b { margin-left: 8px; font-size: 0.78rem; font-weight: 500; color: var(--text-3); font-family: var(--mono); }
.stage-body { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 0.9rem; }
.row .tag { flex: none; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; margin-top: 1px; }
.tag-user { background: var(--accent-soft); color: var(--accent); }
.tag-page { background: var(--warn-soft); color: var(--warn); }
.tag-agent { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.tag-stop { background: var(--bad-soft); color: var(--bad); }
.tag-ok { background: var(--good-soft); color: var(--good); }
.row p { margin: 0; color: var(--text-2); }
.row code { font-size: 0.82em; }
.row.is-hidden-text { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.row.is-blocked { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 5%, var(--bg)); }
.row.is-ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }

/* ── Sections ───────────────────────────────────────────────────────── */
section { padding: 88px 0; }
section.tint { background: var(--bg-soft); border-block: 1px solid var(--line); }
.sec-head { max-width: 760px; margin: 0 0 44px; }
.sec-head h2 { margin: 14px 0 14px; }
.sec-head p { color: var(--text-2); font-size: 1.08rem; margin: 0; }

.cards { display: grid; gap: 18px; }
.cards.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; }
.card p { color: var(--text-2); margin: 0; font-size: 0.97rem; }
.card .ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.card .ico svg { width: 22px; height: 22px; }

/* Pipeline */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; position: relative; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 24px; position: relative; box-shadow: var(--shadow); }
.step::before { content: "1"; position: absolute; top: -14px; left: 20px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.86rem; color: #fff; background: linear-gradient(135deg, var(--ember-a), var(--ember-b)); box-shadow: 0 4px 14px rgba(226, 68, 122, 0.4); }
.step:nth-child(2)::before { content: "2"; }
.step:nth-child(3)::before { content: "3"; }
.step:nth-child(4)::before { content: "4"; }
.step h3 { margin: 10px 0 8px; font-size: 1.12rem; }
.step p { margin: 0; color: var(--text-2); font-size: 0.94rem; }
.step small { display: block; margin-top: 14px; color: var(--text-3); font-size: 0.8rem; font-family: var(--mono); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.split.flip > :first-child { order: 2; }
.checks { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.checks li { display: flex; gap: 12px; color: var(--text-2); }
.checks li > span { min-width: 0; }
.checks svg { flex: none; width: 20px; height: 20px; margin-top: 3px; color: var(--good); }
.checks b { color: var(--text); font-weight: 600; }

/* Shots */
.shots { display: flex; gap: 22px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.shot { margin: 0; }
.shot img { border-radius: 14px; border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); background: var(--surface); }
.shot img { height: auto; }
.shot.wide { margin: 28px 0; }
.shot.wide img { width: 100%; }
.shot.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.shot.narrow img { width: 100%; }
.shot.half { flex: 1 1 320px; min-width: 0; max-width: 490px; }
.shot.half img { width: 100%; }
.shots.stack { align-items: flex-start; margin: 28px 0; }
.shot figcaption { margin-top: 12px; font-size: 0.84rem; color: var(--text-3); text-align: center; }
.theme-shot-light { display: block; } .theme-shot-dark { display: none; }
:root[data-theme="dark"] .theme-shot-light { display: none; } :root[data-theme="dark"] .theme-shot-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-shot-light { display: none; }
  :root:not([data-theme="light"]) .theme-shot-dark { display: block; }
}

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.metric .num { font-size: clamp(2rem, 3.6vw, 2.9rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.metric .lab { margin-top: 10px; font-weight: 600; font-size: 0.95rem; }
.metric .sub { margin-top: 4px; color: var(--text-3); font-size: 0.84rem; line-height: 1.5; }

/* Bars */
.bars { display: grid; gap: 18px; }
.bar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 74px; gap: 16px; align-items: center; font-size: 0.93rem; }
.bar .name { font-weight: 600; } .bar .name small { display: block; font-weight: 400; color: var(--text-3); font-size: 0.78rem; }
.track { position: relative; height: 26px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 7px 0 0 7px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; }
.fill.ember { background: linear-gradient(90deg, var(--ember-a), var(--ember-b)); }
.fill.good { background: linear-gradient(90deg, #1aa877, #3ddc9a); }
.ci { position: absolute; top: 50%; height: 2px; background: var(--text); opacity: 0.75; left: var(--lo); width: calc(var(--hi) - var(--lo)); transform: translateY(-50%); }
.ci::before, .ci::after { content: ""; position: absolute; top: -4px; width: 2px; height: 10px; background: var(--text); }
.ci::after { right: 0; }
.bar .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.js .fill { animation: grow 1.1s cubic-bezier(.2,.8,.2,1) both; animation-play-state: paused; }
.js .in-view .fill { animation-play-state: running; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Callouts */
.callout { border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 18px 20px; background: var(--surface); margin: 26px 0; }
.callout > :last-child { margin-bottom: 0; }
.callout h4 { margin: 0 0 6px; font-size: 0.98rem; }
.callout.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.callout.note { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.callout.good { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 6%, var(--surface)); }
.callout.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin: 22px 0; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.89rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.hl td { background: var(--accent-soft); font-weight: 600; }

/* Download */
.platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.platform { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.platform.is-mine { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.platform .os { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.15rem; }
.platform .os svg { width: 28px; height: 28px; color: var(--text-2); }
.platform .meta { color: var(--text-3); font-size: 0.86rem; min-height: 2.6em; }
.platform .how { color: var(--text-2); font-size: 0.9rem; margin: 0; }
.platform .btn { margin-top: auto; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status.ok i { background: var(--good); } .status.none i { background: var(--warn); }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; line-height: 1.6; margin: 18px 0; position: relative; }
pre code { background: none; border: 0; padding: 0; font-size: 0.86rem; }
.copy { position: absolute; top: 8px; right: 8px; font: inherit; font-size: 0.74rem; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); cursor: pointer; opacity: 0; transition: opacity .15s; }
pre:hover .copy, .copy:focus-visible { opacity: 1; }

/* ── Docs layout ────────────────────────────────────────────────────── */
.wrap.docs { max-width: 1320px; }
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr) 180px; gap: 40px; padding: 44px 0 96px; align-items: start; }
.side, .toc { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; font-size: 0.92rem; }
.side h5, .toc h5 { margin: 0 0 10px; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.side a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.side a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .grp { margin-top: 20px; }
.toc a { display: block; color: var(--text-3); padding: 4px 0 4px 14px; border-left: 2px solid var(--line); font-size: 0.86rem; line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc a.l3 { padding-left: 26px; }
article { min-width: 0; }
article > h1 { font-size: clamp(2rem, 4vw, 2.7rem); margin: 10px 0 14px; }
article .lede { margin-bottom: 30px; }
article h2 { margin: 54px 0 14px; padding-top: 6px; font-size: 1.65rem; }
article h3 { margin: 32px 0 10px; }
article h4 { margin: 22px 0 6px; font-size: 1rem; }
article p, article li { color: var(--text-2); }
article li { margin: 0.35em 0; }
article ul, article ol { padding-left: 1.3em; margin: 0 0 1.1em; }
article strong { color: var(--text); font-weight: 600; }
article h2 .anchor, article h3 .anchor { margin-left: 8px; opacity: 0; font-weight: 400; color: var(--text-3); }
article h2:hover .anchor, article h3:hover .anchor { opacity: 1; }
.crumbs { font-size: 0.86rem; color: var(--text-3); }
.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 64px; }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--text-3); font-size: 0.78rem; margin-bottom: 2px; }
.pager .next { text-align: right; grid-column: 2; }
.diagram { margin: 26px 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.diagram svg { margin: 0 auto; min-width: 560px; }
.diagram text { font-family: var(--font); fill: var(--text); }
.diagram .d-box { fill: var(--surface-2); stroke: var(--line-strong); }
.diagram .d-acc { fill: var(--accent-soft); stroke: var(--accent); }
.diagram .d-bad { fill: var(--bad-soft); stroke: var(--bad); }
.diagram .d-ok { fill: var(--good-soft); stroke: var(--good); }
.diagram .d-line { stroke: var(--text-3); fill: none; stroke-width: 1.5; }
.diagram .d-dim { fill: var(--text-3); }
.formula { font-family: var(--mono); font-size: 0.92rem; padding: 14px 18px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; overflow-x: auto; color: var(--text); }
dl.defs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 22px; margin: 18px 0; }
dl.defs dt { font-weight: 700; color: var(--text); font-family: var(--mono); font-size: 0.9rem; padding-top: 1px; }
dl.defs dd { margin: 0; color: var(--text-2); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0 60px; background: var(--bg-soft); color: var(--text-2); font-size: 0.92rem; }
.foot { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot h5 { margin: 0 0 12px; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.foot a { display: block; color: var(--text-2); padding: 3px 0; }
.foot a.brand { display: flex; color: var(--text); padding: 0; }
.foot p { margin: 12px 0 0; max-width: 34ch; color: var(--text-3); }
.legal { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 0.84rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .docs { grid-template-columns: 220px minmax(0, 1fr); } .toc { display: none; }
}
@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .cards.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  section { padding: 64px 0; }
  .hero { padding: 56px 0 44px; }
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .split.flip > :first-child { order: 0; }
  .cards.c3, .cards.c2, .platforms { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 12px 16px 18px; background: var(--bg); border-bottom: 1px solid var(--line); margin: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 1rem; }
  .nav-cta { display: none; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 24px; }
  .side { position: static; max-height: none; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); }
  .side .grp { margin-top: 12px; }
  .foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bar { grid-template-columns: minmax(0, 1fr) 64px; } .bar .name { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 18px; }
  .metrics, .pipeline, .cards.c4 { grid-template-columns: minmax(0, 1fr); }
  .foot { grid-template-columns: minmax(0, 1fr); }
  .cta .btn { width: 100%; }
  dl.defs { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.defs dd { margin-bottom: 12px; }
  .pager { grid-template-columns: minmax(0, 1fr); } .pager .next { grid-column: 1; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .fill { animation: none; }
  .btn { transition: none; }
}
@media print {
  .site-header, .side, .toc, .site-footer, .copy { display: none; }
  .docs { display: block; } body { background: #fff; color: #000; }
}

/* Wide result tables (live results): let long "k/n = p% [lo-hi]" cells wrap. */
.table-wrap.tight table { font-size: 0.82rem; }
.table-wrap.tight td.num, .table-wrap.tight th.num { white-space: normal; min-width: 7.5em; }
