/* Static design tokens + semantic colour mapping. The palette/radius/font custom
   properties themselves are injected inline from the config (css-vars.ts); this
   file derives spacing, elevation, fluid type and surface tokens from them.

   The theme is a Commodore 64 screen: flat blue canvas, hard 2px light-blue
   rules, no shadows or glows. The default `:root` tokens paint it so there is no
   flash before the client boots. A `[data-theme="light"]` override remains for
   anyone who explicitly opts into a light mode. Tints use oklab mixing so they
   stay perceptually even. */

:root {
  color-scheme: dark;

  /* Spacing scale — compact, to conserve vertical rhythm */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2.25rem;
  --space-8: 3rem;

  /* Fluid type scale built from --type-base / --type-ratio */
  --step--1: calc(var(--type-base) / var(--type-ratio));
  --step-0: var(--type-base);
  --step-1: calc(var(--type-base) * var(--type-ratio));
  --step-2: calc(var(--step-1) * var(--type-ratio));
  --step-3: calc(var(--step-2) * var(--type-ratio));
  --step-4: calc(var(--step-3) * var(--type-ratio));

  /* Semantic surface tokens — the blue screen (default) */
  --surface: var(--paper-dark);
  --surface-2: color-mix(in oklab, var(--paper-dark) 78%, black);
  --surface-raised: var(--paper-dark);
  --text: var(--paper);
  --text-muted: color-mix(in oklab, var(--paper) 62%, var(--paper-dark));
  --border: var(--support);
  --border-strong: color-mix(in oklab, var(--support) 55%, var(--paper));
  --accent-tint: color-mix(in oklab, var(--support) 55%, var(--paper-dark));
  --focus-ring: var(--accent);

  /* Flat, like the hardware: rules instead of depth. The --shadow-* names are
     kept so component rules don't need rewiring; they now resolve to nothing,
     and the "glow" is a solid 2px ring. */
  --outline: var(--border);
  --outline-w: 2px;
  --frame: 10px; /* the light-blue screen border (body::before in base.css) */
  --shadow-1: none;
  --shadow-2: none;
  --shadow-pop: none;
  --shadow-pop-sm: none;
  --shadow-pop-accent: none;
  --glow-accent: 0 0 0 2px var(--accent);

  --bg-wash: none;

  --measure: 34rem;
  --touch: 35px;
  --z-bar: 40;
  --z-frame: 50;
  --z-confetti: 60;
  --z-test-badge: 70;

  /* Shared easing + timing for UI state transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.14s;
  --dur-mid: 0.24s;
  --dur-slow: 0.36s;
}

/* Optional light override (config darkMode: "light") */
:root[data-theme="light"] {
  color-scheme: light;
  --surface: var(--paper);
  --surface-2: color-mix(in oklab, var(--paper) 92%, var(--ink));
  --surface-raised: color-mix(in oklab, var(--paper) 98%, white);
  --text: var(--ink);
  --text-muted: color-mix(in oklab, var(--muted) 55%, var(--ink));
  --border: color-mix(in oklab, var(--ink) 12%, transparent);
  --border-strong: color-mix(in oklab, var(--ink) 22%, transparent);
  --accent-tint: color-mix(in oklab, var(--accent) 14%, var(--paper));
  --shadow-1: 0 1px 2px color-mix(in oklab, var(--ink) 12%, transparent);
  --shadow-2: 0 12px 34px color-mix(in oklab, var(--ink) 16%, transparent);
  --shadow-pop: 0 10px 30px color-mix(in oklab, var(--ink) 14%, transparent);
  --shadow-pop-sm: 0 4px 14px color-mix(in oklab, var(--ink) 12%, transparent);
}

/* Base elements + shared components. Commodore 64: flat blue screen, hard-edged
   blocks, one pixel typeface. UI state changes (selection, expand, focus, hover,
   page swaps) are blended with CSS transitions, keyframes and View Transition
   animations. */

body {
  color: var(--text);
  background: var(--surface);
}

/* The C64's light-blue screen border: a fixed, click-through frame over the
   viewport, so it never affects layout. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-frame);
  border: var(--frame) solid var(--support);
  background: var(--bg-wash);
}

/* Faint CRT scanlines */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, color-mix(in oklab, black 16%, transparent) 2px 3px);
}

h1 { font-size: var(--step-3); font-weight: 700; line-height: 1.15; text-wrap: balance; color: var(--accent); }
h2 { font-size: var(--step-1); font-weight: 700; }
h3 { font-size: var(--step-0); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.lead { font-size: var(--step-1); color: var(--text); margin: 0 0 var(--space-5); }
.muted { color: var(--text-muted); }
.privacy-note { color: var(--text-muted); font-size: var(--step--1); margin-top: var(--space-6); line-height: 1.5; }
.form-error { color: var(--danger); font-weight: 600; }
.field-error { color: var(--danger); font-weight: 600; margin: var(--space-2) 0 0; }
.field-error:empty { display: none; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  position: relative;
  z-index: 2;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-0);
  text-transform: uppercase;
  color: var(--text);
  text-align: left;
}
.brand::before {
  content: "> ";
  color: var(--accent);
}
.brand::after {
  content: "█";
  color: var(--accent);
  margin-left: 0.25em;
}
.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.link.not-you { font-size: large; }
.link:hover { opacity: 0.8; }

/* Cards & layout */
.screen { position: relative; z-index: 2; }
.card {
  background: var(--surface-raised);
  border: var(--outline-w) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-pop-sm);
  margin-bottom: var(--space-5);
  text-align: center;
}
.stack { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }

/* Buttons — flat, monospace, with soft glow feedback */
.btn {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  min-height: var(--touch);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: var(--outline-w) solid var(--border-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-mid) var(--ease-out),
    background var(--dur-mid) var(--ease-out), border-color var(--dur-mid) var(--ease-out), color var(--dur-mid) var(--ease-out);
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border-color: transparent;
  box-shadow: var(--shadow-pop-accent);
}
.btn-primary:hover { background: var(--paper); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: color-mix(in oklab, var(--surface-raised) 60%, transparent); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-round {
  width: var(--touch);
  min-height: var(--touch);
  padding: 0;
  border-radius: var(--radius-pill);
  border: var(--outline-w) solid var(--border-strong);
  background: color-mix(in oklab, var(--surface-raised) 60%, transparent);
  color: var(--text);
  font-size: var(--step-1);
}
.btn-round:hover { border-color: var(--accent); color: var(--accent); }

/* Hero CTA (slide show, and the RSVP button once a name is entered) — a C64
   sprite: white face, stepped hard-edge shadow in two palette colours, a CSS play
   triangle and a scanline that sweeps across. Presses "into" its shadow. The
   margin leaves room for the 8px shadow so it never clips. */
.btn-hero {
  position: relative;
  overflow: hidden;
  margin: 0 8px 8px 0;
  min-height: calc(var(--touch) + var(--space-2));
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  box-shadow: 4px 4px 0 var(--danger), 8px 8px 0 var(--success);
}
.btn-hero:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--danger), 12px 12px 0 var(--success); }
.btn-hero:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--danger), 2px 2px 0 var(--success); }
.btn-hero:disabled { cursor: default; transform: none; box-shadow: 4px 4px 0 var(--danger), 8px 8px 0 var(--success); }
.btn-hero:disabled::after { display: none; }
.btn-hero:focus-visible { outline: var(--outline-w) solid var(--accent); outline-offset: 4px; }
.hero-play {
  display: none; /* only shown inside a .btn-hero (the RSVP button toggles that class) */
  width: 0.8em;
  height: 0.9em;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.btn-hero .hero-play { display: block; }
.btn-hero::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -30%;
  width: 24%;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--accent) 45%, transparent), transparent);
  pointer-events: none;
}

/* Inputs */
.field { display: block; margin-bottom: var(--space-4); }
.field-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-3) var(--space-4);
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: var(--outline-w) solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid) var(--ease-out);
  text-align: center;
}
.input::placeholder { color: color-mix(in oklab, var(--text-muted) 80%, transparent); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow-accent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 5.5rem; resize: vertical; }

/* Character counter under the note box: fill bar + "🍬 used / max". The colour
   escalates via data-tier (set in rsvp-form.ts charCounter). */
.char-count { --tier: var(--text-muted); margin-top: var(--space-2); }
.char-count[data-tier="warm"] { --tier: var(--accent); }
.char-count[data-tier="hot"],
.char-count[data-tier="full"] { --tier: var(--danger); }
.char-bar {
  display: block;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.char-fill {
  display: block;
  height: 100%;
  background: var(--tier);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-mid) var(--ease-out), background var(--dur-mid) var(--ease-out);
}
.char-meta {
  display: block;
  margin-top: var(--space-1);
  text-align: right;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--tier);
  transition: color var(--dur-mid) var(--ease-out);
}
.char-candy { display: inline-block; margin-right: 0.4em; filter: grayscale(1) opacity(0.6); transition: filter var(--dur-mid) var(--ease-out); }
.char-count:not([data-tier="ok"]) .char-candy { filter: none; }
.char-used { display: inline-block; }
.char-count[data-tier="full"] .char-meta { font-weight: 700; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Attendance choice */
.attend-question { margin-top: var(--space-5); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: var(--space-4) 0 var(--space-5); }
.choice-card {
  min-height: 72px;
  border-radius: var(--radius-lg);
  border: var(--outline-w) solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-0);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  transition: transform var(--dur-mid) var(--ease-out), border-color var(--dur-mid) var(--ease-out),
    background var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid) var(--ease-out);
}
.choice-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.choice-card.selected { background: var(--accent-tint); }
.choice-yes.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 2px var(--success);
}
.choice-no.selected {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger);
}

/* Steppers */
.stepper { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) 0; }
.stepper-label { font-weight: 600; }
.stepper-controls { display: flex; align-items: center; gap: var(--space-4); }
.stepper-value {
  min-width: 2ch;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* Chips & toggle */
.chips { display: flex; flex-wrap: nowrap; gap: var(--space-2); margin: var(--space-3) 0; }
.chip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
  border-radius: var(--radius-pill);
  border: var(--outline-w) solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-mid) var(--ease-out),
    color var(--dur-mid) var(--ease-out), border-color var(--dur-mid) var(--ease-out);
}
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip[aria-checked="true"] { background: var(--accent); color: var(--ink); border-color: transparent; }
.toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-2);
  min-height: var(--touch);
  border-radius: var(--radius-pill);
  border: var(--outline-w) solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-mid) var(--ease-out), color var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid) var(--ease-out);
}
.toggle.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--ink);
}

/* Collapsible reveal */
.reveal { overflow: hidden; }
.reveal[hidden] { display: none; }

/* Lookup */
.lookup { margin-top: var(--space-5); }
/* The quiet "Edit my previous RSVP" link under the yes/no buttons; desktop bumps the size in desktop.css. */
.lookup summary {
  cursor: pointer;
  color: var(--accent);
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1.4;
  padding: var(--space-2) 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.lookup summary:hover { opacity: 0.8; }
.preview-details { margin: 0 0 var(--space-4); }
.lookup-body { margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }

/* Landing: identity hero + RSVP form on a single screen, kept compact so the name
   and the yes/no choice sit above the fold on a phone. */
.hero { text-align: center; margin-bottom: var(--space-4); }
.hero h1 { font-size: var(--step-2); white-space: nowrap; }
.hero .lead { margin: var(--space-2) 0 var(--space-1); }
.hero .not-you-row { margin: 0 0 var(--space-2); font-size: var(--step--1); }
.hero .muted { margin: 0; }
.rsvp-form .lookup { margin: 0 0 var(--space-3); text-align: center; }
.rsvp-form .attend-question { margin-top: var(--space-4); }
.rsvp-form .choice-grid { margin: var(--space-3) 0; }
.rsvp-form .choice-card { min-height: 60px; }
.screen > .privacy-note { margin-top: var(--space-4); text-align: center; }

/* Details */
.venue { font-style: normal; }
.addr { color: var(--text-muted); margin-top: var(--space-2); }
.addr-line { display: block; }
.map-link { display: inline-block; margin-top: var(--space-3); }
.when { font-size: 13px; }
.notes { padding-left: var(--space-5); color: var(--text-muted); text-align: left; font-size: smaller }
.cross-links { margin-top: var(--space-5); }

/* Confetti */
.confetti-note {
  position: fixed;
  z-index: var(--z-confetti);
  line-height: 1;
  /* Colour is set per note in motion.ts; the double glow keeps every glyph bright on the blue screen. */
  text-shadow: 0 0 6px currentColor, 0 0 18px currentColor, 0 0 32px var(--accent);
  pointer-events: none;
  will-change: transform, opacity;
}

/* ── Motion: entrance + page transitions (all reduced-motion aware) ──────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes hero-sweep { from { left: -30%; } to { left: 110%; } }
@keyframes hero-pulse { 50% { transform: translateX(3px); } }
@keyframes blink {
  50% { opacity: 0; }
}
@keyframes count-bump {
  50% { transform: translateY(-2px) scale(1.15); }
}
@keyframes candy-wiggle {
  20% { transform: rotate(-18deg) scale(1.2); }
  50% { transform: rotate(14deg) scale(1.2); }
  80% { transform: rotate(-8deg); }
}
@keyframes vt-old {
  to { opacity: 0; transform: translateY(-4px); }
}
@keyframes vt-new {
  from { opacity: 0; transform: translateY(10px); }
}

/* Dev-only "Test mode" label (see client/test-badge.ts): tiny, translucent and
   click-through so it never gets in the way of the UI it sits above. */
.test-badge {
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--space-2));
  left: var(--space-2);
  right: var(--space-2);
  z-index: var(--z-test-badge);
  padding: 0.15rem var(--space-2);
  border: var(--outline-w) solid var(--border-strong);
  border-radius: 999px;
  background: #00ff22;
  color: var(--text-muted);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
}
.test-badge::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

@media (prefers-reduced-motion: no-preference) {
  .brand::after { animation: blink 1.06s steps(1) infinite; }

  .btn-hero::after { animation: hero-sweep 2.4s steps(14) infinite; }
  .btn-hero .hero-play { animation: hero-pulse 1.06s steps(2) infinite; }

  .char-used.bump { animation: count-bump var(--dur-fast) var(--ease-out); }
  .char-count[data-tier="full"] .char-candy { animation: candy-wiggle 0.5s var(--ease-out); }

  .screen > * { animation: rise var(--dur-slow) var(--ease-out) both; }
  .screen > *:nth-child(2) { animation-delay: 0.04s; }
  .screen > *:nth-child(3) { animation-delay: 0.08s; }
  .screen > *:nth-child(4) { animation-delay: 0.12s; }
  .screen > *:nth-child(5) { animation-delay: 0.16s; }
  .screen > *:nth-child(n + 6) { animation-delay: 0.2s; }

  ::view-transition-old(root) { animation: vt-old var(--dur-mid) var(--ease-in-out) both; }
  ::view-transition-new(root) { animation: vt-new var(--dur-slow) var(--ease-out) both; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Mobile-first layout: a single full-height column with a fixed, thumb-reachable
   bottom action bar that respects the safe-area inset. */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--space-1) calc(var(--touch) + env(safe-area-inset-bottom) + var(--space-6));
  text-align: center;
}

.screen { flex: 1; padding-bottom: var(--space-6); }

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-bar);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--surface) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-top: var(--outline-w) solid var(--border);
}
.action-bar .btn { flex: 1; }

/* Compact CTA (RSVP): keep the button snug rather than edge-to-edge, with
   comfortable margin and padding around it. */
.action-bar.compact {
  justify-content: center;
  padding: var(--space-4) var(--space-6) calc(var(--space-4) + env(safe-area-inset-bottom));
}
.action-bar.compact .btn {
  flex: 0 1 auto;
  min-width: 12rem;
  padding: 0 var(--space-7);
}

/* The left identity panel only exists on desktop. */
.identity-panel { display: none; }

/* Desktop (≥ 768px): a split canvas — a fixed left identity panel and a wide
   scrolling right column that fills most of the viewport. A distinct layout, not
   a stretched mobile one. */

@media (min-width: 768px) {
  /* The mobile shell is capped at a narrow reading measure by #app in html.ts;
     on desktop the split-canvas layout takes the full viewport instead. */
  #app { max-width: none; padding: 0; margin: 0; }

  .app-shell {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(320px, 34%) 1fr;
    padding: 0;
    min-height: 100dvh;
    text-align: center;
  }

  .app-header {
    grid-column: 1;
    position: sticky;
    top: 0;
    align-self: start;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    height: 100dvh;
    padding: var(--space-8) var(--space-7);
    color: var(--text);
    background: var(--surface-2);
    border-right: var(--outline-w) solid var(--border);
  }
  .app-header .brand { color: var(--text); }
  .brand { font-size: var(--step-3); line-height: 1.05; }

  .screen {
    grid-column: 2;
    width: 100%;
    max-width: 52rem;
    margin: 0 auto;
    padding: var(--space-8) var(--space-8);
  }

  /* Action bar becomes inline on desktop rather than a fixed bar. */
  .action-bar {
    position: static;
    grid-column: 2;
    max-width: 52rem;
    margin: 0 auto var(--space-8);
    padding: 0 var(--space-8);
    background: none;
    backdrop-filter: none;
    border-top: none;
  }
  .action-bar .btn { flex: 0 1 auto; min-width: 12rem; }

  .lookup summary { font-size: var(--step-1); }

  /* The instrument toggle only stretches full-width on mobile. */
  .toggle { align-self: flex-start; }
}

/* Slideshow. The images are 3:4 portraits, shown uncropped everywhere. Mobile:
   edge-to-edge. Desktop: a centred column whose width is derived from the
   viewport height so the whole slide (stage + controls) fits on screen. */

.slides-intro { color: var(--text-muted); margin-bottom: var(--space-4); }

/* Empty spacer above the stage. It used to hold the skip button; it stays so the
   slides keep their position. */
.slides-top {
  min-height: var(--touch);
  margin-bottom: var(--space-2);
}

.slides-progress {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.slides-progress .seg {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--dur-slow) var(--ease-out);
}
.slides-progress .seg.filled { background: var(--accent); }

.slide-stage {
  margin: 0;
  position: relative;
  border: var(--outline-w) solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-pop);
  touch-action: pan-y;
  user-select: none;
  aspect-ratio: 3 / 4;
}
.slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slide-img.kenburns {
  animation: kenburns 6s ease-out both;
}
@keyframes kenburns {
  from { transform: scale(1.08) translate(0, 0); }
  to { transform: scale(1) translate(0, -1%); }
}
.slide-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-6) var(--space-4) var(--space-4);
  color: white;
  font-size: var(--step-0);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.4;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), #0000007d);
  text-align: center;
}

.slides-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-4);
}
.slides-btn {
  font-size: var(--step-2);
  line-height: 1;
}

@media (min-width: 768px) {
  /* Stage height = 100dvh minus ~19rem of chrome (screen padding, spacer, intro,
     progress bar, controls); width follows from 3:4. Every sibling shares that
     width so the progress bar and controls line up with the image. The floor
     stops it shrinking to a thumbnail on short windows (the page scrolls
     instead), and 100% stops it outgrowing the column on tall ones. */
  .screen:has(> .slide-stage) > * {
    max-width: min(100%, max(18rem, calc((100dvh - 19rem) * 3 / 4)));
    margin-inline: auto;
  }
  .slide-caption {
    inset: auto var(--space-5) var(--space-5) var(--space-5);
    border-radius: var(--radius-md);
    padding: var(--space-4);
  }
}
