/* ROSE — a deliberately flat, gridded, technical look.
   Monochrome and light-only by design: ink on paper, with a soft grey plate
   carrying the diagrams. A dark inversion would lose the drafting-paper feel
   the grid marks depend on. */

:root {
  --accent: #1a1a1a;
  --accent-hover: #3d3d3d;
  --plate: #f1f1f1;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --rule: #e6e6e6;
  --paper: #ffffff;
  --panel: #fafafa;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --gut: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.nav-in {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.logo:hover { text-decoration: none; }
.logo svg { display: block; }
.nav-links {
  display: flex;
  gap: 26px;
  margin-left: auto;
  align-items: center;
}
.nav-links a { color: var(--ink); font-size: 15px; }
/* `.nav-links a` outranks `.btn`, so the button label needs to win back. */
.nav-links a.btn { color: #fff; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 500;
  border: 0;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { background: var(--panel); }

/* -------------------------------------------------------------- rails */

.rail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding: 13px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.rail b { color: var(--ink); font-weight: 500; }

/* --------------------------------------------------------------- hero */

.hero-head {
  padding-top: clamp(40px, 6vw, 74px);
  padding-bottom: clamp(24px, 3vw, 36px);
}
.hero-head h1 { max-width: 26ch; }
.hero-head .lede { max-width: 62ch; }
h1 {
  font-size: clamp(38px, 5.6vw, 68px);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 26px;
}
h1 .accent { color: #a3a3a3; }
.lede {
  font-size: clamp(16px, 1.5vw, 18.5px);
  color: var(--muted);
  max-width: 46ch;
  margin: 0 0 34px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

/* ------------------------------------------------------------- figures */

figure.fig { margin: 0 0 30px; }
.fig .plate {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 30px 28px 26px;
}
.fig .plate > svg { width: 100%; height: auto; display: block; }
.fig figcaption {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 12px;
  line-height: 1.6;
}
.fig figcaption b { color: var(--ink); font-weight: 500; }

.fig-lead { padding: 6px 0 14px; }

/* ------------------------------------------------------------- terminal */

/* A depiction of the real Claude Code window, so radii and colour here are
   mimicry rather than styling — being recognisable at a glance is the whole
   job this figure does. */
.term-fig .plate { padding: 0; border: 0; background: none; }

.cc-stage { position: relative; }

.cc {
  --cc-chrome: #2e2e34;
  --cc-tabbar: #26262b;
  --cc-tab:    #3b3b44;
  --cc-body:   #1b1b20;
  --cc-text:   #d2d2d8;
  --cc-dim:    #74747e;
  --cc-rule:   #3a3a42;
  --cc-user:   #2c2c33;
  --cc-accent: #d97757;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cc-body);
  font-family: var(--mono);
  box-shadow: 0 18px 44px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.14);
}

.cc-title {
  display: flex; align-items: center; gap: 12px;
  background: var(--cc-chrome);
  padding: 11px 15px;
}
.cc-lights { display: flex; gap: 8px; flex: none; }
.cc-lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.cc-lights .r { background: #ff5f57; }
.cc-lights .y { background: #febc2e; }
.cc-lights .g { background: #28c840; }
.cc-name {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  color: #f2f2f4; font-size: 13px; font-weight: 500;
}
.cc-name .ico { width: 15px; height: 13px; flex: none; display: block; }
.cc-name .spin { color: #c9c9d0; }
.cc-name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cc-tabs {
  display: flex; align-items: center; gap: 8px;
  background: var(--cc-tabbar);
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--cc-dim);
}
.cc-tabs .tab {
  padding: 6px 14px; border-radius: 8px; white-space: nowrap;
  transition: background .35s ease, color .35s ease;
}
.cc-tabs .tab.on { background: var(--cc-tab); color: #eaeaef; }
.cc-tabs .sep { opacity: .55; }
.cc-tabs .plus {
  margin-left: auto; width: 24px; height: 24px;
  border: 1px solid #4a4a54; border-radius: 50%;
  display: grid; place-items: center; color: #b9b9c2; flex: none;
}

/* --- transcript: two panes stacked in the same reserved box --- */
.cc-body {
  position: relative;
  height: 330px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cc-text);
}
.pane {
  position: absolute; inset: 0;
  padding: 15px 18px;
  overflow: hidden;
  transition: opacity .45s ease, transform .45s ease;
}
.pane-in { transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .5s ease; }
.pane.dim .pane-in { opacity: .28; }
.pane[data-pane="1"], .pane[data-pane="2"] { opacity: 0; pointer-events: none; }
.cc.on-b .pane[data-pane="1"] { opacity: 1; }
.cc.on-c .pane[data-pane="2"] { opacity: 1; }
.pane.gone { opacity: 0; transform: translateY(-10px); }

.ln { display: none; margin-bottom: 9px; }
.ln.on { display: block; animation: lnIn .3s cubic-bezier(.2,.7,.3,1) both; }
@keyframes lnIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.ln-head, .ln-out { display: flex; gap: 10px; }
.ln-out { color: var(--cc-dim); padding-left: 22px; }
.ln .mark { flex: none; width: 12px; color: var(--cc-dim); }
.ln .txt { min-width: 0; }
.ln.user .ln-head { background: var(--cc-user); padding: 6px 12px 6px 10px; margin: 0 -6px; }
.ln.status .ln-head, .ln.status .mark { color: var(--cc-dim); }
.ln.recall .ln-head, .ln.recall .mark { color: var(--cc-accent); }

/* --- the rush: the whole transcript reels, lightly blurred --- */
.ln.grindline { color: var(--cc-dim); margin-bottom: 4px; }
.ln.grindline .ln-head { white-space: pre; }
.pane.rushing .pane-in { filter: blur(.7px); opacity: .58; }
.pane-in { transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .5s ease, filter .4s ease; }
.rush-tag {
  position: absolute;
  right: 18px; bottom: 12px;
  background: linear-gradient(90deg, transparent, var(--cc-body) 22%);
  color: var(--cc-accent);
  font-size: 12px;
  padding: 3px 0 3px 30px;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.rush-tag.on { opacity: 1; }

/* --- the store --- */
.store { margin-top: 10px; }
.store-head {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--faint);
  padding: 0 0 8px;
}
.store-head .store-note { color: var(--ink); font: inherit; letter-spacing: inherit; }
/* The store drawn as what it is: a lineage. Each compaction files a node one
   level up, and the ones underneath stay reachable forever — which is the
   clearest way to show that nothing is ever deleted. */
.store-tree { margin: 0 18px; }
.tier {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 34px;
  padding: 5px 0;
  position: relative;
}
.tier .lv {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: #c2c2c2;
  padding-top: 9px;
  transition: color .3s ease;
}
.tier.live .lv { color: var(--faint); }
.tier.apex .lv { color: var(--ink); }

/* the rail, with a tick at every level that holds a node */
.tier::before {
  content: "";
  position: absolute;
  left: 25px; top: 0; bottom: 0;
  border-left: 1px solid #e4e4e4;
}
.tier:first-child::before { top: 16px; }
.tier:last-child::before  { bottom: calc(100% - 18px); }
.tier.live::after {
  content: "";
  position: absolute;
  left: 22px; top: 15px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #d0d0d0;
  transition: background .3s ease, box-shadow .3s ease;
}
.tier.apex::after { background: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.07); }

.tier-cards {
  display: flex;
  gap: 10px;
  min-height: 30px;
  align-items: stretch;
}
.tier-cards:empty {
  border: 1px dashed #e0e0e0;
  background: #fbfbfb;
}
.tier-cards > .lesson-card { flex: 1 1 0; min-width: 0; }

/* nodes below the apex are kept, but they are not what recall pays for */
.lesson-card.stored {
  padding: 9px 13px;
  opacity: .38;
  transition: opacity .55s ease;
}
.tier.apex .lesson-card.stored { opacity: 1; }
.tier.landed .lesson-card { animation: land .9s ease 1; }
@keyframes land {
  0%   { box-shadow: 0 0 0 0 rgba(217,119,87,0); }
  40%  { box-shadow: 0 0 0 3px rgba(217,119,87,.55); }
  100% { box-shadow: 0 0 0 0 rgba(217,119,87,0); }
}

/* Two cards closing on each other, about to become one. */
.lesson-card.merging {
  box-shadow: 0 0 0 1px rgba(217,119,87,.9), 0 0 34px rgba(217,119,87,.32);
  z-index: 3;
}

/* --- the lesson, lifted out of one tab and dropped into the other --- */

/* One card design, several instances: what is on disk, the copies injected
   into a session, and the shorter ones compaction writes. Each is a REAL child
   of wherever it lives — a line in the transcript, a row in the store — so it
   scrolls and reflows with its container. Nothing is parked on top of the
   terminal, which is what used to drift out of sync and overlap. */
.limbo { display: none; }
.lesson-mount:empty { display: none; }
.lesson-mount { margin-bottom: 9px; }

.lesson-card {
  box-sizing: border-box;
  display: flex; align-items: flex-start; gap: 14px;
  color: #fff;
  background: #24242b;
  border-left: 2px solid var(--cc-accent);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.lesson-card .lf-text { flex: 1; min-width: 0; }
.lesson-card .lf-tok {
  flex: none;
  font-family: var(--mono);
  font-size: 11.5px; color: #74747e; letter-spacing: .02em;
  white-space: nowrap;
}
.lesson-card .lf-tok b { color: #d2d2d8; font-weight: 400; }

/* In the transcript it is a line, not a panel resting on one. */
.lesson-card.inline {
  background: transparent;
  padding: 3px 0 3px 12px;
  box-shadow: none;
}
.lesson-card.inline + .lesson-card.inline { margin-top: 6px; }
.lesson-card.in-store + .lesson-card.in-store { margin-top: 8px; }

.lesson-card.pop { animation: cardIn .38s cubic-bezier(.2,.7,.3,1); }
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }

/* The travelling copy: a throwaway clone, free of any overflow clipping. */
.ghost {
  position: absolute;
  z-index: 60;
  margin: 0 !important;
  pointer-events: none;
  opacity: 1;
  transition: transform .75s cubic-bezier(.45,0,.2,1),
              width .75s cubic-bezier(.45,0,.2,1);
  box-shadow: 0 18px 36px rgba(0,0,0,.5);
}

.lesson-card.lift {
  box-shadow: 0 18px 36px rgba(0,0,0,.55), 0 0 0 1px rgba(217,119,87,.65);
  background: #24242b;
  padding: 10px 14px;
  transition: box-shadow .4s ease, background .4s ease, padding .4s ease;
}

/* Compaction, made watchable: the clauses on their way out strike through in
   the accent colour, a sweep runs across the card, then they leave and the
   text reflows tighter. */
.lesson-card .seg { transition: color .3s ease, opacity .3s ease; }
.lesson-card .seg.dropping {
  color: var(--cc-accent);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.lesson-card.compacting {
  position: relative;
  overflow: hidden;
  background: #24242b;
  padding: 10px 14px;
  box-shadow: 0 0 0 1px rgba(217,119,87,.9), 0 0 30px rgba(217,119,87,.3);
}
.lesson-card.compacting::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(217,119,87,.24) 45%,
                              rgba(255,255,255,.18) 52%, transparent 100%);
  animation: sweep .95s cubic-bezier(.4,0,.2,1) 2;
  pointer-events: none;
}

/* The merge: two lessons side by side, driven into each other, and one new
   lesson thrown out of the collision. */
.merge-row {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.merge-row > .lesson-card {
  flex: 1 1 0;
  min-width: 0;
  transition: transform .8s cubic-bezier(.32,0,.12,1),
              opacity .5s ease,
              box-shadow .4s ease,
              background .4s ease,
              padding .4s ease;
}
/* draw apart first — the anticipation is what makes the collision read */
.merge-row.armed > .lesson-card {
  background: #24242b;
  padding: 10px 14px;
  box-shadow: 0 0 0 1px rgba(217,119,87,.85), 0 0 26px rgba(217,119,87,.26);
  transition: transform .5s cubic-bezier(.3,0,.3,1),
              box-shadow .4s ease, background .4s ease, padding .4s ease;
}
.merge-row.armed > .merge-a { transform: translateX(-12px); }
.merge-row.armed > .merge-b { transform: translateX(12px); }
.merge-row.clash > .merge-a { transform: translateX(calc(50% + 6px)); }
.merge-row.clash > .merge-b { transform: translateX(calc(-50% - 6px)); opacity: .45; }

/* the flash at the point of impact */
.merge-row .burst {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
  z-index: 4;
}
.merge-row.boom .burst { animation: boom .6s cubic-bezier(.15,.85,.3,1) 1; }
@keyframes boom {
  0%   { opacity: 1; transform: scale(.5);
         box-shadow: 0 0 30px 12px rgba(255,255,255,.85), 0 0 60px 26px rgba(217,119,87,.9); }
  45%  { opacity: .9; }
  100% { opacity: 0; transform: scale(5);
         box-shadow: 0 0 70px 0 rgba(255,255,255,0), 0 0 120px 0 rgba(217,119,87,0); }
}

/* what comes out of the collision */
.merge-row > .lesson-card.born {
  animation: born .65s cubic-bezier(.2,.85,.3,1) 1;
  box-shadow: 0 0 0 1px rgba(217,119,87,.9), 0 0 34px rgba(217,119,87,.34);
  background: #24242b;
  padding: 10px 14px;
}
@keyframes born {
  0%   { transform: scale(.92); opacity: .35; }
  55%  { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes sweep { from { transform: translateX(-110%); } to { transform: translateX(110%); } }
.lesson-gap { height: 0; transition: height .3s ease; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,87,0); }
  50%      { box-shadow: 0 0 0 3px rgba(217,119,87,.35); }
}

/* --- input + status --- */
.cc-input {
  display: flex; align-items: center; gap: 9px;
  border-top: 1px solid var(--cc-rule);
  padding: 11px 18px;
  font-size: 13px; color: var(--cc-dim);
}
.cc-input .typed { color: #e9e9ee; white-space: pre; }
.cc-caret { width: 8px; height: 16px; background: #71717b; flex: none; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%,55% { opacity: 1; } 56%,100% { opacity: .12; } }
.cc-status {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 0 18px 12px;
  font-size: 12px; color: var(--cc-dim);
}
.cc-status b { color: var(--cc-accent); font-weight: 400; }
.cc-status .right { color: #a9a9b3; text-align: right; white-space: nowrap; }

/* Transport. Scrubbing is only honest if seeking lands instantly, so every
   transition is suppressed while the timeline is being replayed to a point. */
.term-transport {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.term-transport .pp {
  width: 34px; height: 34px;
  flex: none;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.term-transport .pp:hover { border-color: var(--faint); }
.term-transport .clock {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.scrub {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 3px;
  background: #e2e2e2;
  cursor: pointer;
}
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px;
  background: var(--ink);
  border: 0; border-radius: 50%;
}
.scrub::-moz-range-thumb {
  width: 13px; height: 13px;
  background: var(--ink);
  border: 0; border-radius: 50%;
}
.seeking * { transition: none !important; animation: none !important; }

.fig-controls {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; margin-top: 14px;
}
.fig-controls figcaption { margin-top: 0; }
.fig-controls button {
  border: 1px solid var(--rule); background: var(--paper);
  font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding: 8px 14px; cursor: pointer; flex: none;
}
.fig-controls button:hover { color: var(--ink); border-color: var(--faint); }

@media (max-width: 620px) {
  .cc-body { height: 400px; font-size: 12px; }
  .cc-tabs { font-size: 11.5px; }
  .cc-tabs .plus { display: none; }
}

/* ------------------------------------------- the lesson rewriting itself */

.morph .plate { padding: 26px 28px 22px; }
.morph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}
.morph-head .n {
  font-size: 27px;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.morph-bar { height: 7px; background: #ededed; margin: 14px 0 0; }
.morph-bar i {
  display: block; height: 100%; background: var(--ink);
  transition: width 620ms cubic-bezier(.4,0,.2,1);
}

/* Fixed slot, shrinking card: the box gets visibly smaller without shoving
   the rest of the page around every few seconds. */
.morph-slot { min-height: 128px; margin-top: 18px; }
.morph-card {
  border-left: 2px solid var(--ink);
  padding: 2px 0 2px 18px;
}
.morph-card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #2a2a2a;
  max-width: 78ch;
  transition: opacity .2s ease;
}
.morph-beat, .morph-drop {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
  opacity: 0;
  transition: opacity .3s ease;
}
.morph-beat { margin-bottom: 10px; }
.morph-beat.show, .morph-drop.show { opacity: 1; }
.morph-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
  padding-top: 14px;
}
.morph-foot .tree-steps { padding-bottom: 0; }

@media (max-width: 620px) {
  .morph-slot { min-height: 196px; }
  .morph-card p { font-size: 15px; }
  .morph-foot { flex-wrap: wrap; gap: 12px; }
}

/* ---------------------------------------------------------- memory tree */

.tree .plate { padding: 28px 26px 22px; }

.tree-hud {
  display: flex;
  align-items: flex-end;
  border-top: 1px solid var(--rule);
  margin-top: 24px;
  padding-top: 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: clamp(24px, 4vw, 52px);
}
.stat + .stat {
  border-left: 1px solid var(--rule);
  padding-left: clamp(24px, 4vw, 52px);
}
.stat .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.stat .v {
  font-family: var(--mono);
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* A segmented track rather than seven little boxes — it reads as progress
   through one story, which is what it is. */
.tree-steps {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  padding-bottom: 4px;
}
.tree-steps button {
  width: 30px; height: 18px;
  padding: 0; border: 0; background: none;
  display: flex; align-items: center;
  cursor: pointer;
}
.tree-steps button::before {
  content: ""; display: block; width: 100%; height: 3px;
  background: #dcdcdc; transition: background .15s, height .15s;
}
.tree-steps button:hover::before { background: #a8a8a8; }
.tree-steps button[aria-selected="true"]::before { background: var(--ink); height: 6px; }

.tree-cap {
  margin: 20px 0 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 78ch;
  min-height: 3.1em;
}

@media (max-width: 700px) {
  .tree-hud { flex-wrap: wrap; gap: 18px; }
  .stat + .stat { border-left: 0; padding-left: 0; }
  .tree-steps { margin-left: 0; width: 100%; }
  .tree-steps button { flex: 1; width: auto; }
  .tree-cap { min-height: 5.4em; font-size: 15.5px; }
}

/* -------------------------------------------------------------- blocks */

section { border-top: 1px solid var(--rule); padding: clamp(46px, 6vw, 84px) 0; }
.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 20px;
}
h3 {
  font-size: clamp(26px, 3.4vw, 40px);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 18px;
  font-weight: 700;
}
.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(24px, 4vw, 56px);
}
.three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.cell { background: var(--paper); padding: 26px; }
.cell .n {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: 12px;
}
.cell h4 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.01em; }
.cell p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------------------------------------------------------------- code */

pre, code { font-family: var(--mono); }
pre {
  background: #f7f7f7;
  border: 1px solid var(--rule);
  color: #1a1a1a;
  padding: 20px 22px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0 0 18px;
}
pre .c { color: #8d8d8d; }   /* comment  */
pre .g { color: #4a4a4a; }   /* literal  */
pre .b { color: #000; font-weight: 600; }  /* command */
p code, li code, td code {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1px 5px;
  font-size: 0.9em;
}

/* --------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.scroll { overflow-x: auto; }

/* -------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0 60px;
  color: var(--faint);
  font-size: 14px;
}
footer .row { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
footer a { color: var(--muted); }

/* ----------------------------------------------------------- docs page */

.docs {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}
/* A grid item defaults to `min-width: auto`, which resolves to its min-content
   size — so a wide table or code block pushes the item past its track however
   the track is sized. `minmax(0, 1fr)` fixes the track; this fixes the item,
   and both are needed. */
.docs > * { min-width: 0; }
.docs {
  gap: clamp(28px, 5vw, 64px);
  /* The horizontal value has to be restated. This element is `wrap docs`, and
     `.wrap` supplies the gutter — but a later shorthand `padding` here resets
     it to zero, so the text ran edge to edge. Invisible on a wide screen,
     where `max-width` leaves margin anyway, and obvious on a phone. */
  padding: 44px var(--gut) 80px;
  align-items: start;
}
.toc { position: sticky; top: 96px; font-size: 14.5px; }
.toc .grp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 22px 0 9px;
}
.toc a { display: block; padding: 5px 0; color: var(--muted); border-left: 2px solid transparent; padding-left: 12px; margin-left: -12px; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }
.prose h2 {
  font-size: 28px;
  letter-spacing: -.025em;
  margin: 52px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 19px; margin: 30px 0 10px; letter-spacing: -.01em; }
/* The divider between the intuitive half and the mechanism. */
.prose h2.part {
  font-size: 13px;
  font-family: var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
  border-top: 2px solid var(--ink);
  margin-top: 72px;
  padding-top: 16px;
}
.prose p, .prose li { color: #2a2a2a; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 7px; }
.note {
  border-left: 3px solid var(--accent);
  background: var(--panel);
  padding: 15px 18px;
  margin: 0 0 18px;
  font-size: 15px;
}
.note b { color: var(--ink); }

@media (max-width: 900px) {
  /* `1fr` is `minmax(auto, 1fr)`, and that `auto` lets a wide child — a code
     block, a table — force the whole track past the viewport. Every grid track
     holding arbitrary content needs an explicit zero minimum. */
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .toc {
    position: static;
    border: 1px solid var(--rule);
    padding: 0;
    margin-bottom: 26px;
  }
  .toc > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
  }
  .toc > summary::-webkit-details-marker { display: none; }
  .toc > summary::after { content: "＋"; color: var(--faint); }
  .toc[open] > summary::after { content: "－"; }
  .toc[open] > summary { border-bottom: 1px solid var(--rule); }
  .toc .grp { padding: 0 16px; margin: 16px 0 6px; }
  .toc a { padding: 7px 16px; margin-left: 0; border-left: 0; }
  .toc a:last-child { margin-bottom: 14px; }
  .nav-links a:not(.btn) { display: none; }
}

/* The disclosure is a mobile affordance; on a wide screen the list is just
   the sidebar, always visible. */
@media (min-width: 901px) {
  .toc > summary { display: none; }
}
