/*
 * app.css — layout + components. Hand-written, no framework.
 *
 * Two ideas carry the whole file:
 *
 *   1. Progressive disclosure lives in CSS. One [data-tier] attribute on .app
 *      decides how much machinery is visible, so tier 1 hides the inspector
 *      without a line of JavaScript.
 *   2. Everything is a panel: a hairline box with an uppercase label bar.
 *      Rules, not shadows. Square corners, not rounded ones.
 */

/* ── shell grid ──────────────────────────────────────────────────────── */
/*
 * The terminal's height is a custom property so the drag handle can change it
 * without anything else needing to know. It is never collapsed: the terminal is
 * the input device for the whole app, and a first screen that says "type a
 * command below" with nowhere to read the answer is simply broken.
 */
.app {
  --term-h: 248px;
  /* The rail collapses to zero rather than sliding over the stage, so the
     canvas actually gains the space instead of hiding behind a drawer. */
  --nav-w: 236px;
  display: grid;
  position: relative;
  height: 100vh;
  grid-template-columns: var(--nav-w) 1fr 0;
  grid-template-rows: 46px minmax(0, 1fr) var(--term-h);
  grid-template-areas:
    "hdr  hdr    hdr"
    "side stage  insp"
    "side term   term";
  transition: grid-template-columns var(--t-med);
}

/* tier 3 reveals the inspector column */
/* 520px is the width a 16-byte hex row plus its ASCII gutter actually needs. */
.app[data-tier="3"] { grid-template-columns: var(--nav-w) 1fr 520px; }
.app[data-nav="closed"] { --nav-w: 0px; }

/* ── header ──────────────────────────────────────────────────────────── */
.hdr {
  grid-area: hdr;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-3);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
.hdr__brand { display: flex; align-items: baseline; gap: var(--sp-2); flex: none; }
.hdr__name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--fg);
}
.hdr__cursor { color: var(--accent); animation: blink 1.1s step-end infinite; }
.hdr__ver { font-size: 9.5px; letter-spacing: 0.1em; color: var(--fg-2); }

/* breadcrumb: ROOT / CH_02 / NAMES_TO_NUMBERS */
.crumbs { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.crumbs__sep { color: var(--fg-2); }
.crumbs__item {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  text-transform: uppercase;
  white-space: nowrap;
}
.crumbs__item--current { color: var(--accent); font-weight: 600; }

.hdr__right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.iconbtn {
  width: 26px; height: 26px;
  color: var(--fg-2);
  border: 1px solid transparent;
  display: grid; place-items: center;
  font-size: 12px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.iconbtn:hover { color: var(--accent); border-color: var(--line); }

.progress { display: flex; gap: 3px; }
.progress__dot {
  width: 10px; height: 3px;
  background: var(--bg-3);
  transition: background var(--t-fast);
}
.progress__dot--done { background: var(--ok); }
.progress__dot--now  { background: var(--accent); }

/* ── sidebar ─────────────────────────────────────────────────────────── */
.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  /* Clipped, not squashed: the inner column keeps its full width while the
     grid column animates to zero, so nothing reflows on the way out. */
  overflow: hidden;
}
.app[data-nav="closed"] .side { border-right-color: transparent; }

.side__inner {
  width: 236px;
  height: 100%;
  padding-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.hdr__burger { font-size: 14px; flex: none; }
.hdr__burger[aria-expanded="true"] { color: var(--accent); }
.side__label {
  font-size: var(--label-size);
  text-transform: uppercase;
  letter-spacing: var(--label-track);
  color: var(--fg-2);
  padding: 0 var(--sp-3) var(--sp-2);
}
.side__label--sep {
  margin-top: var(--sp-5);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
}

.chapters, .tiers { display: flex; flex-direction: column; }

.chapter {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-3);
  color: var(--fg-1);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  width: 100%;
  text-align: left;
  /* The active marker is a left rule, so nothing shifts when it appears. */
  border-left: 2px solid transparent;
  transition: background var(--t-fast), color var(--t-fast);
}
.chapter:hover { background: var(--bg-2); color: var(--fg); }
.chapter--active { background: var(--bg-2); border-left-color: var(--accent); color: var(--fg); }
.chapter__num { width: 16px; flex: none; font-size: 10px; color: var(--fg-2); }
.chapter--active .chapter__num { color: var(--accent); }
.chapter--done .chapter__num { color: var(--ok); }
.chapter__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter__real {
  margin-left: auto;
  font-size: 8.5px;
  letter-spacing: 0.08em;
  padding: 0 4px;
  border: 1px solid var(--line);
  color: var(--fg-2);
}
.chapter__real--live { border-color: var(--ok); color: var(--ok); }

.tier {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 6px var(--sp-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-1);
  width: 100%;
  text-align: left;
  border-left: 2px solid transparent;
  transition: background var(--t-fast);
}
.tier:hover { background: var(--bg-2); }
.tier--active { background: var(--bg-2); color: var(--fg); border-left-color: var(--accent); }
.tier__dot { width: 6px; height: 6px; flex: none; }
.tier[data-tier="1"] .tier__dot { background: var(--tier-1); }
.tier[data-tier="2"] .tier__dot { background: var(--tier-2); }
.tier[data-tier="3"] .tier__dot { background: var(--tier-3); }
.tier__hint { margin-left: auto; color: var(--fg-2); font-size: 9px; letter-spacing: 0.08em; }

/* the way out to the builder, pinned above the zero-dependency block */
.sidelink {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  color: var(--fg-1);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidelink:hover { background: var(--accent-soft); color: var(--fg); }
.sidelink__mark {
  width: 38px; flex: none;
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--accent);
  border-right: 1px solid var(--line);
}
.sidelink__body { padding: var(--sp-2) var(--sp-3); min-width: 0; }
.sidelink__name { display: block; font-size: 9.5px; letter-spacing: 0.12em; }
.sidelink__meta {
  display: block;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.sidelink__go {
  margin-left: auto;
  display: grid; place-items: center;
  padding-right: var(--sp-3);
  font-size: 12px;
  color: var(--fg-2);
  transition: transform var(--t-fast), color var(--t-fast);
}
.sidelink:hover .sidelink__go { transform: translateX(2px); color: var(--accent); }

/* the zero-dependency block, pinned to the foot of the rail */
.side__foot { margin-top: auto; border-top: 1px solid var(--line); }
.statblock { display: flex; align-items: stretch; }
.statblock__mark {
  width: 38px; flex: none;
  display: grid; place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--ok);
  border-right: 1px solid var(--line);
}
.statblock__body { padding: var(--sp-2) var(--sp-3); min-width: 0; }
.statblock__name { font-size: 9.5px; letter-spacing: 0.12em; color: var(--fg-1); }
.statblock__meta {
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.blip {
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 5px;
  background: var(--ok);
  animation: blink 1.6s step-end infinite;
}

/* ── stage ───────────────────────────────────────────────────────────── */
.stage {
  grid-area: stage;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.viz {
  position: relative;
  flex: 1;
  min-height: 0;
  /* Faint graph paper, so an empty canvas still reads as a surface. */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
}
.viz canvas { width: 100%; height: 100%; display: block; position: relative; z-index: 1; }

/* the oversized chapter number, sunk into the background */
.viz__watermark {
  position: absolute;
  top: 6px; right: 18px;
  font-size: 88px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fg);
  opacity: 0.045;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.viz__empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-2);
  color: var(--fg-2);
  text-align: center;
  z-index: 2;
  pointer-events: none;
}
.viz__emptyLabel {
  font-size: var(--label-size);
  letter-spacing: var(--label-track);
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 3px 10px;
  margin-bottom: var(--sp-2);
}
.viz__hint { font-size: 11px; }
.viz__hint code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  color: var(--accent);
}

.narration {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  color: var(--fg-1);
  font-size: 12px;
  line-height: 1.7;
  background: var(--bg-1);
  /* A cyan rule on the left marks it as commentary, not data. */
  box-shadow: inset 2px 0 0 var(--accent-dim);
}
.narration strong { color: var(--fg); font-weight: 600; }

.timeline {
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  /* Capped so a long traceroute cannot squeeze the canvas out of existence. */
  max-height: 34%;
  overflow-y: auto;
  flex: none;
}
.timeline__head {
  position: sticky; top: 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--label-size);
  letter-spacing: var(--label-track);
  color: var(--fg-2);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
.timeline__list { padding: 0; }

.tl {
  display: grid;
  grid-template-columns: 10px 62px 1fr 132px 62px 48px;
  gap: var(--sp-2);
  align-items: center;
  padding: 5px var(--sp-3);
  font-size: 11px;
  color: var(--fg-1);
  cursor: pointer;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--line-soft);
}
.tl:hover { background: var(--bg-2); }
.tl--sel { background: var(--bg-2); border-left-color: var(--accent); color: var(--fg); }
.tl__dot { font-size: 7px; }
.tl--out .tl__dot { color: var(--out); }
.tl--in  .tl__dot { color: var(--in); }
.tl__t     { color: var(--fg-2); text-align: right; }
.tl__label { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl__peer  { color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl__bytes { text-align: right; }
.tl__proto {
  text-align: center;
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  border: 1px solid var(--line);
  padding: 0 3px;
}

/* ── inspector ───────────────────────────────────────────────────────── */
/*
 * Stacked, not side by side: a 16-byte hex row needs ~470px on its own, so two
 * columns inside a 520px rail leaves neither pane usable.
 */
.inspector {
  grid-area: insp;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 1.15fr);
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.pane--tree { border-bottom: 1px solid var(--line); }
.pane__head {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  font-size: var(--label-size);
  letter-spacing: var(--label-track);
  color: var(--fg-2);
}
.pane__meta { margin-left: auto; letter-spacing: 0; text-transform: none; }
.pane__body { flex: 1; overflow: auto; }

.itoolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.itoolbar__meta {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── inspector: packet tabs ──────────────────────────────────────────── */
.ptabs { display: flex; }
.ptab {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.ptab + .ptab { border-left: none; }
.ptab:hover { color: var(--fg-1); }
.ptab--active { background: var(--bg-3); color: var(--fg); border-color: var(--accent); }
.ptab__dir--out { color: var(--out); }
.ptab__dir--in { color: var(--in); }
.ptab__len { color: var(--fg-2); }
.ptab__edit { color: var(--warn); }

/* ── inspector: field tree ───────────────────────────────────────────── */
.tempty { padding: var(--sp-4) var(--sp-3); color: var(--fg-2); font-size: 11px; }

.tparse-error {
  margin: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid var(--err);
  color: var(--err);
  font-size: 10.5px;
}

.tsection__head {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%;
  padding: 4px var(--sp-3);
  font-size: var(--label-size);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-1);
  text-align: left;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line-soft);
}
.tsection__head:hover { color: var(--accent); }
.tsection__caret { color: var(--fg-2); font-size: 8px; width: 8px; }
.tsection__name { font-weight: 600; }
.tsection__span { margin-left: auto; font-size: 9px; color: var(--fg-2); letter-spacing: 0; }

.tleaf {
  display: flex; align-items: baseline; gap: var(--sp-2);
  width: 100%;
  padding: 3px var(--sp-3) 3px var(--sp-4);
  font-size: 11px;
  color: var(--fg-1);
  text-align: left;
  border-left: 2px solid transparent;
}
.tleaf:hover { background: var(--bg-2); }
.tleaf--sel { background: var(--accent-soft); border-left-color: var(--accent); color: var(--fg); }
.tleaf__name { min-width: 86px; color: var(--fg-2); font-size: 10px; letter-spacing: 0.04em; }
.tleaf--sel .tleaf__name { color: var(--accent); }
.tleaf__value { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tleaf__flag { margin-left: auto; color: var(--warn); font-size: 10px; }

/* ── inspector: explanation ──────────────────────────────────────────── */
.explainbox {
  border-top: 1px solid var(--line);
  padding: var(--sp-3);
  background: var(--bg-2);
  font-size: 11px;
  line-height: 1.65;
  max-height: 40%;
  flex: none;
  overflow-y: auto;
}
.explainbox__name {
  font-size: 9.5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--sp-2);
}
.explainbox__text { color: var(--fg-1); }
.explainbox__note { margin-top: var(--sp-2); color: var(--fg-2); font-size: 10.5px; }
.explainbox__hint { margin-top: var(--sp-2); color: var(--warn); font-size: 10.5px; }
.explainbox__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border: 1px solid currentColor;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── inspector: hex ──────────────────────────────────────────────────── */
#hex-view { padding: var(--sp-2) var(--sp-3); }

.hexrow {
  display: flex;
  gap: var(--sp-2);
  font-size: 11px;
  line-height: 1.8;
  white-space: nowrap;
}
.hexrow__off { color: var(--accent-dim); user-select: none; }
.hexrow__bytes { display: inline-flex; }
.hexrow__ascii { display: inline-flex; color: var(--fg-2); }

.hexbyte {
  padding: 0 1px;
  margin-right: 2px;
  color: var(--fg-1);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.hexbyte:hover { background: var(--bg-3); color: var(--fg); }
.hexbyte--group { margin-right: 7px; }
.hexbyte--sel { background: var(--hl); color: #000; font-weight: 700; }
.hexbyte--changed { color: var(--err); font-weight: 700; text-decoration: underline; }
.hexbyte--sel.hexbyte--changed { background: var(--err); color: #fff; text-decoration: none; }
.hexbyte--editing { outline: 1px solid var(--accent); outline-offset: -1px; }

.hexascii { cursor: pointer; }
.hexascii--sel { background: var(--hl); color: #000; }

/* ── inspector: bit ruler ────────────────────────────────────────────── */
.bits {
  border-top: 1px solid var(--line);
  padding: var(--sp-2) var(--sp-3);
  font-size: 10.5px;
  color: var(--fg-1);
}
.bits__head { display: flex; gap: var(--sp-3); align-items: baseline; margin-bottom: var(--sp-2); }
.bits__label { color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9.5px; }
.bits__hex { color: var(--accent); font-weight: 700; }
.bits__dec { color: var(--fg-2); }

.bits__row { display: flex; gap: 2px; margin-bottom: var(--sp-2); }
.bit {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 10px;
}
.bit--on { color: var(--fg); border-color: var(--fg-2); }
.bit--sel { background: var(--hl); color: #000; border-color: var(--hl); font-weight: 700; }
.bit--gap { margin-right: 8px; }

.bits__fields { display: flex; flex-direction: column; }
.bitfield {
  display: flex; gap: var(--sp-2); align-items: baseline;
  padding: 2px 4px;
  font-size: 10px;
  color: var(--fg-2);
}
.bitfield--sel { background: var(--accent-soft); color: var(--fg); }
.bitfield__range { min-width: 66px; }
.bitfield__name { min-width: 64px; color: var(--fg-1); }
.bitfield__value { color: var(--fg); }
.bits__none { color: var(--fg-2); font-size: 10px; }

/* ── inspector: edit bar ─────────────────────────────────────────────── */
.editbar {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: 10.5px;
}
.editbar__row { display: flex; align-items: center; gap: var(--sp-2); }
.editbar__row + .editbar__row { margin-top: var(--sp-2); }
.editbar__target {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.editbar__target--none { color: var(--fg-2); font-weight: 400; }
.editbar__keys { margin-left: auto; color: var(--fg-2); font-size: 9.5px; }
.editbar__idle { color: var(--fg-2); }
.editbar__note { color: var(--fg-2); line-height: 1.6; }
.editbar__badge {
  padding: 2px 7px;
  border: 1px solid var(--err);
  color: var(--err);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  font-size: 9px;
  color: var(--fg-1);
}

.btn {
  padding: 4px 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-1);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.btn:hover { color: var(--fg); border-color: var(--fg-2); }
.btn--send {
  margin-left: auto;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.btn--send:hover { background: var(--accent); color: #000; }

/* ── terminal ────────────────────────────────────────────────────────── */
.term {
  grid-area: term;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-size: 12px;
  min-height: 0;
  overflow: hidden;
}

/* The divider between stage and terminal, and the handle that resizes it. */
.term__grip {
  flex: none;
  height: 9px;
  cursor: row-resize;
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background var(--t-fast);
}
.term__grip::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 30px; height: 1px;
  margin: -1px 0 0 -15px;
  background: var(--line);
  box-shadow: 0 3px 0 var(--line);
  transition: background var(--t-fast), box-shadow var(--t-fast), width var(--t-fast);
}
.term__grip:hover::after,
.term__grip:focus-visible::after,
.term__grip--dragging::after {
  background: var(--accent);
  box-shadow: 0 3px 0 var(--accent);
  width: 48px;
}
.term__grip:hover, .term__grip--dragging { background: var(--bg-2); }

.term__out {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-3) 0;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.term__inputRow {
  flex: none;
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--line);
  background: var(--bg-1);
}
.term__prompt { color: var(--accent); font-weight: 700; }
.term__line { flex: 1; white-space: pre; }
.term__hint { color: var(--fg-2); font-size: 10px; letter-spacing: 0.04em; }
.term__cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.06s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.term__hidden {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px; left: -9999px;
}

/* terminal output line kinds */
.t-cmd  { color: var(--fg); font-weight: 600; }
.t-dim  { color: var(--fg-2); }
.t-out  { color: var(--out); }
.t-in   { color: var(--in); }
.t-warn { color: var(--warn); }
.t-err  { color: var(--err); }
.t-ok   { color: var(--ok); }

/* ── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .app, .app[data-tier="3"] {
    grid-template-columns: 1fr;
    grid-template-areas: "hdr" "stage" "insp" "term";
    grid-template-rows: 46px minmax(0, 1fr) auto var(--term-h);
  }
  .side { display: none; }
  .crumbs { display: none; }
}


/* ── narrow: the rail floats over the stage instead of taking its width ── */
@media (max-width: 820px) {
  .app { --nav-w: 0px; }
  .side {
    position: absolute;
    top: 46px; bottom: 0; left: 0;
    width: 236px;
    z-index: 40;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
    transform: translateX(-100%);
    transition: transform var(--t-med);
  }
  .app[data-nav="open"] .side { transform: none; border-right-color: var(--line); }
}
