/* AboutSharma Infrastructure — an engineering notebook
   ------------------------------------------------------------------------
   One stylesheet. Tokens first, then page furniture, then each section in
   reading order, then responsive states and motion preferences. Figure
   artwork is drawn by app.js and styled here through the .f-* classes. */

@font-face {
  font-family: "Plex Sans";
  src: url("/fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 300 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
/* Two optical cuts of one italic: display for headings, text for captions. */
@font-face {
  font-family: "Newsreader Display";
  src: url("/fonts/newsreader-italic-48.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader Text";
  src: url("/fonts/newsreader-italic-16.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f4f3ec;
  --paper-hi: #fbfaf5;
  --paper-lo: #ecebe2;
  --ink: #1d221b;
  --ink-2: #353d30;
  --ink-3: #596150;
  --ink-4: #646b5d;
  --rule: #d6d8cc;
  --rule-2: #bdc2b2;
  --grid-dot: #cdd1c2;
  --olive: #56702b;
  --olive-2: #7b9748;
  --olive-wash: #e4ead4;
  --blue: #2f5878;
  --blue-2: #5a83a5;
  --blue-wash: #dfe7ec;
  --rust: #a4502d;
  --rust-wash: #f2e1d6;

  --night: #161b15;
  --night-2: #1d241b;
  --night-3: #252e22;
  --night-rule: #34402f;
  --night-ink: #e7ebde;
  --night-ink-2: #c3ccb6;
  --night-ink-3: #9aa88c;
  --lime: #c3db90;

  --sans: "Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: "Newsreader Display", "Iowan Old Style", Georgia, serif;
  --serif-text: "Newsreader Text", "Iowan Old Style", Georgia, serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1360px;
  --masthead: 60px;
  --ease: cubic-bezier(.22, .61, .2, 1);

  /* Figure palette (overridden inside the night plate). */
  --f-bg: var(--paper);
  --f-node: var(--paper-hi);
  --f-node-stroke: #b3b9a6;
  --f-line: #aab19d;
  --f-line-strong: #6f7865;
  --f-text: var(--ink-2);
  --f-label: var(--ink-3);
  --f-faint: #6a7163;
  --f-accent: var(--olive);
  --f-accent-wash: var(--olive-wash);
  --f-out: var(--blue);
  --f-out-wash: var(--blue-wash);
  --f-fail: var(--rust);
  --f-fail-wash: var(--rust-wash);
  --f-band: rgba(86, 112, 43, .07);
  --tick: #9aa190;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead) + 20px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
}
h1, h2, h3, p, figure, dl, dd, ol { margin: 0; }
ol { padding: 0; }
h1, h2, h3 { font-weight: 450; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
code { font: 500 .88em var(--mono); color: var(--ink-2); }
svg { display: block; overflow: visible; }
::selection { background: #d9e4bd; }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }

.mono { font-family: var(--mono); }
.label {
  display: block;
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.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;
}
.skip {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 12px 16px; font: 500 13px var(--mono);
}
.skip:focus { top: 12px; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ───────────────────────────────────────────── masthead */

.masthead {
  position: sticky; top: 0; z-index: 40;
  height: var(--masthead);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 28px;
  padding: 0 var(--gutter);
  background: rgba(244, 243, 236, .94);
  border-bottom: 1px solid var(--rule);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 550; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; fill: none; stroke: var(--ink-2); stroke-width: 1.15; stroke-linejoin: round; }
.brand-sub { font-weight: 400; color: var(--ink-3); }
.running-head {
  justify-self: center;
  display: flex; gap: 12px; align-items: baseline;
  font: 400 12px var(--mono);
  color: var(--ink-3);
  overflow: hidden; height: 18px;
}
.running-head .rh-no { color: var(--olive); }
.running-head .rh-title { font-family: var(--serif-text); font-style: italic; font-size: 15px; color: var(--ink-2); letter-spacing: 0; }
.running-head.is-swapping > * { animation: rh-in .45s var(--ease); }
@keyframes rh-in { from { transform: translateY(70%); opacity: 0; } }
.index { display: flex; gap: 2px; }
.index a {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 8px 10px; font-size: 13px; color: var(--ink-3);
  position: relative; transition: color .2s;
}
.index .n { font: 400 10.5px var(--mono); color: var(--ink-4); transition: color .2s; }
.index a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 1px;
  background: var(--olive); transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.index a:hover, .index a[aria-current] { color: var(--ink); }
.index a[aria-current] .n { color: var(--olive); }
.index a[aria-current]::after { transform: scaleX(1); }
.out { font-size: 13px; color: var(--ink-2); white-space: nowrap; padding: 8px 0; }
.out span { display: inline-block; margin-left: 6px; transition: transform .25s var(--ease); }
.out:hover span { transform: translate(2px, -2px); }
.contents-toggle {
  display: none;
  font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 9px 12px; border: 1px solid var(--rule-2); border-radius: 2px;
}
.contents-toggle .ct-no { font-weight: 500; color: var(--olive); margin-right: 10px; }
.contents-toggle span { display: inline-block; margin-left: 6px; transition: transform .25s var(--ease); }
.contents-toggle[aria-expanded="true"] span { transform: rotate(45deg); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--olive); transform-origin: left; transform: scaleX(var(--p, 0)); }

.contents {
  position: fixed; z-index: 39; top: var(--masthead); left: 0; right: 0;
  background: var(--paper); border-bottom: 1px solid var(--rule);
  padding: 8px var(--gutter) 20px;
  box-shadow: 0 24px 40px -30px rgba(29, 34, 27, .35);
}
.contents ol { list-style: none; }
.contents a {
  display: flex; gap: 16px; align-items: baseline;
  padding: 13px 0; border-bottom: 1px solid var(--rule);
  font-size: 17px;
}
.contents a span { font: 400 11px var(--mono); color: var(--olive); width: 22px; }
.contents a[aria-current] { color: var(--olive); }

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

.hero { padding: 26px 0 0; }
.hero-meta {
  display: flex; justify-content: space-between; gap: 20px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  padding-bottom: 14px; border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: clamp(32px, 4.5vw, 72px);
  align-items: center;
  padding: clamp(40px, 6vw, 84px) 0 clamp(40px, 5vw, 72px);
}
.kicker {
  display: flex; align-items: center; gap: 12px;
  font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.kicker .tick { width: 28px; height: 1px; background: var(--olive); }
h1 {
  font-size: clamp(56px, 6.9vw, 116px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 430;
  margin-top: 28px;
}
h1 em { letter-spacing: -.035em; font-size: 1.04em; }
.hero-lede { font-size: clamp(17px, 1.45vw, 20px); line-height: 1.55; color: var(--ink-2); margin-top: 30px; max-width: 30em; }
.thesis {
  margin-top: 22px; padding-left: 16px; border-left: 1px solid var(--olive-2);
  font-size: 14.5px; line-height: 1.6; color: var(--ink-3);
}
.thesis em { font-family: var(--serif-text); font-size: 17px; color: var(--ink-2); }
.cta {
  display: inline-flex; align-items: center; gap: 28px;
  margin-top: 34px; padding: 15px 18px;
  background: var(--ink); color: var(--paper);
  font: 500 12px var(--mono); letter-spacing: .04em;
  border-radius: 2px; transition: background .25s;
}
.cta span { font-size: 17px; line-height: 1; transition: transform .3s var(--ease); }
.cta:hover { background: #33402b; }
.cta:hover span { transform: translate(2px, 2px); }

.hero-foot {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  border-top: 1px solid var(--rule);
  padding: 30px 0 56px;
}
.abstract .label { margin-bottom: 10px; }
.abstract p { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); max-width: 62ch; }
.specimen { display: grid; grid-template-columns: repeat(4, 1fr); align-self: start; }
.specimen > div { padding: 0 18px; border-left: 1px solid var(--rule); }
.specimen > div:first-child { border-left: 0; padding-left: 0; }
.specimen dt { font: 500 10.5px/1.45 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); order: 2; }
.specimen > div { display: flex; flex-direction: column; gap: 6px; }
.specimen dd { font-size: clamp(30px, 2.6vw, 40px); font-weight: 350; letter-spacing: -.03em; line-height: 1.05; font-feature-settings: "tnum"; order: 1; }

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

.section { position: relative; padding: clamp(72px, 9vw, 128px) 0 clamp(64px, 8vw, 110px); }
.section > .wrap { position: relative; }
.section > .wrap::before {
  content: ""; position: absolute; top: calc(-1 * clamp(72px, 9vw, 128px)); left: var(--gutter); right: var(--gutter);
  height: 1px; background: var(--rule);
  transform-origin: left; transition: transform 1.4s var(--ease);
}
.js .section:not(.is-in) > .wrap::before { transform: scaleX(0); }
.section-head {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) minmax(0, 10.4fr);
  gap: 24px;
  margin-bottom: clamp(36px, 4.5vw, 60px);
}
.margin { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.sec-no {
  display: inline-grid; place-items: center; width: 34px; height: 26px;
  border: 1px solid var(--rule-2); font: 500 11px var(--mono); color: var(--olive);
}
.sec-label { font: 500 10.5px/1.5 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); max-width: 14ch; }
.head-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
h2 { font-size: clamp(40px, 4.7vw, 72px); line-height: 1.04; letter-spacing: -.04em; font-weight: 430; }
h2 em { letter-spacing: -.03em; }
.lede { font-size: 16px; line-height: 1.65; color: var(--ink-3); max-width: 34em; padding-bottom: 6px; }
.js .section-head .head-main > * { transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .section:not(.is-in) .section-head .head-main > * { opacity: 0; transform: translateY(14px); }
.js .section:not(.is-in) .section-head .head-main > .lede { transition-delay: .12s; }

/* ───────────────────────────────────────────── plates (figures) */

.plate { border: 1px solid var(--rule); background: var(--f-bg); position: relative; }
.plate + .plate { margin-top: 40px; }
.plate-head {
  display: flex; align-items: center; gap: 14px;
  min-height: 48px; padding: 8px 18px;
  border-bottom: 1px solid var(--rule);
  font: 400 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.plate-no { color: var(--olive); font-weight: 500; white-space: nowrap; }
.plate-title { color: var(--ink-2); }
.plate-meta, .plate-legend, .plate-controls { margin-left: auto; }
.plate-meta { color: var(--ink-4); white-space: nowrap; }
.plate-legend { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.plate-legend i { width: 16px; height: 2px; display: inline-block; margin-left: 10px; }
.plate-legend i.lg-in { background: var(--olive); }
.plate-legend i.lg-out { background: var(--blue); }
.plate-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; text-transform: none; letter-spacing: 0; }

.plate-body {
  position: relative;
  background-image: radial-gradient(circle, var(--grid-dot) .75px, transparent 1px);
  background-size: 16px 16px;
  background-position: 8px 8px;
}
.plate-body::before {
  content: ""; position: absolute; inset: 7px; pointer-events: none; z-index: 1;
  --t: var(--tick);
  background:
    linear-gradient(var(--t), var(--t)) left top / 9px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) left top / 1px 9px no-repeat,
    linear-gradient(var(--t), var(--t)) right top / 9px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) right top / 1px 9px no-repeat,
    linear-gradient(var(--t), var(--t)) left bottom / 9px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) left bottom / 1px 9px no-repeat,
    linear-gradient(var(--t), var(--t)) right bottom / 9px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) right bottom / 1px 9px no-repeat;
}
.fig-canvas { position: relative; min-height: 120px; }
.fig-canvas > svg { width: 100%; height: auto; }
html:not(.js) .fig-canvas::after { content: "This figure is drawn with JavaScript; a text description follows for screen readers."; display: block; padding: 40px 18px; font: italic 15px var(--serif-text); color: var(--ink-3); }

/* Cursor rulers, added by app.js on fine pointers only. */
.ruler-x, .ruler-y { position: absolute; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .35s; }
.ruler-x { left: 0; right: 0; top: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px) 0 0 / 100% 3px no-repeat,
              repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 40px) 0 0 / 100% 6px no-repeat; }
.ruler-y { top: 0; bottom: 0; left: 0; width: 6px;
  background: repeating-linear-gradient(180deg, var(--tick) 0 1px, transparent 1px 8px) 0 0 / 3px 100% no-repeat,
              repeating-linear-gradient(180deg, var(--tick) 0 1px, transparent 1px 40px) 0 0 / 6px 100% no-repeat; }
.ruler-x i, .ruler-y i { position: absolute; background: var(--olive); }
.ruler-x i { top: 0; left: 0; width: 1px; height: 10px; transform: translateX(var(--rx, 0)); }
.ruler-y i { left: 0; top: 0; width: 10px; height: 1px; transform: translateY(var(--ry, 0)); }
.ruler-read { position: absolute; right: 14px; bottom: 10px; z-index: 2; pointer-events: none; font: 400 10px var(--mono); color: var(--ink-4); opacity: 0; transition: opacity .35s; font-feature-settings: "tnum"; }
.plate-body.is-measuring .ruler-x, .plate-body.is-measuring .ruler-y, .plate-body.is-measuring .ruler-read { opacity: 1; }

.plate-foot {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  border-top: 1px solid var(--rule); padding: 11px 18px;
  font-size: 11px; color: var(--ink-3);
}
.plate-foot .readout { color: var(--ink-2); min-height: 1.4em; }
.plate-note { color: var(--ink-4); text-transform: uppercase; letter-spacing: .07em; font-size: 10px; text-align: right; }
.plate-status { border-top: 1px solid var(--rule); padding: 12px 18px; font-size: 11.5px; color: var(--ink-2); min-height: 44px; }
.caption {
  border-top: 1px solid var(--rule);
  padding: 14px 18px 16px;
  font: italic 400 15.5px/1.5 var(--serif-text);
  color: var(--ink-3);
}
.caption b { font: 500 11px var(--mono); font-style: normal; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); margin-right: 8px; }

/* Figure artwork primitives (SVG, drawn by app.js) */
.f-line { fill: none; stroke: var(--f-line); stroke-width: 1; }
.f-line--strong { stroke: var(--f-line-strong); }
.f-dash { stroke-dasharray: 3 4; }
.f-node { fill: var(--f-node); stroke: var(--f-node-stroke); stroke-width: 1; }
.f-wash { fill: var(--f-accent-wash); stroke: var(--olive-2); stroke-width: 1; }
.f-boundary { fill: none; stroke: var(--f-node-stroke); stroke-dasharray: 4 4; }
.f-band { fill: var(--f-band); }
.f-text { fill: var(--f-text); font: 400 13px var(--sans); }
.f-text--lg { font-size: 15px; }
.f-mono { fill: var(--f-text); font: 400 12px var(--mono); }
.f-label { fill: var(--f-label); font: 500 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.f-faint { fill: var(--f-faint); }
.f-serif { fill: var(--f-label); font: italic 400 14px var(--serif-text); }
.f-accent { fill: var(--f-accent); }
.f-stroke-accent { stroke: var(--f-accent); }
.f-out { fill: var(--f-out); }
.f-glyph { fill: none; stroke: var(--f-line-strong); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.f-hit { cursor: pointer; outline: none; }
.f-hit .f-focus { fill: none; stroke: var(--olive); stroke-width: 1.5; opacity: 0; }
.f-hit:focus-visible .f-focus { opacity: 1; }
.f-packet { fill: var(--f-accent); }
.f-packet--out { fill: var(--f-out); }
.f-packet--req { fill: var(--f-line-strong); }
.f-ghost { opacity: .35; }

/* Construction: paths draw in when a figure first enters the viewport. */
.f-draw { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.is-built .f-draw { stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur, 1.1s) var(--ease) var(--delay, 0s); }
.f-rise { opacity: 0; transform: translateY(6px); transform-box: fill-box; }
.is-built .f-rise { opacity: 1; transform: none; transition: opacity .6s var(--ease) var(--delay, 0s), transform .6s var(--ease) var(--delay, 0s); }
.f-draw.is-done { stroke-dasharray: none; }

/* Emphasis states shared by every figure */
.f-fade { transition: opacity .35s; }
.is-tracing .f-fade:not(.is-hot) { opacity: .22; }
.is-hot.f-line { stroke: var(--f-accent); stroke-width: 1.6; }
.is-hot.f-line.is-out { stroke: var(--f-out); }

/* Labels that sit on top of lines punch a gap in them. */
.f-knock { paint-order: stroke; stroke: var(--f-bg); stroke-width: 5px; stroke-linejoin: round; }
.f-packet--probe { fill: var(--f-out); }
.f-packet.is-waiting { animation: waiting 1.2s ease-in-out infinite; }
@keyframes waiting { 50% { opacity: .35; } }
.is-lost { fill: var(--rust); opacity: .9; transition: opacity 1s .4s; }
.is-lost.f-packet--req { opacity: 0; }
rect.is-lost { opacity: 0; }

/* Fig. 0 */
.spine .f-node { transition: fill .3s, stroke .3s; }
.spine .spine-label { font-size: 11px; fill: var(--ink-2); }
.spine-port { fill: var(--f-node-stroke); }
.spine:hover .f-node, .spine.is-hot .f-node { fill: var(--olive-wash); stroke: var(--olive-2); }
.spine.is-commit .f-node { fill: var(--olive-wash); stroke: var(--olive); }
.spine.is-commit .spine-port, .spine.is-hot .spine-port { fill: var(--olive); }
.ctrl-name { font-size: 15px; fill: var(--ink); letter-spacing: -.02em; }
.stage-cell { fill: var(--paper-hi); stroke: #b7c39d; stroke-width: 1; transition: fill .25s, stroke .25s; }
.stage-label { font-size: 9.5px; fill: var(--ink-3); transition: fill .25s; }
.stage.is-on .stage-cell { fill: var(--olive); stroke: var(--olive); }
.stage.is-on .stage-label { fill: var(--paper-hi); }
.ctr .f-node { transition: fill .3s, stroke .3s; }
.led { fill: var(--olive-2); }
.ctr.is-deploying .led { animation: blink .5s steps(2) infinite; }
.ctr.is-deploying .f-node { stroke: var(--olive-2); }
.ctr.is-verified .f-node { fill: var(--olive-wash); stroke: var(--olive); }
.ctr.is-verified .led { fill: var(--olive); }
.ctr.is-hot .f-node { stroke: var(--olive-2); }
@keyframes blink { 50% { fill: var(--paper-hi); } }
.edge-label { font-size: 11px; }
.hover-label { text-transform: none; letter-spacing: .02em; fill: var(--olive); }
@media (max-width: 540px) { .spine .spine-label { font-size: 10px; } }

/* Fig. 1 */
.lane-route { stroke: var(--olive); stroke-width: 1.6; }
.token-halo { fill: var(--olive-wash); stroke: var(--olive-2); stroke-width: 1; }
.lane-short { font-size: 12px; }
.lane-tight { font-size: 12px; }

/* Fig. 2 */
.waiter-label { fill: var(--night-ink-3); }
.waiter .token-chip { stroke: var(--f-faint); }

/* Fig. 3a */
.layer-text { font-size: 11.5px; }
.layer-text--sm { font-size: 10px; }
.rebuild-svg.is-verified .ctr-cell .f-node { stroke: var(--olive-2); }
.layer-id { font-size: 10px; fill: var(--ink-3); }
.ctr-tick { font: 500 9.5px var(--mono); }

/* Fig. 4 */
.region-inner { fill: rgba(228, 234, 212, .45); stroke: #c3cdb0; }
.probe-local { stroke: var(--olive-2); }
.probe-public { stroke: var(--blue-2); }
.probe-tag--local { fill: var(--olive); }
.probe-tag--public { fill: var(--blue); }
.path-node .f-node { fill: var(--paper-hi); }
.path-node.node-ctrl .f-node { fill: var(--paper-hi); stroke: var(--ink-3); }

/* ───────────────────────────────────────────── buttons and controls */

.btn {
  display: inline-flex; align-items: center; gap: 16px;
  padding: 10px 14px; border: 1px solid var(--rule-2); border-radius: 2px;
  background: var(--paper-hi);
  font: 500 12px var(--mono); letter-spacing: .02em; text-transform: none; color: var(--ink);
  white-space: nowrap; transition: background .2s, border-color .2s;
}
.btn:hover:not(:disabled) { background: var(--olive-wash); border-color: var(--olive-2); }
.btn span { font-size: 14px; line-height: 1; }
.btn--light { background: var(--lime); border-color: var(--lime); color: #24301b; }
.btn--light:hover:not(:disabled) { background: #d6e8ae; border-color: #d6e8ae; }
.switch { display: inline-flex; align-items: center; gap: 10px; font: 400 12px var(--mono); color: inherit; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 30px; height: 16px; border-radius: 8px; border: 1px solid currentColor; position: relative; opacity: .8; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; transition: transform .25s var(--ease); }
.switch input:checked + .switch-ui { background: rgba(214, 140, 104, .3); border-color: #e2a07f; }
.switch input:checked + .switch-ui::after { transform: translateX(14px); background: #e2a07f; }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--lime); outline-offset: 3px; }
.switch input:disabled + .switch-ui { opacity: .4; }

/* ───────────────────────────────────────────── 01 workflow */

.phase-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); }
.phase-tabs button {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 18px; text-align: left;
  font-size: 15px; color: var(--ink-3);
  border-left: 1px solid var(--rule); position: relative;
  transition: background .25s, color .25s;
}
.phase-tabs button:first-child { border-left: 0; }
.phase-tabs button span { font: 500 10.5px var(--mono); color: var(--ink-4); }
.phase-tabs button::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--olive); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.phase-tabs button[aria-pressed="true"] { color: var(--ink); background: rgba(228, 234, 212, .55); }
.phase-tabs button[aria-pressed="true"] span { color: var(--olive); }
.phase-tabs button[aria-pressed="true"]::after { transform: scaleX(1); }
.phase-tabs button:hover { color: var(--ink); }
.phase-detail {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(20px, 4vw, 56px);
  border-top: 1px solid var(--rule); padding: 24px 18px 26px; min-height: 150px;
}
.phase-detail h3 { font-size: 23px; letter-spacing: -.02em; line-height: 1.25; margin-top: 10px; }
.phase-detail p { font-size: 15px; color: var(--ink-3); max-width: 60ch; }
.phase-detail .swap { animation: swap-in .5s var(--ease); }
@keyframes swap-in { from { opacity: 0; transform: translateY(5px); } }

.handoff {
  display: flex; align-items: center; gap: 18px;
  margin-top: 26px; padding: 14px 0;
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.handoff i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--olive-2), var(--rule) 60%); }
.handoff .arrow { width: 34px; height: 34px; border: 1px solid var(--rule-2); border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--olive); transition: transform .3s var(--ease), background .2s; }
.handoff:hover .arrow { transform: translateY(3px); background: var(--olive-wash); }

/* Swimlane specifics */
.lane-node .f-node { transition: fill .35s, stroke .35s; }
.lane-node.is-lit .f-node { fill: var(--f-accent-wash); stroke: var(--olive-2); }
.lane-node .f-text { transition: fill .35s; }
.lane-node:not(.is-lit) .f-text { fill: var(--ink-4); }
.lane-node.is-optional .f-node { stroke-dasharray: 3 3; }
.lane-band { fill: transparent; transition: fill .45s; }
.lane-band.is-on { fill: var(--f-band); }
.phase-mark { transition: fill .35s; }
.phase-mark.is-on { fill: var(--f-accent); }

/* ───────────────────────────────────────────── 02 deployment (night) */

.section--night {
  background: var(--night); color: var(--night-ink);
  --rule: var(--night-rule);
  --rule-2: #4a5843;
  --ink-2: var(--night-ink-2);
  --ink-3: var(--night-ink-3);
  --ink-4: #8a987d;
  --olive: var(--lime);
  --olive-2: #8fa868;
  --olive-wash: #2b3626;
  --grid-dot: #2b3428;
  --tick: #586651;
  --paper-hi: var(--night-2);
  --f-bg: var(--night-2);
  --f-node: var(--night-3);
  --f-node-stroke: #4b5944;
  --f-line: #475540;
  --f-line-strong: #8d9c80;
  --f-text: var(--night-ink-2);
  --f-label: #9aa88c;
  --f-faint: #8a987d;
  --f-accent: var(--lime);
  --f-accent-wash: #33422a;
  --f-out: #9cc0de;
  --f-fail: #e2a07f;
  --f-fail-wash: #43302a;
  --f-band: rgba(195, 219, 144, .06);
}
.section--night ::selection { background: #4b5e34; }
.section--night :focus-visible { outline-color: var(--lime); }
.section--night > .wrap::before { display: none; }
.boundary {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--gutter); height: 36px; transform: translateY(-50%);
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.boundary span { background: var(--night); padding: 4px 10px; border: 1px solid var(--night-rule); color: var(--night-ink-3); }
.boundary span:last-child { border: 0; color: var(--night-ink-3); text-transform: none; letter-spacing: .02em; }
.boundary i { flex: 0 0 60px; height: 0; border-top: 1px dashed #4d5b45; }
.section--night .section-head .sec-no { border-color: #4a5843; }
.section--night h2 em { color: #d2e3ad; }
.plate--night .plate-head { color: var(--night-ink-3); }

.trace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); border-top: 1px solid var(--rule); }
.gate-detail { padding: 22px 18px 26px; min-height: 210px; }
.gate-detail h3 { font-size: 24px; letter-spacing: -.02em; margin-top: 10px; color: var(--night-ink); }
.gate-detail p { font-size: 15px; color: var(--night-ink-3); margin-top: 10px; max-width: 54ch; }
.gate-detail .label { color: var(--lime); }
.log { border-left: 1px solid var(--rule); background: rgba(0, 0, 0, .14); display: flex; flex-direction: column; }
.log-head { display: flex; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--rule); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #8a987d; }
.log-lines { list-style: none; padding: 10px 16px 14px; font-size: 12px; line-height: 1.75; min-height: 190px; max-height: 260px; overflow: auto; }
.log-lines li { display: grid; grid-template-columns: 4.2ch 8ch 1fr auto; gap: 12px; color: var(--night-ink-2); animation: log-in .35s var(--ease); }
.log-lines .t { color: #8a987d; font-feature-settings: "tnum"; }
.log-lines .k { color: var(--night-ink-3); }
.log-lines .ok { color: var(--lime); }
.log-lines .bad { color: #e8ab8b; }
.log-lines .is-hint { color: #8a987d; }
.log-lines li.is-result { margin-top: 4px; padding-top: 4px; border-top: 1px dashed #3b4835; }
@keyframes log-in { from { opacity: 0; transform: translateX(-4px); } }

.gate .f-node { transition: fill .3s, stroke .3s; }
.gate .gate-ring { fill: none; stroke: var(--f-accent); stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; }
.gate.is-active .gate-ring { animation: ring 1.1s var(--ease) infinite; }
@keyframes ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }
.gate.is-active .f-node { stroke: var(--f-accent); }
.gate.is-passed .f-node { fill: var(--f-accent-wash); stroke: var(--olive-2); }
.gate.is-failed .f-node { fill: var(--f-fail-wash); stroke: var(--f-fail); }
.gate.is-selected .gate-title { fill: var(--night-ink); }
.gate .gate-title { transition: fill .3s; }
.gate .gate-mark { font: 500 11px var(--mono); fill: var(--f-label); }
.gate.is-passed .gate-mark { fill: var(--f-accent); }
.gate.is-failed .gate-mark { fill: var(--f-fail); }
.gate .gate-under { fill: var(--f-accent); opacity: 0; transition: opacity .3s; }
.gate.is-selected .gate-under { opacity: 1; }
.track-done { stroke: var(--f-accent); stroke-width: 1.6; fill: none; }
.track-fail { stroke: var(--f-fail); }
.token-label { font: 500 11px var(--mono); fill: var(--f-text); }
.token-chip { fill: var(--night); stroke: var(--f-accent); stroke-width: 1; }
.token.is-failed .token-chip { stroke: var(--f-fail); }
.token.is-failed .token-dot { fill: var(--f-fail); }
.lock-shackle { transition: transform .35s var(--ease); transform-box: fill-box; transform-origin: right bottom; }
.lock.is-open .lock-shackle { transform: translateY(-3px); }
.lock.is-held .lock-body { fill: var(--f-accent-wash); stroke: var(--f-accent); }
.retry-arc { transition: stroke .3s; }
.retry-arc.is-on { stroke: var(--f-accent); }
.retry-arc.is-bad { stroke: var(--f-fail); }

.notes-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 44px); margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); }
.notes-3 p { font-size: 14.5px; color: var(--ink-3); margin-top: 10px; max-width: 42ch; }

/* ───────────────────────────────────────────── 03 infrastructure */

.layer .f-node { transition: fill .4s, stroke .4s; }
.layer.is-running .f-node { fill: var(--f-accent-wash); stroke: var(--olive-2); }
.layer-note { transition: opacity .4s; }
.layer-note .f-mono { transition: fill .3s; }
.layer-note.is-running .f-mono { fill: var(--f-accent); }
.layer-note .note-state { font: 400 10px var(--mono); fill: var(--f-faint); }
.layer-note.is-done .note-state { fill: var(--f-accent); }
.js .rebuild-svg .layer { transition: opacity .55s var(--ease), transform .55s var(--ease); }
.js .rebuild-svg .layer.is-pending { opacity: 0; transform: translateY(-14px); }
.js .rebuild-svg .layer-note.is-pending { opacity: .35; }
.ctr-tick { opacity: 0; transition: opacity .3s; }
.is-verified .ctr-tick { opacity: 1; }

.plate--table .plate-body { padding: 8px 18px 18px; }
.matrix { width: 100%; border-collapse: collapse; font-size: 14px; position: relative; z-index: 2; }
.matrix th, .matrix td { padding: 0; text-align: center; border-bottom: 1px solid var(--rule); }
.matrix thead th { font: 500 10.5px/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 14px 6px 10px; vertical-align: bottom; border-bottom-color: var(--rule-2); }
.matrix thead th.app-col { text-align: left; padding-left: 0; }
.matrix tbody th { text-align: left; font-weight: 400; padding: 9px 12px 9px 0; white-space: nowrap; }
.matrix tbody th small { font: 400 11px var(--mono); color: var(--ink-4); margin-left: 8px; }
.matrix td { width: 12%; height: 38px; }
.matrix .dot { vertical-align: middle; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--olive); transform: scale(1); transition: transform .45s var(--ease), background .2s; }
.matrix .dash { vertical-align: middle; display: inline-block; width: 9px; height: 1px; background: var(--rule-2); }
.js .matrix:not(.is-built) .dot { transform: scale(0); }
.matrix tbody tr { transition: background .2s; }
.matrix tbody tr:hover, .matrix tbody tr.is-self { background: rgba(228, 234, 212, .5); }
.matrix tbody tr.is-self th { color: var(--olive); }
.matrix .col-hot { background: rgba(228, 234, 212, .5); }
.matrix .col-hot .dot { background: var(--ink); }
.matrix-key { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 28px; margin-top: 18px; position: relative; z-index: 2; }
.matrix-key div { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.matrix-key dt { font: 500 10.5px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.matrix-key dd { color: var(--ink-3); }

/* ───────────────────────────────────────────── 04 network */

.probe-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--rule); padding: 12px 18px; }
.faults { border: 0; padding: 0; margin: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.faults legend { float: left; margin-right: 12px; padding: 0; }
.faults label { position: relative; cursor: pointer; }
.faults input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.faults span { display: inline-block; padding: 8px 11px; border: 1px solid var(--rule); border-radius: 2px; font: 400 12px var(--mono); color: var(--ink-3); transition: background .2s, color .2s, border-color .2s; }
.faults input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.faults input:not([value="none"]):checked + span { background: var(--rust); border-color: var(--rust); }
.faults input:focus-visible + span { outline: 2px solid var(--olive); outline-offset: 2px; }
.faults label:hover span { border-color: var(--rule-2); color: var(--ink); }
.probe-results { border-top: 1px solid var(--rule); }
.probe-results > div { display: grid; grid-template-columns: 13ch minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; padding: 10px 18px; font-size: 12px; border-top: 1px dashed var(--rule); align-items: baseline; }
.probe-results > div:first-child { border-top: 0; }
.probe-results dt { text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; color: var(--ink-3); }
.probe-results .route { color: var(--ink-4); }
.probe-results .res { color: var(--ink-2); }
.probe-results .ok { color: var(--olive); }
.probe-results .bad { color: var(--rust); }
.probe-results [data-probe="decision"] dt { color: var(--ink); }
.fault-mark { opacity: .0; transition: opacity .3s; }
.fault-mark.is-on { opacity: 1; }
.fault-hit .fault-ring { fill: var(--paper); stroke: var(--rule-2); transition: stroke .2s, fill .2s; }
.fault-hit:hover .fault-ring, .fault-hit.is-on .fault-ring { stroke: var(--rust); }
.fault-hit.is-on .fault-ring { fill: var(--rust-wash); }
.fault-hit .fault-x { stroke: var(--f-faint); stroke-width: 1.2; transition: stroke .2s; }
.fault-hit:hover .fault-x, .fault-hit.is-on .fault-x { stroke: var(--rust); }
.probe-fail { fill: var(--rust); font: 500 10.5px var(--mono); }
.seg-broken { stroke: var(--rust) !important; stroke-dasharray: 2 4; }

/* ───────────────────────────────────────────── 05 email */

.plate--mail { --f-band: rgba(47, 88, 120, .05); }
.mail-id .f-node { transition: fill .3s, stroke .3s; }
.mail-id .id-local { font: 500 13.5px var(--mono); fill: var(--ink); }
.mail-id .id-domain { font: 400 10.5px var(--mono); fill: var(--ink-4); }
.mail-id .id-role { font: italic 400 14px var(--serif-text); fill: var(--ink-4); }
.mail-id .id-flash { fill: none; stroke: var(--olive); opacity: 0; }
.mail-id.is-out .id-flash { stroke: var(--blue); }
.mail-id.is-flash .id-flash { animation: flash 1s var(--ease); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.mail-id.is-hot .f-node { stroke: var(--olive); fill: var(--olive-wash); }
.mail-id.is-out.is-hot .f-node { stroke: var(--blue); fill: var(--blue-wash); }
.mail-glyph { fill: none; stroke: var(--ink-4); stroke-width: 1; }
.mail-id.is-hot .mail-glyph { stroke: var(--olive); }
.mail-id.is-out.is-hot .mail-glyph { stroke: var(--blue); }
.mail-path.is-hot { stroke: var(--olive); stroke-width: 1.8; }
.mail-path.is-out.is-hot { stroke: var(--blue); }
.hub-box { fill: var(--paper-hi); stroke: var(--ink-2); stroke-width: 1; }
.hub-inner { fill: none; stroke: var(--rule-2); stroke-dasharray: 2 3; }
.hub-title { font: 500 11px var(--mono); letter-spacing: .1em; fill: var(--ink); }
.hub-sub { font: italic 400 14px var(--serif-text); fill: var(--ink-3); }
.hub-count { text-transform: none; letter-spacing: .02em; }
.hub-port { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1; }
.inbox-row { transition: transform .45s var(--ease), opacity .45s; }
.inbox-row .row-bg { fill: transparent; transition: fill .3s; }
.inbox-row .row-tag { font: 500 10.5px var(--mono); fill: var(--olive); }
.inbox-row .row-bar { fill: #d9dccf; }
.inbox-row .row-time { font: 400 9.5px var(--mono); fill: var(--ink-4); }
.inbox-row .row-reply { font: 500 10.5px var(--mono); fill: var(--blue); opacity: 0; transition: opacity .3s; }
.inbox-row.is-hot .row-bg { fill: var(--olive-wash); }
.inbox-row.is-replying .row-bg { fill: var(--blue-wash); }
.inbox-row.is-replying .row-reply, .inbox-row.is-replied .row-reply { opacity: 1; }
.inbox-row.is-replied .row-tag { fill: var(--ink-3); }
.inbox-row.is-dim { opacity: .3; }
.inbox-empty { font: italic 400 14px var(--serif-text); fill: var(--ink-4); }
.f-env { fill: var(--paper-hi); stroke-width: 1.2; }
.f-env--in { stroke: var(--olive); }
.f-env--out { stroke: var(--blue); }
.dim-bracket { fill: none; stroke: var(--f-faint); stroke-width: 1; }

.mail-notes { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 48px); margin-top: 44px; }
.mail-notes li { border-top: 1px solid var(--rule); padding-top: 18px; }
.mail-notes h3 { font-size: 22px; letter-spacing: -.02em; margin-top: 12px; }
.mail-notes p { font-size: 15px; color: var(--ink-3); margin-top: 8px; }
.mail-notes strong { font-weight: 500; color: var(--ink); }
.mail-notes .label { display: flex; align-items: center; gap: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-in { background: var(--olive); }
.dot-out { background: var(--blue); }
.dot-mid { background: var(--paper); border: 1px solid var(--ink-2); }
.aside { margin-top: 36px; font: italic 400 18px/1.5 var(--serif-text); color: var(--ink-3); max-width: 46em; }
.aside a, .colophon a, .endnotes a { color: var(--ink); background: linear-gradient(var(--olive-2), var(--olive-2)) 0 100% / 100% 1px no-repeat; transition: background-size .3s, color .2s; }
.aside a:hover, .colophon a:hover, .endnotes a:hover { color: var(--olive); }

/* ───────────────────────────────────────────── 06 principles */

.section--quiet { background: linear-gradient(var(--paper), var(--paper-lo) 85%); }
.section--quiet .head-main { grid-template-columns: 1fr; gap: 22px; }
.principles { list-style: none; border-top: 1px solid var(--ink-2); }
.principles li {
  display: grid; grid-template-columns: minmax(150px, 1.6fr) minmax(0, 3.4fr) minmax(0, 5fr) 10.5rem;
  gap: 24px; align-items: baseline;
  padding: 20px 0; border-bottom: 1px solid var(--rule);
  transition: background .25s;
}
.p-no { font: italic 400 24px var(--serif); color: var(--olive-2); }
.principles h3 { font-size: 21px; letter-spacing: -.02em; }
.principles p { font-size: 15px; color: var(--ink-3); }
.principles a { justify-self: end; font: 400 11.5px var(--mono); letter-spacing: .04em; color: var(--ink-3); white-space: nowrap; padding: 4px 0; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.principles a::after { content: " →"; }
.principles a:hover { color: var(--olive); border-color: var(--olive-2); }
.principles li:hover { background: rgba(228, 234, 212, .35); }
.closing { display: flex; align-items: center; gap: 30px; margin-top: clamp(56px, 7vw, 96px); }
.closing p { font-size: clamp(28px, 3vw, 40px); line-height: 1.2; letter-spacing: -.03em; }
.to-top { margin-left: auto; flex: none; width: 48px; height: 48px; border: 1px solid var(--rule-2); border-radius: 50%; display: grid; place-items: center; font-size: 20px; color: var(--olive); transition: background .2s, transform .3s var(--ease); }
.to-top:hover { background: var(--olive-wash); transform: translateY(-3px); }

/* Cross-reference arrival flash */
.plate.is-referenced { animation: referenced 1.6s var(--ease); }
@keyframes referenced { 0%, 40% { box-shadow: 0 0 0 4px rgba(123, 151, 72, .35); } 100% { box-shadow: 0 0 0 4px rgba(123, 151, 72, 0); } }

/* ───────────────────────────────────────────── notes & colophon */

.section--notes { padding-top: 64px; background: var(--paper-lo); }
.section--notes > .wrap::before { display: none; }
.notes-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); }
.endnotes { margin-top: 18px; padding-left: 22px; }
.endnotes li { font-size: 13.5px; line-height: 1.65; color: var(--ink-3); padding: 6px 0 6px 6px; }
.endnotes li::marker { font: 500 11px var(--mono); color: var(--olive); }
.colophon p { font-size: 14px; line-height: 1.65; color: var(--ink-3); margin-top: 12px; }
.colophon .label + p { margin-top: 18px; }
.colophon .weight { font-size: 11.5px; color: var(--ink-2); padding: 10px 0; border-top: 1px dashed var(--rule-2); border-bottom: 1px dashed var(--rule-2); }
.elsewhere { display: flex; gap: 22px; flex-wrap: wrap; }

.footer { border-top: 1px solid var(--rule); background: var(--paper-lo); }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 22px; padding-bottom: 26px; }
.footer .brand { font-size: 12.5px; }
.footer .mono { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.motion-toggle { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); padding: 8px 12px; border: 1px solid var(--rule-2); border-radius: 2px; }
.motion-toggle span { color: var(--olive); }
.motion-toggle:hover { background: var(--olive-wash); }

/* ───────────────────────────────────────────── responsive */

@media (max-width: 1180px) {
  .running-head { display: none; }
  .masthead { grid-template-columns: auto 1fr auto; }
  .index { justify-self: end; }
  .index .t { display: none; }
  .index a { padding: 8px 9px; }
  .index .n { font-size: 11.5px; color: var(--ink-3); }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 640px; }
  .hero-foot { grid-template-columns: 1fr; }
  .section-head { grid-template-columns: 1fr; gap: 18px; }
  .margin { flex-direction: row; align-items: center; padding-top: 0; }
  .sec-label { max-width: none; }
  .head-main { grid-template-columns: 1fr; gap: 18px; }
  .trace { grid-template-columns: 1fr; }
  .log { border-left: 0; border-top: 1px solid var(--rule); }
  .principles li { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .principles li p { grid-column: 2 / 3; }
  .principles li a { grid-column: 3; grid-row: 1; }
  .matrix-key { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root { --masthead: 56px; }
  body { font-size: 15.5px; }
  .masthead { grid-template-columns: auto 1fr auto; gap: 12px; }
  .index, .out { display: none; }
  .contents-toggle { display: inline-flex; justify-self: end; align-items: center; }
  .hero { padding-top: 16px; }
  .hero-meta { font-size: 10px; }
  .hero-meta .hm-mid { display: none; }
  h1 { font-size: clamp(56px, 17vw, 84px); margin-top: 22px; }
  .hero-lede { margin-top: 22px; }
  .specimen { grid-template-columns: repeat(2, 1fr); gap: 18px 0; }
  .specimen > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .plate-head { flex-wrap: wrap; padding: 10px 14px; gap: 6px 12px; }
  .plate-head .plate-title { flex: 1 1 auto; }
  .plate-meta, .plate-legend { margin-left: 0; width: 100%; }
  .plate-controls { margin-left: 0; width: 100%; justify-content: space-between; padding-top: 6px; }
  .plate-foot { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 14px; }
  .plate-note { text-align: left; }
  .caption { padding: 12px 14px 14px; font-size: 15px; }
  .plate-status { padding: 10px 14px; }
  .phase-tabs { grid-template-columns: repeat(2, 1fr); }
  .phase-tabs button:nth-child(3) { border-left: 0; }
  .phase-tabs button:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .phase-detail { grid-template-columns: 1fr; padding: 18px 14px 20px; gap: 10px; min-height: 230px; }
  .phase-detail h3 { font-size: 20px; }
  .handoff { gap: 10px; font-size: 10px; }
  .handoff span.mono:first-child { display: none; }
  .gate-detail { padding: 18px 14px 20px; min-height: 230px; }
  .gate-detail h3 { font-size: 21px; }
  .log-lines { padding: 10px 14px; font-size: 11px; }
  .log-lines li { grid-template-columns: 4.6ch 6.5ch 1fr auto; gap: 8px; }
  .notes-3 { grid-template-columns: 1fr; gap: 20px; }
  .boundary span:last-child { display: none; }
  .plate--table .plate-body { padding: 4px 10px 14px; }
  .matrix thead th { height: 96px; padding: 8px 0; }
  .matrix thead th:not(.app-col) span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; }
  .matrix tbody th { font-size: 13px; padding-right: 6px; }
  .matrix tbody th small { display: none; }
  .matrix td { height: 34px; }
  .matrix-key { grid-template-columns: 1fr; gap: 6px; }
  .probe-bar { padding: 12px 14px; }
  .faults legend { float: none; width: 100%; margin-bottom: 8px; }
  .probe-bar .btn { width: 100%; justify-content: space-between; }
  .probe-results > div { grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; }
  .probe-results .route { grid-column: 1 / -1; grid-row: 2; font-size: 11px; }
  .mail-notes { grid-template-columns: 1fr; gap: 6px; }
  .aside { font-size: 17px; }
  .principles li { grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; padding: 16px 0; }
  .principles li p, .principles li a { grid-column: 2; grid-row: auto; }
  .principles li a { justify-self: start; margin-top: 4px; }
  .p-no { font-size: 20px; grid-row: 1 / 4; }
  .closing { gap: 18px; }
  .notes-grid { grid-template-columns: 1fr; }
  .footer-row { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .hero-meta span:last-child { display: none; }
  .specimen dd { font-size: 30px; }
  .phase-tabs button { padding: 12px 14px; font-size: 14px; }
}

@media (min-width: 761px) { .contents { display: none; } }

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

[data-motion="off"] { scroll-behavior: auto; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  transition-delay: 0s !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) { scroll-behavior: auto; }
}
@media print {
  .masthead, .contents, .skip, .plate-controls, .probe-bar, .phase-tabs, .footer .motion-toggle { display: none !important; }
  .section--night { background: #fff; color: #000; }
  .plate { break-inside: avoid; }
}
