/**
 * visit.css — the site as one guided visit.
 *
 *   the chapter rail · chapter heads & hand-offs · 00 agenda + role lens ·
 *   01 hosts · 02 full-bleed floor · 03 the batch record (signature
 *   chapter) · the ORD-016 batch token · 04 station views & footage state ·
 *   06 bento · 09 recap · the art-direction pass (type, mono, colour)
 *
 * Motion only ever animates transform / opacity / clip-path / filter /
 * stroke-dashoffset, on the tokens. Reduced motion lands every one of them
 * on its final state (base.css collapses durations; the rules at the end
 * make the few intentional exceptions explicit).
 */

/* a component's own display rule must never beat its [hidden] */
:is(.ebr-audit, .ebr-foot, .hosts, .visit-recap, .proof-block, .view-note, .chapter-handoff, .role-lens, .objective-card)[hidden] { display: none !important; }

/* scrolled-to targets clear the sticky top bar */
#plant-garden, #plant-story .st-chapters, .chapter-handoff, .visit-recap, #faq-list, .batch-card { scroll-margin-top: calc(var(--topbar-h, 72px) + 16px); }

/* ══════════════ the art-direction pass: type and values ══════════════ */

h1, h2, h3, .chapter-title, .batch-headline, .handoff-title { text-wrap: balance; }
/* paragraphs under a title never end on one stranded word */
:is(.chapter-lead, .story-lead, .home-lead, .home-hero-lead, .lab-hero-sub, .door-desc, .challenge-desc) { text-wrap: pretty; }
/* every system-written value is set in mono */
.crumb-value, .stat-value, .kpi-value, .roi-output-value, .card-tag,
.status-pill, .journey-batch-id, .mono { font-family: var(--font-mono); letter-spacing: 0; }

/* ══════════════ the lit batch token (a signature object) ══════════════
   The one lit-glass capsule: the orbit spheres' material (--sphere-*),
   tinted with the thread's green. Rides the rail, walks the batch
   chapter, stamps the seal. */
.batch-token {
  display: block; width: 18px; height: 10px; border-radius: var(--radius-pill);
  background:
    radial-gradient(circle at 32% 30%, var(--sphere-spec) 0 14%, var(--sphere-spec-soft) 26%, transparent 46%),
    linear-gradient(168deg, color-mix(in srgb, var(--accent) 55%, #fff) 0%, var(--accent) 62%, color-mix(in srgb, var(--accent) 70%, #062) 100%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 3px 8px -2px var(--sphere-shadow),
    inset 0 -2px 3px var(--sphere-shade);
}

/* ══════════════ the chapter rail — a compact stepper in the top bar ══════════════
   ←  03 / 07  One batch, recipe to release   →
      ●─●─●─◉─○─○─○─○
   It sits beside the section switch: the chapter in words over the dots.
   No dropdown: every chapter is a dot, its name in a tooltip; the line
   fills with the reader's position as they scroll. */

.chapter-rail {
  --pos: 0;
  grid-area: rail; position: relative; min-width: 0; margin: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "prev now next" "prev track next";
  align-items: center; column-gap: 10px; row-gap: 4px;
  padding-left: 18px; border-left: 1px solid var(--border);
}
.rail-prev { grid-area: prev; }
.rail-next { grid-area: next; }
.rail-step {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--navy-deep); font-size: 12px; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out-quart), transform var(--dur-fast) var(--ease-out-quart), background var(--dur-fast) var(--ease-out-quart);
}
.rail-step:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.rail-step:disabled { opacity: .35; cursor: default; }

/* where you are, in words */
.rail-now {
  grid-area: now; min-width: 0; margin: 0; display: flex; align-items: baseline; gap: 6px;
  font-size: 12px; font-weight: 700; line-height: 1.2; color: var(--navy-deep); white-space: nowrap;
}
.rail-num { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--blue); }
.rail-of  { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.rail-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-now.is-changing { animation: rail-now-in var(--dur-base) var(--ease-out-expo); }
@keyframes rail-now-in { from { opacity: 0; transform: translateY(6px); } }

/* the dots on their line */
.rail-track { grid-area: track; position: relative; min-width: 0; }
.rail-line {
  position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; margin-top: -1px;
  background: var(--border); border-radius: 2px; overflow: hidden;
}
.rail-fill {
  position: absolute; inset: 0; background: var(--accent); border-radius: inherit;
  transform-origin: 0 50%; transform: scaleX(var(--pos));
  transition: transform 120ms linear;                    /* rides the scroll */
}
.rail-fill::after { content: ""; position: absolute; inset: -3px 0; background: var(--accent); filter: blur(4px); opacity: 0; }
.chapter-rail.is-pulsing .rail-fill::after { animation: rail-pulse 1.4s var(--ease-out-quart) 1; }
@keyframes rail-pulse { 0% { opacity: 0; } 25% { opacity: .75; } 100% { opacity: 0; } }

.rail-steps { position: relative; list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; }
.rail-stop { position: relative; }
.rail-dot {
  position: relative; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  text-decoration: none; background: var(--surface); border: 1.5px solid var(--border);
  transition: transform var(--dur-fast) var(--ease-spring-physical), background var(--dur-fast) var(--ease-out-quart), border-color var(--dur-fast) var(--ease-out-quart), box-shadow var(--dur-base) var(--ease-out-quart);
}
.rail-dot::before { content: ""; position: absolute; inset: -6px; }        /* a bigger hit area */
.rail-dot-num { font-family: var(--font-mono); font-size: 7.5px; font-weight: 700; letter-spacing: -.02em; color: var(--text-faint); }
.rail-stop.is-visited .rail-dot { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: var(--accent); }
.rail-stop.is-visited .rail-dot-num { color: var(--accent); }
.rail-stop.is-current .rail-dot { background: var(--blue); border-color: var(--blue); transform: scale(1.18); box-shadow: 0 0 0 4px var(--blue-dim); }
.rail-stop.is-current .rail-dot-num { color: #fff; }
.rail-dot:hover { transform: scale(1.15); border-color: var(--blue); }
.rail-dot:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* the name of each chapter, on hover / keyboard focus */
.rail-tip {
  position: absolute; top: calc(100% + 12px); left: 50%; z-index: 620; translate: -50% -4px;
  display: grid; gap: 2px; min-width: 150px; max-width: 220px; padding: 8px 12px; border-radius: var(--radius-md);
  background: var(--chrome); color: #fff; box-shadow: var(--shadow-lg); text-align: left; white-space: normal;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out-quart), translate var(--dur-base) var(--ease-out-expo);
}
.rail-tip::before {                                   /* the notch */
  content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; translate: -50% 0; rotate: 45deg;
  background: var(--chrome); border-radius: 2px;
}
.rail-tip-title { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.rail-tip-meta { font-family: var(--font-mono); font-size: 10.5px; color: rgba(255, 255, 255, .62); }
.rail-dot:is(:hover, :focus-visible) .rail-tip { opacity: 1; translate: -50% 0; }
/* the first and last tips stay inside the bar */
.rail-stop:first-child .rail-tip { left: -6px; translate: 0 -4px; }
.rail-stop:first-child .rail-dot:is(:hover, :focus-visible) .rail-tip { translate: 0 0; }
.rail-stop:first-child .rail-tip::before { left: 17px; }
.rail-stop:last-child .rail-tip { left: auto; right: -6px; translate: 0 -4px; }
.rail-stop:last-child .rail-dot:is(:hover, :focus-visible) .rail-tip { translate: 0 0; }
.rail-stop:last-child .rail-tip::before { left: auto; right: 12px; translate: 0 0; }

/* ══════════════ chapter heads — one column, on the content's left edge ══════════════
   The mono numeral leads the kicker line ("00  YOUR PROCESS"), as in the
   Lab hero, so a chapter's title, lead and everything under it share one
   left edge. */

.chapter-head { margin: 6px 0 clamp(28px, 4vw, 44px); max-width: 980px; }
.chapter-kicker .chapter-num {
  font-family: var(--font-mono); font-weight: 500; letter-spacing: 0;
  color: var(--text-muted); margin-right: 12px; font-variant-numeric: tabular-nums;
}
.chapter-kicker {
  font-size: var(--fs-kicker); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 12px;
}
.chapter-title {
  font-size: var(--fs-title); font-weight: 800; line-height: 1.02;
  letter-spacing: -0.03em; color: var(--navy-deep); max-width: 18ch; margin-bottom: 16px;
}
.chapter-title:focus { outline: none; }
.chapter-title:focus-visible { outline: 2px solid var(--blue); outline-offset: 6px; }
.chapter-lead { max-width: 62ch; margin-bottom: 0; font-size: var(--fs-lead); }

/* ── realm: "where you are" — the lab's physical stations (03) vs the
   PLANT template library (04). Lab: an outlined place-pin chip. PLANT:
   a filled layers chip. Both sit on the open page, no framing panel. */
.chapter-realm {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin-bottom: 16px; padding: 7px 14px 7px 9px; border-radius: 999px;
  font-size: 12.5px; line-height: 1.3;
}
.chapter-realm b { font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.chapter-realm-icon {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
}
.chapter-realm-icon svg { width: 14px; height: 14px; }
.chapter-realm-note { opacity: .82; }
.chapter-realm-note::before { content: "·"; margin-right: 10px; opacity: .6; }

.chapter-realm[data-tone="lab"] {
  border: 1px solid var(--blue); color: var(--blue); background: var(--surface);
}
.chapter-realm[data-tone="lab"] .chapter-realm-icon { background: var(--blue-dim); }

.chapter-realm[data-tone="plant"] { background: var(--blue); color: var(--surface); }
.chapter-realm[data-tone="plant"] .chapter-realm-icon { background: rgba(255, 255, 255, .18); }

/* Company: the team behind both — the deep navy chip */
.chapter-realm[data-tone="company"] { background: var(--chrome); color: #fff; }
.chapter-realm[data-tone="company"] .chapter-realm-icon { background: rgba(255, 255, 255, .16); }

/* a realm is the whole page when open: no hairline across its top */
.wrap > .page.chapter.realm-page::before { display: none; }
/* a head without a numeral (the PLANT section) */

/* ══════════════ realms — Home, PLANT, Company ══════════════
   Not part of the visit's scroll: each is hidden until the top bar's
   section switch opens it (#/, #/plant, #/company; main.js enterRealm
   sets html[data-open-realm]). Then the visit is put away and the realm
   is the whole page, walked like the visit: the rail and the roots switch
   to its own stops (home has none), and the "Lab visit" tab leads back.
   Display only — #page-plant is never moved, transformed or pinned (the
   App Library inside it stays in flow). */
.wrap > .page.chapter.realm-page { display: none; }
[data-open-realm] .wrap > .page.chapter:not(.realm-page),
[data-open-realm] .header-batch-track { display: none; }
[data-open-realm="home"] .wrap > #page-home.page.chapter,
[data-open-realm="plant"] .wrap > #page-plant.page.chapter,
[data-open-realm="company"] .wrap > #page-company.page.chapter {
  display: block;
  margin-top: clamp(20px, 3vw, 36px);
  margin-bottom: clamp(40px, 6vw, 72px);
  padding-top: clamp(28px, 4vw, 48px);
}
/* the landing has no chapters: no rail, no roots */
[data-open-realm="home"] :is(.chapter-rail, .roots) { display: none; }
.chapter-rail[hidden] { display: none; }

/* landing in a realm: held invisible while main.js builds the page over
   the visit (index.html), shown once the router has opened it — or after
   a beat regardless, so a failed script never leaves a blank page */
[data-boot-realm] main { opacity: 0; animation: boot-show 0s 1.5s forwards; }
@keyframes boot-show { to { opacity: 1; } }
/* the way in and out is the top bar's section switch (base.css) */

@media (max-width: 600px) {
  .chapter-realm-note::before { display: none; }
  .chapter-realm-note { flex-basis: 100%; padding-left: 34px; }
  .chapter-realm { border-radius: 8px; }
}
/* 00's numeral sits in the hero's eyebrow */
.lab-hero-eyebrow .chapter-num { font-size: inherit; padding: 0; margin-right: 12px; color: var(--text-muted); }
/* 00's title is a chapter title set at the page opener's size, like Home's */
.lab-hero-title.chapter-title { font-size: var(--fs-display); letter-spacing: -0.035em; line-height: 1; max-width: none; }

/* ══════════════ the seam between chapters ══════════════
   The visit reads as one scroll. Between two chapters: room to breathe
   and a hairline of the thread; each chapter's head then enters like
   every other head (js/vocab.js, MOTION in js/scroll.js). */
.wrap > .page.chapter + .page.chapter {
  position: relative; margin-top: clamp(72px, 11vw, 150px); padding-top: clamp(40px, 5vw, 64px);
}
.wrap > .page.chapter + .page.chapter::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 18%, var(--border) 82%, transparent);
}
/* a realm's own sections (the batch walk, …, the booking)
   follow the templates with the same seam */
.realm-section {
  position: relative; margin-top: clamp(72px, 11vw, 150px); padding-top: clamp(40px, 5vw, 64px);
  scroll-margin-top: 12px;
}
.realm-section::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 18%, var(--border) 82%, transparent);
}
/* the hand-offs were buttons to the next page; the next chapter now simply
   follows on the scroll, so only those out of an area remain (visit.js) */
.chapter-handoff:not(.is-shown) { display: none; }

/* ══════════════ the closing hand-off ══════════════ */

.chapter-handoff { margin: clamp(48px, 7vw, 88px) 0 8px; padding-top: 22px; border-top: 1px solid var(--border); }
.handoff {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: baseline; gap: 14px;
  padding: 20px 24px; border-radius: var(--radius-lg); text-decoration: none; color: var(--navy-deep);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-out-quart), box-shadow var(--dur-fast) var(--ease-out-quart), border-color var(--dur-fast) var(--ease-out-quart);
}
.handoff:hover, .handoff:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--navy); }
.handoff-label { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.handoff-num { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }
.handoff-title { font-size: clamp(18px, 2.3vw, 28px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.handoff-min { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.handoff-arrow { font-size: 20px; transition: transform var(--dur-fast) var(--ease-out-quart); }
.handoff:hover .handoff-arrow { transform: translateX(4px); }
.handoff-end { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }

/* ══════════════ 00 · agenda and the role lens ══════════════ */

.visit-agenda { margin: 8px 0 32px; }
.agenda-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.agenda-title { font-size: 15px; font-weight: 800; color: var(--navy-deep); }
.agenda-total { font-size: 12.5px; color: var(--text-muted); }
.agenda-total b { color: var(--navy-deep); }
.agenda-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.agenda-item a {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; height: 100%;
  padding: 10px 12px; border-radius: var(--radius-md); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); color: var(--navy-deep);
  transition: border-color var(--dur-fast) var(--ease-out-quart), transform var(--dur-fast) var(--ease-out-quart);
}
.agenda-item a:hover, .agenda-item a:focus-visible { border-color: var(--navy); transform: translateY(-1px); }
.agenda-num { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.agenda-name { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.agenda-min { grid-column: 2; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.agenda-item a.is-visited .agenda-num { color: var(--accent); }
.agenda-item a[aria-current="step"] { background: color-mix(in srgb, var(--highlight) 55%, var(--surface)); }

.role-lens {
  margin: 0 0 22px; padding: 24px 26px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.role-q { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy-deep); margin-bottom: 4px; }
.role-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.role-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.role-chip {
  position: relative; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  padding: 12px 14px; border-radius: var(--radius-md); border: 1.5px solid var(--border); background: var(--bg);
  transition: border-color var(--dur-fast) var(--ease-out-quart), transform var(--dur-fast) var(--ease-spring-physical), background var(--dur-fast) var(--ease-out-quart);
}
.role-chip:hover { border-color: var(--navy); transform: translateY(-1px); }
.role-input { position: absolute; opacity: 0; pointer-events: none; }
.role-label { font-size: 14px; font-weight: 800; color: var(--navy-deep); }
.role-desc { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.role-chip:has(.role-input:checked) { border-color: var(--navy-deep); background: var(--surface); box-shadow: var(--shadow-sm); }
.role-chip:has(.role-input:checked) .role-label::after { content: " ✓"; }
.role-chip:has(.role-input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.objective-card h2 { font-size: 20px; letter-spacing: -0.02em; }

/* ══════════════ 01 · hosts (warm: the hosts are the other "you are here") ══════════════ */

.hosts { margin: 36px 0 8px; }
.hosts-title { font-size: 17px; font-weight: 800; color: var(--navy-deep); margin-bottom: 14px; }
.hosts-strip { display: flex; flex-wrap: wrap; gap: 14px; }
.host { display: grid; justify-items: center; gap: 4px; width: 132px; text-align: center; }
.host-photo {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 3px var(--highlight), var(--shadow-sm);
}
.host-initial { display: grid; place-items: center; background: var(--highlight); color: var(--highlight-ink); font-weight: 800; font-size: 28px; }
.host-name { font-size: 14px; color: var(--navy-deep); }
.host-role { font-size: 12px; color: var(--text-muted); }

/* ══════════════ 02 · the floor, full-bleed ══════════════ */

@media screen and (min-width: 720.02px) {
  /* as wide as the screen allows, but never wider than the photo at its
     height cap, so the picture always fills the frame edge to edge */
  .chapter-floor .lab-photo-card {
    --lab-w: min(calc(100vw - 40px), calc(min(76vh, 760px) * 1870 / 841));
    width: var(--lab-w); max-width: none;
    margin-left: calc(50% - var(--lab-w) / 2); margin-right: 0;
  }
  .chapter-floor .lab-photo-card.is-full { width: auto; margin: 0; }
}
/* pins pop in one by one, on a real spring */
.chapter-floor .lab-image.pins-in .hotspot { animation-timing-function: var(--ease-spring-physical); }

/* ══════════════ 03 · one batch — the live batch record ══════════════ */

/* one screen, not nine: the stage bar on top, then the stage card and the
   live record side by side at one fixed height (the record scrolls inside) */
.batch-layout {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px;
  height: clamp(470px, 64vh, 580px);
}

.ebr-panel {
  position: relative; height: 100%;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: 18px 18px 14px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text);
}
.ebr-panel::after {                        /* the seal's soft green pulse */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 26px 4px color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0;
}
.ebr-panel.is-sealed:not(.is-sealed-static)::after { animation: ebr-seal-pulse 1.6s var(--ease-out-quart) 1.1s 1; }
@keyframes ebr-seal-pulse { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
.ebr-panel.is-sealed { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }

.ebr-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.ebr-title { font-family: var(--font); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--navy-deep); }
.ebr-id { color: var(--text-muted); }
.ebr-status {
  margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-muted);
}
.ebr-panel.is-sealed .ebr-status { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.ebr-meta { padding: 8px 0 10px; color: var(--text-faint); font-size: 11px; }

.ebr-lines { list-style: none; margin: 0; padding: 0 2px 0 0; flex: 1 1 auto; min-height: 120px; overflow-y: auto; }
.ebr-line {
  position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 1px 10px;
  padding: 7px 6px; border-bottom: 1px solid var(--border); line-height: 1.45;
}
.ebr-t { color: var(--text-faint); grid-row: span 2; }
.ebr-who { color: var(--text-muted); font-size: 10.5px; }
.ebr-what { grid-column: 2; color: var(--navy-deep); }
.ebr-chip { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: var(--radius-pill); }
.ebr-chip.is-sig { color: var(--navy); font-size: 12px; }
.kind-deviation .ebr-what { color: var(--red); }
.kind-deviation .ebr-chip { color: var(--red); background: var(--red-dim); }
.ebr-line.is-resolved .ebr-what { color: var(--text-muted); }
.ebr-line.is-resolved .ebr-chip { color: var(--accent); background: var(--accent-dim); }
.kind-resolved .ebr-what::before { content: "✓ "; color: var(--accent); }

/* typed in: each line lands a beat after the last; its text writes across */
.ebr-line.is-new { animation: ebr-line-in var(--dur-base) var(--ease-out-quart) both; animation-delay: calc(var(--d) * var(--stagger-step) * 5); }
.ebr-line.is-new .ebr-what {
  animation: ebr-type calc(var(--chars) * 16ms) steps(var(--chars), end) both;
  animation-delay: calc(var(--d) * var(--stagger-step) * 5 + 120ms);
}
@keyframes ebr-line-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes ebr-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* the deviation flashes red once, then later re-renders as resolved */
.ebr-line::before { content: ""; position: absolute; inset: 0; border-radius: 6px; opacity: 0; pointer-events: none; }
.ebr-line.kind-deviation.is-new::before { background: var(--red-dim); animation: ebr-flash 1.1s var(--ease-out-quart) .5s 1; }
.ebr-line.is-rerender::before { background: var(--accent-dim); animation: ebr-flash 1.1s var(--ease-out-quart) .4s 1; }
@keyframes ebr-flash { 0% { opacity: 0; } 20% { opacity: 1; } 45% { opacity: .25; } 65% { opacity: .9; } 100% { opacity: 0; } }

/* the audit view (stage 9) */
.ebr-audit { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ebr-audit-title { font-family: var(--font); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 4px 0 8px; }
.ebr-audit-scroll { overflow: auto; }
.ebr-audit-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.ebr-audit-table th { text-align: left; font-family: var(--font); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 4px 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.ebr-audit-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ebr-audit-table tr.kind-deviation td:nth-child(2) { color: var(--red); }
.ebr-panel.is-audit .ebr-audit { animation: ebr-line-in var(--dur-base) var(--ease-out-expo) both; }

/* the signature draws itself at release; the seal stamps */
.ebr-foot { display: flex; align-items: center; gap: 10px; padding-top: 10px; margin-top: 8px; border-top: 1px dashed var(--border); }
.ebr-sign { flex: 0 0 120px; }
.ebr-sig-svg { display: block; width: 100%; height: auto; }
.ebr-sig-svg path {
  fill: none; stroke: var(--navy-deep); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.ebr-panel.is-sealed .ebr-sig-svg path { stroke-dashoffset: 0; transition: stroke-dashoffset 1.3s var(--ease-in-out-smooth) .2s; }
.ebr-sig-caption { font-size: 10px; color: var(--text-faint); line-height: 1.35; flex: 1; opacity: .35; transition: opacity var(--dur-base) var(--ease-out-quart); }
.ebr-panel.is-sealed .ebr-sig-caption { opacity: 1; }
.ebr-seal { opacity: 0; transform: scale(.4); transition: opacity var(--dur-fast) var(--ease-out-quart) 1s, transform var(--dur-slow) var(--ease-spring-physical) 1s; }
.ebr-panel.is-sealed .ebr-seal { opacity: 1; transform: none; }
.ebr-seal-token { width: 30px; height: 30px; }

/* ── the stage bar: nine stages as tabs, a progress line, Play / Pause ── */
.batch-stepper {
  --progress: 0;
  --auto-ms: 5200ms;                                  /* = AUTO_MS in batch.js */
  margin-bottom: 18px; padding: 14px 18px 12px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.batch-stepper-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.batch-count { font-size: 12px; font-weight: 600; color: var(--navy-deep); }
.batch-hint { margin-right: auto; font-size: 12px; color: var(--text-faint); }
.batch-play {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; cursor: pointer;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg);
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--navy-deep);
  transition: border-color var(--dur-fast) var(--ease-out-quart), transform var(--dur-fast) var(--ease-out-quart);
}
.batch-play:hover { border-color: var(--blue); transform: translateY(-1px); }
.batch-play-icon { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); }
.batch-play-icon::before {                            /* play: a triangle */
  content: ""; position: absolute; inset: 6px 5px 6px 8px; background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.batch-play[data-state="pause"] .batch-play-icon::before {   /* pause: two bars */
  inset: 7px; clip-path: none;
  background: linear-gradient(90deg, #fff 0 35%, transparent 35% 65%, #fff 65%);
}

.batch-steps { position: relative; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.batch-steps-line {                                   /* runs through the step circles */
  position: absolute; left: calc(100% / 18); right: calc(100% / 18); top: 15px; height: 2px;
  background: var(--border); border-radius: 2px; pointer-events: none;
}
.batch-steps-fill {
  position: absolute; inset: 0; border-radius: inherit; background: var(--accent);
  transform-origin: 0 50%; transform: scaleX(var(--progress));
  transition: transform var(--dur-slow) var(--ease-out-expo);
}
.batch-step {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0;
  padding: 0 2px 8px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--text-muted); text-align: center;
}
.step-num {
  position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font-size: 11.5px; font-weight: 600; background: var(--surface); border: 1.5px solid var(--border); color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-out-quart), border-color var(--dur-fast) var(--ease-out-quart),
              color var(--dur-fast) var(--ease-out-quart), transform var(--dur-base) var(--ease-spring-physical), box-shadow var(--dur-base) var(--ease-out-quart);
}
.step-label { font-size: 11.5px; font-weight: 700; line-height: 1.25; text-wrap: balance; transition: color var(--dur-fast) var(--ease-out-quart); }
.batch-step:hover .step-num { border-color: var(--blue); color: var(--blue); }
.batch-step.is-done .step-num { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: var(--accent); color: var(--accent); }
.batch-step.is-current .step-num { background: var(--blue); border-color: var(--blue); color: var(--on-blue); transform: scale(1.1); box-shadow: 0 0 0 5px var(--blue-dim); }
.batch-step.is-current .step-label { color: var(--navy-deep); }
.batch-step:focus-visible { outline: none; }
.batch-step:focus-visible .step-num { outline: 2px solid var(--blue); outline-offset: 3px; }
/* while the batch plays itself, the current stage's timer fills */
.step-timer {
  position: absolute; left: 20%; right: 20%; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--blue); transform: scaleX(0); transform-origin: 0 50%; opacity: 0;
}
.batch-stepper.is-playing .batch-step.is-current .step-timer { opacity: 1; animation: step-timer var(--auto-ms) linear forwards; }
@keyframes step-timer { to { transform: scaleX(1); } }


/* ── the stage card ── */
.batch-card {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: 22px 24px 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.batch-card-body {
  flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px;
}
.batch-card-body.is-in-next { animation: card-in-next var(--dur-base) var(--ease-out-expo) both; }
.batch-card-body.is-in-prev { animation: card-in-prev var(--dur-base) var(--ease-out-expo) both; }
@keyframes card-in-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes card-in-prev { from { opacity: 0; transform: translateX(-28px); } }
.batch-card-text { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px; align-items: end; }
.batch-card-text > :not(.batch-actions) { grid-column: 1; }
.batch-card-text > .batch-actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; flex-direction: column; align-items: stretch; }
.batch-card-nav {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.batch-card-nav .footer-nav-btn:disabled { visibility: hidden; }

.batch-stage-num { display: flex; gap: 12px; align-items: baseline; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); margin-bottom: 8px; }
.batch-stage-num .mono { color: var(--text-muted); letter-spacing: 0; }
.batch-headline { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.12; color: var(--navy-deep); margin-bottom: 8px; }
.batch-outcome { font-size: 14.5px; line-height: 1.55; color: var(--text-muted); max-width: 60ch; margin: 0; }
.batch-media {
  margin: 0; min-height: 0; height: 100%; border-radius: var(--radius-md); overflow: hidden;
  background: var(--chrome); box-shadow: var(--shadow-sm);
}
.batch-media picture, .batch-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* the honest state: the lit backdrop, the name, one true line */
.batch-honest {
  position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: clamp(18px, 3vw, 30px);
  background:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 28px 28px,        /* a blueprint grid */
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(110% 90% at 18% 0%, color-mix(in srgb, var(--blue) 45%, transparent) 0%, transparent 60%),
    radial-gradient(80% 70% at 100% 100%, color-mix(in srgb, var(--blue) 18%, transparent) 0%, transparent 70%),
    var(--chrome);
  color: var(--fw-t90);
}
/* the stage's number, large and quiet, so an empty frame still reads as designed */
.batch-media:is(.is-honest, .is-record) { position: relative; }
.batch-media:is(.is-honest, .is-record)[data-num]::after {
  content: attr(data-num); position: absolute; pointer-events: none; right: clamp(14px, 3vw, 28px); top: clamp(4px, 1.5vw, 12px);
  font-family: var(--font-mono); font-weight: 700; font-size: clamp(64px, 9vw, 120px); line-height: 1; letter-spacing: -.04em;
  color: rgba(var(--fw-t90-rgb), .09);
}
.batch-honest-name { font-size: clamp(22px, 2.8vw, 32px); font-weight: 800; letter-spacing: -0.02em; }
.batch-honest-line { font-family: var(--font-mono); font-size: 12px; color: rgba(var(--fw-t90-rgb), .82); }
.batch-honest-caption { font-size: 12px; color: rgba(var(--fw-t90-rgb), .6); }
.batch-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════ 04 · stations: honest thumbs, the view toggle, footage ══════════════ */

.thumb-lit {
  height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 16px;
  background:
    radial-gradient(110% 90% at 20% 0%, color-mix(in srgb, var(--blue) 45%, transparent) 0%, transparent 62%),
    var(--chrome);
  color: var(--fw-t90); text-align: left;
}
.thumb-lit-tag { font-family: var(--font-mono); font-size: 10.5px; color: rgba(var(--fw-t90-rgb), .7); }
.thumb-lit-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.thumb-lit-note { font-size: 11.5px; color: rgba(var(--fw-t90-rgb), .65); }

.view-toggle {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; padding: 4px;
  border-radius: var(--radius-pill); background: var(--tile); border: 1px solid var(--border);
}
.view-toggle-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); padding: 0 8px; }
.view-opt {
  border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-muted);
  padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out-quart), color var(--dur-fast) var(--ease-out-quart);
}
.view-opt[aria-pressed="true"] { background: var(--surface); color: var(--navy-deep); box-shadow: var(--shadow-sm); }
.view-note { font-size: 12px; color: var(--text-muted); margin: -2px 0 10px; }

.kiosk-placeholder.is-footage { padding: 0; inset: 0; }
.footage-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: clamp(18px, 3.4vw, 36px); text-align: left;
  background:
    radial-gradient(110% 90% at 18% 0%, color-mix(in srgb, var(--blue) 45%, transparent) 0%, transparent 60%),
    radial-gradient(80% 70% at 100% 100%, color-mix(in srgb, var(--blue) 18%, transparent) 0%, transparent 70%),
    var(--chrome);
  color: var(--fw-t90);
}
.footage-kicker { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(var(--fw-t90-rgb), .75); }
.footage-name { font-size: clamp(24px, 3.2vw, 36px); font-weight: 800; letter-spacing: -0.025em; }
.footage-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footage-points li { font-size: 13.5px; color: rgba(var(--fw-t90-rgb), .85); }
.footage-points li::before { content: "— "; color: rgba(var(--fw-t90-rgb), .45); }
.footage-lead { font-size: 12.5px; color: rgba(var(--fw-t90-rgb), .6); }
.footage-cta { align-self: flex-start; margin-top: 6px; }
/* no photos yet: no strip of empty frames */
.photo-strip:has(.photo-empty):not(:has(picture)) { display: none; }


/* 06 · under the hood: css/hood.css */

/* ══════════════ 09 · the visit recap (written like the batch record) ══════════════ */

.visit-recap {
  margin: 32px 0 28px; padding: 20px 22px 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-family: var(--font-mono); font-size: 12px;
}
.recap-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.recap-title { font-family: var(--font); font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--navy-deep); }
.recap-id { margin-left: auto; color: var(--text-faint); }
.recap-lines { list-style: none; margin: 0; padding: 0; }
.recap-line {
  display: grid; grid-template-columns: 70px minmax(140px, 220px) minmax(0, 1fr); gap: 10px;
  padding: 8px 4px; border-bottom: 1px solid var(--border);
  animation: ebr-line-in var(--dur-base) var(--ease-out-quart) both; animation-delay: calc(var(--d) * var(--stagger-step) * 3);
}
.recap-t { color: var(--text-faint); }
.recap-k { color: var(--text-muted); }
.recap-v { color: var(--navy-deep); }
.recap-seal { display: flex; align-items: center; gap: 12px; padding-top: 12px; }
.recap-seal .ebr-sign { flex: 0 0 140px; }
.recap-seal .ebr-sig-svg path { animation: sig-draw 1.4s var(--ease-in-out-smooth) .6s forwards; }
@keyframes sig-draw { to { stroke-dashoffset: 0; } }
.recap-token { width: 26px; height: 26px; }
.recap-seal-caption { color: var(--accent); font-size: 11px; font-weight: 700; }
.book-heading { margin-top: 12px; }

/* ══════════════ colour discipline ══════════════
   green: healthy / released / the thread · red: the deviation only ·
   warm: hosts and "you are here" only */
.lab-image .hotspot.action, .hotspot.action { background: var(--navy); }
.lab-image .hotspot.action::before, .hotspot.action::before { border-color: var(--navy); }

/* ══════════════ phones and narrow screens ══════════════ */

@media (max-width: 1100px) {
  .agenda-list { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .role-options { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 900px) {
  /* stacked: the card, then the record under it */
  .batch-layout { grid-template-columns: 1fr; height: auto; }
  .batch-card-body { grid-template-rows: auto auto; }
  .batch-card .batch-media { height: auto; aspect-ratio: 16 / 9; }
  .ebr-panel { height: 340px; }
  .ebr-lines { min-height: 60px; }
  /* the stage bar scrolls sideways; the line gives way to the step colours */
  .batch-steps { grid-template-columns: repeat(9, 92px); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .batch-steps::-webkit-scrollbar { display: none; }
  .batch-steps-line { display: none; }
  .batch-hint { display: none; }
  .batch-count { margin-right: auto; }
  .batch-card { padding: 18px 16px 14px; }
  .batch-card-text { grid-template-columns: 1fr; }
  .batch-card-text > .batch-actions { grid-column: 1; grid-row: auto; flex-direction: row; margin-top: 12px; }
}

@media (max-width: 720px) {
  .topbar-right { gap: 8px; }
  .topbar-right .topbar-cta { padding: 10px 16px; }

  /* the chapters as a slim segmented bar under the title — each segment
     a tap target */
  .chapter-rail { column-gap: 8px; row-gap: 5px; }
  .rail-line { display: none; }
  .rail-steps { gap: 4px; }
  .rail-stop { flex: 1; }
  .rail-dot { width: 100%; height: 5px; border-radius: 3px; border: 0; background: var(--border); }
  .rail-dot::before { inset: -10px 0; }                   /* ~24px tall to tap */
  .rail-dot-num, .rail-tip { display: none; }
  .rail-stop.is-visited .rail-dot { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .rail-stop.is-current .rail-dot { background: var(--blue); transform: none; box-shadow: none; }
  .rail-dot:hover { transform: none; }


  .handoff { grid-template-columns: auto minmax(0, 1fr) auto; }
  .handoff-label { grid-column: 1 / -1; }
  .handoff-min { display: none; }
  .recap-line { grid-template-columns: 62px minmax(0, 1fr); }
  .recap-v { grid-column: 2; }
  .ebr-head { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 420px) {
  :root { --wrap-pad: 16px; }
  .topbar-main { column-gap: 8px; }
  .brand-group { gap: 6px; }
  .brand-logo { height: 30px; }
  .batch-home-btn { width: 28px; height: 28px; }
  .topbar-right { gap: 6px; }
  .topbar-right .theme-toggle { width: 36px; height: 36px; }
  .topbar-right .topbar-cta { padding: 9px 14px; font-size: 12.5px; gap: 6px; }
}

/* ══════════════ reduced motion: final states, explicitly ══════════════ */
@media (prefers-reduced-motion: reduce) {
  .ebr-line.is-new, .ebr-line.is-new .ebr-what, .recap-line { animation: none; }
  .ebr-sig-svg path, .recap-seal .ebr-sig-svg path { animation: none; stroke-dashoffset: 0; transition: none; }
  .ebr-panel::after, .rail-fill::after { animation: none; opacity: 0; }
  .ebr-seal, .ebr-sig-caption { transition: none; }
  .rail-fill, .batch-steps-fill, .batch-card-body, .step-num { transition: none; animation: none; }
}
