/* OVAT Navigate: one stylesheet for every page.

   Design system
   -------------
   Layout concept: a signal schematic. A dark, blue-biased sheet with hairline
   rules; diagrams are drawn as wiring; the only bright colour is the "live
   signal" (cyan) travelling along it. Intel energy blue is structure, not
   decoration.

   Colour comes from OVAT's own PALETTE (ovat/cli/ui.py): blue #0068B5,
   cyan #00C7FD, purple #8F5CFF, ok #3DD68C, warn #FFC107, fail #FF5C5C,
   dim #7A8CA0. Purple is reserved for "a tool is running".

   Type: Bricolage Grotesque (display, optical sizes), Geist (body),
   Intel One Mono (code, labels, data). All self-hosted, OFL 1.1.

   Spacing scale: 4 8 12 16 24 32 48 64 96 128 (px)
   Radius: 6 (chips, buttons) and 12 (panels). Borders are 1px hairlines.
   Motion: one travelling signal per diagram, 160 to 260ms UI transitions,
   standard ease cubic-bezier(.2,.7,.2,1). Everything has a still state.
*/

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-opsz.woff2") format("woff2-variations"),
       url("../fonts/bricolage-grotesque-opsz.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-variable.woff2") format("woff2-variations"),
       url("../fonts/geist-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Intel One Mono";
  src: url("../fonts/intel-one-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Intel One Mono";
  src: url("../fonts/intel-one-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Dark first. Light is an opt-in theme (the toggle in the header). */
:root {
  --bg: #070a10;
  --bg-raised: #0c1119;
  --bg-sunk: #05070b;
  --bg-tint: #101827;
  --line: #1a2332;
  --line-strong: #2a3850;
  --fg: #e6edf6;
  --fg-muted: #9aabc0;
  --fg-faint: #71839a;
  --intel: #0068b5;
  --intel-ink: #ffffff;
  --signal: #00c7fd;
  --signal-ink: #5fdcff;
  --signal-soft: rgba(0, 199, 253, 0.12);
  --tool: #8f5cff;
  --tool-ink: #b79bff;
  --tool-soft: rgba(143, 92, 255, 0.14);
  --ok: #3dd68c;
  --ok-soft: rgba(61, 214, 140, 0.13);
  --warn: #ffc107;
  --warn-soft: rgba(255, 193, 7, 0.12);
  --fail: #ff5c5c;
  --fail-soft: rgba(255, 92, 92, 0.12);
  --grid: rgba(120, 160, 210, 0.055);
  --code-bg: #05080d;
  --term-bg: #04060a;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.75);

  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Intel One Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --r-sm: 0;
  --r-md: 0;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-raised: #ffffff;
  --bg-sunk: #e9eef4;
  --bg-tint: #e6eef8;
  --line: #d9e1eb;
  --line-strong: #b9c6d6;
  --fg: #0a1420;
  --fg-muted: #3f5167;
  --fg-faint: #56677d;
  --intel: #0068b5;
  --intel-ink: #ffffff;
  --signal: #0090c8;
  --signal-ink: #00609a;
  --signal-soft: rgba(0, 104, 181, 0.09);
  --tool: #6b3fd9;
  --tool-ink: #5a2fc4;
  --tool-soft: rgba(107, 63, 217, 0.1);
  --ok: #0d7343;
  --ok-soft: rgba(19, 138, 80, 0.11);
  --warn: #855600;
  --warn-soft: rgba(184, 120, 0, 0.12);
  --fail: #c4302d;
  --fail-soft: rgba(196, 48, 45, 0.1);
  --grid: rgba(0, 70, 140, 0.05);
  --code-bg: #0b111a;
  --term-bg: #0b111a;
  --shadow: 0 30px 70px -36px rgba(10, 30, 60, 0.45);
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; }
img { height: auto; }
a { color: var(--signal-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--intel); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 0; }
[hidden] { display: none !important; }
p, ul, ol { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 650; letter-spacing: -0.02em; line-height: 1.08; text-wrap: balance; }
code, kbd, pre, samp { font-family: var(--f-mono); }
:not(pre) > code {
  font-size: 0.86em;
  padding: 0.12em 0.38em;
  border-radius: 0;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  color: var(--fg);
  white-space: nowrap;
}
.wrap-code :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
kbd {
  font-size: 0.8em; padding: 0.1em 0.45em; border-radius: 0;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--bg-raised);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--intel); color: #fff; padding: 10px 14px; border-radius: 0; font-weight: 600;
}
.skip:focus { top: 12px; }

/* The faint schematic grid behind every page. */


.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- header ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: var(--s5); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; flex: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-word { font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.brand-tag { font-family: var(--f-mono); font-size: 11px; color: var(--fg-faint); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav ul { list-style: none; display: flex; gap: 2px; padding: 0; justify-content: center; }
.nav a {
  display: block; padding: 7px 12px; border-radius: 0;
  color: var(--fg-muted); text-decoration: none; font-size: 14.5px; white-space: nowrap;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}
.nav a:hover { color: var(--fg); background: var(--bg-tint); }
.nav a[aria-current="page"] { color: var(--fg); background: var(--bg-tint); box-shadow: inset 0 -2px 0 var(--signal); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border-radius: 0; border: 1px solid var(--line); background: transparent; color: var(--fg-muted);
  cursor: pointer; text-decoration: none; transition: color 160ms, border-color 160ms, background 160ms;
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-tint); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-ico-light { display: none; }
:root[data-theme="light"] .theme-ico-light { display: block; }
:root[data-theme="light"] .theme-ico-dark { display: none; }

@media (max-width: 880px) {
  .brand-tag { display: none; }
  .top-inner { flex-wrap: wrap; gap: 0 var(--s3); padding-block: 8px 0; }
  .nav { order: 3; flex-basis: 100%; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .nav ul { justify-content: flex-start; padding-bottom: 8px; }
  .top-actions { margin-left: auto; }
}

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--f-mono); font-size: 14px; letter-spacing: 0; color: var(--fg-muted);
  display: inline-flex; align-items: baseline; gap: 1px;
}
.eyebrow::before { content: "#"; color: var(--tool-ink); font-weight: 600; margin-right: 1px; }
.display {
  font-size: clamp(40px, 6.1vw, 82px);
  font-weight: 700; letter-spacing: -0.034em; line-height: 0.98;
  font-variation-settings: "opsz" 96;
}
.display .soft { color: var(--fg-faint); }
.display .lit { color: var(--signal-ink); }
.h2 { font-size: clamp(30px, 4.2vw, 50px); letter-spacing: -0.028em; font-variation-settings: "opsz" 72; }
.h3 { font-size: clamp(21px, 2.2vw, 26px); letter-spacing: -0.02em; }
.h4 { font-size: 18px; letter-spacing: -0.01em; font-family: var(--f-body); font-weight: 620; }
.lede { font-size: clamp(18px, 1.9vw, 21px); line-height: 1.55; color: var(--fg-muted); max-width: 60ch; }
.prose { max-width: 66ch; display: grid; gap: var(--s4); }
.prose p, .prose li { color: var(--fg-muted); }
.prose strong, .lede strong { color: var(--fg); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: var(--s2); }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: 14.5px; }

/* ---------- sections ---------- */
.section { padding-block: clamp(56px, 7.5vw, 100px); border-top: 1px solid var(--line); position: relative; }
.section.tight { padding-block: clamp(48px, 6vw, 80px); }
.section-head { display: grid; gap: var(--s4); margin-bottom: clamp(32px, 5vw, 56px); max-width: 760px; }
.section-head .lede { font-size: 18.5px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.split > * { min-width: 0; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }
.stack { display: grid; gap: var(--s5); }
.stack-sm { display: grid; gap: var(--s3); }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

/* Layer marker: the architecture doc numbers its layers, so the numbers mean something. */
.layer-tag {
  display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 14px; color: var(--fg-faint);
}
.layer-tag b { font-weight: 600; color: var(--fg); }
.layer-tag b::before { content: "#"; color: var(--tool-ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px;
  border-radius: 0; border: 1px solid transparent; font: 600 15.5px/1 var(--f-body);
  text-decoration: none; cursor: pointer; transition: background 180ms var(--ease), border-color 180ms, color 180ms, transform 180ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--intel); color: var(--intel-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--intel) 86%, #fff); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-tint); }
.btn .arr { transition: transform 200ms var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

.install {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 6px 0 16px;
  border: 1px solid var(--line-strong); border-radius: 0; background: var(--bg-sunk);
  font-family: var(--f-mono); font-size: 15px; color: var(--fg);
}
.install .prompt { color: var(--signal-ink); margin-right: 6px; }

.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg-faint);
  font: 500 12px/1 var(--f-mono); letter-spacing: 0.04em; cursor: pointer;
}
.copy-btn:hover { color: var(--fg); border-color: var(--line-strong); }
.copy-btn[data-copied] { color: var(--ok); border-color: var(--ok); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(48px, 8vw, 104px) clamp(48px, 6vw, 72px); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto -10% -40% 30%; height: 520px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 104, 181, 0.22), transparent);
}
:root[data-theme="light"] .hero::after { background: radial-gradient(closest-side, rgba(0, 104, 181, 0.12), transparent); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: clamp(32px, 5vw, 64px); align-items: center; position: relative; z-index: 1; }
.hero-grid > * { min-width: 0; }
.hero-copy { display: grid; gap: var(--s5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s2); }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-family: var(--f-mono); font-size: 13px; color: var(--fg-faint); }
.hero-meta span { display: inline-flex; gap: 8px; align-items: center; }
.hero-meta i { width: 6px; height: 6px; border-radius: 0; background: var(--ok); display: inline-block; }
@media (max-width: 1000px) { .hero-grid { grid-template-columns: 1fr; } }

.page-hero { padding-block: clamp(48px, 7vw, 96px) clamp(40px, 5vw, 64px); }
.page-hero .display { font-size: clamp(40px, 6vw, 76px); }
.page-hero .lede { margin-top: var(--s5); }

/* ---------- terminal ---------- */
.term {
  background: var(--term-bg); color: #d5e2f0; border: 1px solid var(--line-strong);
  border-radius: 0; box-shadow: var(--shadow); overflow: hidden;
  font-family: var(--f-mono); font-size: 14px; line-height: 1.6;
}
:root[data-theme="light"] .term { border-color: #1d2a3b; }
.term-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #1a2433;
  background: #0a0f17; color: #7f93ab; font-size: 12px;
}
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 0; background: #233046; display: block; }
.term-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-tabs { display: flex; gap: 4px; }
.term-tab {
  font: 500 11.5px/1 var(--f-mono); padding: 6px 9px; border-radius: 0; border: 1px solid transparent;
  background: transparent; color: #7f93ab; cursor: pointer;
}
.term-tab[aria-selected="true"] { color: #e6edf6; border-color: #24324a; background: #101826; }
.term-body { padding: 18px 18px 20px; min-height: 340px; overflow-x: auto; }
.term-body pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.t-prompt { color: #00c7fd; }
.t-cmd { color: #f2f6fb; }
.t-dim { color: #7a8ca0; }
.t-ok { color: #3dd68c; }
.t-warn { color: #ffc107; }
.t-bold { color: #f2f6fb; font-weight: 600; }
.t-tool { color: #b79bff; }
.t-caret { display: inline-block; width: 8px; height: 1.15em; background: #00c7fd; vertical-align: -3px; margin-left: 2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.term-foot { padding: 10px 18px; border-top: 1px solid #1a2433; color: #7a8ca0; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.term-foot button { font: inherit; color: #9fb2c8; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- code blocks ---------- */
.code {
  position: relative; background: var(--code-bg); color: #d5e2f0; border: 1px solid var(--line);
  border-radius: 0; overflow: hidden;
}
:root[data-theme="light"] .code { border-color: #1d2a3b; }
.code-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 16px; border-bottom: 1px solid #172131; color: #7f93ab; font: 12.5px/1.2 var(--f-mono); }
.code-head .copy-btn { color: #7f93ab; border-color: #24324a; }
.code-head .copy-btn:hover { color: #e6edf6; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.65; tab-size: 2; }
.code .k { color: #7cc7ff; }
.code .s { color: #a5e8c6; }
.code .c { color: #6c7f96; font-style: normal; }
.code .n { color: #ffd479; }
.code .p { color: #00c7fd; }
.code .f { color: #c9b3ff; }
.code .w { color: #f2f6fb; }
.code mark { background: rgba(0, 199, 253, 0.13); color: inherit; border-radius: 0; box-shadow: 0 0 0 2px rgba(0, 199, 253, 0.13); }

/* ---------- compare (boilerplate vs yaml) ---------- */
.compare { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s5); align-items: stretch; }
.compare > * { min-width: 0; }

.compare-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.compare-label .h4 { font-size: 16px; }
.compare-col { display: flex; flex-direction: column; min-width: 0; }
.compare-col:first-child .code { flex: 1; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }

/* ---------- panels, lists ---------- */
.panel { border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); padding: clamp(18px, 2.4vw, 28px); }
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.ledger > div { padding: var(--s5) var(--s5) var(--s5) 0; display: grid; gap: var(--s2); align-content: start; }
.ledger > div + div { padding-left: var(--s5); border-left: 1px solid var(--line); }
.ledger dt, .ledger .term-word { font-family: var(--f-mono); font-size: 13px; color: var(--signal-ink); letter-spacing: 0.02em; }
.ledger p { color: var(--fg-muted); font-size: 16px; }
@media (max-width: 860px) {
  .ledger { grid-template-columns: 1fr; }
  .ledger > div, .ledger > div + div { padding: var(--s5) 0; border-left: 0; }
  .ledger > div + div { border-top: 1px solid var(--line); }
}

/* ---------- numbers strip ---------- */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 0; overflow: hidden; background: var(--bg-raised); }
.figure { padding: clamp(18px, 2.4vw, 28px); display: grid; gap: 10px; align-content: start; min-width: 0; }
.figure + .figure { border-left: 1px solid var(--line); }
.figure .big { font-family: var(--f-display); font-weight: 650; font-size: clamp(34px, 3.8vw, 48px); letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.figure .big small { font-size: 0.48em; color: var(--fg-faint); letter-spacing: -0.01em; font-weight: 500; }
.figure .vs { font-family: var(--f-mono); font-size: 13px; color: var(--fg-faint); }
.figure p { font-size: 15px; color: var(--fg-muted); }
@media (max-width: 960px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .figures { grid-template-columns: 1fr; }
  .figure + .figure { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- diagrams ---------- */
.diagram { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 0; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); overflow: hidden; }
.diagram.wide { grid-template-columns: 1fr; }
.diagram > * { min-width: 0; }
.diagram-stage { position: relative; padding: clamp(12px, 2vw, 24px); background:
  radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--bg-sunk);
  overflow-x: auto; display: grid; align-items: center; }
.diagram-stage svg { display: block; width: 100%; height: auto; min-width: var(--svg-min, 0); }
.diagram-side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.diagram.wide .diagram-side { border-left: 0; border-top: 1px solid var(--line); }
@media (max-width: 960px) {
  .diagram { grid-template-columns: 1fr; }
  .diagram-side { border-left: 0; border-top: 1px solid var(--line); }
}
.diagram-controls { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.diagram-controls .count { margin-left: auto; font: 12.5px var(--f-mono); color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg-muted);
  font: 500 13px/1 var(--f-body); cursor: pointer;
}
.ctl:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-tint); }
.ctl svg { width: 14px; height: 14px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; overflow-y: auto; }
.steps li {
  counter-increment: step; position: relative; padding: 12px 16px 12px 46px; border-bottom: 1px solid var(--line);
  color: var(--fg-faint); font-size: 14.5px; line-height: 1.5; cursor: pointer;
  transition: color 220ms var(--ease), background 220ms var(--ease);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 0;
  border: 1px solid var(--line-strong); display: grid; place-items: center; font: 600 11px/1 var(--f-mono); color: var(--fg-faint);
}
.steps li b { color: var(--fg-muted); font-weight: 600; }
.steps li.is-current { color: var(--fg); background: var(--signal-soft); }
.steps li.is-current b { color: var(--fg); }
.steps li.is-current::before { border-color: var(--signal); background: var(--signal); color: #021018; }
.steps li.tone-tool.is-current { background: var(--tool-soft); }
.steps li.tone-tool.is-current::before { border-color: var(--tool); background: var(--tool); color: #fff; }
.steps li.tone-ok.is-current { background: var(--ok-soft); }
.steps li.tone-ok.is-current::before { border-color: var(--ok); background: var(--ok); color: #03140b; }
.steps li:focus-visible { outline-offset: -2px; }
.diagram-note { padding: 12px 16px; font-size: 13.5px; color: var(--fg-faint); border-top: 1px solid var(--line); margin-top: auto; }
.svg-scroll-hint { display: none; font: 12px var(--f-mono); color: var(--fg-faint); padding: 8px 12px 0; }
@media (max-width: 700px) { .svg-scroll-hint { display: block; } }

/* SVG vocabulary. Presentation attributes are avoided so the theme reaches every mark. */
.dg text { font-family: var(--f-body); fill: var(--fg); }
.dg .t-k { font-family: var(--f-mono); font-size: 13px; fill: var(--fg-faint); letter-spacing: 0.01em; }
.dg .t-t { font-family: var(--f-display); font-size: 21px; font-weight: 640; letter-spacing: -0.02em; fill: var(--fg); }
.dg .t-s { font-family: var(--f-mono); font-size: 13px; fill: var(--fg-muted); }
.dg .t-c { font-family: var(--f-mono); font-size: 13px; fill: var(--fg-faint); }
.dg .t-big { font-family: var(--f-display); font-size: 40px; font-weight: 700; fill: var(--fg); letter-spacing: -0.03em; }
.dg .box { fill: var(--bg-raised); stroke: var(--line-strong); stroke-width: 1.25; transition: stroke 260ms var(--ease), fill 260ms var(--ease); }
.dg .box-soft { fill: var(--bg-tint); stroke: var(--line); stroke-width: 1; }
.dg .node.is-on .box { stroke: var(--signal); fill: color-mix(in srgb, var(--signal) 9%, var(--bg-raised)); }
.dg .node.is-on .t-k { fill: var(--signal-ink); }
.dg .node.tone-tool.is-on .box { stroke: var(--tool); fill: color-mix(in srgb, var(--tool) 12%, var(--bg-raised)); }
.dg .node.tone-tool.is-on .t-k { fill: var(--tool-ink); }
.dg .node.tone-ok.is-on .box { stroke: var(--ok); fill: color-mix(in srgb, var(--ok) 10%, var(--bg-raised)); }
.dg .node.tone-ok.is-on .t-k { fill: var(--ok); }
.dg .node.is-off { opacity: 0.38; }
.dg .node.is-off .box { stroke-dasharray: 4 4; }
.dg .wire { fill: none; stroke: var(--line-strong); stroke-width: 1.5; transition: stroke 260ms var(--ease), opacity 260ms; }
.dg .wire.is-on { stroke: var(--signal); stroke-dasharray: 6 7; animation: march 0.9s linear infinite; }
.dg .wire.tone-tool.is-on { stroke: var(--tool); }
.dg .wire.tone-ok.is-on { stroke: var(--ok); }
.dg .wire.is-hidden { opacity: 0; }
.dg .wire-faint { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.dg .arrow { fill: var(--line-strong); }
.dg .packet circle.core { fill: var(--signal); }
.dg .packet circle.halo { fill: var(--signal); opacity: 0.22; }
.dg .packet.tone-tool circle { fill: var(--tool); }
.dg .packet.tone-ok circle { fill: var(--ok); }
.dg .packet { opacity: 0; transition: opacity 200ms; }
.dg .packet.is-moving { opacity: 1; }
.dg .chip { fill: var(--bg-tint); stroke: var(--line); }
.dg .chip-on { fill: var(--signal-soft); stroke: var(--signal); }
.dg .ring { fill: none; stroke: var(--line); stroke-width: 1; }
.dg .hl-text { fill: var(--signal-ink); }
.dg .ok-text { fill: var(--ok); }
.dg .tool-text { fill: var(--tool-ink); }
.dg .bar-a { fill: var(--intel); }
.dg .bar-b { fill: var(--signal); opacity: 0.85; }
@keyframes march { to { stroke-dashoffset: -26; } }

/* ---------- tabs (engines, devices) ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 0; background: var(--bg-sunk); }
.seg button {
  font: 500 14px/1 var(--f-body); padding: 9px 12px; border-radius: 0; border: 0; background: transparent;
  color: var(--fg-muted); cursor: pointer; transition: background 180ms, color 180ms;
}
.seg button code { background: none; border: 0; padding: 0; font-size: 13.5px; color: inherit; }
.seg button:hover { color: var(--fg); }
.seg button[aria-selected="true"] { background: var(--bg-raised); color: var(--fg); box-shadow: 0 0 0 1px var(--line-strong), 0 1px 0 0 var(--signal) inset; }
.engine-detail { padding: 16px; display: grid; gap: 12px; }
.engine-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.engine-detail dt { font-family: var(--f-mono); color: var(--fg-faint); font-size: 12.5px; padding-top: 2px; }
.engine-detail dd { margin: 0; color: var(--fg-muted); min-width: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 13px/1.3 var(--f-body); color: var(--fg-faint); background: var(--bg-sunk); white-space: nowrap; }
tbody th { font: 600 15px/1.5 var(--f-body); color: var(--fg); background: transparent; white-space: normal; min-width: 7.5em; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
td { color: var(--fg-muted); }
td:first-child { color: var(--fg); }
.yes { color: var(--ok); font-weight: 600; }
.no { color: var(--fg-faint); }
.part { color: var(--warn); font-weight: 600; }

/* ---------- guide steps ---------- */
.guide-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; counter-reset: g; }
.guide-step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--s5); padding-block: clamp(28px, 4vw, 44px); border-top: 1px solid var(--line); counter-increment: g; }
.guide-step:first-child { border-top: 0; padding-top: 0; }
.guide-step::before {
  content: counter(g, decimal-leading-zero); font: 600 15px/1 var(--f-mono); color: var(--signal-ink);
  width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 0; display: grid; place-items: center; background: var(--bg-raised);
}
.guide-step > div { display: grid; gap: var(--s4); min-width: 0; }
.guide-step p { color: var(--fg-muted); max-width: 66ch; }
@media (max-width: 640px) {
  .guide-step { grid-template-columns: 1fr; gap: var(--s3); }
  .guide-step::before { width: 40px; height: 40px; font-size: 13px; }
}
.callout { border-left: 2px solid var(--warn); background: var(--warn-soft); padding: 12px 16px; border-radius: 0; font-size: 15.5px; color: var(--fg-muted); max-width: 72ch; }
.callout strong { color: var(--fg); }
.callout.info { border-color: var(--signal); background: var(--signal-soft); }
.callout.ok { border-color: var(--ok); background: var(--ok-soft); }

/* Side navigation for long pages. */
.with-toc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); }
.toc { position: sticky; top: 84px; align-self: start; display: grid; gap: 2px; font-size: 14px; max-height: calc(100vh - 100px); overflow-y: auto; }
.toc p { font: 600 13px var(--f-mono); color: var(--fg-faint); margin-bottom: 8px; }
.toc a { color: var(--fg-faint); text-decoration: none; padding: 5px 0 5px 12px; border-left: 1px solid var(--line); }
.toc a:hover { color: var(--fg); }
.toc a.is-current { color: var(--fg); border-left-color: var(--signal); }
@media (max-width: 1000px) { .with-toc { grid-template-columns: 1fr; } .toc { display: none; } }

/* ---------- annotated yaml ---------- */
.anno { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.anno > * { min-width: 0; }
@media (max-width: 900px) { .anno { grid-template-columns: 1fr; } }
.anno-code pre { counter-reset: ln; }
.anno-line { display: block; border-radius: 0; margin-inline: -8px; padding-inline: 8px; cursor: pointer; transition: background 160ms; }
.anno-line:hover { background: rgba(255, 255, 255, 0.04); }
.anno-line.is-current { background: rgba(0, 199, 253, 0.12); }
.anno-notes { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); overflow: hidden; }
.anno-notes button {
  all: unset; box-sizing: border-box; display: grid; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.anno-notes button:last-child { border-bottom: 0; }
.anno-notes button:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.anno-notes .key { font: 600 13px var(--f-mono); color: var(--fg); }
.anno-notes .txt { font-size: 14.5px; color: var(--fg-faint); line-height: 1.5; }
.anno-notes button.is-current { background: var(--signal-soft); }
.anno-notes button.is-current .txt { color: var(--fg-muted); }
.anno-notes button.is-current .key { color: var(--signal-ink); }

/* ---------- charts ---------- */
.chart { border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); padding: clamp(18px, 2.6vw, 30px); display: grid; gap: var(--s5); min-width: 0; }
.chart-head { display: grid; gap: 8px; }
.chart-head .h3 { font-size: clamp(20px, 2vw, 24px); }
.chart-head p { color: var(--fg-muted); font-size: 15.5px; max-width: 64ch; }
.chart-foot { font-size: 13.5px; color: var(--fg-faint); border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 6px; }
.chart-foot strong { color: var(--fg-muted); font-weight: 600; }
.charts-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
@media (max-width: 900px) { .charts-2 { grid-template-columns: 1fr; } }

.hbars { display: grid; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.hbar-label { font-size: 14.5px; color: var(--fg-muted); line-height: 1.3; }
.hbar-label code { font-size: 12.5px; }
.hbar-track { height: 28px; background: var(--bg-sunk); border-radius: 0; position: relative; overflow: hidden; border: 1px solid var(--line); }
.hbar-fill { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--fill, var(--intel)); border-radius: 0; transform-origin: left center; }
.hbar-fill.hi { --fill: linear-gradient(90deg, var(--intel), var(--signal)); }
.hbar-fill.low { --fill: var(--line-strong); }
.hbar-fill.bad { --fill: color-mix(in srgb, var(--fail) 70%, var(--bg-raised)); }
.hbar-val { font: 600 15px var(--f-mono); font-variant-numeric: tabular-nums; color: var(--fg); min-width: 6.5ch; text-align: right; }
.hbar-val small { color: var(--fg-faint); font-weight: 400; }
.axis { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) auto; gap: 14px; }
.axis-ticks { display: flex; justify-content: space-between; font: 12px var(--f-mono); color: var(--fg-faint); }
.axis-ticks span { font-variant-numeric: tabular-nums; }
.axis > span:last-child { min-width: 6.5ch; }
@media (max-width: 560px) {
  .hbar, .axis { grid-template-columns: 1fr auto; }
  .hbar-label { grid-column: 1 / -1; }
  .axis > span:first-child { display: none; }
}

.vbars { display: flex; align-items: flex-end; gap: clamp(20px, 6vw, 72px); height: 240px; padding: 0 8px; border-bottom: 1px solid var(--line-strong); position: relative; }
.vbar { flex: 1; max-width: 140px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; gap: 8px; }
.vbar-val { font: 600 20px var(--f-display); text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.vbar-fill { height: var(--h); background: var(--fill, var(--intel)); border-radius: 0; transform-origin: bottom center; }
.vbar-fill.low { --fill: color-mix(in srgb, var(--fail) 60%, var(--bg-raised)); }
.vbar-fill.hi { --fill: linear-gradient(180deg, var(--signal), var(--intel)); }
.vbar-labels { display: flex; gap: clamp(20px, 6vw, 72px); padding: 0 8px; }
.vbar-labels span { flex: 1; max-width: 140px; text-align: center; font-size: 13.5px; color: var(--fg-muted); line-height: 1.35; }

.dots { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dot { width: 26px; height: 26px; border-radius: 0; display: grid; place-items: center; font: 600 11px var(--f-mono); color: #fff; }
.dot.d1 { background: #0068b5; } .dot.d2 { background: #8f5cff; } .dot.d3 { background: #c47a00; } .dot.d4 { background: #13895a; } .dot.d5 { background: #b23b5e; }
.dot.same { background: var(--signal); color: #021018; }
.dot.right { background: var(--ok); color: #03140b; }
.dot.wrong { background: transparent; border: 1.5px solid var(--fail); color: var(--fail); }
.dots-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); gap: 14px; align-items: center; }
.dots-row .hbar-label { margin: 0; }
@media (max-width: 560px) { .dots-row { grid-template-columns: 1fr; } }

.flip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flip div { border: 1px solid var(--line); border-radius: 0; padding: 14px 16px; display: grid; gap: 4px; background: var(--bg-sunk); }
.flip b { font: 650 30px/1 var(--f-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.flip span { font-size: 13.5px; color: var(--fg-faint); }

.strip { position: relative; height: 120px; margin: 8px 0 0; border-bottom: 1px solid var(--line-strong); }
.strip-pt { position: absolute; bottom: calc(var(--y) * 1px); left: var(--x); transform: translate(-50%, 50%); display: grid; justify-items: center; gap: 2px; }
.strip-pt i { width: 14px; height: 14px; border-radius: 0; background: var(--ok); display: block; box-shadow: 0 0 0 3px var(--bg-raised); }
.strip-pt.fail i { background: var(--bg-raised); border: 2px solid var(--fail); }
.strip-pt.full i { background: var(--warn); }
.strip-pt em { font: 11.5px var(--f-mono); font-style: normal; color: var(--fg-faint); white-space: nowrap; }
.strip-axis { display: flex; justify-content: space-between; font: 12px var(--f-mono); color: var(--fg-faint); margin-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--fg-faint); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 0; display: inline-block; }
.legend .l-ok { background: var(--ok); } .legend .l-full { background: var(--warn); } .legend .l-fail { border: 2px solid var(--fail); width: 11px; height: 11px; }
.legend .l-p { background: var(--intel); border-radius: 0; } .legend .l-c { background: var(--signal); border-radius: 0; }

.stack-bar { display: flex; height: 30px; border-radius: 0; overflow: hidden; border: 1px solid var(--line); background: var(--bg-sunk); transform-origin: left center; }
.stack-bar span { display: grid; place-items: center; font: 600 12px var(--f-mono); color: #fff; min-width: 0; overflow: hidden; white-space: nowrap; }
.stack-bar .p { background: var(--intel); }
.stack-bar .c { background: color-mix(in srgb, var(--signal) 75%, #003a55); color: #021018; }

/* Charts grow in when they scroll into view. With no JS, or reduced motion, they are already drawn. */
.js .anim-ready .hbar-fill, .js .anim-ready .stack-bar { transform: scaleX(0); }
.js .anim-ready .vbar-fill { transform: scaleY(0); }
.js .anim-ready .dot, .js .anim-ready .strip-pt { opacity: 0; }
.js .anim-in .hbar-fill, .js .anim-in .stack-bar { transform: scaleX(1); transition: transform 1100ms var(--ease); }
.js .anim-in .vbar-fill { transform: scaleY(1); transition: transform 1100ms var(--ease); }
.js .anim-in .dot, .js .anim-in .strip-pt { opacity: 1; transition: opacity 500ms var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.js .anim-in .hbar:nth-child(2) .hbar-fill { transition-delay: 120ms; }
.js .anim-in .hbar:nth-child(3) .hbar-fill { transition-delay: 240ms; }
.js .anim-in .hbar:nth-child(4) .hbar-fill { transition-delay: 360ms; }
.js .anim-in .vbar:nth-child(2) .vbar-fill { transition-delay: 160ms; }

/* ---------- codebase navigator ---------- */
.nav-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: var(--s5); }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 38px; border-radius: 0; border: 1px solid var(--line-strong);
  background: var(--bg-sunk); color: var(--fg); font: 15px var(--f-body);
}
.search input::placeholder { color: var(--fg-faint); }
.search svg { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; color: var(--fg-faint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  font: 500 13px/1 var(--f-body); padding: 8px 11px; border-radius: 0; border: 1px solid var(--line);
  background: transparent; color: var(--fg-muted); cursor: pointer;
}
.chip-btn:hover { color: var(--fg); border-color: var(--line-strong); }
.chip-btn[aria-pressed="true"] { background: var(--signal-soft); border-color: var(--signal); color: var(--fg); }
.navigator { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: var(--s5); align-items: start; }
.navigator > * { min-width: 0; }
@media (max-width: 1000px) { .navigator { grid-template-columns: 1fr; } }
.pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--s4); }
.pkg { border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); overflow: hidden; display: flex; flex-direction: column; }
.pkg-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.pkg-head h3 { font: 600 14px var(--f-mono); letter-spacing: 0; color: var(--fg); }
.pkg-head p { font-size: 13px; color: var(--fg-faint); line-height: 1.4; }
.mods { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.mod {
  all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 8px 10px; border-radius: 0; cursor: pointer; transition: background 160ms, opacity 200ms;
}
.mod:hover { background: var(--bg-tint); }
.mod:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.mod-name { font: 14px var(--f-mono); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-lines { font: 11.5px var(--f-mono); color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.mod-bar { grid-column: 1 / -1; height: 3px; border-radius: 0; background: var(--line); overflow: hidden; }
.mod-bar i { display: block; height: 100%; width: var(--w); background: var(--intel); border-radius: 0; }
.mod[aria-pressed="true"] { background: var(--signal-soft); box-shadow: inset 0 0 0 1px var(--signal); }
.mod[aria-pressed="true"] .mod-bar i { background: var(--signal); }
.mod.is-dim { opacity: 0.28; }
.mod.is-trace { background: var(--tool-soft); box-shadow: inset 0 0 0 1px var(--tool); }
.mod .tui-flag { font: 10.5px var(--f-mono); color: var(--tool-ink); letter-spacing: 0.05em; }
.detail { position: sticky; top: 84px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--bg-raised); overflow: hidden; }
@media (max-width: 1000px) { .detail { position: static; } }
.detail-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; background: var(--bg-sunk); }
.detail-path { font: 13px var(--f-mono); color: var(--fg-faint); overflow-wrap: anywhere; }
.detail-head h2 { font-size: 26px; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font: 500 12px/1 var(--f-mono); padding: 5px 8px; border-radius: 0; border: 1px solid var(--line); color: var(--fg-muted); background: var(--bg-raised); }
.tag.layer { color: var(--signal-ink); border-color: color-mix(in srgb, var(--signal) 40%, var(--line)); }
.tag.tui { color: var(--tool-ink); border-color: color-mix(in srgb, var(--tool) 40%, var(--line)); }
.detail-body { padding: 18px 20px 20px; display: grid; gap: 16px; }
.detail-body p { color: var(--fg-muted); font-size: 15.5px; }
.detail-body h3 { font: 600 13px var(--f-mono); color: var(--fg-faint); }
.detail-why { border-left: 2px solid var(--warn); padding-left: 12px; }
.detail-related { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-related button { all: unset; cursor: pointer; font: 12.5px var(--f-mono); padding: 5px 8px; border-radius: 0; border: 1px solid var(--line); color: var(--fg-muted); }
.detail-related button:hover { color: var(--fg); border-color: var(--signal); }
.detail-related button:focus-visible { outline: 2px solid var(--signal); }
.trace-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 0; margin-bottom: var(--s5); background: var(--bg-raised); }
.trace-bar p { font-size: 14.5px; color: var(--fg-muted); flex: 1 1 280px; }
.trace-bar b { color: var(--fg); }

/* ---------- failure tree ---------- */
.tree { display: grid; gap: 10px; }
.tree-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); }
.tree-row > * { min-width: 0; }
.tree-row .flag { font: 600 14px var(--f-mono); }
.tree-row .flag.f-warn { color: var(--warn); } .tree-row .flag.f-fail { color: var(--fail); } .tree-row .flag.f-ok { color: var(--ok); }
.tree-row p { color: var(--fg-muted); font-size: 15px; }
@media (max-width: 640px) { .tree-row { grid-template-columns: 1fr; } }

/* ---------- media ---------- */
.shot { margin: 0; border: 1px solid var(--line-strong); border-radius: 0; overflow: hidden; background: var(--term-bg); box-shadow: var(--shadow); }
.shot img { display: block; width: 100%; }
.shot figcaption { padding: 10px 14px; font-size: 13.5px; color: var(--fg-faint); border-top: 1px solid var(--line); background: var(--bg-raised); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 48px 64px; margin-top: 0; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: var(--s6); }
.foot-grid > * { min-width: 0; }
.foot h2 { font: 600 13px var(--f-mono); color: var(--fg-faint); margin-bottom: 12px; }
.foot ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.foot a { color: var(--fg-muted); text-decoration: none; font-size: 14.5px; }
.foot a:hover { color: var(--fg); }
.foot p { font-size: 14.5px; color: var(--fg-faint); max-width: 44ch; }
.foot-base { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font: 12.5px var(--f-mono); color: var(--fg-faint); }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }

.next-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--s4); }
.next-card {
  display: grid; gap: 8px; padding: 22px; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised);
  text-decoration: none; color: var(--fg); transition: border-color 200ms, transform 200ms var(--ease);
}
.next-card:hover { border-color: var(--signal); transform: translateY(-2px); }
.next-card span { font: 13px var(--f-mono); color: var(--fg-faint); }
.next-card strong { font: 650 22px/1.15 var(--f-display); letter-spacing: -0.02em; }
.next-card p { color: var(--fg-muted); font-size: 15px; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .dg .wire.is-on { stroke-dasharray: none; }
  .t-caret { animation: none; }
}
:root.reduce-motion .dg .wire.is-on { animation: none; stroke-dasharray: none; }

/* ---------- additions ---------- */
.brand-mark .bm-frame { fill: var(--bg-tint); stroke: var(--line-strong); stroke-width: 1; }
.brand-mark .bm-ring { fill: none; stroke: var(--intel); stroke-width: 2.4; }
:root[data-theme="light"] .brand-mark .bm-ring { stroke: var(--intel); }
.brand-mark .bm-dot { fill: var(--signal); }
.dg .core-legend { fill: var(--signal); }
.dg .core-legend.tool { fill: var(--tool); }
.dg .core-legend.ok { fill: var(--ok); }
.minw-640 .diagram-stage svg { min-width: 640px; }
.minw-560 .diagram-stage svg { min-width: 560px; }
.ledger > div:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
.ledger > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
.ledger dd { margin: 0; }
@media (max-width: 860px) {
  .ledger > div:nth-child(n) { padding: var(--s5) 0; border-left: 0; }
}
.foot-about { margin-top: 14px; }
.section > .wrap > .row { margin-top: var(--s5); }
.compare + p { margin-top: var(--s5); max-width: 72ch; }

/* Wide diagrams: drawing on top, steps underneath in columns. */
.diagram.wide .diagram-stage { padding: clamp(12px, 2.4vw, 32px); }
.diagram.wide .steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.diagram.wide.cols-3 .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.diagram.wide .steps li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.diagram.wide .steps li:nth-child(4n) { border-right: 0; }
.diagram.wide.cols-3 .steps li:nth-child(4n) { border-right: 1px solid var(--line); }
.diagram.wide.cols-3 .steps li:nth-child(3n) { border-right: 0; }
@media (max-width: 1000px) {
  .diagram.wide .steps, .diagram.wide.cols-3 .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagram.wide .steps li:nth-child(n) { border-right: 1px solid var(--line); }
  .diagram.wide .steps li:nth-child(2n) { border-right: 0; }
}
@media (max-width: 600px) {
  .diagram.wide .steps, .diagram.wide.cols-3 .steps { grid-template-columns: 1fr; }
  .diagram.wide .steps li:nth-child(n) { border-right: 0; }
}
.diagram-side .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
.diagram-side .seg button { text-align: left; }
.handles { list-style: none; padding: 0; margin-top: var(--s4); display: grid; gap: 0; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); }
.handles li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--fg-muted); }
.handles li:last-child { border-bottom: 0; }
.handles li::before { content: ""; width: 8px; height: 8px; margin: 8px 0 0 4px; border-radius: 0; background: var(--ok); }
.handles b { color: var(--fg); font-weight: 600; }

/* ---------- architecture page ---------- */
.arch-body { min-width: 0; display: grid; gap: 0; padding-bottom: var(--s8); }
.arch-sec { padding-block: clamp(48px, 7vw, 88px); border-top: 1px solid var(--line); display: grid; gap: var(--s5); min-width: 0; }
.arch-sec:first-child { border-top: 0; padding-top: 0; }
.arch-sec .section-head { margin-bottom: 0; }
.arch-sec > .h2 { max-width: 22ch; }
.sub-h { margin-top: var(--s5); }
.after-fig { margin-top: var(--s2); }
.layer-stack { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.layer-stack a {
  display: grid; grid-template-columns: 44px minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised);
  color: var(--fg); text-decoration: none; transition: border-color 200ms, transform 200ms var(--ease), background 200ms;
}
.layer-stack a:hover { border-color: var(--signal); transform: translateX(4px); }
.layer-stack li:nth-child(6) a { background: transparent; border-style: dashed; color: var(--fg-faint); }
.ln-n { font: 600 15px var(--f-mono); color: var(--signal-ink); }
.ln-name { font-weight: 600; font-size: 16px; }
.ln-files { font: 13px var(--f-mono); color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font: 600 11.5px/1 var(--f-mono); padding: 6px 8px; border-radius: 0; white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.off { color: var(--fg-faint); border: 1px solid var(--line-strong); }
@media (max-width: 640px) {
  .layer-stack a { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .ln-files { display: none; }
}
.socket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
@media (max-width: 760px) { .socket-grid { grid-template-columns: 1fr; } }
.socket { border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); padding: 18px 20px; display: grid; gap: 12px; align-content: start; }
.socket .h4 { font-family: var(--f-mono); font-size: 15px; font-weight: 600; color: var(--signal-ink); }
.socket ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.socket li { display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr); gap: 12px; align-items: baseline; font-size: 15px; color: var(--fg-muted); }
.socket li > code { justify-self: start; }
.rules3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 0; background: var(--bg-raised); overflow: hidden; }
.rules3 > div { padding: 20px 22px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.rules3 > div + div { border-left: 1px solid var(--line); }
.rules3 p { color: var(--fg-muted); font-size: 15px; }
.rules4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .rules4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rules4 > div:nth-child(3) { border-left: 0; } .rules4 > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 860px) {
  .rules3, .rules4 { grid-template-columns: 1fr; }
  .rules3 > div + div, .rules4 > div:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .rules3 > div:first-child, .rules4 > div:first-child { border-top: 0; }
}
.locator { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: loc; border: 1px solid var(--line); border-radius: 0; overflow: hidden; background: var(--bg-raised); }
.locator li { counter-increment: loc; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; position: relative; min-width: 0; }
.locator li + li { border-left: 1px solid var(--line); }
.locator li::before { content: counter(loc); font: 600 12px var(--f-mono); color: var(--signal-ink); width: 100%; }
.locator li span { width: 100%; font-size: 13.5px; color: var(--fg-faint); }
@media (max-width: 860px) { .locator { grid-template-columns: 1fr 1fr; } .locator li:nth-child(3) { border-left: 0; } .locator li:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 480px) { .locator { grid-template-columns: 1fr; } .locator li:nth-child(n) { border-left: 0; } .locator li + li { border-top: 1px solid var(--line); } }
.dg .t-m { font-family: var(--f-mono); font-size: 15px; fill: var(--fg); }
.diagram-side .seg.seg-1 { grid-template-columns: 1fr; }
.tight-end { padding-bottom: 0; }
.anno-code pre .anno-line { display: block; min-height: 1.65em; }
.kv-fail { color: var(--fail); font-weight: 600; }
.code .t-ok-c { color: #3dd68c; }
.code .t-warn-c { color: #ffc107; }
.npu-figs { margin-bottom: var(--s2); }
.npu-figs .big { font-size: clamp(28px, 3vw, 40px); overflow-wrap: anywhere; }

/* Inside the narrower documentation column every diagram stacks: drawing on
   top at full width, steps or tabs underneath. */
.arch-body .diagram { grid-template-columns: 1fr; }
.arch-body .diagram-side { border-left: 0; border-top: 1px solid var(--line); }
.arch-body .diagram .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.arch-body .diagram .steps li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.arch-body .diagram .steps li:nth-child(3n) { border-right: 0; }
.arch-body .diagram-side .seg { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.arch-body .diagram-side .seg.seg-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 720px) {
  .arch-body .engine-detail { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: start; gap: 20px; }
}
@media (max-width: 1000px) {
  .arch-body .diagram .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arch-body .diagram .steps li:nth-child(n) { border-right: 1px solid var(--line); }
  .arch-body .diagram .steps li:nth-child(2n) { border-right: 0; }
}
@media (max-width: 700px) {
  .arch-body .diagram-side .seg, .arch-body .diagram-side .seg.seg-1 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .arch-body .diagram .steps { grid-template-columns: 1fr; }
  .arch-body .diagram .steps li:nth-child(n) { border-right: 0; }
}
.arch-body .diagram .diagram-note { border-top: 1px solid var(--line); }

/* ---------- round 2 fixes ---------- */
.axis-ticks { position: relative; display: block; height: 16px; }
.axis-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.axis-ticks span:nth-child(1) { left: 0; transform: none; }
.axis-ticks span:nth-child(2) { left: 25%; }
.axis-ticks span:nth-child(3) { left: 50%; }
.axis-ticks span:nth-child(4) { left: 75%; }
.axis-ticks span:nth-child(5) { left: 100%; transform: translateX(-100%); }
.hbar, .axis { grid-template-columns: minmax(130px, 220px) minmax(0, 1fr) 7.5ch; }
.dots-row { grid-template-columns: minmax(130px, 220px) minmax(0, 1fr); }
.hbar-label code { white-space: normal; overflow-wrap: anywhere; }
.dot { width: 28px; height: 28px; font-size: 13px; }
.figure p code { white-space: normal; overflow-wrap: anywhere; }
.npu-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.npu-figs .figure:nth-child(3) { border-left: 0; }
.npu-figs .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
.npu-figs .big.hex { font-family: var(--f-mono); font-size: clamp(22px, 2.4vw, 30px); font-weight: 600; letter-spacing: -0.02em; }
@media (max-width: 520px) {
  .npu-figs { grid-template-columns: 1fr; }
  .npu-figs .figure:nth-child(n) { border-left: 0; }
  .npu-figs .figure + .figure { border-top: 1px solid var(--line); }
}
.pkgs { display: block; columns: 2 300px; column-gap: var(--s4); }
.pkg { break-inside: avoid; margin-bottom: var(--s4); }
@media (max-width: 560px) {
  .hbar, .axis { grid-template-columns: minmax(0, 1fr) 7.5ch; }
}
/* Single-column grids: an implicit "auto" track grows to its widest child
   (a long code line), so every one of them gets an explicit shrinkable track. */
.arch-sec, .arch-body, .stack, .stack-sm, .prose, .chart, .chart-head, .guide-step > div,
.hero-copy, .section-head, .detail-body, .engine-detail, .socket, .tree { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .arch-body .engine-detail { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
}
p > code, li > code, dd > code, .callout code, p span code { white-space: normal; overflow-wrap: anywhere; }

.ctl { height: 36px; min-width: 36px; }
.chip-btn { min-height: 34px; }
.term-foot .term-acts { display: inline-flex; gap: 14px; }
.motion-ctl { margin-left: auto; }
.ctl { white-space: nowrap; }
.arch-body .engine-detail.single { grid-template-columns: minmax(0, 1fr); }
.engine-detail.single p { max-width: 70ch; }
.stack-cap { font: 12.5px var(--f-mono); color: var(--fg-faint); font-variant-numeric: tabular-nums; margin-bottom: 6px; }

/* =====================================================================
   Round 3: the owner's review. Sharp corners, one scrollbar, one code
   box, the dotted-glow nav, hashtag markers, tagged notes, more charts.
   ===================================================================== */

/* One scrollbar everywhere: thin, square, on-theme. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--fg-faint); }
::-webkit-scrollbar-corner { background: transparent; }

/* One code box. Same bar, same padding, same type, always a Copy button.
   Lines wrap instead of scrolling sideways. */
.code { border: 1px solid var(--line-strong); }
:root[data-theme="light"] .code { border-color: #1d2a3b; }
.code-head { min-height: 40px; padding: 0 8px 0 14px; background: #0a0f17; border-bottom: 1px solid #172131; font: 12.5px/1 var(--f-mono); color: #8a9db4; }
.code-head > span:first-child::before { content: "#"; color: #b79bff; margin-right: 1px; }
.code pre { padding: 14px 16px 16px; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: hidden; }
.code-head .copy-btn { height: 26px; padding: 0 9px; border-color: #24324a; color: #8a9db4; background: transparent; }
.code-head .copy-btn:hover { color: #e6edf6; border-color: #00c7fd; }
.code-head .copy-btn[data-copied] { color: #3dd68c; border-color: #3dd68c; }
.term-body { overflow-x: hidden; }

/* The comparison pair: equal heights, no dead space under the shorter side. */
.compare { align-items: stretch; }
.compare-col { gap: 0; }
.compare-col .code + .code { margin-top: var(--s3); }
.compare-col:first-child .code { flex: 1; display: flex; flex-direction: column; }
.compare-col:first-child .code pre { flex: 1; }
.compare-col .handles { flex: 1; margin-top: var(--s3); align-content: start; }

/* Top menu: a dotted sky-blue frame that glows, with purple text. */
.nav a {
  position: relative; border: 1px dotted transparent; padding: 6px 12px;
  transition: color 180ms var(--ease), background 180ms var(--ease), box-shadow 220ms var(--ease), border-color 180ms, text-shadow 220ms;
}
.nav a:hover, .nav a:focus-visible {
  color: #c9b3ff; background: rgba(0, 199, 253, 0.07); border-color: rgba(0, 199, 253, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 199, 253, 0.12), 0 0 14px rgba(0, 199, 253, 0.35), inset 0 0 12px rgba(0, 199, 253, 0.12);
  text-shadow: 0 0 10px rgba(143, 92, 255, 0.85), 0 0 2px rgba(143, 92, 255, 0.6);
  outline: none;
}
.nav a[aria-current="page"] {
  color: var(--tool-ink); background: transparent; border-color: rgba(0, 199, 253, 0.55); box-shadow: none;
}
.nav a[aria-current="page"]::before { content: "#"; color: var(--signal-ink); margin-right: 1px; }
:root[data-theme="light"] .nav a:hover, :root[data-theme="light"] .nav a:focus-visible {
  color: #5a2fc4; background: rgba(0, 144, 200, 0.07); border-color: #0090c8;
  box-shadow: 0 0 12px rgba(0, 144, 200, 0.35), inset 0 0 10px rgba(0, 144, 200, 0.1);
  text-shadow: 0 0 8px rgba(107, 63, 217, 0.35);
}
:root[data-theme="light"] .nav a[aria-current="page"] { border-color: #0090c8; }

/* Brand: the real OVAT mark. */
.brand-mark-img { width: 28px; height: 28px; display: block; }
.logo-dark, .logo-light { display: block; }
.logo-light { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
:root[data-theme="light"] .logo-dark { display: none; }
.hero-logo { width: min(100%, 360px); height: auto; margin-bottom: var(--s2); }
.hero-logo img { width: 100%; height: auto; }

/* Notes: a mono tag in its own cell, inside a dotted frame. Sharp. */
.callout {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch;
  border: 1px dashed var(--line-strong); background: var(--bg-raised); padding: 0; border-left-width: 1px;
  max-width: 76ch; font-size: 15.5px; color: var(--fg-muted);
}
.callout::before {
  content: attr(data-tag); display: block; padding: 13px 14px; min-width: 78px;
  font: 600 12.5px/1.4 var(--f-mono); color: var(--warn); background: var(--bg-sunk);
  border-right: 1px dashed var(--line-strong);
}
.callout.info::before { color: var(--signal-ink); }
.callout.ok::before { color: var(--ok); }
.callout.why::before { color: var(--tool-ink); }
.callout > p { padding: 12px 16px; margin: 0; }
.callout, .callout.info, .callout.ok { background: var(--bg-raised); border-color: var(--line-strong); }
.detail-why { border-left: 0; padding-left: 0; }
@media (max-width: 480px) {
  .callout { grid-template-columns: minmax(0, 1fr); }
  .callout::before { border-right: 0; border-bottom: 1px dashed var(--line-strong); padding: 8px 14px; }
}

/* Keep reading: ruled rows, not three equal cards. */
.next-up { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line-strong); }
.next-card {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 24px; align-items: baseline;
  padding: 22px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; transform: none;
}
.next-card:hover { transform: none; background: var(--bg-raised); border-color: var(--line); }
.next-card:hover strong { color: var(--signal-ink); }
.next-card span::before { content: "#"; color: var(--tool-ink); }
@media (max-width: 760px) { .next-card { grid-template-columns: minmax(0, 1fr); } }

/* Bars without filled tracks: an axis line instead. */
.hbar-track { background: transparent; border: 0; border-left: 1px solid var(--line-strong); }
.hbar-fill { inset: 3px auto 3px 0; }

/* Steps and guide numbers: square counters. */
.steps li::before, .guide-step::before { border-radius: 0; }

/* Squares for data marks too. */
.dot, .legend i, .term-dots i, .strip-pt i { border-radius: 0; }

/* SVG charts built at publish time (build.py). */
.plot { display: block; width: 100%; height: auto; }
.plot text { font-family: var(--f-mono); font-size: 12px; fill: var(--fg-faint); }
.plot .ax { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.plot .gr { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; fill: none; }
.plot .ln { fill: none; stroke: var(--signal); stroke-width: 2; }
.plot .ln.b { stroke: var(--tool); }
.plot .area { fill: var(--signal-soft); stroke: none; }
.plot .pt { fill: var(--bg-raised); stroke: var(--signal); stroke-width: 2; }
.plot .pt.b { stroke: var(--tool); }
.plot .bar { fill: var(--intel); }
.plot .bar.hi { fill: var(--signal); }
.plot .sq { fill: var(--signal); }
.plot .sq.t { fill: var(--tool); }
.plot .sq.o { fill: var(--ok); }
.plot .sq.w { fill: var(--warn); }
.plot .lbl { fill: var(--fg); font-family: var(--f-body); font-size: 13px; }
.plot .cap { stroke: var(--fail); stroke-width: 1.5; stroke-dasharray: 6 5; fill: none; }
.plot .val { fill: var(--fg-muted); font-size: 11.5px; }
.js .plot-ready .mk { opacity: 0; }
.js .plot-ready .ln, .js .plot-ready .cap { stroke-dashoffset: var(--len, 2000); stroke-dasharray: var(--len, 2000); }
.js .plot-ready .area { opacity: 0; }
.js .plot-in .area { opacity: 1; transition: opacity 600ms var(--ease) var(--area-delay, 0ms); }
.js .plot-in .mk { opacity: 1; transition: opacity 260ms var(--ease); }
.chart-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
@media (max-width: 900px) { .chart-row { grid-template-columns: minmax(0, 1fr); } }

/* One bar at a time. --i is set per bar by site.js. */
.js .anim-in .hbar-fill, .js .anim-in .stack-bar, .js .anim-in .vbar-fill { transition-duration: 650ms; transition-delay: calc(var(--i, 0) * 420ms) !important; }

/* Footer: the Intel tile. */
.made-for { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 18px; max-width: 420px; }
.made-for img { width: 120px; height: 90px; object-fit: cover; border: 1px solid var(--line-strong); display: block; }
.made-for p { font-size: 13.5px; }
.measured-on { display: inline-flex; align-items: center; gap: 12px; margin-top: var(--s4); font-size: 14px; color: var(--fg-muted); }
.measured-on img { width: 69px; height: 45px; border: 1px solid var(--line-strong); }
.foot-logo { display: block; width: min(100%, 260px); }
.foot-logo img { width: 100%; height: auto; }
.foot-about { margin-top: 16px; }
.brand { gap: 10px; }
.diagram-side .diagram-controls { flex-wrap: wrap; }
.diagram-side .diagram-controls .seg { flex: 1 1 100%; }
.diagram-side .diagram-controls .motion-ctl { margin-left: auto; }
.next-card span { text-transform: lowercase; }
.handles li { padding: 9px 16px; }
/* One colour per headline: the accent lives in the logo and the signal, not in a highlighted phrase. */
.display .lit, .display .soft { color: inherit; }
.plot-wrap { max-width: 820px; }
.arch-body .chart-row { grid-template-columns: minmax(0, 1fr); }

/* =====================================================================
   Smooth motion. Nothing flips state in one frame: every highlight fades
   up from dark (and back down) on a soft ease, and sequential elements are
   staggered. Mostly opacity, transform and filter, so it holds 60 fps.
   ===================================================================== */
:root {
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-glow: cubic-bezier(0.45, 0.05, 0.35, 1);
  --fade-in: 800ms;
  --fade-out: 1100ms;
}

/* Diagram nodes: the box tints, its border warms up and a blurred halo
   (injected by flow.js) rises from 0 to full opacity. */
.dg .node { transition: opacity var(--fade-out) var(--ease-glow); }
.dg .node .box { transition: stroke var(--fade-out) var(--ease-glow), fill var(--fade-out) var(--ease-glow); }
.dg .node.is-on .box { transition: stroke var(--fade-in) var(--ease-glow) var(--d, 0ms), fill var(--fade-in) var(--ease-glow) var(--d, 0ms); }
.dg .node text { transition: fill var(--fade-out) var(--ease-glow); }
.dg .node.is-on text { transition: fill var(--fade-in) var(--ease-glow) var(--d, 0ms); }
.dg .halo { fill: none; stroke: var(--signal); stroke-width: 7; opacity: 0; transition: opacity var(--fade-out) var(--ease-glow); pointer-events: none; }
.dg .node.is-on .halo { opacity: 0.6; transition: opacity var(--fade-in) var(--ease-glow) var(--d, 0ms); }
.dg .node.tone-tool .halo { stroke: var(--tool); }
.dg .node.tone-ok .halo { stroke: var(--ok); }
:root[data-theme="light"] .dg .node.is-on .halo { opacity: 0.35; }

/* Wires: the base line eases its colour; a dashed live copy (flow.js) fades
   in over it and keeps marching, so the dash pattern never pops in. */
.dg .wire { transition: stroke var(--fade-out) var(--ease-glow), opacity var(--fade-out) var(--ease-glow); }
.dg .wire.is-on { stroke-dasharray: none; animation: none; transition: stroke var(--fade-in) var(--ease-glow), opacity var(--fade-in) var(--ease-glow); }
.dg .wire-live { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-dasharray: 6 7; opacity: 0; pointer-events: none;
  animation: march 0.9s linear infinite; transition: opacity var(--fade-out) var(--ease-glow); }
.dg .wire.is-on + .wire-live { opacity: 1; transition: opacity var(--fade-in) var(--ease-glow); }
.dg .wire.tone-tool + .wire-live { stroke: var(--tool); }
.dg .wire.tone-ok + .wire-live { stroke: var(--ok); }
.dg .wire.is-hidden + .wire-live { opacity: 0; }
.dg .packet { transition: opacity 450ms var(--ease-soft); }

/* Step lists, tabs and cards ease both ways. */
.steps li { transition: color var(--fade-out) var(--ease-glow), background-color var(--fade-out) var(--ease-glow); }
.steps li.is-current { transition: color var(--fade-in) var(--ease-glow), background-color var(--fade-in) var(--ease-glow); }
.steps li::before { transition: background-color var(--fade-out) var(--ease-glow), border-color var(--fade-out) var(--ease-glow), color var(--fade-out) var(--ease-glow); }
.steps li.is-current::before { transition-duration: var(--fade-in); }
.seg button { transition: background-color 500ms var(--ease-soft), color 500ms var(--ease-soft), box-shadow 500ms var(--ease-soft); }
.term-tab { transition: color 450ms var(--ease-soft), border-color 450ms var(--ease-soft), background-color 450ms var(--ease-soft); }
.mod { transition: background-color 500ms var(--ease-soft), box-shadow 500ms var(--ease-soft), opacity 600ms var(--ease-soft); }
.mod-bar i { transition: background-color 500ms var(--ease-soft); }
.chip-btn, .ctl, .icon-btn, .copy-btn, .detail-related button { transition: color 350ms var(--ease-soft), border-color 350ms var(--ease-soft), background-color 350ms var(--ease-soft); }
.btn { transition: background-color 350ms var(--ease-soft), border-color 350ms var(--ease-soft), color 350ms var(--ease-soft), transform 250ms var(--ease-soft); }
.next-card { transition: background-color 500ms var(--ease-soft); }
.next-card strong { transition: color 500ms var(--ease-soft); }
.layer-stack a { transition: border-color 500ms var(--ease-soft), transform 500ms var(--ease-soft), background-color 500ms var(--ease-soft); }
.anno-line, .anno-notes button { transition: background-color 450ms var(--ease-soft); }
.anno-notes .key, .anno-notes .txt { transition: color 450ms var(--ease-soft); }
.toc a { transition: color 450ms var(--ease-soft), border-color 450ms var(--ease-soft); }

/* Menu: the glow eases in over ~350 ms and out a little slower. */
.nav a { transition: color 450ms var(--ease-soft), background-color 450ms var(--ease-soft), border-color 450ms var(--ease-soft), box-shadow 500ms var(--ease-soft), text-shadow 500ms var(--ease-soft); }
.nav a:hover, .nav a:focus-visible { transition-duration: 350ms; }

/* Content that appears (terminal lines, tab panels, the module panel)
   fades up instead of popping in. */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.term-body .ln:not([hidden]) { animation: fade-up 480ms var(--ease-soft) both; }
.engine-detail:not([hidden]) { animation: fade-up 520ms var(--ease-soft) both; }
.detail-head, .detail-body { animation: fade-up 520ms var(--ease-soft) both; }
.detail-body { animation-delay: 90ms; }
.mod.is-trace { transition: background-color 600ms var(--ease-soft), box-shadow 600ms var(--ease-soft); }

/* Charts: bars grow on an eased curve; points scale and fade in. */
.js .anim-in .hbar-fill, .js .anim-in .stack-bar, .js .anim-in .vbar-fill { transition-duration: 900ms !important; transition-timing-function: var(--ease-soft) !important; }
.plot .mk { transform-box: fill-box; transform-origin: center; }
.plot .bar.mk { transform-origin: 50% 100%; }
.js .plot-ready .mk { opacity: 0; transform: scale(0.4); }
.js .plot-ready .bar.mk { transform: scaleY(0); }
.js .plot-in .mk { opacity: 1; transform: none; transition: opacity 520ms var(--ease-soft), transform 720ms var(--ease-soft); }
.js .anim-ready .dot { transform: scale(0.5); }
.js .anim-in .dot { transform: none; transition: opacity 500ms var(--ease-soft), transform 600ms var(--ease-soft); transition-delay: calc(var(--i, 0) * 160ms); }

@media (prefers-reduced-motion: reduce) {
  .dg .wire-live { animation: none; stroke-dasharray: none; }
  .term-body .ln, .engine-detail, .detail-head, .detail-body { animation: none !important; }
}
:root.reduce-motion .dg .wire-live { animation: none; stroke-dasharray: none; }

/* The demo video in the hero, and screenshots in the docs. */
.demo { margin: 0; border: 1px solid var(--line-strong); background: var(--term-bg); box-shadow: var(--shadow); scroll-margin-top: 88px; }
.demo-video { display: block; width: 100%; height: auto; aspect-ratio: 3024 / 1904; background: #000; }
.demo figcaption { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 12px 14px; border-top: 1px solid var(--line-strong); background: var(--bg-raised); font-size: 14px; color: var(--fg-muted); }
.demo-len { font: 600 13px var(--f-mono); color: var(--tool-ink); padding-right: 14px; border-right: 1px dashed var(--line-strong); grid-row: span 2; }
.demo-note { grid-column: 2; font-size: 13px; color: var(--fg-faint); }
.shot { border-radius: 0; }
.shot img { background: var(--term-bg); }
.arch-sec > .shot, .guide-step .shot { margin: 0; }
.shots-2 { align-items: start; }
