/* =====================================================================
   main.css — HUD, cards, résumé overlay, dock, loader, fallback page.
   Dusk palette matches the 3D sky: indigo → rose → amber.
   ===================================================================== */

:root {
  --ink: #221a3a;
  --paper: #fff7ec;
  --panel: rgba(23, 17, 42, 0.82);
  --panel-edge: rgba(255, 226, 174, 0.22);
  --amber: #ffcf7a;
  --rose: #ff9ec2;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: #33306b;
  color: var(--paper);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- HUD frame -------------------------------------------------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#hud > * { pointer-events: auto; }
/* Non-interactive HUD chips must never swallow scene clicks — especially
   while they're invisible (before the intro finishes / after the hint
   fades out) but still occupying their screen rectangle.
   IMPORTANT: `#hud > *` above carries ID specificity, so every reset here
   must carry the ID too — a bare `.detail-panel { pointer-events: none }`
   LOSES to it, which is exactly the bug that made the whole lower screen
   tap-dead on phones after closing a panel (the invisible closed sheet
   kept swallowing touches). */
#hud .hint, #hud .identity { pointer-events: none; }
#hud .detail-panel { pointer-events: none; }
#hud .detail-panel.open { pointer-events: auto; }
#hud .tour-progress, #hud .tour-coach { pointer-events: none; }

/* HUD elements slide in after the intro camera settles
   (the dock is zone-gated instead — see .dock--on below) */
.identity, .hint {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#hud.ready .identity, #hud.ready .hint {
  opacity: 1;
  transform: none;
}
#hud.ready .identity { transition-delay: 0.05s; }
#hud.ready .hint     { transition-delay: 0.25s; }

/* ---------- identity chip (top-left) ----------------------------------- */

.identity {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 18px;
  padding: 10px 18px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  line-height: 1.25;
}
.identity strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.identity span {
  font-size: 0.78rem;
  color: var(--amber);
  letter-spacing: 0.04em;
}

/* ---------- résumé button (top-right) ---------------------------------- */

.resume-btn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font: 600 0.95rem var(--font-body);
  letter-spacing: 0.02em;
  color: var(--ink);
  background: linear-gradient(160deg, #ffe3a9, #ffb35c);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(255, 179, 92, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.resume-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 28px rgba(255, 179, 92, 0.6);
}
.resume-btn:active { transform: scale(0.98); }
.rb-icon { font-size: 1.05rem; }

/* ---------- mobile mini HUD (sheet open ⇒ chips collapse to dots) ------- */
/* Owned by js/ui.js. Two 44px glass dots at the top corners that crossfade
   in while a bottom sheet is open on phones (#hud.sheet-open, mobile only),
   replacing the identity chip and the résumé pill so they stop covering the
   3D name boards and the peeking sheet. Hidden everywhere else. */

.hud-mini {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--amber);
  font: 800 1.15rem var(--font-display);
  z-index: 16;
  opacity: 0;
  transform: scale(0.6);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.26s ease,
    transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    visibility 0s linear 0.32s;
}
.hud-mini--id { left: 16px; }
.hud-mini--resume {
  right: 16px;
  border: none;
  color: var(--ink);
  background: linear-gradient(160deg, #ffe3a9, #ffb35c);
  box-shadow: 0 6px 18px rgba(255, 179, 92, 0.4);
  font-size: 1.15rem;
  cursor: pointer;
}
.hud-mini--resume:active { transform: scale(0.92); }

@media (max-width: 720px) {
  #hud.sheet-open .hud-mini {
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity 0.26s ease 0.1s,
      transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.1s,
      visibility 0s;
  }
  #hud.sheet-open .hud-mini--id { pointer-events: none; } /* decorative */
  #hud.ready.sheet-open .identity,
  #hud.ready.sheet-open .resume-btn {
    opacity: 0;
    transform: scale(0.85) translateY(-4px);
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.22s ease,
      transform 0.26s ease,
      visibility 0s linear 0.26s;
  }
}

/* ---------- control hint ------------------------------------------------ */

.hint {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  padding: 10px 20px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  font-size: 0.85rem;
  color: #e9ddff;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hint-key {
  color: var(--amber);
  font-weight: 700;
}
.hint.fade {
  opacity: 0 !important;
  transition: opacity 1.4s ease 1.2s;
}

/* ---------- quick-travel dock (bottom) ---------------------------------- */

.dock {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  /* hidden until the character walks into a district */
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none !important; /* don't block taps while hidden */
}
#hud.ready .dock.dock--on {
  opacity: 1;
  transform: none;
  pointer-events: auto !important;
}
.dock.tucked {
  opacity: 0.25 !important;
  transform: translateY(6px);
}
#hud.ready .dock.dock--on.tucked:hover { opacity: 1 !important; transform: none; }

/* small district title above the icon row */
.dock-zone {
  font: 700 0.62rem var(--font-body);
  letter-spacing: 0.22em;
  color: var(--amber);
  padding-top: 2px;
  transition: opacity 0.16s ease;
}
.dock-row {
  display: flex;
  gap: 6px;
  transition: opacity 0.16s ease;
}
/* crossfade while the dock swaps to another district's content */
.dock--swap .dock-zone, .dock--swap .dock-row { opacity: 0; }

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  min-width: 66px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: #efe6ff;
  font: 500 0.68rem var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.dock-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-3px);
}
.dock-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--hue) 24%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--hue) 65%, transparent);
}

/* ---------- detail panel (left half of the screen) ---------------------- */

.detail-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: min(500px, 44vw);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(165deg,
      color-mix(in srgb, var(--hue, #ffcf7a) 16%, rgba(21, 15, 40, 0.9)) 0%,
      rgba(21, 15, 40, 0.92) 34%);
  border: 1px solid color-mix(in srgb, var(--hue, #ffcf7a) 45%, transparent);
  border-radius: 24px;
  box-shadow:
    0 24px 70px rgba(8, 4, 22, 0.6),
    0 0 60px -22px var(--hue, #ffcf7a);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateX(-28px);
  /* visibility (delayed until the exit animation ends) is a second line of
     defence: a hidden element can never be a hit-test target, even if the
     pointer-events reset ever regresses */
  visibility: hidden;
  transition:
    opacity 0.32s ease,
    transform 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    visibility 0s linear 0.4s;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}
.detail-panel.open {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition:
    opacity 0.32s ease,
    transform 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    visibility 0s;
  pointer-events: auto;
}
.detail-panel::before {
  /* thin theme-coloured spine on the left edge */
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg,
    var(--hue, #ffcf7a),
    color-mix(in srgb, var(--hue, #ffcf7a) 20%, transparent));
}

/* drag handle for the mobile bottom sheet — hidden on desktop */
.dp-grab { display: none; }

.dp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 247, 236, 0.08);
  color: var(--paper);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.2s ease;
}
.dp-close:hover {
  background: rgba(255, 247, 236, 0.18);
  transform: rotate(90deg);
}

.dp-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 34px 34px 30px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--hue, #ffcf7a) 45%, transparent) transparent;
}

.dp-kicker {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--hue, #ffcf7a);
  border-radius: 999px;
}
.dp-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.7rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0.005em;
}
.dp-tagline {
  margin-top: 8px;
  font-size: 1.02rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--hue, #ffcf7a) 82%, white);
}
.dp-desc, .dp-where {
  margin-top: 18px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #efe8ff;
}
.dp-where {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #c8bce6;
}

.dp-sec { margin-top: 24px; }
.dp-sec-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b9a9e0;
  margin-bottom: 10px;
}
.dp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dp-bullets {
  margin-left: 18px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #efe8ff;
}
.dp-bullets li + li { margin-top: 8px; }
.dp-bullets li::marker { color: var(--hue, #ffcf7a); }

.dp-shot {
  margin-top: 24px;
  display: grid;
  place-content: center;
  gap: 8px;
  aspect-ratio: 16 / 9;
  border: 2px dashed color-mix(in srgb, var(--hue, #ffcf7a) 42%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--hue, #ffcf7a) 6%, transparent);
  text-align: center;
}
.dp-shot-mark {
  font-size: 1.6rem;
  color: color-mix(in srgb, var(--hue, #ffcf7a) 85%, white);
}
.dp-shot figcaption {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b9a9e0;
}

.dp-foot { margin-top: 26px; }
.dp-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font: 700 0.9rem var(--font-body);
  letter-spacing: 0.02em;
  color: var(--ink);
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--hue, #ffcf7a) 70%, white),
    var(--hue, #ffcf7a));
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 8px 24px -6px var(--hue, #ffcf7a);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dp-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -6px var(--hue, #ffcf7a);
}
.dp-cta--soon {
  background: rgba(255, 255, 255, 0.08);
  color: #c8bce6;
  box-shadow: none;
  cursor: default;
}
.dp-cta--soon:hover { transform: none; box-shadow: none; }

/* ---------- shared chips ------------------------------------------------- */

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  align-items: center;
}
.chip {
  padding: 5px 11px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.chip--tech {
  background: transparent;
  border-color: color-mix(in srgb, var(--hue) 45%, transparent);
  color: color-mix(in srgb, var(--hue) 85%, white);
}
/* ---------- résumé overlay ---------------------------------------------- */

.rs-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 10, 32, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.rs-overlay.open { opacity: 1; pointer-events: auto; }

.rs-panel {
  position: relative;
  width: min(820px, 100%);
  max-height: min(86vh, 980px);
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(8, 4, 22, 0.6);
  overflow: hidden;
  transform: translateY(16px);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.rs-overlay.open .rs-panel { transform: none; }

.rs-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(34, 26, 58, 0.08);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.rs-close:hover { background: rgba(34, 26, 58, 0.16); transform: rotate(90deg); }

.rs-body {
  max-height: min(86vh, 980px);
  overflow-y: auto;
  padding: 40px 44px 48px;
}
.rs-head {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 2px solid #eadfcb;
}
.rs-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.05;
}
.rs-title {
  margin-top: 6px;
  font-weight: 600;
  color: #a8552e;
}
.rs-intro {
  margin-top: 10px;
  max-width: 46ch;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #4d4368;
}
.rs-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.rs-contact a {
  color: #a8552e;
  font-weight: 600;
  text-decoration: none;
}
.rs-contact a:hover { text-decoration: underline; }

.rs-sec {
  margin: 30px 0 14px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #6b3fa0;
}
.rs-item { margin-bottom: 20px; }
.rs-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rs-item-head h3 {
  font-size: 1.02rem;
  font-weight: 700;
}
.rs-item-head span {
  font-size: 0.8rem;
  color: #7a6f96;
}
.rs-role {
  margin: 2px 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #a8552e;
}
.rs-item ul {
  margin-left: 18px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #43395e;
}
.rs-item li + li { margin-top: 4px; }

.rs-products {
  display: grid;
  gap: 12px;
}
.rs-product {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.rs-product p {
  font-size: 0.84rem;
  color: #5b5178;
}
.rs-dot {
  flex: none;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--hue);
  box-shadow: 0 0 8px var(--hue);
}

.rs-body .card-chips .chip {
  color: var(--ink);
  background: rgba(107, 63, 160, 0.08);
  border-color: rgba(107, 63, 160, 0.22);
}

/* ---------- loader ------------------------------------------------------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #33306b 0%, #b46a9e 70%, #ffb27a 100%);
  transition: opacity 0.7s ease 0.15s;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-inner p {
  margin-top: 16px;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 247, 236, 0.85);
}
.loader-mark {
  display: inline-block;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--amber);
  animation: loaderSpin 1.2s cubic-bezier(0.6, 0.05, 0.3, 0.95) infinite;
}
@keyframes loaderSpin {
  0%   { transform: rotate(0deg)   scale(1); border-radius: 12px; }
  50%  { transform: rotate(180deg) scale(0.8); border-radius: 50%; }
  100% { transform: rotate(360deg) scale(1); border-radius: 12px; }
}

/* ---------- fallback static page ------------------------------------------ */

body.fallback-mode {
  overflow: auto;
  background: var(--paper);
}
#fallback {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}
.rs-body--page {
  max-width: 860px;
  max-height: none;
  margin: 0 auto;
}
.fb-note {
  margin-bottom: 24px;
  padding: 12px 16px;
  font-size: 0.85rem;
  background: rgba(107, 63, 160, 0.08);
  border-left: 3px solid #6b3fa0;
  border-radius: 6px;
  color: #55496f;
}

/* ---------- small screens -------------------------------------------------- */

@media (max-width: 720px) {
  .identity {
    padding: 8px 14px 10px;
    /* leave the résumé pill its own corner — no underlap */
    max-width: calc(100vw - 178px);
  }
  .identity strong { font-size: 1.05rem; }
  .identity span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .hint {
    top: auto;
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 84px);
    font-size: 0.72rem;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }
  .resume-btn {
    padding: 10px 14px;
    font-size: 0.82rem;
    /* opacity/visibility joins the transition so the pill fades back
       smoothly when the sheet closes (see #hud.sheet-open above) */
    transition:
      transform 0.26s ease, box-shadow 0.15s ease,
      opacity 0.26s ease 0.08s, visibility 0s;
  }
  .dock { gap: 2px; padding: 6px; max-width: calc(100vw - 20px); }
  .dock-row { gap: 2px; }
  .dock-btn { min-width: 52px; padding: 6px 6px; }
  .dock-name { display: none; }
  /* ---- detail panel: two-stage draggable bottom sheet -------------------
     The sheet keeps a fixed 88dvh height and slides via translateY:
       peek     — only the top ~30vh shows (name / tagline / intro), the
                  temple stays fully visible above it;
       expanded — pulled up to 88dvh, content scrolls.
     js/ui.js drives --dy (drag position) and the sheet-peek / sheet-expanded
     / dragging classes; snapping is animated by the transform transition. */
  .detail-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: none;
    height: 88vh;
    height: 88dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    opacity: 1;                          /* slide, don't fade — it's a sheet */
    transform: translateY(105%);
    transition:
      transform 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
      visibility 0s linear 0.42s;
  }
  .detail-panel.open {
    transform: translateY(var(--dy, 0px));
    transition:
      transform 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
      visibility 0s;
  }
  .detail-panel.dragging { transition: none; }
  .detail-panel::before { display: none; } /* spine replaced by the grabber */

  /* grabber: full-width touch strip with the little rounded bar */
  .dp-grab {
    display: grid;
    place-items: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 34px;
    z-index: 2;
    background: transparent;
    border: none;
    cursor: grab;
    touch-action: none;
  }
  .dp-grab-bar {
    width: 46px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 247, 236, 0.38);
  }

  .dp-close { top: 9px; right: 10px; width: 34px; height: 34px; z-index: 3; }

  .dp-scroll {
    padding: 36px 22px calc(26px + env(safe-area-inset-bottom));
  }
  /* peek: no native scrolling — every vertical drag moves the sheet */
  .detail-panel.sheet-peek .dp-scroll { overflow: hidden; }

  .dp-title { font-size: 1.7rem; }
  .dp-tagline { font-size: 0.92rem; }
  .dp-shot { aspect-ratio: 21 / 9; }
  .rs-body { padding: 28px 22px 36px; }
}

/* ---------- station nav arrows (prev / next while a panel is open) -------- */
/* Owned by js/nav-arrows.js. Big "ghost glass" chevrons: dark blurred disc,
   warm-gold hairline, faint at rest, glowing gold on hover. Desktop: both
   sit in the scene half (left one hugs the panel's outer edge). Mobile:
   both sides just above the bottom-sheet panel. */

.nav-arrows { display: contents; } /* buttons position against #hud directly */

.nav-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;                 /* centering only — transform is free for states */
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffeccb;
  background:
    radial-gradient(120% 120% at 30% 22%,
      rgba(255, 226, 174, 0.10) 0%, rgba(23, 17, 42, 0.55) 46%);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px -14px rgba(8, 4, 22, 0.8);
  cursor: pointer;
  z-index: 14;
  opacity: 0.45;                     /* the "ghost" resting state */
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s ease,
    transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    visibility 0s linear 0.32s;
}
/* hidden ⇒ drift inward + shrink; shown ⇒ settle into place */
.nav-arrow--prev { left: calc(min(500px, 44vw) + 34px); transform: translateX(16px) scale(0.82); }
.nav-arrow--next { right: 26px;                          transform: translateX(-16px) scale(0.82); }

.nav-arrows.nav-on .nav-arrow {
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}
.nav-arrows.nav-on .nav-arrow--next { transition-delay: 0.06s; } /* tiny stagger */

.nav-arrows.nav-on .nav-arrow:hover,
.nav-arrows.nav-on .nav-arrow:focus-visible {
  opacity: 1;
  transform: scale(1.07);
  border-color: color-mix(in srgb, var(--amber) 80%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--amber) 40%, transparent),
    0 14px 38px -12px rgba(255, 207, 122, 0.55),
    inset 0 0 24px -14px var(--amber);
}
.nav-arrows.nav-on .nav-arrow:active {
  transform: scale(0.94);
  transition-duration: 0.08s;
}
.nav-arrow:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.na-chev {
  display: block;
  transition: transform 0.2s ease;
}
.nav-arrow--prev:hover .na-chev { transform: translateX(-3px); }
.nav-arrow--next:hover .na-chev { transform: translateX(3px); }

/* hover tip: "Prev / Next · station name" pill under the button */
.na-tip {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 14px;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease 0.05s, transform 0.18s ease 0.05s;
}
.nav-arrow:hover .na-tip,
.nav-arrow:focus-visible .na-tip { opacity: 1; transform: none; }
.na-tip-dir {
  font: 700 0.6rem var(--font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}
.na-tip-name {
  font: 600 0.8rem var(--font-body);
  color: var(--paper);
}

@media (max-width: 720px) {
  /* Panel is a draggable bottom sheet. js/ui.js keeps --sheet-visible (on
     #hud) equal to the sheet's on-screen height, so the arrows ride its top
     edge: just above it in peek, up at the sheet's top corners (beside the
     grabber) when expanded — capped so they never crash into the top HUD. */
  .nav-arrow {
    top: auto;
    /* cap low enough that on the expanded sheet the next-arrow sits
       clear BELOW the sheet's ✕ close button instead of on top of it */
    bottom: min(calc(var(--sheet-visible, 0px) + 14px), calc(100vh - 218px));
    translate: none;
    width: 54px;
    height: 54px;
    opacity: 0.55;                   /* no hover on touch — keep them readable */
    z-index: 16;                     /* above the sheet (15) when they overlap */
    transition:
      opacity 0.32s ease,
      transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
      bottom 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
      visibility 0s linear 0.32s;
  }
  .nav-arrow--prev { left: 12px; }
  .nav-arrow--next { right: 12px; }
  .na-chev { width: 24px; height: 24px; }
  .na-tip { display: none; }         /* hover tips are pointless on touch */
  /* while the finger drags the sheet, everything tracks it with no lag */
  #hud.sheet-dragging .nav-arrow,
  #hud.sheet-dragging .tour-progress,
  #hud.sheet-dragging .tour-coach { transition: none; }
}

/* ---------- tour progress dots + one-time browse coach hint --------------- */
/* Owned by js/nav-arrows.js. Bottom-centre of the scene half (above the
   bottom sheet on mobile), same glass language as the HUD pills:
   · .tour-progress — one dot per station; current glows amber, visited
     stay half-lit. All 13 seen ⇒ dots flare + a brief note slides in.
   · .tour-coach — first-panel-of-the-visit hint ("← → to browse…"),
     fades in late, fades out on its own or as soon as the user navigates. */

.tour-progress,
.tour-coach {
  position: absolute;
  right: 26px;                       /* the next-arrow's column — clear of the
                                        tucked dock at any viewport width */
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 13;                       /* under the arrows (14), over the scene */
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition:
    opacity 0.32s ease,
    transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    visibility 0s linear 0.32s;
}

.tour-progress {
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
}
.tour-progress.tour-on {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition-delay: 0.1s;            /* trails the arrows by a beat */
}
.tp-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tp-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 247, 236, 0.22);
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.tp-dot.is-seen { background: rgba(255, 207, 122, 0.55); }
.tp-dot.is-current {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 207, 122, 0.9);
  transform: scale(1.35);
}
/* all stops seen: every dot flares and the note slides open for a moment */
.tp-done {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font: 600 0.72rem var(--font-body);
  letter-spacing: 0.05em;
  color: var(--amber);
  opacity: 0;
  transition: max-width 0.45s ease, opacity 0.4s ease;
}
.tour-complete .tp-done { max-width: 170px; opacity: 1; transition-delay: 0s, 0.15s; }
.tour-complete .tp-dot {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(255, 207, 122, 0.7);
}

.tour-coach {
  bottom: 76px;                      /* one storey above the dots, clear of
                                        the next-arrow at mid-height */
  padding: 10px 18px;
  font-size: 0.85rem;
  color: #f2ebff;                    /* a notch brighter for contrast */
  white-space: nowrap;
}
.tour-coach.coach-on {
  opacity: 1;
  transform: none;
  visibility: visible;
}
/* keycap chips for ← → (and ‹ › on touch) */
.tc-key {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  margin: 0 2px;
  border-radius: 6px;
  background: rgba(255, 226, 174, 0.12);
  border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent);
  box-shadow: 0 2px 0 rgba(8, 4, 22, 0.5);
  font: 700 0.78rem var(--font-body);
  color: var(--amber);
  vertical-align: -5px;
}

@media (max-width: 720px) {
  /* panel is a bottom sheet — sit centred between / above the edge arrows,
     riding the sheet's live top edge exactly like the arrows do */
  .tour-progress {
    right: auto;
    left: 50vw;
    translate: -50% 0;
    bottom: calc(var(--sheet-visible, 0px) + 29px);  /* level with the arrows */
    padding: 7px 12px;
    transition:
      opacity 0.32s ease,
      transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
      bottom 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
      visibility 0s linear 0.32s;
  }
  .tp-dots { gap: 4px; }
  .tour-coach {
    right: auto;
    left: 50vw;
    translate: -50% 0;
    bottom: calc(var(--sheet-visible, 0px) + 84px);  /* clears the 54px arrows */
    font-size: 0.76rem;
    padding: 9px 14px;
    transition:
      opacity 0.32s ease,
      transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2),
      bottom 0.42s cubic-bezier(0.22, 0.9, 0.32, 1),
      visibility 0s linear 0.32s;
  }
  .tc-key { min-width: 19px; height: 19px; font-size: 0.72rem; }
  /* expanded sheet covers the scene — dots / coach would float mid-sheet,
     so tuck them away until the sheet drops back to peek */
  #hud.sheet-expanded .tour-progress,
  #hud.sheet-expanded .tour-coach {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
  }
}
