/* relevo · macrostructure: Narrative Workflow · move: M05 · nav: N9 · footer: Ft2 · slop: pass (42–45) · critique: landing P4/H5/E4/S4/R5/V5 · docs P4/H4/E4/S4/R4/V4 */

/* ── tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg:       oklch(98% 0.008 257);
  --surface:  oklch(99.6% 0.005 257);
  --grid:     oklch(93.5% 0.012 257);
  --border:   oklch(90.5% 0.014 257);
  --fg:       oklch(29.5% 0.037 259);
  --dim:      oklch(45.5% 0.035 257);
  --ink:      oklch(50% 0.215 262);
  --ink-deep: oklch(38% 0.18 262);

  --sel:  rgba(15, 85, 219, 0.15);
  --wash: rgba(15, 85, 219, 0.07);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  --s-xs: 0.5rem;
  --s-sm: 1rem;
  --s-md: 1.75rem;
  --s-lg: 3rem;
  --s-xl: 5rem;
  --s-xxl: 8rem;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --rule: 1px solid var(--border);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  accent-color: var(--ink);
}

/* ── cyanotype ──────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       oklch(21% 0.055 258);
    --surface:  oklch(25.5% 0.055 258);
    --grid:     oklch(34% 0.045 258);
    --border:   oklch(46% 0.042 258);
    --fg:       oklch(96% 0.014 258);
    --dim:      oklch(76% 0.032 258);
    --ink:      oklch(72% 0.145 248);
    --ink-deep: oklch(83% 0.11 248);
    --sel:      rgb(80 171 250 / 0.22);
    --wash:     rgb(80 171 250 / 0.10);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:       oklch(21% 0.055 258);
  --surface:  oklch(25.5% 0.055 258);
  --grid:     oklch(34% 0.045 258);
  --border:   oklch(46% 0.042 258);
  --fg:       oklch(96% 0.014 258);
  --dim:      oklch(76% 0.032 258);
  --ink:      oklch(72% 0.145 248);
  --ink-deep: oklch(83% 0.11 248);
  --sel:      rgb(80 171 250 / 0.22);
  --wash:     rgb(80 171 250 / 0.10);
  color-scheme: dark;
}

/* ── base ───────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
  touch-action: manipulation;
  caret-color: var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--dim) var(--bg);
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

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

::selection { background: var(--sel); color: var(--fg); }
@supports (color: color-mix(in oklch, red, blue)) {
  ::selection { background: color-mix(in oklch, var(--ink) 18%, transparent); color: var(--fg); }
}

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

h1, h2, h3 { text-wrap: balance; }
p, li, dd  { text-wrap: pretty; }

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in oklch, currentColor 40%, transparent);
  transition: color 200ms ease, text-decoration-color 200ms ease;
}
a:hover { color: var(--ink-deep); text-decoration-color: currentColor; }

b, strong { font-weight: 600; color: var(--fg); }

code, pre, kbd, samp { font-family: var(--mono); }

/* every surface that sets the mono face: ligatures off, so flags render as typed */
code, pre, kbd, samp, .sched dt, .colophon__spec,
.map__svg .t-path, .map__svg .t-file, .map__svg .t-verbs, .map__svg .t-edge,
.wire .t-mono, .wire .t-edge {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0, "calt" 0;
}

code {
  font-size: 0.84em;
  background: var(--grid);
  color: var(--fg);
  padding: 0.1em 0.36em;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
/* narrow columns and phones: let a long literal wrap rather than push the page wide */
.sched dd code, .steps dd code, .codes dd code, .legend__row code { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 619.98px) { code { white-space: normal; overflow-wrap: anywhere; } }

pre {
  margin: var(--s-md) 0;
  padding: 1.15rem 1.3rem;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  font-size: 0.8125rem;
  line-height: 1.75;
  color: var(--fg);
  tab-size: 2;
}
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; white-space: inherit; overflow-wrap: normal; }
pre .c { color: var(--dim); }

pre::-webkit-scrollbar { height: 8px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-pill); }

.ico { width: 0.95em; height: 0.95em; flex: none; margin-left: 0.3em; vertical-align: -0.1em; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--ink); border-radius: var(--r-sm);
  padding: 0.65rem 1rem;
  font-size: 0.875rem; font-weight: 500; text-decoration: none;
}
.skip:focus { left: var(--gutter); top: 0.75rem; }

.wrap { width: min(100% - (var(--gutter) * 2), 1200px); margin-inline: auto; }

[id] { scroll-margin-top: 0.5rem; }

/* ── nav · N9 edge-aligned minimal ──────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: var(--rule);
}
.topbar__in {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
  min-height: 3.75rem;
}

.topbar__brand { display: flex; align-items: center; gap: 0.75rem; flex: none; }

.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 600; font-size: 1.125rem; line-height: 1;
  letter-spacing: -0.02em; color: var(--fg); text-decoration: none;
}
.wordmark:hover { color: var(--fg); }
.wordmark__glyph { width: 22px; height: 22px; flex: none; display: block; }

.topbar__crumb { font-size: 0.875rem; color: var(--dim); white-space: nowrap; }

.topbar__nav {
  display: flex; align-items: center; gap: clamp(1rem, 2.6vw, 2rem);
  min-width: 0; overflow-x: auto; scrollbar-width: none;
  /* room for a focus ring (2px + 3px offset) inside the scroll box, which clips */
  padding: 6px; margin: -6px;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav a {
  font-size: 0.875rem; font-weight: 500; color: var(--dim);
  text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap;
  min-height: 44px;
}
.topbar__nav a:hover { color: var(--fg); }

@media (max-width: 419.98px) {
  .topbar__nav { gap: 0.85rem; flex-wrap: wrap; justify-content: flex-end; row-gap: 0; }
  .topbar__crumb { display: none; }
}

.theme {
  font: 500 0.875rem/1 var(--sans); color: var(--dim);
  background: none; border: var(--rule); border-radius: var(--r-pill);
  padding: 0.45rem 0.8rem; margin: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap;
  transition: color 200ms ease, border-color 200ms ease;
}
.theme::before {
  content: ""; inline-size: 0.7em; block-size: 0.7em; border-radius: var(--r-pill);
  border: 1px solid currentColor;
  background: linear-gradient(to right, currentColor 50%, transparent 50%);
}
.theme:hover { color: var(--fg); border-color: var(--dim); }

/* ── hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(3rem, 7vw, 6rem) clamp(4.5rem, 10vw, 8rem);
}
.hero__mast {
  display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.5rem);
  margin: 0 0 var(--s-lg);
  font-weight: 600;
  font-size: clamp(3rem, 1.6rem + 6vw, 6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fg);
}
.hero__glyph { width: 0.72em; height: 0.72em; flex: none; display: block; }

h1 {
  margin: 0;
  max-width: 17ch;
  font-weight: 600;
  font-size: clamp(2.375rem, 1.35rem + 3.4vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.036em;
  color: var(--fg);
}

.lede {
  margin: var(--s-md) 0 0;
  max-width: 58ch;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.3125rem);
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--dim);
}

.hero__act {
  display: grid;
  gap: var(--s-md);
  margin-top: var(--s-lg);
  align-items: start;
}
@media (min-width: 760px) {
  .hero__act { grid-template-columns: auto minmax(0, 52ch); justify-content: start; column-gap: var(--s-lg); }
}

.cta {
  display: inline-flex; align-items: center; justify-self: start;
  min-height: 48px;
  padding: 0.8rem 1.35rem;
  border-radius: var(--r-pill);
  color: var(--bg);
  background: var(--ink);
  font-size: 0.9375rem; font-weight: 500; line-height: 1.2;
  text-decoration: none;
  transition: background-color 200ms ease;
}
.cta:hover, .cta:active { background: var(--ink-deep); color: var(--bg); }

.hard {
  margin: 0;
  max-width: 52ch;
  padding-left: var(--s-sm);
  border-left: var(--rule);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--dim);
}

/* ── diagram stage ──────────────────────────────────────────────────────── */

.map { margin: 0; }
/* the stage panel frames the drawn diagram only; the stacked node list stands on the page,
   so its node boxes never sit inside a second box */
@media (min-width: 1000px) {
  .map {
    padding: clamp(1rem, 2.6vw, 2.25rem);
    background: var(--surface);
    border: var(--rule);
    border-radius: var(--r-lg);
  }
}

.map__frame { --map-pad: clamp(0.5rem, 1.4vw, 1rem); padding: var(--map-pad); }

.legend {
  display: grid;
  gap: 0.75rem;
  margin: clamp(1rem, 2vw, 1.5rem) 0 0;
  padding-top: 1.1rem;
  border-top: var(--rule);
}
@media (min-width: 840px) {
  .legend { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 clamp(2rem, 4vw, 3.5rem); }
}

.legend__row {
  display: flex; gap: 0.85rem; align-items: flex-start;
  margin: 0; max-width: 58ch;
  font-size: 0.875rem; line-height: 1.55; color: var(--dim);
}
.legend__row b { color: var(--fg); font-weight: 600; }

.swatch { width: 34px; height: 8px; flex: none; margin-top: 0.55em; overflow: visible; }
.swatch__solid { stroke: var(--ink); stroke-width: 1.5; }
.swatch__dash  { stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 5 4; }
.swatch__head  { fill: var(--ink); }
.swatch__headd { fill: var(--dim); }

/* stacked schematic (default, narrow) */

.map__svg { display: none; }

.map__nodes { list-style: none; margin: 0; padding: 0; }

.node a {
  display: block;
  padding: 1rem 1.15rem;
  background: var(--bg);
  border: var(--rule);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 200ms ease;
}
.node a:hover { border-color: var(--ink); }

.node__name { display: block; font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.015em; color: var(--fg); }
.node__sub { display: block; margin-top: 0.4rem; font-size: 0.9375rem; line-height: 1.55; color: var(--dim); }
.node a:hover .node__name { color: var(--ink); }

.node__edge {
  position: relative;
  margin: 0;
  padding: 0.9rem 0 0.9rem 2.75rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--dim);
}
.node__edge::before {
  content: ""; position: absolute; left: 1.4rem; top: 0; bottom: 0;
  border-left: 1.5px solid var(--ink);
}
.node__edge--in::before { border-left-color: var(--dim); border-left-style: dashed; }
.node__edge::after {
  content: ""; position: absolute; left: calc(1.4rem - 3.75px); bottom: -1px;
  width: 0; height: 0;
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 6px solid var(--ink);
}
.node__edge--in::after { border-top-color: var(--dim); }
.node:last-child .node__edge { padding-bottom: 0.4rem; }

/* drawn schematic (wide) */

@media (min-width: 1000px) {
  .map__frame { position: relative; width: min(100%, 60rem); margin-inline: auto; }
  .map__svg { display: block; width: 100%; height: auto; overflow: visible; }
  .map__nodes { position: absolute; inset: var(--map-pad); pointer-events: none; }

  .node { position: absolute; }
  .node--planner { left: 6.364%;  top: 3.104%;  width: 30.909%; height: 23.947%; }
  .node--cli     { left: 6.364%;  top: 37.251%; width: 30.909%; height: 29.712%; }
  .node--state   { left: 51.364%; top: 24.834%; width: 23.636%; height: 68.514%; }
  .node--runner  { left: 77.727%; top: 3.104%;  width: 21.591%; height: 30.155%; }
  .node--daemon  { left: 6.364%;  top: 71.397%; width: 30.909%; height: 25.499%; }

  .node a {
    position: absolute; inset: 0;
    padding: 0; background: transparent; border: 0; pointer-events: auto;
  }
  /* the drawn rect carries the hover and focus state, so the highlight is always the box itself */
  .node a:hover { background: transparent; }
  .node a:focus-visible { outline: none; }
  .node__name, .node__sub {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .node__edge { display: none; }
}


.map__svg .n rect {
  fill: var(--bg);
  stroke: var(--fg);
  stroke-width: 1.5;
  rx: 6px;
  vector-effect: non-scaling-stroke;
  transition: fill 200ms ease, stroke 200ms ease, stroke-width 200ms ease;
}
.map__svg .t-name  { font-family: var(--sans); font-size: 19px; font-weight: 600; letter-spacing: -0.015em; fill: var(--fg); }
.map__svg .t-sub   { font-family: var(--sans); font-size: 16px; fill: var(--dim); }
.map__svg .t-path  { font-family: var(--mono); font-size: 15px; fill: var(--dim); }
.map__svg .t-file  { font-family: var(--mono); font-size: 15px; fill: var(--fg); }
.map__svg .t-verbs { font-family: var(--mono); font-size: 15px; fill: var(--dim); }
.map__svg .t-edge  { font-family: var(--mono); font-size: 15px; }
.map__svg .t-edge--out { fill: var(--ink); }
.map__svg .t-edge--in  { fill: var(--dim); }

.map__svg .edge { fill: none; stroke-width: 1.25; vector-effect: non-scaling-stroke; transition: stroke-width 200ms ease; }
.map__svg .edge--out { stroke: var(--ink); }
.map__svg .edge--in  { stroke: var(--dim); stroke-dasharray: 6 5; }
.map__svg .ah--out { fill: var(--ink); }
.map__svg .ah--in  { fill: var(--dim); }

.map__frame:has(.node--planner a:is(:hover, :focus-visible)) .n-planner rect,
.map__frame:has(.node--cli     a:is(:hover, :focus-visible)) .n-cli     rect,
.map__frame:has(.node--state   a:is(:hover, :focus-visible)) .n-state   rect,
.map__frame:has(.node--runner  a:is(:hover, :focus-visible)) .n-builder rect,
.map__frame:has(.node--daemon  a:is(:hover, :focus-visible)) .n-daemon  rect {
  stroke: var(--ink); stroke-width: 2.5;
}
@supports (color: color-mix(in oklch, red, blue)) {
  .map__frame:has(.node--planner a:is(:hover, :focus-visible)) .n-planner rect,
  .map__frame:has(.node--cli     a:is(:hover, :focus-visible)) .n-cli     rect,
  .map__frame:has(.node--state   a:is(:hover, :focus-visible)) .n-state   rect,
  .map__frame:has(.node--runner  a:is(:hover, :focus-visible)) .n-builder rect,
  .map__frame:has(.node--daemon  a:is(:hover, :focus-visible)) .n-daemon  rect {
    fill: color-mix(in oklch, var(--ink) 12%, var(--bg));
  }
}
.map__frame:has(.node--planner a:is(:hover, :focus-visible)) .e-ab,
.map__frame:has(.node--cli     a:is(:hover, :focus-visible)) .e-bc,
.map__frame:has(.node--state   a:is(:hover, :focus-visible)) .e-cd,
.map__frame:has(.node--runner  a:is(:hover, :focus-visible)) .e-dc,
.map__frame:has(.node--daemon  a:is(:hover, :focus-visible)) .e-ce,
.map__frame:has(.node--daemon  a:is(:hover, :focus-visible)) .e-ea {
  stroke-width: 2.25;
}

/* the one authored moment: nodes ink on, one at a time, capped at five */

@media (prefers-reduced-motion: no-preference) {
  @media (min-width: 1000px) {
    .js .map__frame .map__svg > g.reveal {
      opacity: 0;
      transition: opacity 460ms var(--ease) calc(var(--i) * 110ms);
    }
    .js .map__frame.is-in .map__svg > g.reveal { opacity: 1; }
  }
  @media (max-width: 999.98px) {
    .js .map__frame .node.reveal {
      opacity: 0;
      transform: translateY(8px);
      transition:
        opacity   460ms var(--ease) calc(var(--i) * 110ms),
        transform 460ms var(--ease) calc(var(--i) * 110ms);
    }
    .js .map__frame.is-in .node.reveal { opacity: 1; transform: none; }
  }
}

@media print {
  .js .map__frame .map__svg > g.reveal,
  .js .map__frame .node.reveal { opacity: 1; transform: none; transition: none; }
}

.after-map { margin-top: var(--s-lg); }
.why { margin: 0; max-width: 64ch; font-size: 1.0625rem; line-height: 1.7; color: var(--fg); }

/* ── sections ───────────────────────────────────────────────────────────── */

.section { padding-top: var(--s-xl); margin-top: var(--s-xl); border-top: var(--rule); }

/* section head: index above heading, single column, never a row */
.sec-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: var(--s-md);
}
.sec-head__n {
  font-size: 0.875rem; line-height: 1.4; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.section .sec-head h2 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.625rem, 1.2rem + 1.3vw, 2.375rem);
  line-height: 1.1;
  letter-spacing: -0.028em;
  color: var(--fg);
}
.sec-head__more {
  margin-top: 0.4rem;
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none;
}
.sec-head__more:hover { text-decoration: underline; }

.section__body { min-width: 0; }
.section__body p { max-width: 68ch; }
.section__body p { margin: 0 0 1.1rem; }
.section__body > p:last-child { margin-bottom: 0; }

.section h3 {
  margin: var(--s-lg) 0 0.75rem;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--fg);
}

.note { font-size: 0.9375rem; line-height: 1.6; color: var(--dim); }

/* The Hanging Heading Rule — landing stages */

.section--hang { padding-top: var(--s-lg); margin-top: var(--s-xxl); }

@media (min-width: 960px) {
  .section--hang {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
  }
  .section--hang .sec-head { position: sticky; top: 6rem; margin-bottom: 0; }
}

.landing-after { margin-top: var(--s-lg); }
@media (min-width: 960px) {
  .landing-after {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    column-gap: clamp(2rem, 4vw, 4rem);
  }
  .landing-after > * { grid-column: 2; }
}

/* the landing's stage bodies */

.stage-body > p:first-child { font-size: 1.0625rem; }
.stage-body pre { margin-top: var(--s-md); }
.stage-body .aside {
  margin-top: var(--s-md);
  padding-top: var(--s-md);
  border-top: var(--rule);
  font-size: 0.9375rem; color: var(--dim);
}

/* ── refusals ───────────────────────────────────────────────────────────── */

.refusals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: var(--s-md);
}
@media (max-width: 619.98px) { .refusals { grid-template-columns: 1fr; } }

.refusal {
  padding: 1.2rem 1.3rem 1.3rem;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
}
.section .refusal h3 { margin: 0 0 0.45rem; font-size: 1rem; line-height: 1.4; }
.refusal p { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--dim); }

/* ── reference rows ─────────────────────────────────────────────────────── */

.sched { margin: var(--s-md) 0; border-top: var(--rule); }
.sched > div {
  display: grid;
  gap: 0.25rem 0;
  padding: 0.9rem 0;
  border-bottom: var(--rule);
  min-width: 0;
}
@media (min-width: 620px) {
  .sched > div { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 0 var(--s-md); }
  .sched--wide > div { grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); }
  .sched--tight > div { grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); }
}
.sched dt {
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 500;
  line-height: 1.75;
  color: var(--fg);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.sched--tight dt { font-family: var(--sans); font-size: 0.9375rem; font-weight: 600; line-height: 1.6; font-variant-ligatures: normal; font-feature-settings: normal; }
.sched dd { margin: 0; min-width: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--dim); }
.sched dt br { display: none; }

/* exit codes: one row per code */
.codes { margin: var(--s-sm) 0 var(--s-md); border-top: var(--rule); }
.codes > div {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 0 var(--s-sm);
  padding: 0.6rem 0; border-bottom: var(--rule);
}
.codes dt { font-family: var(--mono); font-size: 0.875rem; font-weight: 500; color: var(--fg); font-variant-numeric: tabular-nums; font-variant-ligatures: none; }
.codes dd { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--dim); }

/* ── contacts · hairline reference rows, never a panel ──────────────────── */

.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; margin: var(--s-md) 0; }

.contacts {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  border-top: var(--rule);
  font-size: 0.9375rem;
  line-height: 1.6;
}
.contacts th, .contacts td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1rem 0.85rem 0;
  border-bottom: var(--rule);
}
.contacts thead th { font-size: 0.875rem; font-weight: 500; color: var(--dim); }
.contacts tbody th { font-weight: 600; color: var(--fg); }
.contacts td { color: var(--dim); }

/* ── demonstration label, joined to its specimen ────────────────────────── */

.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.6rem;
  row-gap: 0.2rem;
  margin: var(--s-md) 0 0;
  padding: 0.6rem 1.3rem;
  background: var(--grid);
  border: var(--rule);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  font: 400 0.8125rem/1.45 var(--sans);
  color: var(--dim);
}
.section__body p.demo { margin-bottom: 0; max-width: none; }
.demo__k { color: var(--ink); font-weight: 500; }
@supports (color: color-mix(in oklch, red, blue)) {
  .demo__k { color: color-mix(in oklch, var(--ink) 80%, var(--fg)); }
}
.demo__rule { width: 1px; height: 12px; background: var(--border); }
.demo + pre { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

.pre--sm { font-size: 11.5px; line-height: 1.5; padding: 1rem 1.1rem; }
.tok-s { font-weight: 600; }
.tok-k { color: var(--ink); }

/* ── docs · remote builders drawing ─────────────────────────────────────── */

.remote__grid, .remote__pair { display: grid; gap: 0 var(--s-lg); align-items: start; }
.remote__grid > *, .remote__pair > * { min-width: 0; }
@media (min-width: 760px) { .remote__pair { grid-template-columns: 1fr 1fr; } }

.wire { margin: var(--s-md) 0; }

.wire__frame {
  display: none;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-lg);
  padding: 1rem;
}
.wire__svg { display: block; width: 100%; height: auto; }

.wire .n rect    { fill: var(--bg); stroke: var(--fg); stroke-width: 1.5; rx: 6px; vector-effect: non-scaling-stroke; }
.wire .host rect { fill: none; stroke: var(--dim); stroke-width: 1; stroke-dasharray: 3 3; rx: 10px; vector-effect: non-scaling-stroke; }

.wire .t-name { font-family: var(--sans); font-weight: 600; font-size: 17px; letter-spacing: -0.015em; fill: var(--fg); }
.wire .t-host, .wire .t-sub { font-family: var(--sans); font-size: 13px; fill: var(--dim); }
.wire .t-mono { font-family: var(--mono); font-size: 13.5px; fill: var(--fg); }
.wire .t-edge { font-family: var(--mono); font-size: 13.5px; }
.wire .t-edge--out { fill: var(--ink); }
.wire .t-edge--in  { fill: var(--dim); }

.wire .edge { fill: none; stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.wire .edge--out { stroke: var(--ink); }
.wire .edge--in  { stroke: var(--dim); stroke-dasharray: 6 5; }
.wire .ah--out { fill: var(--ink); }
.wire .ah--in  { fill: var(--dim); }

.wire a { cursor: pointer; outline: none; text-decoration: none; }
.wire a:is(:hover, :focus-visible) rect { stroke: var(--ink); stroke-width: 2.5; }
.wire a rect, .wire .edge { transition: stroke 200ms ease, stroke-width 200ms ease; }
.wire a text { pointer-events: none; }

.wire__frame:has(:is(.wn-cli, .wn-listener, .wn-serve):is(:hover, :focus-visible)) .w-out { stroke-width: 2.25; }
.wire__frame:has(:is(.wn-daemon, .wn-refs, .wn-worktree):is(:hover, :focus-visible)) .w-in { stroke-width: 2.25; }

.wire__list { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }

.wire figcaption { margin-top: 0.85rem; font-size: 0.875rem; line-height: 1.55; color: var(--dim); max-width: 68ch; }

@media (min-width: 760px) {
  .wire__frame { display: block; }
  .wire__list { display: none; }
}

.steps { margin: var(--s-sm) 0 var(--s-md); padding: 0; counter-reset: none; }
.steps > div {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0 0.75rem;
  padding: 0.85rem 0;
  border-bottom: var(--rule);
}
.steps > div:first-child { border-top: var(--rule); }
.steps dt { font-size: 0.875rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.steps dd { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--dim); }

/* ── docs · rail + article ──────────────────────────────────────────────── */

.docs__grid {
  display: grid;
  grid-template-columns: 15rem minmax(0, 46rem);
  gap: 0 clamp(3rem, 6vw, 5.5rem);
  padding-top: var(--s-lg);
  align-items: start;
}
@media (max-width: 959.98px) { .docs__grid { grid-template-columns: minmax(0, 1fr); padding-top: var(--s-md); } }

.docs__article { min-width: 0; }

.legal__article { min-width: 0; max-width: 46rem; padding-top: var(--s-lg); }
@media (max-width: 959.98px) { .legal__article { padding-top: var(--s-md); } }

.docs__intro, .legal__intro { padding-bottom: var(--s-lg); }
.docs__intro h1, .legal__intro h1 { font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem); max-width: none; }
.docs__intro .lede, .legal__intro .lede { max-width: 60ch; }

.docs__article .section, .legal__article .section { margin-top: var(--s-lg); padding-top: var(--s-xl); }
.docs__article .section:first-of-type, .legal__article .section:first-of-type { margin-top: 0; }

.rail {
  position: sticky; top: 5.25rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 0.25rem 0.5rem 2rem 0;
}
.rail__group { margin: 0; }
.rail a {
  position: relative;
  display: block;
  padding: 0.35rem 0 0.35rem 0.9rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--dim);
  text-decoration: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.rail a::before {
  content: ""; position: absolute; left: 0; top: 0.3rem; bottom: 0.3rem;
  width: 2px; background: transparent;
}
.rail a:hover { color: var(--fg); }
.rail a.is-current { color: var(--fg); font-weight: 500; }
.rail a.is-current::before { background: var(--ink); }
.rail__subs { margin: 0.1rem 0 0.5rem; }
.rail a.rail__sub { padding-left: 1.8rem; font-size: 0.875rem; }
.rail a.rail__sub::before { left: 0.9rem; }
.js .rail__group:not(.is-open) .rail__subs { display: none; }

@media (max-width: 959.98px) { .rail { display: none; } }
@media (min-width: 960px) { body.docs .menu { display: none; } }

.docs__article .install { display: block; }

/* ── sections menu (docs, narrow) ───────────────────────────────────────── */

.menu { position: relative; display: flex; align-items: center; }

.menu__btn {
  display: flex; align-items: center; gap: 0.2rem;
  font: 500 0.875rem/1 var(--sans); color: var(--dim);
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  min-height: 44px;
  transition: color 200ms ease;
}
.menu__btn:hover { color: var(--fg); }
.menu__btn .ico { transition: transform 200ms ease; }
.menu__btn[aria-expanded="true"] .ico { transform: rotate(180deg); }

.menu__panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  z-index: 55;
  width: 300px;
  padding: 0.4rem;
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
}
.menu__panel[hidden] { display: none; }

.menu__item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  font: 400 0.9375rem/1.4 var(--sans);
  color: var(--fg);
  text-decoration: none;
}
.menu__item:hover, .menu__item.is-current { background: var(--grid); color: var(--fg); }
.menu__idx { color: var(--dim); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }

@media (max-width: 959.98px) {
  .menu__panel {
    position: fixed;
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    top: calc(var(--topbar-h, 3.75rem) + 0.25rem);
    max-height: calc(100vh - var(--topbar-h, 3.75rem) - 1rem);
    max-height: calc(100dvh - var(--topbar-h, 3.75rem) - 1rem);
    overflow-y: auto;
  }
}

/* ── footer · Ft2 inline ───────────────────────────────────────────── */

.colophon {
  margin-top: var(--s-xxl);
  border-top: var(--rule);
  padding-block: var(--s-md) var(--s-lg);
}
.colophon__row {
  display: grid;
  gap: var(--s-md);
}
@media (min-width: 760px) {
  .colophon__row { grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s-xl); align-items: baseline; }
}

.colophon__map { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; }
.colophon__map a { font-size: 0.9375rem; font-weight: 500; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; }
.colophon__map a:hover { color: var(--ink); }

.colophon__spec {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start;
  gap: 0.35rem 1.25rem;
  margin: 0;
  font: 400 0.75rem/1.5 var(--mono);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 760px) { .colophon__spec { justify-content: flex-end; text-align: right; } }
.colophon__spec a { color: var(--dim); display: inline-flex; align-items: center; }
.colophon__spec a:hover { color: var(--ink); }

/* ── reduced motion ─────────────────────────────────────────────────────── */

@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;
  }
}

/* phones: the theme switch keeps its mark and its aria-label, drops its word */
@media (max-width: 559.98px) {
  .theme { position: relative; width: 44px; height: 44px; padding: 0; overflow: hidden; text-indent: 200%; white-space: nowrap; }
  .theme::before { position: absolute; inset: 0; margin: auto; inline-size: 14px; block-size: 14px; }
}
