/* ============================================================
   datafetch — carousel variant
   Fixed 4-region stage that holds steady across slides.
   Built on top of colors_and_type.css + styles.css.
   ============================================================ */

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  background-image:
    radial-gradient(rgba(var(--ink-rgb),0.06) 1px, transparent 1px),
    radial-gradient(rgba(var(--ink-rgb),0.04) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.85 0 0 0 0 0.84 0 0 0 0 0.8 0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.45'/></svg>");
  mix-blend-mode: overlay; opacity: var(--grain-opacity);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 99;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, var(--scan-stripe) 3px);
  opacity: 0.35;
}

/* ─── APP SHELL ──────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100dvh;
  height: 100vh;
}

/* chrome */
.chrome {
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
  padding: 10px 32px;
  display: flex; gap: 24px; align-items: center;
  flex-wrap: wrap;
}
.chrome .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.chrome .brand svg { width: 16px; height: 16px; display: block; }
.chrome .grow { flex: 1; }
.chrome .ch-meta { color: var(--ink-faint); }
.chrome .ch-meta b { color: var(--ink-dim); font-weight: 400; }
.chrome .ch-stamp {
  border: 1px solid var(--ink-mute); padding: 4px 10px; color: var(--ink-dim);
  display: inline-flex; gap: 8px; align-items: center;
}
.chrome .ch-stamp .dot { display: inline-block; width: 6px; height: 6px; background: var(--ink); animation: bl 1.1s steps(2) infinite; }
/* chrome controls — ported from the landing so the demo header reads identically */
.chrome .chrome-link,
.chrome .theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-faint); text-decoration: none;
  border: 1px solid var(--ink-faint);
  padding: 4px 8px;
  font: inherit; font-size: 11px; line-height: 1;
  letter-spacing: 0.14em; text-transform: uppercase;
  background: transparent; cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.chrome .chrome-link:hover,
.chrome .theme-toggle:hover {
  color: var(--bg); background: var(--ink); border-color: var(--ink);
}
.chrome .chrome-link svg,
.chrome .theme-toggle svg { display: block; }
.chrome .chrome-link .chrome-link-out { color: var(--ink-faint); margin-left: 1px; transition: color 0.14s; }
.chrome .chrome-link:hover .chrome-link-out { color: var(--bg); }
.chrome .chrome-link:focus-visible,
.chrome .theme-toggle:focus-visible { outline: 1px dashed var(--ink); outline-offset: 2px; }
/* sun/moon + label swap, driven by the data-theme attribute on <body> */
.chrome .theme-toggle .icon-moon { display: none; }
.chrome .theme-toggle .label-dark { display: none; }
[data-theme="light"] .chrome .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .chrome .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .chrome .theme-toggle .label-light { display: none; }
[data-theme="light"] .chrome .theme-toggle .label-dark  { display: inline; }
@keyframes bl { 50% { opacity: 0; } }

/* ─── SLIDE HEADER ───────────────────────────────────────────── */
.s-head {
  padding: 22px 32px 14px;
  border-bottom: 1px dashed var(--rule);
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 36px;
  align-items: start;
  min-height: 160px;     /* fixed: eyebrow + 2-line title + bottom padding */
}
.s-eye {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 8px;
}
.s-title {
  font-family: var(--font-mono); font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.0; letter-spacing: -0.015em;
  margin: 0;
  min-height: calc(1em * 2);     /* reserve 2 lines so short titles don't collapse the header */
}
.s-title .dim { color: var(--ink-dim); font-weight: 400; }
.s-title code { color: var(--hot); font-weight: 700; }
.s-intent {
  border-left: 2px solid var(--ink-mute);
  padding: 4px 0 4px 14px;
  font-size: 12.5px; line-height: 1.55;
  color: var(--ink);
}
.s-intent.from-provider { border-left-color: var(--ink); }
.s-intent .who {
  display: block; font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px;
}

/* ─── STAGE — 3 columns × 2 rows ──────────────────────────────
   ┌─────┬──────────────┬───────────┐
   │     │   editor     │ trajectory│   row 1
   │ tree├──────────────┼───────────┤
   │     │   console    │ stats     │   row 2
   └─────┴──────────────┴───────────┘
*/
.stage {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 360px;
  grid-template-rows: minmax(0, 1.4fr) minmax(0, 0.85fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  min-height: 0;
  position: relative;
}
.stage > .region {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 14px 16px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.region-tree {
  background: var(--panel-recess-1);
  grid-row: 1 / span 2;
  grid-column: 1 / span 1;
  border-bottom: 0;
}
.region-editor {
  background: var(--bg-2);
  grid-row: 1 / span 1;
  grid-column: 2 / span 1;
  padding: 0;
}
.region-console {
  background: #000;                     /* call-out: pure-black "screen" against the panel bg */
  grid-row: 2 / span 1;
  grid-column: 2 / span 1;
  border-bottom: 0;
}
[data-theme="light"] .region-console {
  /* warm ink — same hue as light-mode --ink, used as a "screen" surface.
     keeps the terminal metaphor without going stark white. */
  background: #1a1815;
}
[data-theme="light"] .region-console .region-title {
  color: rgba(243, 239, 226, 0.55);
  border-bottom-color: rgba(243, 239, 226, 0.18);
}
[data-theme="light"] .region-console .region-title .right { color: rgba(243, 239, 226, 0.45); }
[data-theme="light"] .region-console .term { color: #f3efe2; }
[data-theme="light"] .region-console .term .pr  { color: rgba(243, 239, 226, 0.55); }
[data-theme="light"] .region-console .term .dim { color: rgba(243, 239, 226, 0.55); }
[data-theme="light"] .region-console .term .cm  { color: rgba(243, 239, 226, 0.45); }
[data-theme="light"] .region-console .term .ok  { color: #b7d49a; }   /* brighter olive on dark */
[data-theme="light"] .region-console .term .st  { color: #c8d99e; }   /* string olive on dark */
[data-theme="light"] .region-console .term .id  { color: #f0b07a; }   /* amber identifier on dark */
[data-theme="light"] .region-console .term .fn  { color: #d9c08a; }
[data-theme="light"] .region-console .term .fl  { color: #f0b07a; }
[data-theme="light"] .region-console .term .err { color: #f0b07a; }
[data-theme="light"] .region-console .term .cursor { background: #f3efe2; }
.region-console .region-title {
  color: var(--ink-dim);
  border-bottom-color: rgba(var(--ink-rgb), 0.18);
}
[data-theme="light"] .region-console .region-title {
  color: var(--ink-faint);
  border-bottom-color: rgba(var(--ink-rgb), 0.14);
}
.region-console .term {
  font-weight: 500;                     /* a touch punchier than body */
}
.region-traj {
  background: var(--bg);                /* page-level: reads as observation, outside the workspace panels */
  grid-row: 1 / span 2;
  grid-column: 3 / span 1;
  border-right: 0;
  border-bottom: 0;
}

.region-title {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
  border-bottom: 1px dashed var(--rule);
  padding-bottom: 6px;
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  flex: 0 0 auto;
  min-height: 22px;       /* lock height so chrome doesn't bounce */
  white-space: nowrap;
  overflow: hidden;
}
.region-title > span {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.region-title > span:first-child { flex: 0 1 auto; }
.region-title > span.right { flex: 0 1 auto; max-width: 60%; text-align: right; }
.region-title .right { color: var(--ink-dim); }
.region-title .pulse { display: inline-block; width: 6px; height: 6px; background: var(--ink); margin-right: 6px; vertical-align: middle; animation: bl 1.1s steps(2) infinite; flex: 0 0 auto; }

/* ─── TREE inside stage ─────────────────────────────────────── */
.stage .tree {
  border: 0; background: transparent; padding: 0;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.75;
  border-left: 2px solid var(--ink-mute);
  padding-left: 10px;
}
.stage .tree .root {
  color: var(--ink); font-weight: 700;
  border-bottom: 1px dashed var(--rule);
  padding-bottom: 6px; margin-bottom: 6px;
}
.stage .tree .ln {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; color: var(--ink-faint);
  padding: 1px 4px;
  transition: color 0.18s, background 0.18s;
}
.stage .tree .ln .path { white-space: pre; flex: 1 1 auto; min-width: 0; }
.stage .tree .ln.bright { color: var(--ink); }
.stage .tree .ln.bright .path { color: var(--ink); }
.stage .tree .ln.active {
  color: var(--ink);
  background: rgba(var(--ink-rgb), 0.06);
}
.stage .tree .ln.active .path { color: var(--ink); font-weight: 500; }
.stage .tree .ln.empty .path { color: var(--ink-faint); font-style: italic; }
.stage .tree .ln .tag {
  flex: 0 0 auto; font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint);
  border: 1px solid var(--ink-mute); padding: 1px 6px; line-height: 1.4;
}
.stage .tree .ln .tag.yours { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.stage .tree .ln .tag.new {
  color: var(--bg); background: var(--hl-ok); border-color: var(--hl-ok);
}
.stage .tree .ln.fresh {
  animation: lineFlash 1.2s ease-out;
}
@keyframes lineFlash {
  0%   { background: rgba(var(--ink-rgb), 0.22); }
  100% { background: rgba(var(--ink-rgb), 0); }
}

/* ─── CLICKABLE TREE ROWS ──────────────────────────────────── */
.stage .tree .ln.clickable {
  cursor: pointer;
  border-radius: 0;
}
.stage .tree .ln.clickable:hover {
  background: rgba(var(--ink-rgb), 0.09);
  color: var(--ink);
}
.stage .tree .ln.clickable:hover .path { color: var(--ink); }
.stage .tree .ln.is-open {
  background: var(--ink);
  color: var(--bg);
}
.stage .tree .ln.is-open .path { color: var(--bg); font-weight: 700; }
.stage .tree .ln.is-open .tag {
  background: var(--bg); color: var(--ink); border-color: var(--bg);
}
.stage .tree .ln.is-open .open-dot {
  color: var(--bg);
  font-size: 8px;
  margin: 0 4px 0 -2px;
}
.stage .tree .ln.is-dir { cursor: default; }
.stage .tree .ln.clickable:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: -1px;
}
.tree-hint {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ─── EDITOR PANE ──────────────────────────────────────────── */
.region-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.region-editor .editor-title {
  margin: 0;
  padding: 14px 18px 8px;
  border-bottom: 1px dashed var(--rule);
  background: transparent;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  min-height: 22px;
}
.region-editor .ed-path { color: var(--ink); display: inline-flex; align-items: baseline; gap: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.region-editor .ed-mnt  { color: var(--ink-faint); letter-spacing: 0.18em; font-size: 10px; }
.region-editor .ed-name { color: var(--ink); font-weight: 700; letter-spacing: 0.04em; text-transform: none; font-size: 12px; }
.region-editor .editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 18px;
  background: var(--bg-2);
}
.region-editor .editor-body .code {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre;
  margin: 0;
  background: transparent;
  border: 0;
  padding: 0;
}
.region-editor .editor-body .code .gut {
  display: inline-block; width: 26px; color: var(--ink-faint);
  text-align: right; padding-right: 12px; user-select: none;
}
.region-editor .editor-body .code .kw  { color: var(--ink); font-weight: 700; }
.region-editor .editor-body .code .id  { color: var(--hot); font-weight: 700; }
.region-editor .editor-body .code .st  { color: var(--hl-str); }
.region-editor .editor-body .code .fn  { color: var(--hl-fn); }
.region-editor .editor-body .code .ok  { color: var(--hl-ok); }
.region-editor .editor-body .code .nm  { color: var(--ink); }
.region-editor .editor-body .code .cm  { color: var(--ink-faint); font-style: italic; }
.region-editor .editor-body .code .pn  { color: var(--ink-dim); }
.region-editor .editor-body .code .empty { color: var(--ink-faint); font-style: italic; }

/* ─── CONSOLE — terminal lines, beat-grouped ────────────────── */
.stage .term {
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.7;
  color: var(--ink);
  flex: 1 1 auto;
  display: block;
  font-weight: 500;
  overflow-y: auto;       /* autoscroll: latest beat stays visible */
  min-height: 0;
  scroll-behavior: smooth;
}
.t-beat { display: block; }
.t-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}
.t-beat.just-in {
  animation: beatIn 0.18s ease-out;
}
@keyframes beatIn {
  0%   { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}
.stage .term .pr { color: var(--ink-dim); }
.stage .term .fl { color: var(--hl-flag); }
.stage .term .st { color: var(--hl-str); }
.stage .term .fn { color: var(--hl-fn); }
.stage .term .id { color: var(--hot); font-weight: 700; }
.stage .term .ok { color: var(--hl-ok); }
.stage .term .dim { color: var(--ink-dim); }
.stage .term .cm { color: var(--ink-faint); font-style: italic; }
.stage .term .err { color: var(--err); }
.stage .term .cursor {
  display: inline-block; width: 7px; height: 11px;
  background: var(--ink); vertical-align: -2px;
  animation: bl 1s steps(2) infinite; margin-left: 2px;
}

/* ─── CODE inside stage ─────────────────────────────────────── */
.stage .code {
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.65;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
  flex: 1 1 auto;
}
.stage .code .gut {
  display: inline-block; width: 22px; color: var(--ink-faint);
  text-align: right; padding-right: 10px; user-select: none;
}
.stage .code .kw  { color: var(--ink); font-weight: 700; }
.stage .code .id  { color: var(--hot); font-weight: 700; }
.stage .code .st  { color: var(--hl-str); }
.stage .code .fn  { color: var(--hl-fn); }
.stage .code .ok  { color: var(--hl-ok); }
.stage .code .nm  { color: var(--ink); }
.stage .code .cm  { color: var(--ink-faint); font-style: italic; }
.stage .code .pn  { color: var(--ink-dim); }
.stage .code .empty { color: var(--ink-faint); font-style: italic; }

/* ─── FOOT (trajectory + stats) ─────────────────────────────── */
.foot-traj { display: grid; gap: 8px; min-width: 0; }
.foot-traj .region-title { margin-bottom: 4px; }
.traj { display: grid; gap: 4px; }
.traj-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 5px 8px;
  border-left: 2px solid var(--ink-mute);
  background: var(--panel-recess-1);
  min-width: 0;
}
.traj-row .op {
  font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
  text-align: right; padding-right: 10px;
  border-right: 1px solid var(--rule);
}
.traj-row.r .op { color: var(--hl-str); }
.traj-row.c .op { color: var(--hl-fn); }
.traj-row.w .op { color: var(--hl-ok); }
.traj-row .call { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.traj-row .call .id { color: var(--hot); font-weight: 700; }
.traj-row .call .st { color: var(--hl-str); }
.traj-row .call .dim { color: var(--ink-dim); }
.traj-row.nested {
  margin-left: 22px;
  border-left: 1px dashed var(--ink-mute);
  background: transparent;
  opacity: 0.72;
}
.traj-row.nested .op { color: var(--ink-faint); font-size: 9px; }
.traj-row.just-in {
  animation: trajIn 0.32s cubic-bezier(.2,.75,.2,1);
}
@keyframes trajIn {
  0%   { opacity: 0; transform: translateX(-8px); border-left-color: var(--hot); }
  60%  { border-left-color: var(--hot); }
  100% { opacity: 1; transform: translateX(0); border-left-color: var(--ink-mute); }
}
.traj-placeholder {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 8px;
  border-left: 2px dashed var(--ink-mute);
}

.foot-stats {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--rule);
  background: rgba(var(--ink-rgb), 0.018);
}
.foot-stat {
  padding: 10px 14px;
  border-right: 0;
  border-bottom: 1px dashed var(--rule);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 16px;
  row-gap: 2px;
  align-items: baseline;
}
.foot-stat:last-child { border-bottom: 0; }
.foot-stat .v {
  grid-row: 1 / span 2; grid-column: 1;
  font-size: 28px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em; line-height: 0.95;
  color: var(--ink);
}
.foot-stat .v sub {
  font-size: 10px; color: var(--ink-dim);
  letter-spacing: 0; margin-left: 2px; font-weight: 400;
}
.foot-stat .v.ok { color: var(--hl-ok); }
.foot-stat .k {
  grid-row: 1 / span 2; grid-column: 2;
  align-self: center;
  font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ─── CRYST OVERLAY ─────────────────────────────────────────── */
.cryst-banner {
  position: absolute; top: 12px; right: 16px;
  border: 1px solid var(--ink); background: var(--bg);
  padding: 6px 12px;
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 10px;
  z-index: 4;
}
.cryst-banner .diamond { color: var(--hl-ok); animation: bl 1.1s steps(2) infinite; }

/* ─── S-HEAD PROGRESS BAR ──────────────────────────────────── */
.s-progress {
  position: absolute;
  left: 32px; right: 32px;
  bottom: -1px;
  height: 2px;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.s-progress.is-playing { opacity: 1; }
.s-progress-bar {
  display: block; height: 100%;
  background: var(--ink);
  transition: width 0.2s ease-out;
}
.s-head { position: relative; }

/* ─── PLAY BUTTON ──────────────────────────────────────────── */
.nav-btn.nav-play {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.nav-btn.nav-play:hover:not(:disabled) {
  background: var(--hot);
  border-color: var(--hot);
  color: var(--bg);
}
.nav-btn.nav-play .play-glyph {
  display: inline-block;
  width: 10px;
  text-align: center;
  font-size: 10px;
}
.nav-btn.nav-restart { opacity: 0.8; }
.nav-dock {
  border-top: 1px solid var(--rule);
  padding: 12px 24px;
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.nav-btn {
  appearance: none; background: transparent;
  border: 1px solid var(--ink-mute); color: var(--ink-dim);
  padding: 6px 14px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  display: inline-flex; align-items: center; gap: 8px;
}
.nav-btn:hover:not(:disabled) {
  color: var(--ink); border-color: var(--ink-faint);
  background: rgba(var(--ink-rgb), 0.04);
}
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.nav-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: stretch;
  border: 1px solid var(--rule);
  background: rgba(var(--ink-rgb), 0.02);
  min-width: 0;
}
.nav-step {
  appearance: none; background: transparent;
  border: 0;
  border-right: 1px dashed var(--rule);
  border-top: 2px solid transparent;
  padding: 8px 10px;
  cursor: pointer; color: var(--ink-dim);
  font-family: var(--font-mono);
  display: grid; gap: 2px;
  text-align: left;
  min-width: 0;
  transition: color 0.12s, background 0.12s, border-top-color 0.12s;
}
.nav-step:last-child { border-right: 0; }
.nav-step:hover {
  color: var(--ink);
  background: rgba(var(--ink-rgb), 0.04);
}
.nav-step.is-on {
  border-top-color: var(--ink);
  background: rgba(var(--ink-rgb), 0.06);
  color: var(--ink);
}
.nav-step.is-on .ns-num { color: var(--ink); }
.nav-step.cryst.is-on { border-top-color: var(--hl-ok); }
.nav-step .ns-num {
  font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}
.nav-step .ns-name {
  font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
  white-space: nowrap;
}
.nav-count b { color: var(--ink); font-weight: 700; }
.nav-keyhint {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-left: 8px;
}
.nav-keyhint kbd {
  border: 1px solid var(--ink-mute);
  padding: 1px 6px;
  font: inherit; color: var(--ink-dim);
  margin: 0 2px;
}

/* ─── SLIDE TRANSITION ───────────────────────────────────────── */
/* No entry animation — we want chrome to feel steady across slides.
   The remount on key change is enough to update content. */
.slide-fader { display: contents; }
.slide-anim { opacity: 1; }

/* ─── helpers ────────────────────────────────────────────────── */
.id-accent { color: var(--hot); font-weight: 700; }
.dim { color: var(--ink-dim); }

/* ─── responsive ────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .stage { grid-template-columns: 300px minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  .stage {
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.7fr) auto;
  }
  .region-tree    { grid-row: 1 / span 3; }
  .region-editor  { grid-row: 1; grid-column: 2; }
  .region-console { grid-row: 2; grid-column: 2; border-bottom: 1px solid var(--rule); }
  .region-traj    { grid-row: 3; grid-column: 2; border-bottom: 1px solid var(--rule); }
  .s-head { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  /* On narrow screens the fixed-viewport "stage" can't hold four regions —
     unlock the page so it scrolls naturally instead of clipping content. */
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app { height: auto; min-height: 100dvh; min-height: 100vh; }

  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .stage > .region {
    border-right: 0;
    overflow: visible;          /* let the page scroll, not each box */
  }
  .region-tree    { grid-row: 1; grid-column: 1; border-bottom: 1px solid var(--rule); }
  .region-editor  { grid-row: 2; grid-column: 1; border-bottom: 1px solid var(--rule); min-height: 220px; }
  .region-console { grid-row: 3; grid-column: 1; min-height: 180px; }
  .region-traj    { grid-row: 4; grid-column: 1; border-bottom: 1px solid var(--rule); }
  /* editor keeps a horizontal scroll for wide code but grows vertically with content */
  .region-editor .editor-body { overflow-x: auto; overflow-y: visible; }
  .stage .term { overflow: visible; min-height: 0; }
  .nav-track { display: none; }
}

@media (max-width: 600px) {
  /* phone: compact the chrome + slide header, and let the nav dock wrap */
  .chrome { padding: 9px 14px; gap: 12px; }
  .chrome-tag { display: none; }        /* keep the header to one line on phones */

  .s-head { padding: 16px 16px 12px; min-height: 0; gap: 14px; }
  .s-title { font-size: clamp(20px, 6.4vw, 26px); min-height: 0; }
  .s-intent { font-size: 12px; }
  .s-progress { left: 16px; right: 16px; }

  .stage > .region { padding: 12px 14px; }
  .region-editor .editor-title { padding: 12px 14px 8px; }
  .region-editor .editor-body { padding: 14px; }

  .nav-dock {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px; padding: 10px 12px;
  }
  .nav-dock > div { flex-wrap: wrap; justify-content: center; }
  .nav-keyhint { display: none; }       /* keyboard hints are irrelevant on touch */
  .nav-count { width: 100%; text-align: center; order: -1; }
  .nav-btn { padding: 11px 14px; }      /* ~44px tall touch targets */
}
