/* Reins site. One stylesheet, system fonts, no external resource.
   The palette is the one Reins already has: the ink and indigo of docs/media/hero.svg and
   of the driver's own overlay (packages/driver/src/overlay.ts). Every URL here is relative. */

/* ───────────────────────────── tokens ───────────────────────────── */
:root {
  color-scheme: light dark;
  --bg: #fafafc;
  --surface: #ffffff;
  --sunk: #f1f1f6;
  --ink: #16161d;
  --ink-2: #474859;
  --ink-3: #62637a;
  --line: rgba(22, 22, 40, 0.12);
  --line-2: rgba(22, 22, 40, 0.24);
  --accent: #5b5bf6;
  --accent-h: #4a49e6;
  --accent-ink: #4341d6;
  --accent-soft: rgba(91, 91, 246, 0.09);
  --on-accent: #ffffff;
  --ok: #136c34;
  --ok-soft: rgba(22, 163, 74, 0.12);
  --warn: #9a4a05;
  --warn-soft: rgba(217, 119, 6, 0.13);
  --danger: #b91c1c;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --code-bg: #f3f3f8;
  --code-ink: #20203a;
  --t-c: #62637a;
  --t-s: #166534;
  --t-k: #4341d6;
  --t-n: #9a4a05;
  --t-v: #0f6b66;
  --shadow: 0 10px 30px rgba(16, 16, 48, 0.1), 0 2px 6px rgba(16, 16, 48, 0.06);
  --shadow-lg: 0 30px 80px rgba(16, 16, 48, 0.18);
  --backdrop: rgba(8, 8, 18, 0.48);
  --glass: rgba(250, 250, 252, 0.86);
  /* the demo app in the playground keeps the colours of examples/kiosk */
  --k-bg: #f6f1ea;
  --k-surface: #ffffff;
  --k-surface-2: #efe8de;
  --k-text: #2a1f18;
  --k-muted: #6e6055;
  --k-border: #d9cfc2;
  --k-accent: #a84a1b;
  --k-accent-h: #8f3f16;
  --k-accent-text: #ffffff;
  --k-accent-soft: #f6e3d6;
  --k-danger: #b3261e;
  --k-ok: #1f6b3a;

  --radius: 14px;
  --radius-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Segoe UI Variable Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 60px;
  --gutter: 16px;
  --wrap: 1240px;
}
@media (min-width: 700px) {
  :root { --gutter: 28px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f14;
    --surface: #16161d;
    --sunk: #0a0a0e;
    --ink: #f1f1f6;
    --ink-2: #c5c6d4;
    --ink-3: #a3a4b5;
    --line: rgba(255, 255, 255, 0.11);
    --line-2: rgba(255, 255, 255, 0.24);
    --accent: #7c7cff;
    --accent-h: #8f8fff;
    --accent-ink: #a9a9ff;
    --accent-soft: rgba(124, 124, 255, 0.14);
    --on-accent: #0f0f14;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.13);
    --warn: #f5a524;
    --warn-soft: rgba(245, 165, 36, 0.13);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.13);
    --code-bg: #0a0a0e;
    --code-ink: #e4e4f0;
    --t-c: #9091a6;
    --t-s: #86efac;
    --t-k: #a9a9ff;
    --t-n: #fbbf24;
    --t-v: #5eead4;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
    --glass: rgba(15, 15, 20, 0.84);
    --k-bg: #17120e;
    --k-surface: #231c16;
    --k-surface-2: #2d241c;
    --k-text: #f3ebe2;
    --k-muted: #b3a595;
    --k-border: #3d3228;
    --k-accent: #e0803f;
    --k-accent-h: #ea9355;
    --k-accent-text: #1b1008;
    --k-accent-soft: #3a2616;
    --k-danger: #ff8a80;
    --k-ok: #7fd49a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f14;
  --surface: #16161d;
  --sunk: #0a0a0e;
  --ink: #f1f1f6;
  --ink-2: #c5c6d4;
  --ink-3: #a3a4b5;
  --line: rgba(255, 255, 255, 0.11);
  --line-2: rgba(255, 255, 255, 0.24);
  --accent: #7c7cff;
  --accent-h: #8f8fff;
  --accent-ink: #a9a9ff;
  --accent-soft: rgba(124, 124, 255, 0.14);
  --on-accent: #0f0f14;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.13);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.13);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.13);
  --code-bg: #0a0a0e;
  --code-ink: #e4e4f0;
  --t-c: #9091a6;
  --t-s: #86efac;
  --t-k: #a9a9ff;
  --t-n: #fbbf24;
  --t-v: #5eead4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
  --glass: rgba(15, 15, 20, 0.84);
  --k-bg: #17120e;
  --k-surface: #231c16;
  --k-surface-2: #2d241c;
  --k-text: #f3ebe2;
  --k-muted: #b3a595;
  --k-border: #3d3228;
  --k-accent: #e0803f;
  --k-accent-h: #ea9355;
  --k-accent-text: #1b1008;
  --k-accent-soft: #3a2616;
  --k-danger: #ff8a80;
  --k-ok: #7fd49a;
}
:root[data-theme="light"] { color-scheme: light; }

/* ───────────────────────────── base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 20px);
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
body > main, body > .doc { flex: 1 0 auto; }
img, svg, video { max-width: 100%; }
img, video { height: auto; display: block; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.15; font-family: var(--display); font-weight: 750; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
code, kbd, samp, pre { font-family: var(--mono); }
code { font-size: 0.88em; }
:not(pre) > code { padding: 0.12em 0.36em; border-radius: 6px; background: var(--sunk); color: var(--code-ink); overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 0.4em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--ink-2); font-size: 0.72rem; line-height: 1.5; text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
::selection { background: var(--accent); color: var(--on-accent); }
[hidden] { display: none !important; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.no-js .needs-js { display: none !important; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
/* a grid child is as narrow as its column, whatever it holds: a code block scrolls instead of widening the page */
.hero-grid > *, .shapes > *, .trio > *, .support > *, .footer-grid > *, .pg-head > *, .pg-grid > *, .pg-notes > *, .kiosk-body > *, .console > * { min-width: 0; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 200; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 650; text-decoration: none; }
.skip-link:focus { top: 10px; }
.icon { flex: none; }

.eyebrow { display: flex; align-items: center; gap: 0.6em; margin: 0 0 1.1rem; color: var(--ink-3); font: 600 0.76rem/1.4 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 9px; height: 9px; border: 2px solid currentColor; border-radius: 50%; flex: none; }
.lede { color: var(--ink-2); font-size: 1.14rem; line-height: 1.6; max-width: 42em; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); font: 650 0.7rem/1.6 var(--mono); letter-spacing: 0.03em; vertical-align: 0.1em; white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn, .tag-draft { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ───────────────────────────── buttons ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 44px; padding: 0 1.25em; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: 650 0.95rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-h); border-color: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--sunk); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 0.9em; font-size: 0.84rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

/* ───────────────────────────── header ───────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--glass); -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 8px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; color: var(--ink); text-decoration: none; font: 800 1.28rem/1 var(--display); letter-spacing: -0.035em; }
.logo { display: block; color: var(--ink); }
.logo-cursor { fill: var(--accent); }
.site-nav ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.site-nav a { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.94rem; }
.site-nav a:hover { background: var(--sunk); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
.header-tools { display: flex; align-items: center; gap: 4px; }
.tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-2); font: 550 0.88rem/1 var(--font); cursor: pointer; }
.tool-btn:hover { background: var(--sunk); color: var(--ink); }
.search-open { border-color: var(--line); padding: 0 8px 0 12px; }
.search-open .tool-label { color: var(--ink-3); }
.theme-toggle[data-mode="light"] .icon-fill { opacity: 0; }
.theme-toggle[data-mode="dark"] circle { fill: currentColor; }
.nav-toggle { display: none; }
@media (max-width: 1040px) {
  .search-open .tool-label, .search-open kbd { display: none; }
  .search-open { border-color: transparent; padding: 0 10px; }
}
@media (max-width: 860px) {
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; padding: 8px var(--gutter) 16px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .js .site-nav[data-open="true"] { display: block; }
  .js .site-nav ul { flex-direction: column; align-items: stretch; }
  .js .site-nav a { padding: 12px; font-size: 1rem; }
  .no-js .header-row { flex-wrap: wrap; padding-block: 8px; }
  .no-js .site-nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ───────────────────────────── footer ───────────────────────────── */
.site-footer { margin-top: clamp(4rem, 9vw, 7rem); padding: 3.5rem 0 3rem; border-top: 1px solid var(--line); background: var(--surface); font-size: 0.94rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } .footer-brand { grid-column: 1 / -1; } }
@media (min-width: 980px) { .footer-grid { grid-template-columns: 1.7fr repeat(3, 1fr); } .footer-brand { grid-column: auto; } }
.footer-brand p { max-width: 34em; margin: 1rem 0 0; color: var(--ink-2); }
.footer-brand .footer-small { color: var(--ink-3); font-size: 0.86rem; }
.site-footer h2 { margin: 0 0 0.9rem; color: var(--ink-3); font: 600 0.74rem/1.4 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.site-footer nav a { color: var(--ink); text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }

/* ───────────────────────────── code, tables, callouts (used everywhere) ───────────────────────────── */
.code { position: relative; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line); }
.code-lang { color: var(--ink-3); font: 600 0.7rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.copy { min-height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: 650 0.76rem/1 var(--font); cursor: pointer; }
.copy:hover { background: var(--line); color: var(--ink); }
.copy[data-done] { color: var(--ok); }
.no-js .copy { display: none; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-ink); font-size: 0.84rem; line-height: 1.62; tab-size: 2; }
.code pre code { font-size: inherit; }
.t-c { color: var(--t-c); }
.t-s { color: var(--t-s); }
.t-k { color: var(--t-k); }
.t-n, .t-f { color: var(--t-n); }
.t-v, .t-p { color: var(--t-v); }

.table-wrap { margin: 0 0 1.5em; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.5; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--sunk); color: var(--ink-2); font: 650 0.78rem/1.5 var(--font); letter-spacing: 0.02em; white-space: nowrap; }
tr:last-child > td { border-bottom: 0; }
td:first-child > code:only-child { white-space: nowrap; }
/* in a table, code breaks at spaces only: a column gets wider and the table scrolls, but an identifier stays whole */
td code, th code { overflow-wrap: normal; }
@media (max-width: 700px) { th, td { min-width: 6.5em; padding: 9px 11px; } }

.callout { margin: 0 0 1.5em; padding: 14px 18px; border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 0.3em; color: var(--accent-ink); font: 700 0.76rem/1.5 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.callout-warning, .callout-caution { border-left-color: var(--warn); background: var(--warn-soft); }
.callout-warning .callout-title, .callout-caution .callout-title { color: var(--warn); }
.callout-tip { border-left-color: var(--ok); background: var(--ok-soft); }
.callout-tip .callout-title { color: var(--ok); }

/* ───────────────────────────── home ───────────────────────────── */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0 0; }
.section-head { max-width: 46rem; margin-bottom: clamp(1.8rem, 4vw, 3rem); }
.section-head h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.section-head p:not(.eyebrow) { color: var(--ink-2); font-size: 1.1rem; margin: 0; }

.hero { position: relative; padding: clamp(2.5rem, 7vw, 5.5rem) 0 0; overflow: hidden; }
.hero-grid { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 1000px) { .hero-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); } }
.hero h1 { margin: 0 0 1.4rem; font-size: clamp(2.5rem, 6.4vw, 4.7rem); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98; }
.hero h1 .hl { display: block; color: var(--accent-ink); }
.hero .lede { margin-bottom: 2rem; }
.hero-meta { margin: 1.4rem 0 0; color: var(--ink-3); font-size: 0.88rem; }

.stage { position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.stage svg { display: block; width: 100%; height: auto; }
.stage figcaption { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 20px 14px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.86rem; }
.stage figcaption span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.rs-label { font: 600 15px var(--mono); fill: var(--ink-3); text-anchor: middle; }
.rs-you { font: 650 15px var(--font); fill: var(--ink); text-anchor: middle; }
.rs-ring { fill: none; stroke: var(--line-2); stroke-width: 2.5; }
.rs-hand { fill: var(--surface); stroke: var(--ink); stroke-width: 4.5; }
.rs-rein { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.rs-ok circle { fill: var(--ok); }
.rs-wait circle { fill: var(--warn); }
.rs-ok path, .rs-wait path { fill: none; stroke: var(--surface); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.rs-waits { font: 700 14px var(--font); fill: var(--warn); text-anchor: middle; }
.rs-ok, .rs-wait, .rs-waits { opacity: 0; transition: opacity 0.2s; }
.rs-node.is-done .rs-ok, .rs-node.is-waiting .rs-wait, .rs-node.is-waiting .rs-waits { opacity: 1; }
.rs-agent path { fill: var(--accent); stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.rs-agent rect { fill: var(--accent); }
.rs-agent text { font: 700 12.5px var(--font); fill: var(--on-accent); text-anchor: middle; }

.film { margin: 0; }
.film video { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #16161d; box-shadow: var(--shadow); aspect-ratio: 16 / 9; }
.film figcaption { max-width: 60rem; margin-top: 1rem; color: var(--ink-3); font-size: 0.9rem; }
.stills { display: grid; gap: 14px; margin: 2rem 0 0; padding: 0; list-style: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .stills { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .stills { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.stills figure { margin: 0; }
.stills img { width: 100%; border: 1px solid var(--line); border-radius: 12px; }
.stills figcaption { margin-top: 0.5rem; color: var(--ink-2); font-size: 0.86rem; line-height: 1.45; }

.diagram { margin: 0 0 2rem; }
.diagram img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.shapes { display: grid; gap: 16px; }
@media (min-width: 800px) { .shapes { grid-template-columns: 1fr 1fr; } }
.shape { padding: 1.6rem 1.7rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.shape h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.shape p { color: var(--ink-2); }
.shape .more { font-weight: 650; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 1.1rem; padding: 0; list-style: none; font: 600 0.78rem/1 var(--mono); color: var(--ink-2); }
.chain li { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); }
.chain li.link { padding: 0 2px; border: 0; background: none; color: var(--accent-ink); }

.hands { display: grid; gap: 16px; }
@media (min-width: 980px) { .hands { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } .hand-levels { grid-row: span 2; } }
.hand { min-width: 0; padding: 1.6rem 1.7rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.hand h3 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.hand p { color: var(--ink-2); }
.hand { display: flex; flex-direction: column; }
.hand .more { margin: auto 0 0; padding-top: 0.4rem; font-weight: 650; }
.hand .table-wrap { margin: 1.1rem 0; }
/* a two-column table that fits a phone: the heading may wrap, the first column stays narrow */
.hand th { white-space: normal; }
.hand th:first-child, .hand td:first-child { min-width: 0; }
@media (max-width: 520px) { .hand { padding: 1.25rem 1.1rem; } }
.props { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
@media (min-width: 640px) { .props { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .props { grid-template-columns: repeat(4, 1fr); } }
.prop { padding: 1.6rem 1.5rem 1.8rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .prop { padding-right: 2rem; } }
@media (min-width: 1080px) { .prop { border-bottom: 0; border-right: 1px solid var(--line); padding-left: 1.5rem; } .prop:first-child { padding-left: 0; } .prop:last-child { border-right: 0; } }
.prop-metric { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 1.1rem; }
.prop-metric b { font: 800 2.9rem/1 var(--display); letter-spacing: -0.05em; }
.prop-metric span { color: var(--ink-3); font: 600 0.74rem/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.prop h3 { font-size: 1.22rem; margin-bottom: 0.45rem; }
.prop p { margin: 0; color: var(--ink-2); font-size: 0.97rem; }

/* the rein: a line down the page with a ring at every step */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step { position: relative; padding: 0 0 2.6rem 3rem; counter-increment: step; }
.step::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--bg); font: 750 0.86rem/1 var(--mono); }
.step::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2.5px; border-radius: 2px; background: var(--line-2); }
.step:last-child { padding-bottom: 0; }
.step:last-child::after { display: none; }
.step h3 { font-size: 1.35rem; margin-bottom: 0.4rem; }
.step > p { color: var(--ink-2); max-width: 44rem; }
.step .code { max-width: 52rem; }
.step .more { font-weight: 650; }

.profiles .table-wrap { margin-bottom: 1rem; }
.profiles td:first-child { color: var(--ink-2); white-space: nowrap; }
.note { color: var(--ink-3); font-size: 0.94rem; }

.trio { display: grid; gap: 16px; }
@media (min-width: 900px) { .trio { grid-template-columns: repeat(3, 1fr); } }
.trio article { display: flex; flex-direction: column; padding: 1.6rem 1.7rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.trio .big { margin: 0 0 0.6rem; font: 800 2.6rem/1 var(--display); letter-spacing: -0.05em; }
.trio .big small { margin-left: 0.4rem; color: var(--ink-3); font: 600 0.74rem/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.trio h3 { font-size: 1.2rem; }
.trio p { color: var(--ink-2); font-size: 0.97rem; }
.trio .more { margin: auto 0 0; font-weight: 650; }

.support { display: grid; gap: 1.5rem; padding: 1.8rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
@media (min-width: 860px) { .support { grid-template-columns: 0.8fr 1.2fr; align-items: start; } }
.support h2 { font-size: 1.5rem; margin: 0; }
.support ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.7rem; }
.support li { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; align-items: baseline; }
.support p { margin: 0; color: var(--ink-2); }

.map { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.map a { display: block; height: 100%; padding: 1.3rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.map a:hover { border-color: var(--accent); transform: translateY(-2px); }
.map strong { display: block; margin-bottom: 0.25rem; font: 750 1.08rem/1.3 var(--display); letter-spacing: -0.015em; }
.map span { color: var(--ink-2); font-size: 0.92rem; }

/* ───────────────────────────── wiki ───────────────────────────── */
.doc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 clamp(1.5rem, 3vw, 3rem); align-items: start; padding-top: 1.25rem; }
.sidebar { font-size: 0.92rem; }
.side-home { display: block; padding: 7px 10px; margin: 0 0 0.6rem -10px; border-radius: 8px; color: var(--ink); font-weight: 650; text-decoration: none; }
.side-home:hover, .side-home[aria-current="page"] { background: var(--sunk); }
.side-group { margin-bottom: 1.4rem; }
.side-group h2 { margin: 0 0 0.35rem; color: var(--ink-3); font: 600 0.71rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.side-group ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.side-group a { display: block; margin-left: -1px; padding: 5px 10px 5px 13px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side-group a:hover { color: var(--ink); border-left-color: var(--line-2); }
.side-group a[aria-current="page"] { border-left-color: var(--accent); color: var(--ink); font-weight: 650; background: linear-gradient(90deg, var(--accent-soft), transparent); }
.side-toggle { display: none; }

@media (max-width: 899px) {
  .js .side-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-bottom: 0.5rem; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font: 650 0.9rem/1 var(--font); cursor: pointer; }
  .js .sidebar { display: none; margin-bottom: 1.5rem; padding: 1rem 1.1rem 0.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .js .sidebar[data-open="true"] { display: block; }
  .no-js .sidebar { order: 3; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
  .no-js .doc-main { order: 2; }
}
@media (min-width: 900px) {
  .doc { grid-template-columns: 236px minmax(0, 1fr); }
  .sidebar { position: sticky; top: calc(var(--header-h) + 1.25rem); max-height: calc(100vh - var(--header-h) - 1.25rem); padding: 0 6px 2rem 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .toc { display: none; }
}
@media (min-width: 1220px) {
  .doc { grid-template-columns: 236px minmax(0, 1fr) 216px; }
  .doc-wide { grid-template-columns: 236px minmax(0, 1fr); }
  .toc { display: block; }
}
.toc { position: sticky; top: calc(var(--header-h) + 1.25rem); max-height: calc(100vh - var(--header-h) - 2.5rem); overflow-y: auto; scrollbar-width: thin; padding-bottom: 1rem; font-size: 0.85rem; }
@media (max-width: 1219px) { .toc { display: none; } }
.toc h2 { margin: 0 0 0.6rem; color: var(--ink-3); font: 600 0.71rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc a { display: block; margin-left: -1px; padding: 4px 0 4px 12px; border-left: 2px solid transparent; color: var(--ink-3); text-decoration: none; line-height: 1.35; }
.toc .toc-3 a { padding-left: 24px; }
.toc a:hover { color: var(--ink); }
.toc a.is-current { border-left-color: var(--accent); color: var(--ink); }

.doc-main { min-width: 0; padding-bottom: 2rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; margin: 0 0 1.6rem; padding: 0; list-style: none; color: var(--ink-3); font-size: 0.86rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--line-2); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink-2); }

.doc-head { margin-bottom: 2.2rem; }
.doc-head h1 { font-size: clamp(2.1rem, 4.6vw, 3.1rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.04; margin-bottom: 0.9rem; }
.doc-head .lede { margin: 0; }
.source-note { margin: 1.2rem 0 0; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--ink-2); font-size: 0.88rem; max-width: 46rem; }

.prose { max-width: 47rem; font-size: 1.04rem; line-height: 1.7; }
.prose > h2 { position: relative; margin: 2.8em 0 0.7em; padding-top: 0.1em; font-size: 1.62rem; font-weight: 780; letter-spacing: -0.03em; }
.prose > h3 { margin: 2.1em 0 0.6em; font-size: 1.22rem; font-weight: 720; }
.prose > h4 { margin: 1.9em 0 0.5em; font-size: 1.02rem; font-weight: 720; letter-spacing: 0; }
.prose > h2:first-child, .prose > header + h2 { margin-top: 0.5em; }
.prose li { margin: 0.3em 0; }
.prose li > ul, .prose li > ol { margin: 0.3em 0; }
.prose li > p { margin: 0 0 0.5em; }
.prose blockquote { margin: 0 0 1.2em; padding: 0.1em 0 0.1em 1.1em; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { margin: 0.5em 0; border: 1px solid var(--line); border-radius: var(--radius); }
.anchor { margin-left: 0.3em; color: var(--ink-3); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity 0.12s; }
:is(h2, h3, h4):hover > .anchor, .anchor:focus-visible { opacity: 1; }
@media (hover: none) { .anchor { opacity: 0.5; } }
/* the rein runs down the article, with a ring at every section */
@media (min-width: 1000px) {
  .prose { padding-left: 1.9rem; border-left: 2px solid var(--line); margin-left: 6px; }
  .prose > h2::before { content: ""; position: absolute; left: calc(-1.9rem - 8px); top: 0.42em; width: 14px; height: 14px; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--bg); }
  .prose > h2:target::before { border-color: var(--accent); background: var(--accent); }
}

.doc-foot { max-width: 49rem; margin-top: 3.5rem; }
.edit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin: 0 0 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: 0.9rem; }
.edit a { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.edit-path { color: var(--ink-3); }
.edit .md-link { margin-left: auto; color: var(--ink-3); font-weight: 500; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color 0.15s; }
.pager a:hover { border-color: var(--accent); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-dir { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 0.8rem; }
.pager-title { font-weight: 680; line-height: 1.3; }
@media (max-width: 520px) { .pager { grid-template-columns: 1fr; } }

.wiki-head { max-width: 50rem; }
.wiki-meta { color: var(--ink-2); margin-top: 1rem; }
.wiki-section { padding: 2.2rem 0 0.6rem; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 12px); }
.wiki-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; margin-bottom: 1.1rem; }
.wiki-section-head h2 { margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em; }
.wiki-section-head p { margin: 0; color: var(--ink-3); }
.wiki-list { display: grid; gap: 4px 20px; margin: 0 0 1.4rem; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.wiki-list a { display: block; height: 100%; padding: 10px 12px; margin-inline: -12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.wiki-list a:hover { background: var(--sunk); }
.wiki-title { display: block; font-weight: 680; }
.wiki-list a:hover .wiki-title { color: var(--accent-ink); }
.wiki-desc { display: block; color: var(--ink-2); font-size: 0.88rem; line-height: 1.45; }

.notfound { padding-block: clamp(4rem, 12vw, 9rem); }
.notfound h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.04em; }
.notfound .lede { margin-bottom: 2rem; }

/* ───────────────────────────── search ───────────────────────────── */
.search { width: min(680px, calc(100vw - 24px)); max-height: min(78vh, 720px); margin: 9vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
.search::backdrop { background: var(--backdrop); }
.search[open] { display: flex; }
.search-box { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.search-field input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; color: var(--ink); font: 400 1.05rem var(--font); outline: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-close { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--sunk); color: var(--ink-2); font: 600 0.8rem var(--font); cursor: pointer; }
.search-status { margin: 0; padding: 10px 18px 6px; color: var(--ink-3); font-size: 0.82rem; }
.search-status:empty { display: none; }
.search-results { margin: 0; padding: 4px 8px 10px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.search-results a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results li[aria-selected="true"] a { background: var(--accent-soft); }
.sr-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; font-weight: 660; line-height: 1.35; }
.sr-where small { color: var(--ink-3); font: 600 0.7rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.sr-snippet { display: block; margin-top: 2px; color: var(--ink-2); font-size: 0.86rem; line-height: 1.45; }
.search mark { padding: 0 1px; border-radius: 3px; background: var(--warn-soft); color: inherit; font-weight: 650; }

/* ───────────────────────────── playground ───────────────────────────── */
.pg-head { display: grid; gap: 1.2rem 2.5rem; padding-top: clamp(1.6rem, 4vw, 2.8rem); padding-bottom: 1.4rem; align-items: end; }
@media (min-width: 1000px) { .pg-head { grid-template-columns: minmax(0, 1fr) auto; } }
.pg-head h1 { margin-bottom: 0.7rem; font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.03; }
.pg-head .lede { margin: 0; font-size: 1.04rem; }
.pg-profiles { display: flex; flex-direction: column; gap: 6px; }
.pg-profiles > span { color: var(--ink-3); font: 600 0.72rem/1.4 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunk); }
.seg a { padding: 7px 15px; border-radius: 999px; color: var(--ink-2); font: 650 0.88rem/1.2 var(--mono); text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 16, 48, 0.16); }

.pg-grid { display: grid; gap: 18px; align-items: start; }
@media (min-width: 1080px) { .pg-grid { grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr); } }
.pg-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.pg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.pg-bar .pg-status { flex: 1 1 14rem; min-width: 0; min-height: 4.05em; margin: 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.35; }
.pg-status b { color: var(--ink); }
.pg-status[data-tone="ok"] b { color: var(--ok); }
.pg-status[data-tone="warn"] b { color: var(--warn); }
.pg-status[data-tone="danger"] b { color: var(--danger); }

/* the demo app: Brew Kiosk, in its own colours */
.kiosk { padding: 18px; background: var(--k-bg); color: var(--k-text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.4; }
.kiosk h2 { margin: 0; color: var(--k-accent); font: 800 1.45rem/1.1 system-ui, sans-serif; letter-spacing: -0.02em; }
.kiosk-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.kiosk-top p { margin: 0; color: var(--k-muted); font-size: 0.9rem; }
.kiosk-body { display: grid; gap: 14px; }
@media (min-width: 620px) { .kiosk-body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.kiosk-menu { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.k-card { display: flex; flex-direction: column; gap: 3px; min-height: 92px; padding: 11px 12px; border: 1.5px solid var(--k-border); border-radius: 12px; background: var(--k-surface); color: var(--k-text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.12s, transform 0.1s; }
.k-card:hover { border-color: var(--k-accent); }
.k-card:active { transform: scale(0.98); }
.k-card:focus-visible, .kiosk :focus-visible { outline: 2px solid var(--k-accent); outline-offset: 2px; }
.k-name { font-weight: 750; font-size: 0.98rem; }
.k-note { color: var(--k-muted); font-size: 0.76rem; line-height: 1.3; }
.k-price { margin-top: auto; color: var(--k-accent); font-weight: 750; font-size: 0.92rem; }
.kiosk-side { display: grid; gap: 10px; align-content: start; }
.k-panel { padding: 13px 14px; border: 1.5px solid var(--k-border); border-radius: 12px; background: var(--k-surface); }
.k-panel h3 { margin: 0 0 8px; color: var(--k-muted); font: 700 0.7rem/1.4 system-ui, sans-serif; letter-spacing: 0.1em; text-transform: uppercase; }
.k-lines { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 0.9rem; }
.k-lines li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; }
.k-qty { color: var(--k-muted); font-variant-numeric: tabular-nums; }
.k-remove { padding: 2px 8px; border: 1px solid var(--k-border); border-radius: 999px; background: transparent; color: var(--k-muted); font: 600 0.72rem system-ui, sans-serif; cursor: pointer; }
.k-remove:hover { color: var(--k-text); border-color: var(--k-muted); }
.k-empty { margin: 0 0 8px; color: var(--k-muted); font-size: 0.86rem; }
.k-total { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; }
.k-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.kiosk label { display: block; margin: 0 0 4px; color: var(--k-muted); font-size: 0.78rem; }
.kiosk input { width: 100%; height: 38px; margin: 0 0 9px; padding: 0 11px; border: 1.5px solid var(--k-border); border-radius: 9px; background: var(--k-bg); color: var(--k-text); font: 1rem system-ui, sans-serif; }
.k-btn { width: 100%; min-height: 42px; border: 0; border-radius: 10px; background: var(--k-accent); color: var(--k-accent-text); font: 750 0.95rem system-ui, sans-serif; cursor: pointer; }
.k-btn:hover { background: var(--k-accent-h); }
.k-btn:disabled { background: var(--k-surface-2); color: var(--k-muted); cursor: not-allowed; }
.k-btn-quiet { background: var(--k-surface-2); color: var(--k-text); }
.k-btn-quiet:hover { background: var(--k-border); }
.k-confirm { margin: 8px 0 0; color: var(--k-ok); font-size: 0.86rem; font-weight: 650; min-height: 1.2em; }
.k-confirm.is-error { color: var(--k-danger); }
.k-chart-title { margin: 0 0 6px; font-size: 0.9rem; font-weight: 700; }
.k-bars { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.78rem; }
.k-bars li { display: grid; grid-template-columns: 5.6em 1fr auto; gap: 8px; align-items: center; }
.k-track { height: 9px; border-radius: 999px; background: var(--k-surface-2); overflow: hidden; }
.k-fill { display: block; height: 100%; border-radius: 999px; background: var(--k-accent); }
.k-staff summary { cursor: pointer; color: var(--k-muted); font-size: 0.84rem; font-weight: 650; padding: 4px 2px; border-radius: 6px; }
.k-staff[open] summary { margin-bottom: 8px; }
.k-staff-result { margin: 8px 0 0; font-size: 0.84rem; min-height: 1.2em; }
.k-staff-result.is-error { color: var(--k-danger); }

/* the side panel: wire, console, script, audit */
.pg-tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.pg-tabs button { position: relative; padding: 9px 14px 11px; border: 0; background: transparent; color: var(--ink-3); font: 650 0.9rem/1 var(--font); cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.pg-tabs button:hover { color: var(--ink); }
.pg-tabs button[aria-selected="true"] { color: var(--ink); }
.pg-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--accent); }
.pg-tabs .count { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--sunk); color: var(--ink-3); font: 650 0.68rem/1.5 var(--mono); }
.pg-tabpanel { display: flex; flex-direction: column; height: min(72vh, 700px); min-height: 420px; }
.pg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-3); }
.pg-tools .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-3); font: 650 0.74rem/1 var(--mono); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--line-2); background: var(--sunk); color: var(--ink); }
.chip:hover { color: var(--ink); }
.wire-find { flex: 1 1 8.5em; min-width: 0; max-width: 13em; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: 0.74rem/1 var(--mono); }
.wire-find::placeholder { color: var(--ink-3); }
.pg-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pg-empty { margin: 0; padding: 2rem 1.5rem; color: var(--ink-3); font-size: 0.92rem; text-align: center; }

.frames { margin: 0; padding: 0; list-style: none; font: 0.78rem/1.45 var(--mono); }
.frame { border-bottom: 1px solid var(--line); }
.frame summary { display: grid; grid-template-columns: 3.9em 8.4em 5.4em minmax(0, 1fr); gap: 0 6px; align-items: baseline; padding: 6px 12px; cursor: pointer; list-style: none; }
.frame summary::-webkit-details-marker { display: none; }
.frame summary:hover, .frame[open] summary { background: var(--sunk); }
.f-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.f-lane { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-type { font-weight: 700; color: var(--ink); }
.f-sum { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-sum b { color: var(--ink); font-weight: 700; }
.f-seal { margin-left: 6px; color: var(--ok); font-weight: 700; }
.frame[data-t="req"] .f-type { color: var(--accent-ink); }
.frame[data-t="res"] .f-type { color: var(--ok); }
.frame[data-err] .f-type, .frame[data-t="bye"] .f-type { color: var(--danger); }
.frame[data-t="evt"] .f-type, .frame[data-t="flow"] .f-type { color: var(--warn); }
.frame[data-lane="surface"] summary { box-shadow: inset 3px 0 0 var(--k-accent); }
.frame[data-lane="agent"] summary, .frame[data-lane="console"] summary { box-shadow: inset 3px 0 0 var(--accent); }
.f-body { margin: 0; padding: 8px 12px 12px 18px; background: var(--code-bg); color: var(--code-ink); overflow-x: auto; white-space: pre; font-size: 0.76rem; line-height: 1.55; }
.f-note { margin: 0; padding: 6px 12px 8px 18px; background: var(--code-bg); color: var(--ink-3); font: 0.76rem/1.45 var(--font); border-top: 1px dashed var(--line); }
@media (max-width: 520px) {
  .frame summary { grid-template-columns: 3.6em 4.8em minmax(0, 1fr); }
  .f-lane { display: none; }
}

.console { padding: 14px; display: grid; gap: 12px; }
.console-row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.field label { display: block; margin: 0 0 5px; color: var(--ink-3); font: 600 0.72rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.field select, .field textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); font: 0.86rem/1.5 var(--mono); }
.field select { height: 42px; padding: 0 10px; }
.field textarea { min-height: 104px; padding: 10px 12px; resize: vertical; tab-size: 2; }
.console-hint { margin: 0; color: var(--ink-3); font-size: 0.84rem; }
.console-hint code { font-size: 0.8rem; }
.console-out { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.console-out li { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.co-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 7px 12px; background: var(--sunk); font: 0.76rem/1.5 var(--mono); }
.co-head b { color: var(--ink); }
.co-ok { color: var(--ok); font-weight: 700; }
.co-err { color: var(--danger); font-weight: 700; }
.co-local { color: var(--warn); font-weight: 700; }
.co-body { margin: 0; padding: 10px 12px; max-height: 300px; overflow: auto; background: var(--code-bg); color: var(--code-ink); font: 0.76rem/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.script-log { margin: 0; padding: 8px 0; list-style: none; font: 0.8rem/1.5 var(--mono); }
.script-log li { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); gap: 0 8px; padding: 4px 14px; }
.script-log .s-step { grid-template-columns: 1fr; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); font: 650 0.86rem/1.4 var(--font); }
.script-log .s-step:first-child { margin-top: 0; border-top: 0; }
.s-tag { font-weight: 700; }
.s-ok .s-tag { color: var(--ok); }
.s-held .s-tag { color: var(--warn); }
.s-err .s-tag { color: var(--danger); }
.s-text { color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.script-log pre { grid-column: 1 / -1; margin: 6px 0 2px; padding: 10px 12px; border-radius: 10px; background: var(--code-bg); color: var(--code-ink); font: 0.74rem/1.5 var(--mono); overflow-x: auto; }

.audit { width: 100%; font: 0.74rem/1.45 var(--mono); }
.audit th { position: sticky; top: 0; font: 650 0.68rem/1.5 var(--mono); }
.audit td { padding: 6px 10px; white-space: nowrap; }
.audit .a-hash { color: var(--ink-3); }

.pg-notes { display: grid; gap: 2rem 3rem; margin-top: clamp(2.5rem, 6vw, 4.5rem); }
@media (min-width: 960px) { .pg-notes { grid-template-columns: 1fr 1fr; } }
.pg-notes h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.pg-notes p, .pg-notes li { color: var(--ink-2); }
.pg-notes li { margin: 0.4em 0; }
.noscript-note { margin: 0 0 1rem; padding: 14px 18px; border-left: 3px solid var(--warn); border-radius: 0 var(--radius) var(--radius) 0; background: var(--warn-soft); }

/* ───────────────────────────── motion, print ───────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero-copy > * { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.06s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.12s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.18s; }
  .hero .stage { animation: rise 0.7s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .frame.is-new summary { animation: flash 0.9s ease-out; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .sidebar, .toc, .side-toggle, .pager, .copy, .skip-link { display: none !important; }
  .doc { display: block; }
  .prose { border: 0; padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
}
