

/* AgentStack splash — one design system: ivory paper, ink lines, blue strokes,
   cyan routes, and a small lime highlight. No external fonts or resources. */


:root {
  --ivory: #F5F5EC;
  --paper: #FBFBF6;
  --paper-2: #EEEFE3;
  --paper-3: #E3E5D7;
  --ink: #182733;
  --ink-80: #33424E;
  --ink-60: #56636E;
  --ink-40: #8C969E;
  --line: rgba(24, 39, 51, 0.14);
  --line-strong: rgba(24, 39, 51, 0.3);
  --blue: #075BFF;
  --blue-deep: #0647C9;
  --blue-wash: #E7EEFF;
  --cyan: #00D7DF;
  --cyan-wash: #D5F6F7;
  --lime: #C3F600;
  --night: #0F1A23;
  --night-2: #16242F;
  --night-line: rgba(220, 230, 236, 0.12);
  --night-text: #DCE3E8;
  --night-muted: #93A3AF;

  --font-display: "Avenir Next", Avenir, "Futura PT", "Century Gothic", "Ubuntu Sans", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", "Ubuntu Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Ubuntu Sans Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --font-serif: "Iowan Old Style", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;

  --header-h: 68px;
  --gutter: clamp(20px, 4vw, 56px);
  --max: 1320px;
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 0.7, 0.18, 1);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
strong { font-weight: 650; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Author display rules (e.g. .btn's inline-flex) must never revive hidden elements. */
[hidden] { display: none !important; }

.visually-hidden {
  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-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--ivory);
  padding: 10px 16px; border-radius: 999px; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ── Shared type ─────────────────────────────────────────── */

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 18px;
}
.eyebrow-dot {
  position: relative;
  flex: 0 0 10px; width: 10px; height: 10px; aspect-ratio: 1; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 1.5px var(--ink);
}
/* A quiet brightness dip; the circular rim never changes size or fades. */
.eyebrow-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--ink); opacity: 0;
  animation: status-light 3.8s ease-in-out infinite;
}
@keyframes status-light {
  0%, 64%, 100% { opacity: 0; }
  78% { opacity: 0.18; }
}

.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 { font-size: clamp(2.1rem, 1.3rem + 2.8vw, 3.6rem); margin-bottom: 18px; }
.section-head p:not(.eyebrow) { color: var(--ink-80); font-size: 1.125rem; max-width: 62ch; }
.section-head--split {
  max-width: none;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 64px; align-items: end;
}
.section-head--split h2 { margin-bottom: 0; }

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; transform: none; }
.btn--primary { background: var(--ink); color: var(--ivory); }
.btn--primary:hover:not([disabled]) { background: var(--blue); }
.btn--quiet { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--quiet:hover:not([disabled]) { background: var(--ink); color: var(--ivory); }
.btn--small { min-height: 44px; padding: 10px 20px; font-size: 0.95rem; }
.btn-arrow { font-family: var(--font-body); transition: transform 0.2s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(2px); }

.link-button {
  background: none; border: 0; padding: 8px 4px; min-height: 40px;
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* ── Header ───────────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--ivory);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
  max-width: var(--max); height: 100%;
  margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; padding: 6px 0;
}
/* Logo clear space: the icon keeps at least ~25% of its height around it. */
.brand-icon { width: 40px; flex: none; }
.brand-icon img { width: 100%; height: auto; }
.brand-word { width: 128px; flex: none; }
.brand-word img { width: 100%; height: auto; }

.nav-list {
  display: flex; align-items: center; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav-list a {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none; font-size: 0.95rem; font-weight: 550;
  color: var(--ink-80);
  transition: background-color 0.2s, color 0.2s;
}
.nav-list a:hover { background: var(--paper-2); color: var(--ink); }
.nav-list a[aria-current] { color: var(--ink); background: var(--paper-2); }
.nav-github { border: 1.5px solid var(--ink); margin-left: 8px; color: var(--ink) !important; }
.nav-github:hover { background: var(--ink) !important; color: var(--ivory) !important; }
.ext { font-size: 0.85em; }

.nav-toggle {
  display: none;
  align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--ink); border-radius: 999px;
  background: transparent; cursor: pointer; font-weight: 600; line-height: 1;
}
/* Both strokes share a centred icon box, including when they become a cross. */
.nav-toggle-bars {
  display: block; position: relative;
  width: 16px; height: 16px; flex: none;
}
.nav-toggle-bars::before, .nav-toggle-bars::after {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 100%; height: 1.5px; background: var(--ink);
  transform-origin: center; transition: transform 0.2s;
}
.nav-toggle-bars::before { transform: translateY(-3.25px); }
.nav-toggle-bars::after { transform: translateY(1.75px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(-0.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-0.75px) rotate(-45deg); }

/* ── Chapter: hero + scroll story with a shared sticky drawing ─ */

.chapter {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6.2fr);
  column-gap: clamp(32px, 5vw, 80px);
}
.hero {
  grid-column: 1; grid-row: 1;
  min-height: calc(100svh - var(--header-h));
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(40px, 8vh, 96px) 0;
}
.hero-title {
  font-size: clamp(3rem, 1.4rem + 5.2vw, 6.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.045em;
  margin-bottom: 28px;
}
.hero-line { display: block; }
.hero-line--accent { color: var(--blue); }
.lede {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-80);
  max-width: 34ch;
  margin-bottom: 36px;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }
.spec-list {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0; margin: 0;
  border-top: 1px solid var(--line-strong);
  max-width: 560px;
}
.spec-list > div { padding: 14px 16px 0 0; }
.spec-list > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.spec-list dt {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-60); margin-bottom: 4px;
}
.spec-list dd { margin: 0; font-size: 0.92rem; line-height: 1.4; }

.story-figure {
  grid-column: 2; grid-row: 1 / span 2;
  position: sticky;
  top: calc(var(--header-h) + 12px);
  align-self: start;
  height: calc(100svh - var(--header-h) - 24px);
  min-height: 520px;
  max-height: 940px;
  margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}

.drawing-sheet {
  position: relative;
  flex: 1; min-height: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(7, 91, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 91, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  overflow: hidden;
}
.sheet-marks span {
  position: absolute; width: 14px; height: 14px;
  border-color: var(--ink-40); border-style: solid; border-width: 0;
}
.sheet-marks span:nth-child(1) { top: 14px; left: 14px; border-top-width: 1px; border-left-width: 1px; }
.sheet-marks span:nth-child(2) { top: 14px; right: 14px; border-top-width: 1px; border-right-width: 1px; }
.sheet-marks span:nth-child(3) { bottom: 14px; left: 14px; border-bottom-width: 1px; border-left-width: 1px; }
.sheet-marks span:nth-child(4) { bottom: 14px; right: 14px; border-bottom-width: 1px; border-right-width: 1px; }

.drawing { position: absolute; inset: 10px; }
.drawing .bp { width: 100%; height: 100%; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-60);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.js .scroll-cue { opacity: var(--cue, 1); }
.scroll-cue-line { width: 1px; height: 22px; background: var(--ink-40); }

.title-block {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  border: 1px solid var(--line-strong); border-radius: 14px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  color: var(--ink-80);
  background: var(--paper);
}
.tb-cell { padding: 9px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-cell + .tb-cell { border-left: 1px solid var(--line); }
.tb-id { font-weight: 700; color: var(--ink); }
.tb-state { color: var(--blue-deep); }

.story { grid-column: 1; grid-row: 2; padding-bottom: clamp(48px, 10vh, 120px); }
.story-intro { padding: clamp(24px, 6vh, 64px) 0 8px; max-width: 34rem; }
.story-intro h2 { font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.4rem); margin-bottom: 18px; }
.story-intro h2 em, .serif-accent {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  letter-spacing: -0.01em; color: var(--blue-deep);
}
.story-intro p:not(.eyebrow) { color: var(--ink-80); font-size: 1.1rem; }
.story-steps { list-style: none; margin: 0; padding: 0; }
.story-step {
  min-height: 74svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 0;
  max-width: 34rem;
  opacity: 0.72;
  transition: opacity 0.4s;
}
html:not(.js) .story-step, .story-step.is-active, .reduced-motion .story-step { opacity: 1; }
.story-step h3 { font-size: clamp(1.6rem, 1.1rem + 1.4vw, 2.3rem); margin-bottom: 16px; }
.story-step p { color: var(--ink-80); margin-bottom: 14px; }
.step-index {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-60) !important;
  margin-bottom: 16px !important;
}
.step-index span {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 26px; padding: 0 8px;
  border: 1.5px solid currentColor; border-radius: 999px;
  color: var(--ink);
}
.story-step.is-active .step-index span { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.fact-list {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.fact-list li {
  font-family: var(--font-mono); font-size: 0.78rem;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--paper);
}
.story-outro {
  max-width: 34rem; padding: 24px 0 0;
  border-top: 1px solid var(--line-strong);
  color: var(--ink-80);
}
.story-outro a { color: var(--blue-deep); font-weight: 600; text-underline-offset: 3px; }

/* ── Workspace machine drawing (SVG built with the Anatomy kit) ── */
/* The kit's light-theme tokens, re-inked in the brand palette: ivory paper,
   ink lines, blue for the one lit accent, cyan and lime only on lights. */

.mx {
  display: block; overflow: visible;
  font-family: var(--font-body);
  --anatomy-paper: #FBFBF6;
  --anatomy-face: #FFFFFF;
  --anatomy-top: #FDFDF9;
  --anatomy-shade-0: #B9C1B6;
  --anatomy-shade-1: #C8CEC3;
  --anatomy-shade-2: #D6DBD1;
  --anatomy-shade-3: #E4E8DF;
  --anatomy-lit-top: #FFFFFF;
  --anatomy-lit-shade: #D2E0FF;
  --anatomy-hi: #182733;
  --anatomy-mid: #2C3943;
  --anatomy-lo: #6C7881;
  --anatomy-faint: #A2AAA4;
  --anatomy-lit: #075BFF;
  --anatomy-halo: #5F6A5C;
  --anatomy-halo-opacity: 0.34;
  --anatomy-dot: #182733;
  --anatomy-weight: 1px;
  --mx-active-top: #EEF3FF;
  --mx-active-shade: #DCE6FF;
}
.mx path, .mx circle { vector-effect: non-scaling-stroke; }
.mx .iso-fill { fill: var(--anatomy-paper); stroke: none; }
.mx .iso-shade, .mx .iso-top { stroke: none; }
.mx .iso-shade[data-shade="0"] { fill: var(--anatomy-shade-0); }
.mx .iso-shade[data-shade="1"] { fill: var(--anatomy-shade-1); }
.mx .iso-shade[data-shade="2"] { fill: var(--anatomy-shade-2); }
.mx .iso-shade[data-shade="3"] { fill: var(--anatomy-shade-3); }
.mx .iso-top { fill: var(--anatomy-top); }
.mx .iso-solid[data-lit] > .iso-fill { fill: var(--anatomy-face); }
.mx .iso-solid[data-lit] > .iso-top { fill: var(--anatomy-lit-top); }
.mx .iso-solid[data-lit] > .iso-shade { fill: var(--anatomy-lit-shade); }
.mx .iso-solid[data-lit] > .iso-edge { stroke: var(--anatomy-lit); }
.mx .iso-halo { fill: var(--anatomy-halo); stroke: none; filter: blur(9px); opacity: var(--anatomy-halo-opacity); transform: translateY(3px); }
.mx .iso-line { fill: none; stroke: var(--anatomy-lo); stroke-width: var(--anatomy-weight); stroke-linecap: round; stroke-linejoin: round; }
.mx .iso-line[data-tone="hi"] { stroke: var(--anatomy-hi); }
.mx .iso-line[data-tone="mid"] { stroke: var(--anatomy-mid); }
.mx .iso-line[data-tone="lo"] { stroke: var(--anatomy-lo); }
.mx .iso-line[data-tone="faint"] { stroke: var(--anatomy-faint); }
.mx .iso-line[data-tone="lit"] { stroke: var(--anatomy-lit); }
.mx .iso-dots circle { fill: var(--anatomy-dot); stroke: none; opacity: 0.32; }
.mx .iso-dots[data-tone="hi"] circle { opacity: 0.85; }
.mx .iso-dots[data-tone="mid"] circle { opacity: 0.45; }
.mx .iso-dots[data-tone="lo"] circle { opacity: 0.22; }
.mx .iso-face-text { fill: var(--anatomy-mid); font-family: var(--font-mono); letter-spacing: 0.04em; }
.mx .iso-face-text[data-tone="hi"] { fill: var(--anatomy-hi); font-weight: 600; }
.mx .mx-engrave.is-empty { fill: var(--anatomy-lo); }

/* The chief-of-staff status display: text the machine shows, in its own type. */
.mx .mx-screen { fill: #0F1A23; stroke: none; }
.mx .mx-screen-text { fill: var(--cyan); font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.06em; }
.mx .mx-screen-sub { fill: #9ADFE3; font-family: var(--font-mono); letter-spacing: 0.03em; }
.mx .mx-screen-text.is-empty, .mx .mx-screen-sub.is-empty { fill: #6F8593; }

/* Lights: the chief of staff is the one lime accent; fitted cards glow cyan. */
.mx .mx-led circle { opacity: 1; }
.mx .mx-led--agent circle { fill: var(--lime); stroke: var(--ink); stroke-width: 0.5; }
.mx .mx-led[data-led="codex"] circle, .mx .mx-led[data-led="claude"] circle { fill: var(--cyan); }
.mx[data-builder] .mx-led:not([data-on]) circle { fill: var(--anatomy-faint); stroke: none; }

/* Optional and chosen parts. */
.mx .mx-item[data-optional]:not([data-chosen]) { opacity: 0.5; }
.mx .mx-item[data-off] { display: none; }
.mx .mx-item[data-main] .iso-edge { stroke: var(--anatomy-lit); }
.mx .mx-item[data-main] .iso-top { fill: var(--anatomy-lit-top); }

/* The layer being explained or chosen: tinted tops, blue edges. */
.mx :is(
  [data-active="agent"] .mx-item[data-layer="agent"],
  [data-active="provider"] .mx-item[data-layer="provider"],
  [data-active="workspace"] .mx-item[data-layer="workspace"],
  [data-active="workflows"] .mx-item[data-layer="workflows"],
  [data-active="foundation"] .mx-item[data-layer="foundation"],
  [data-active="foundation"] .mx-item[data-layer="access"],
  [data-active="access"] .mx-item[data-layer="access"]
) .iso-top { fill: var(--mx-active-top); }
.mx :is(
  [data-active="agent"] .mx-item[data-layer="agent"],
  [data-active="provider"] .mx-item[data-layer="provider"],
  [data-active="workspace"] .mx-item[data-layer="workspace"],
  [data-active="workflows"] .mx-item[data-layer="workflows"],
  [data-active="foundation"] .mx-item[data-layer="foundation"],
  [data-active="foundation"] .mx-item[data-layer="access"],
  [data-active="access"] .mx-item[data-layer="access"]
) .iso-edge { stroke: var(--part-color, var(--selection-color, var(--blue))); }
.mx .mx-item .iso-top, .mx .mx-item .iso-edge { transition: fill 0.35s, stroke 0.35s; }

/* The builder colours the chosen parts; the story keeps its blue section cue. */
.mx[data-builder] .mx-item[data-selected] .iso-edge { stroke: var(--part-color); }
.mx[data-builder] .mx-item[data-selected] .iso-top { fill: color-mix(in srgb, var(--part-color) 7%, var(--anatomy-top)); }
/* The chief-of-staff colour belongs only to its housing, tray and fittings.
   Provider changes colour the display itself, while that assembly keeps its colour. */
.mx[data-builder][data-active="agent"] .mx-item[data-piece="agent"] .iso-edge { stroke: var(--selection-color); }
.mx[data-builder][data-active="agent"] .mx-item[data-piece="agent"] .iso-top { fill: var(--mx-active-top); }
.mx[data-builder] .mx-screen { fill: var(--provider-color); transition: fill 0.25s; }
.mx[data-builder] .mx-screen-text { fill: var(--provider-ink); }
.mx[data-builder] .mx-screen-text.is-empty { fill: #AABAC4; }
.mx[data-builder] .mx-led[data-on] circle { fill: var(--part-color, var(--selection-color)); }

/* Phones: engraving and display text are too small to read, so the key and
   summary beside the drawing carry the words. */
.mx.is-narrow :is(.iso-face-text, .mx-screen-text, .mx-screen-sub) { display: none; }
.mx.is-narrow[data-provider-focus] :is(.mx-screen-text, .mx-screen-sub) { display: block; }

/* Parts key under the story drawing: the engraved numbers, spelled out. */
.mx-key {
  list-style: none; margin: 0; padding: 7px 12px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  font-size: 0.76rem; line-height: 1.3; color: var(--ink-80);
}
.mx-key li { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; min-width: 0; transition: color 0.3s; }
.mx-key strong { color: var(--ink); font-weight: 650; margin-right: 5px; }
.mx-key li[data-active] strong { color: var(--blue-deep); }
.mx-mark {
  flex: none; display: inline-grid; place-items: center;
  min-width: 28px; height: 18px; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; color: var(--ink);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.mx-key li[data-active] .mx-mark { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.summary dt .mx-mark { min-width: 26px; height: 17px; margin-right: 6px; font-size: 0.6rem; vertical-align: 1px; }

/* ── Builder ──────────────────────────────────────────────── */

.builder, .handoff, .deploy, .start {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 12vh, 140px) var(--gutter) 0;
}
.builder { border-top: 1px solid var(--line-strong); }

.builder-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.progress-label { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.04em; color: var(--ink-80); }
.progress-track { height: 4px; border-radius: 999px; background: var(--paper-3); overflow: hidden; }
.progress-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  border-radius: inherit;
  transition: width 0.5s var(--ease);
}
.progress-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.progress-step {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent;
  text-align: left; cursor: pointer;
  font-size: 0.9rem; font-weight: 550;
  transition: background-color 0.2s, border-color 0.2s;
}
.progress-step:hover:not([disabled]) { border-color: var(--ink); }
.progress-step[disabled] { cursor: not-allowed; color: var(--ink-60); background: transparent; }
.progress-step[aria-current="step"] { border-color: var(--ink); background: var(--paper); }
.progress-num {
  flex: none; display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.75rem;
  border: 1.5px solid var(--ink-40);
}
.progress-step.is-done .progress-num { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.progress-step[aria-current="step"] .progress-num { border-color: var(--blue); color: var(--blue-deep); }
.progress-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.builder-steps { display: flex; flex-direction: column; gap: 12px; }

.bstep {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  scroll-margin-top: calc(var(--header-h) + 24px);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.bstep.is-open { border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.bstep.is-locked { background: transparent; }
.bstep h3 { font-size: inherit; letter-spacing: 0; }
.bstep-toggle {
  width: 100%;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  min-height: 64px; padding: 14px 18px;
  background: none; border: 0; border-radius: var(--radius);
  text-align: left; cursor: pointer;
}
.bstep-toggle[aria-disabled="true"] { cursor: not-allowed; }
.bstep-num {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--ink-40);
  font-family: var(--font-mono); font-size: 0.8rem;
}
.bstep.is-done .bstep-num { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.bstep.is-open .bstep-num { border-color: var(--blue); color: var(--blue-deep); background: transparent; }
.bstep-title { font-family: var(--font-display); font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; }
.bstep.is-locked .bstep-title { color: var(--ink-60); }
.bstep-value {
  font-family: var(--font-mono); font-size: 0.78rem;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-80);
  white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis;
}
.bstep.is-done .bstep-value { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.bstep.is-locked .bstep-value { border-style: dashed; color: var(--ink-60); }

.bstep-panel { overflow: hidden; }
.bstep-content { padding: 0 18px 20px; }
.bstep-hint { color: var(--ink-80); margin: 0 0 16px; max-width: 52ch; }
.bstep fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.options--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.option { position: relative; display: block; cursor: pointer; }
.option input {
  position: absolute; opacity: 0; width: 1px; height: 1px;
  pointer-events: none;
}
.option-body {
  display: flex; flex-direction: column; gap: 6px;
  height: 100%;
  min-height: 112px;
  padding: 16px 16px 16px 48px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--ivory);
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
  position: relative;
}
.option-body::before {
  content: ""; position: absolute; left: 16px; top: 19px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--ink-60);
  background: var(--paper);
  transition: all 0.2s;
}
.option:hover .option-body { border-color: var(--ink); }
.option input:checked + .option-body {
  border-color: var(--blue);
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px var(--blue);
}
.option input:checked + .option-body::before {
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: inset 0 0 0 3px var(--ink);
}
.option input:focus-visible + .option-body { outline: 3px solid var(--blue); outline-offset: 3px; }
.option-label { font-weight: 650; font-size: 1.05rem; line-height: 1.3; }
.option-detail { font-size: 0.9rem; line-height: 1.45; color: var(--ink-80); }
.option-selected {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--blue-deep); display: block; visibility: hidden;
}
.option input:checked + .option-body .option-selected { visibility: visible; }

.option-label::after {
  content: ''; display: inline-block; width: 10px; height: 10px;
  margin-left: 8px; border-radius: 3px;
  background: var(--choice-swatch, var(--choice-color));
  box-shadow: 0 0 0 1px rgba(24, 39, 51, 0.15);
}
.option input:checked + .option-body {
  border-color: var(--choice-color);
  background: color-mix(in srgb, var(--choice-color) 7%, var(--ivory));
}
.option input:checked + .option-body::before {
  background: var(--choice-swatch, var(--choice-color));
  box-shadow: inset 0 0 0 3px var(--ivory);
}
.option-selected { color: var(--ink); }
.bstep.is-open .bstep-num { border-color: var(--choice-color); color: var(--ink); }
.bstep.is-done .bstep-value, .progress-step.is-done .progress-num {
  background: var(--choice-color); border-color: var(--choice-color); color: var(--choice-ink);
}
.progress-step[aria-current="step"] { border-color: var(--choice-color); }
.summary [data-chosen] .mx-mark { background: var(--choice-color); border-color: var(--choice-color); color: var(--choice-ink); }



.bstep-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.bstep-actions-note { font-size: 0.85rem; color: var(--ink-60); }
.bstep-actions-note.is-reserved { visibility: hidden; }

.builder-figure {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  height: calc(100svh - var(--header-h) - 24px);
  max-height: 860px; min-height: 520px;
  display: flex; flex-direction: column; gap: 12px;
}
.drawing-sheet--builder { background-color: #FDFDF9; }
.ready-stamp {
  position: absolute; top: 18px; right: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--ivory);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  animation: stamp-in 0.5s var(--ease) both;
}
.ready-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); }
@keyframes stamp-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.summary {
  margin: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--paper);
}
.summary > div { padding: 10px 14px; min-width: 0; }
.summary > div + div { border-left: 1px solid var(--line); }
.summary dt { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-60); }
.summary dd { margin: 2px 0 0; font-size: 0.92rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.summary dd.is-empty { color: var(--ink-60); font-weight: 450; font-style: italic; }

.done-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px;
  margin-top: 8px; padding: 20px;
  border-radius: var(--radius);
  background: var(--ink); color: var(--ivory);
  animation: stamp-in 0.5s var(--ease) both;
}
.done-card.is-editing { background: var(--paper); color: var(--ink); border: 1.5px dashed var(--ink); }
.done-dot { width: 14px; height: 14px; margin-top: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 2px var(--ivory); }
.done-card.is-editing .done-dot { background: var(--cyan); box-shadow: 0 0 0 2px var(--ink); }
.done-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.2; }
.done-text { margin-top: 4px; color: inherit; opacity: 0.85; font-size: 0.95rem; }
.done-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.done-card .btn--primary { background: var(--lime); color: var(--ink); }
.done-card .btn--primary:hover { background: #D8FF3D; }
.done-card .btn--quiet { border-color: rgba(245, 245, 236, 0.7); color: var(--ivory); }
.done-card .btn--quiet:hover { background: var(--ivory); color: var(--ink); }
.done-card .link-button { color: #C9D7FF; }
.done-card.is-editing .btn--primary { background: var(--ink); color: var(--ivory); }
.done-card.is-editing .link-button { color: var(--blue-deep); }
.done-card :focus-visible { outline-color: var(--cyan); }
.noscript-note { padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ── Handoff ──────────────────────────────────────────────── */

.handoff { padding-top: clamp(56px, 9vh, 104px); scroll-margin-top: calc(var(--header-h) + 8px); }
.handoff-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end;
  padding: clamp(24px, 4vw, 40px);
  border: 1.5px dashed var(--line-strong);
  border-radius: 28px;
  transition: border-color 0.4s, background-color 0.4s, border-radius 0.4s;
}
.handoff-head h2 { font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem); margin-bottom: 12px; }
.handoff-lede { color: var(--ink-80); max-width: 60ch; }
.handoff-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.handoff[data-state="ready"] .handoff-head {
  border-style: solid; border-color: var(--ink);
  background: var(--paper);
  border-radius: 28px 28px 0 0;
}
.handoff[data-state="ready"] h2::before {
  content: ""; display: inline-block; vertical-align: 0.12em;
  width: 0.42em; height: 0.42em; margin-right: 0.35em; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 0 2px var(--ink);
}

.handoff-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.7s var(--ease);
}
.handoff-inner {
  min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 0;
  visibility: hidden;
  transition: visibility 0s 0.7s;
}
.handoff[data-state="ready"] .handoff-body { grid-template-rows: 1fr; }
.handoff[data-state="ready"] .handoff-inner {
  visibility: visible; transition: visibility 0s 0s;
  border: 1px solid var(--ink); border-top: 0;
  border-radius: 0 0 28px 28px;
  background: var(--paper);
}
.prompt-panel { min-width: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.prompt-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-60);
}
.prompt-file { color: var(--ink); font-weight: 600; }
.prompt-meta { flex: 1; }
.prompt-text {
  margin: 0;
  padding: 20px 22px 28px;
  max-height: 560px; overflow: auto;
  font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--ink);
  background: #FFFFFF;
  user-select: text;
}
.prompt-text:focus-visible { outline-offset: -3px; border-radius: 0; }
.prompt-notes { padding: 24px; }
.prompt-notes h3 { font-size: 1.15rem; margin-bottom: 14px; letter-spacing: -0.01em; }
.prompt-notes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.prompt-notes li { position: relative; padding-left: 20px; font-size: 0.93rem; color: var(--ink-80); line-height: 1.5; }
.prompt-notes li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--blue);
}

.copy-feedback { font-family: var(--font-mono); font-size: 0.8rem; color: var(--blue-deep); }
.btn.is-copied { background: var(--blue); }

/* ── Terminal ─────────────────────────────────────────────── */

.terminal {
  background: var(--night);
  color: var(--night-text);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid #0A1218;
}
.terminal-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--night-line);
  font-family: var(--font-mono); font-size: 0.78rem;
}
.sim-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--lime); color: var(--lime);
  letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem;
}
.terminal-config { color: var(--night-muted); }
.terminal-config strong { color: var(--night-text); font-weight: 600; }
.terminal-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); }
.terminal-stages { border-right: 1px solid var(--night-line); padding: 12px; }
.terminal-stages ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.stage-btn {
  width: 100%;
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: center;
  min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--night-muted);
  text-align: left; cursor: pointer; font-size: 0.88rem; line-height: 1.3;
  transition: background-color 0.2s, color 0.2s;
}
.stage-btn:hover { background: var(--night-2); color: var(--night-text); }
.stage-btn:focus-visible { outline-color: var(--cyan); }
.stage-num {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.68rem;
  border: 1px solid rgba(147, 163, 175, 0.5);
}
.stage-btn.is-done { color: var(--night-text); }
.stage-btn.is-done .stage-num { background: var(--cyan); border-color: var(--cyan); color: var(--night); }
.stage-btn[aria-current="step"] { background: var(--night-2); color: #FFFFFF; }
.stage-btn[aria-current="step"] .stage-num { border-color: var(--lime); color: var(--lime); background: transparent; }

.terminal-screen { display: flex; flex-direction: column; min-width: 0; }
.terminal-output {
  position: relative;
  height: 440px; overflow: auto;
  padding: 18px 22px;
  font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.7;
  scroll-behavior: smooth;
}
.terminal-output:focus-visible { outline: 2px solid var(--cyan); outline-offset: -4px; }
.t-stage {
  margin: 14px 0 6px; padding-top: 12px;
  border-top: 1px dashed var(--night-line);
  color: #FFFFFF; font-weight: 600;
  scroll-margin-top: 8px;
}
.t-stage:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.t-stage-num { color: var(--lime); margin-right: 8px; }
.t-line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 2ch; text-indent: -2ch; }
.t-cmd { color: #FFFFFF; }
.t-cmd::before { content: "$ "; color: var(--cyan); }
.t-out { color: var(--night-text); padding-left: 4ch; text-indent: 0; }
.t-step::before { content: "▸ "; color: var(--cyan); }
.t-note { color: var(--night-muted); }
.t-note::before { content: "# "; }
.t-check { color: var(--night-text); }
.t-check::before { content: "○ "; color: var(--cyan); }
.t-check::after { content: "  · verify on your machine"; color: var(--night-muted); }
.t-task::before { content: "□ "; color: var(--lime); }
.t-hold { color: var(--lime); }
.t-hold::before { content: "‖ "; }
.t-cursor {
  display: inline-block; width: 0.6em; height: 1.1em; vertical-align: -0.2em;
  background: var(--cyan); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.t-enter { animation: line-in 0.25s var(--ease) both; }
@keyframes line-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.terminal-controls {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--night-line);
}
.btn--terminal { background: var(--lime); color: var(--night); }
.btn--terminal:hover:not([disabled]) { background: #D8FF3D; }
.btn--terminal-quiet { border-color: rgba(220, 230, 236, 0.45); color: var(--night-text); background: transparent; }
.btn--terminal-quiet:hover:not([disabled]) { background: var(--night-text); color: var(--night); }
.btn--terminal:focus-visible, .btn--terminal-quiet:focus-visible { outline-color: var(--cyan); }

/* ── Get started ──────────────────────────────────────────── */

.start { padding-bottom: clamp(72px, 12vh, 140px); }
.start-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 0.9fr);
  gap: 0;
  border-top: 1px solid var(--ink);
}
.start-col, .start-cta { padding: 28px 28px 0 0; }
.start-col + .start-col, .start-cta { padding-left: 28px; border-left: 1px solid var(--line); }
.start-col h3 { font-size: 1.3rem; margin-bottom: 18px; letter-spacing: -0.01em; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.check-list li { position: relative; padding-left: 28px; color: var(--ink-80); line-height: 1.5; }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: 0.3em;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--ink);
}
.check-list li strong { color: var(--ink); }
.check-list--plain li::before { border-radius: 50%; border-color: var(--blue); }
.start-cta-copy {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 1.1rem + 1.4vw, 2.3rem); letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: 20px;
}
.cta-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.cta-stack .btn { max-width: 100%; }
.cta-stack .btn--quiet { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; overflow-wrap: anywhere; }

/* ── Footer ───────────────────────────────────────────────── */

.site-footer { background: var(--ink); color: #C9D2D9; }
.footer-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 56px var(--gutter);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 24px 48px; align-items: center;
}
.footer-brand { display: block; width: 150px; padding: 8px 0; }
.footer-brand img { width: 100%; height: auto; }
.site-footer a { color: #FFFFFF; text-underline-offset: 3px; }
.footer-note { font-family: var(--font-mono); font-size: 0.78rem; color: #9DABB6; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
  .options--3 { grid-template-columns: minmax(0, 1fr); }
  .options--3 .option-body { min-height: 0; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(3) { border-left: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-cta { grid-column: 1 / -1; border-left: 0; padding-left: 0; margin-top: 28px; border-top: 1px solid var(--line); }
}

@media (max-width: 920px) {
  :root { --header-h: 60px; }
  .nav-toggle { display: inline-flex; }
  .nav-list {
    display: none;
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: var(--ivory);
    border-bottom: 1px solid var(--line-strong);
  }
  html:not(.js) .nav-list { display: flex; position: static; flex-direction: row; flex-wrap: wrap; padding: 0; border: 0; }
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .site-header { height: auto; position: static; }
  .nav-list.is-open { display: flex; }
  .nav-list a { min-height: 48px; font-size: 1.05rem; }
  .nav-github { margin-left: 0; justify-content: center; margin-top: 8px; }
  .brand-word { width: 112px; }
  .brand-icon { width: 34px; }

  .chapter { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-column: 1; grid-row: auto; min-height: 0; padding: 48px 0 40px; }
  .story-figure {
    grid-column: 1; grid-row: auto;
    top: var(--header-h);
    height: 46svh; min-height: 300px; max-height: 520px;
    z-index: 5;
    background: var(--ivory);
    padding: 8px 0 10px;
    margin: 0 calc(-1 * var(--gutter));
    padding-left: var(--gutter); padding-right: var(--gutter);
    border-bottom: 1px solid var(--line);
  }
  /* Reserve the same caption space for one, two or three lines. The SVG
     gets a fixed grid row and never resizes when the section label changes. */
  .story-figure { display: grid; grid-template-rows: minmax(0, 1fr) 68px; gap: 8px; }
  .story-figure .drawing-sheet { grid-area: 1 / 1; }
  .story-figure :is(.title-block, .mx-key) { grid-area: 2 / 1; align-self: stretch; height: 100%; align-content: start; }
  /* Phones get one compact line under the drawing: the part being explained
     (with the external provider beside the chief of staff), retaining the nearest description when no explanation is in view. */
  .story-figure .title-block { display: none; }
  .story-figure:not([data-description-layer]) .title-block { display: block; border-radius: 10px; }
  .story-figure:not([data-description-layer]) .tb-id { display: none; }
  .story-figure .tb-name { padding: 7px 10px; border-left: 0; }
  .story-figure .tb-state { border-left: 0; padding: 7px 10px; }
  .story-figure .mx-key { display: none; grid-template-columns: minmax(0, 1fr); padding: 6px 10px; border-radius: 10px; font-size: 0.78rem; }
  .story-figure[data-description-layer] .mx-key { display: grid; }
  .story-figure .mx-key li { display: none; }
  .story-figure[data-description-layer="agent"] .mx-key :is(li[data-key-layer="agent"], li[data-key-layer="provider"]),
  .story-figure[data-description-layer="workspace"] .mx-key li[data-key-layer="workspace"],
  .story-figure[data-description-layer="workflows"] .mx-key li[data-key-layer="workflows"],
  .story-figure[data-description-layer="foundation"] .mx-key li[data-key-layer="foundation"] { display: flex; }
  .story { grid-column: 1; grid-row: auto; }
  .story-step { min-height: 0; padding: 40px 0 56px; opacity: 1; }
  .story-intro { padding-top: 40px; }

  .section-head--split { grid-template-columns: minmax(0, 1fr); }

  .builder-grid { grid-template-columns: minmax(0, 1fr); }
  .builder-figure {
    order: -1;
    top: var(--header-h);
    height: auto; min-height: 0; max-height: none;
    z-index: 5;
    background: var(--ivory);
    margin: 0 calc(-1 * var(--gutter));
    padding: 8px var(--gutter) 10px;
    border-bottom: 1px solid var(--line);
    gap: 8px;
  }
  .builder-figure .drawing-sheet { flex: none; height: 30svh; min-height: 200px; border-radius: 20px; }
  .builder-figure .drawing { inset: 8px; }
  .ready-stamp { top: 10px; right: 10px; padding: 6px 10px; font-size: 0.68rem; }
  .summary { grid-template-columns: repeat(4, minmax(0, 1fr)); border-radius: 12px; }
  .summary > div { padding: 6px 8px; }
  .summary > div:nth-child(3) { border-left: 1px solid var(--line); }
  .summary > div:nth-child(n+3) { border-top: 0; }
  .summary dt { font-size: 0.6rem; letter-spacing: 0.06em; }
  .summary dd { font-size: 0.78rem; }
  .bstep { scroll-margin-top: calc(var(--header-h) + 30svh + 96px); }
  .progress-steps { display: none; }

  .handoff-head { grid-template-columns: minmax(0, 1fr); }
  .handoff-actions { justify-content: flex-start; }
  .handoff-inner { grid-template-columns: minmax(0, 1fr); }
  .prompt-panel { border-right: 0; border-bottom: 1px solid var(--line); }

  .terminal-grid { grid-template-columns: minmax(0, 1fr); }
  .terminal-stages { border-right: 0; border-bottom: 1px solid var(--night-line); overflow-x: auto; }
  .terminal-stages ol { display: flex; gap: 6px; width: max-content; }
  .stage-btn { width: auto; grid-template-columns: 24px auto; padding: 6px 12px 6px 8px; border: 1px solid var(--night-line); border-radius: 999px; }
  .stage-label { white-space: nowrap; }
  .terminal-output { height: 380px; }

  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .spec-list { grid-template-columns: minmax(0, 1fr); }
  .spec-list > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
  .spec-list > div { padding-top: 12px; }
  .cta-row .btn { flex: 1 1 100%; }
  .options { grid-template-columns: minmax(0, 1fr); }
  .option-body { min-height: 0; }
  .bstep-toggle { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .bstep-value { grid-column: 2; justify-self: start; max-width: 100%; }
  .bstep-content { padding: 0 14px 16px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(3) { border-left: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .story-figure { height: 42svh; min-height: 260px; }
  .start-grid { grid-template-columns: minmax(0, 1fr); }
  .start-col + .start-col { padding-left: 0; border-left: 0; margin-top: 28px; border-top: 1px solid var(--line); }
  .start-col { padding-right: 0; }
  .terminal-bar { padding: 12px 14px; }
  .terminal-output { padding: 14px; font-size: 0.78rem; height: 360px; }
  .terminal-controls { padding: 12px 14px; }
  .terminal-controls .btn { flex: 1 1 auto; }
  .handoff-actions .btn { flex: 1 1 auto; }
  .prompt-text { font-size: 0.78rem; padding: 16px; max-height: 460px; }
}

@media (max-width: 360px) {
  /* The two chief-of-staff key entries wrap to five lines on narrow phones. */
  .story-figure { grid-template-rows: minmax(0, 1fr) 88px; }
}

/* ── Reduced motion: stable expanded drawing, no animation ── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .scroll-cue { display: none; }
  .t-cursor { animation: none; }
  .eyebrow-dot::after { animation: none; opacity: 0; }
}
