/* Expedition tracker — main UI styles.
   Vanilla CSS only. Dark theme, GitHub-style palette inherited from race-tracker.
   Layout strategy:
     - .page-landing: stacked column landing page with event list
     - .page-event[data-layout="left-panel"]: CSS Grid: panel | map on desktop,
       column stack with map mid-page on mobile.
*/

:root {
  --bg-0: #0d1117;
  --bg-1: #161b22;
  --bg-2: #21262d;
  --bg-3: #30363d;
  --text-0: #e6edf3;
  --text-1: #c9d1d9;
  --text-2: #8b949e;
  --text-3: #6e7681;
  --accent: #58a6ff;
  --accent-warm: #f0883e;
  --accent-archive: #6e7681;
  --accent-live: #3fb950;
  --accent-pre: #58a6ff;
  --accent-media: #a371f7;
  --accent-aid: #f85149;
  --accent-camp: #f0883e;
  --accent-nav: #6e7681;
  --accent-info: #58a6ff;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --shadow: 0 6px 24px rgba(0,0,0,0.4);
  --radius: 6px;
  --radius-lg: 10px;
}

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

html, body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--text-0); font-weight: 600; }

button { font: inherit; cursor: pointer; }

/* ===========================================================
   Landing page
   =========================================================== */
.page-landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent-warm); font-size: 18px; }
.brand-name { font-weight: 700; color: var(--text-0); letter-spacing: 0.3px; }
.landing-nav .nav-link {
  color: var(--text-2); font-size: 13px;
  padding: 6px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.landing-nav .nav-link:hover { color: var(--text-0); border-color: var(--accent); text-decoration: none; }

.landing-main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  width: 100%;
}

.landing-hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.landing-sub {
  color: var(--text-2);
  max-width: 56ch;
  font-size: 17px;
}

.landing-events { margin-top: 48px; }

.section-title {
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 12px;
  font-weight: 700;
}

.event-list { display: grid; gap: 12px; }

.event-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.15s ease, border-color 0.15s ease;
  color: inherit;
}
.event-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.event-card-title { font-size: 19px; color: var(--text-0); font-weight: 600; }
.event-card-meta { color: var(--text-2); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.event-card-skeleton {
  padding: 18px; color: var(--text-3); background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}

.landing-footer {
  padding: 18px 24px;
  color: var(--text-3);
  font-size: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ===========================================================
   Status pill
   =========================================================== */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.status-pill.pill-live {
  background: rgba(63,185,80,0.12);
  color: var(--accent-live);
  border-color: rgba(63,185,80,0.4);
  animation: live-pulse 2s ease-in-out infinite;
}
.status-pill.pill-pre {
  background: rgba(88,166,255,0.12);
  color: var(--accent-pre);
  border-color: rgba(88,166,255,0.4);
}
.status-pill.pill-archive {
  background: rgba(110,118,129,0.15);
  color: var(--text-1);
  border-color: rgba(110,118,129,0.4);
}
.status-pill.pill-demo {
  background: rgba(187,128,255,0.14);
  color: #d4b8ff;
  border-color: rgba(187,128,255,0.45);
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(63,185,80,0); }
}

/* ===========================================================
   Event page — left-panel layout
   =========================================================== */
.page-event { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: rgba(13,17,23,0.85);
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-block;
  padding: 10px 18px;
  color: var(--text-2);
  font-size: 13px;
}
.back-link + .back-link { border-left: 1px solid var(--border); }
.back-link:hover { color: var(--text-0); text-decoration: none; }

.event-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* Desktop: panel | resizer | map | story-panel.
   --panel-w (left panel) persisted by panel-resizer.js.
   --story-w (right story panel) toggled by body.story-panel-open. */
@media (min-width: 1024px) {
  .event-shell {
    grid-template-columns: var(--panel-w, minmax(360px, 38%)) 6px 1fr var(--story-w, 0px);
    transition: grid-template-columns 280ms ease;
  }
  body.story-panel-open .event-shell {
    --story-w: 360px;
  }
  .event-panel { overflow-y: auto; border-right: 1px solid var(--border); min-height: 0; }
  .event-map-wrap { position: relative; min-height: 0; height: 100%; }
  .event-map { position: absolute; inset: 0; }
}

/* Mobile / tablet: panel stacked above map. Allow page scroll on narrow widths. */
@media (max-width: 1023px) {
  .page-event { height: auto; min-height: 100vh; overflow: visible; }
  .event-map-wrap { height: 55vh; min-height: 320px; position: relative; }
  .event-map { position: absolute; inset: 0; }
  .event-panel { padding-bottom: 24px; }
  .panel-resizer { display: none; }
}

/* Themed scrollbar on the left panel so it reads as part of the UI, not a
   chunky white default that bleeds into the map. */
.event-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.event-panel::-webkit-scrollbar { width: 6px; }
.event-panel::-webkit-scrollbar-track { background: transparent; }
.event-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.event-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.32); }

/* Panel resizer — vertical drag handle between the left panel and map. */
.panel-resizer {
  position: relative;
  cursor: ew-resize;
  background: transparent;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  transition: background 120ms ease;
}
.panel-resizer::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 4px; height: 44px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
  transition: background 120ms ease, height 120ms ease;
}
.panel-resizer:hover::before,
.panel-resizer.is-dragging::before {
  background: rgba(255,255,255,0.55);
  height: 56px;
}
.panel-resizer:hover { background: rgba(255,255,255,0.04); }
.panel-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.event-panel { background: var(--bg-0); }

.panel-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-hero { padding-top: 24px; padding-bottom: 14px; }
.hero-title {
  font-size: clamp(22px, 3.5vw, 30px);
  letter-spacing: -0.3px;
  line-height: 1.2;
  margin-bottom: 6px;
}
.hero-dates { color: var(--text-2); font-size: 14px; }

.panel-description .description {
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.55;
}

/* Team */
.team-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.team-member {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  min-width: 80px;
}
.team-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
  border: 1px solid var(--border-strong);
  overflow: hidden;
}
.team-avatar--photo { padding: 0; }
.team-avatar--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.team-name {
  font-size: 12px;
  color: var(--text-1);
  text-align: center;
  max-width: 80px;
  line-height: 1.2;
}

/* Solo team — one participant collapses to a single horizontal row with a
   smaller avatar and the name on the right rather than wrapped underneath. */
.team-row.is-solo .team-member {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.team-row.is-solo .team-avatar {
  width: 36px; height: 36px;
  font-size: 13px;
}
.team-row.is-solo .team-name {
  font-size: 14px;
  text-align: left;
  max-width: none;
}

/* Info panel */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

/* Status headline — replaces the "Status" section h2 with a rich, computed
   label (Moving / Stopped / At Camp / Streaming Live / Finished / countdown).
   The hero LIVE pill above the title was removed; this is the new visual
   anchor for "what's happening right now". Color is driven by [data-status]. */
.status-headline {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-transform: none;
  color: var(--text-1);
  margin-bottom: 14px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-headline::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
  box-shadow: 0 0 8px currentColor;
}
.status-headline[data-status="pre"]            { color: var(--text-1); }
.status-headline[data-status="archive"]        { color: var(--text-2); }
.status-headline[data-status="stopped"]        { color: var(--text-2); }
.status-headline[data-status="moving"]         { color: var(--accent-warm); }
.status-headline[data-status="at_camp"]        { color: var(--accent-camp); }
.status-headline[data-status="streaming_live"] { color: var(--accent-media); }

/* Pulsing dot for active states (moving + streaming_live) — subtle 1.6s loop. */
.status-headline[data-status="moving"]::before,
.status-headline[data-status="streaming_live"]::before {
  animation: status-pulse 1.6s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { transform: scale(1);   opacity: 1;    box-shadow: 0 0 8px currentColor; }
  50%      { transform: scale(1.3); opacity: 0.75; box-shadow: 0 0 14px currentColor; }
}
.info-cell {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.info-label {
  font-size: 11px; letter-spacing: 0.8px; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 4px;
}
.info-value {
  font-size: 18px; color: var(--text-0); font-weight: 600;
  line-height: 1.3;
}
.info-value .unit { font-size: 12px; color: var(--text-2); font-weight: 500; margin-left: 3px; }

/* ===========================================================
   Journey panel — prev/next waypoint with animated traveler dot
   =========================================================== */
.panel-journey { /* sandwiched between status and journal */ }
.journey-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(40px, 2fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.journey-endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.journey-prev {
  flex-direction: row;
  justify-content: flex-start;
}
.journey-next {
  flex-direction: row-reverse;
  justify-content: flex-start;
}
.journey-endpoint-meta { min-width: 0; flex: 1; }
.journey-prev .journey-endpoint-meta { text-align: left; }
.journey-next .journey-endpoint-meta { text-align: right; }

.journey-title {
  font-size: 13px;
  color: var(--text-0);
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.journey-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.2;
}

/* Endpoint dots (kind-colored). .is-prev is filled solid; .is-next is outline. */
.journey-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
  background: var(--text-3);
  box-shadow: 0 0 0 0 transparent;
}
.journey-dot.is-next {
  background: transparent;
  border: 2px solid var(--text-3);
}
.journey-dot[data-kind="camp"],
.journey-dot[data-kind="planned_stop"] { background: var(--accent-camp); }
.journey-dot.is-next[data-kind="camp"],
.journey-dot.is-next[data-kind="planned_stop"] {
  background: transparent; border-color: var(--accent-camp);
}
.journey-dot[data-kind="aid_station"] { background: var(--accent-aid); }
.journey-dot.is-next[data-kind="aid_station"] {
  background: transparent; border-color: var(--accent-aid);
}
.journey-dot[data-kind="info_point"] { background: var(--accent-info); }
.journey-dot.is-next[data-kind="info_point"] {
  background: transparent; border-color: var(--accent-info);
}
.journey-dot[data-kind="media_point"] { background: var(--accent-media); }
.journey-dot.is-next[data-kind="media_point"] {
  background: transparent; border-color: var(--accent-media);
}
.journey-dot[data-kind="nav"] { background: var(--accent-nav); }
.journey-dot.is-next[data-kind="nav"] {
  background: transparent; border-color: var(--accent-nav);
}

/* Connector line + animated traveler */
.journey-line {
  position: relative;
  height: 2px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
}
.journey-line-done {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 0%;
  background: var(--accent-warm);
  border-radius: 999px;
  transition: width 0.45s ease;
}
.journey-traveler {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent-warm);
  box-shadow: 0 0 6px rgba(240,136,62,0.7);
  transition: left 0.45s ease;
  z-index: 2;
}
.journey-traveler::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 20px; height: 20px;
  margin-left: -10px; margin-top: -10px;
  border-radius: 50%;
  background: rgba(240,136,62,0.45);
  animation: journey-traveler-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes journey-traveler-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.6; }
  50%      { transform: scale(1.6); opacity: 0;   }
}

/* Ghost dots for interest waypoints (info_point / media_point) sitting
   between the prev/next routing endpoints. Half-transparent, brighten on
   hover, clickable to open the same drawer as the map pins. */
.journey-ghost {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px; height: 9px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.18);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1; /* below the traveler */
}
.journey-ghost:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.25);
  z-index: 3;
}
.journey-ghost[data-kind="info_point"]  { background: rgba(88,166,255,0.30); border-color: rgba(88,166,255,0.6); }
.journey-ghost[data-kind="media_point"] { background: rgba(163,113,247,0.30); border-color: rgba(163,113,247,0.6); }

/* Projected finish footer */
.journey-finish {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.journey-finish[hidden] { display: none; }
.journey-finish-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
}
.journey-finish-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.2;
}
.journey-finish-remaining {
  font-size: 12px;
  color: var(--text-2);
}

/* Narrow panels: keep endpoint text wrapping clean. */
@media (max-width: 420px) {
  .journey-title { font-size: 12.5px; }
  .journey-sub { font-size: 10.5px; }
}

/* Journal */
.journal-feed { display: flex; flex-direction: column; gap: 12px; }
.journal-entry {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.journal-entry-header {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 4px;
}
.journal-entry-title { font-size: 14px; font-weight: 600; color: var(--text-0); }
.journal-entry-date { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.journal-entry-body { color: var(--text-1); font-size: 13.5px; line-height: 1.55; }
.journal-entry-author { color: var(--text-2); font-size: 11px; margin-top: 6px; }
.journal-skeleton { color: var(--text-3); }

/* ===========================================================
   Map — MapLibre canvas backdrop + custom marker styles
   =========================================================== */
.event-map { background: #0a0e13; }

/* MapLibre injects its own controls; tone them to match the dark theme. */
.maplibregl-ctrl-attrib {
  background: rgba(13,17,23,0.7) !important;
  color: var(--text-3) !important;
}
.maplibregl-ctrl-attrib a { color: var(--text-2); }
.maplibregl-ctrl-group {
  background: rgba(22,27,34,0.85) !important;
  border: 1px solid var(--border-strong) !important;
}
.maplibregl-ctrl-group button {
  filter: invert(0.92) hue-rotate(180deg);
}

/* ----- Interactive position marker ----- */
.position-marker {
  position: relative;
  width: 22px;
  height: 22px;
  cursor: pointer;
  outline: none;
}
.position-marker:focus-visible::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}
.position-marker-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent-warm);
  border: 3px solid #fff;
  box-shadow: 0 0 14px rgba(240,136,62,0.7), 0 2px 6px rgba(0,0,0,0.5);
  z-index: 2;
}
.position-marker::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  margin-left: -11px; margin-top: -11px;
  border-radius: 50%;
  background: rgba(240,136,62,0.45);
  animation: pm-pulse 1.8s ease-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes pm-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  70%  { transform: scale(2.6); opacity: 0;   }
  100% { transform: scale(2.6); opacity: 0;   }
}

.position-marker-tooltip {
  position: fixed;
  transform: translate(-50%, -100%);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-1);
  z-index: 900;
  pointer-events: none;
  min-width: 160px;
}
.pm-tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.pm-tt-lbl { color: var(--text-3); }
.pm-tt-val { color: var(--text-0); font-weight: 600; }

/* ----- Waypoint pulse (used by step-scrubber on land) ----- */
.waypoint-pulse {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(88,166,255,0.18);
  border: 2px solid rgba(88,166,255,0.85);
  box-shadow: 0 0 18px rgba(88,166,255,0.7);
  animation: wp-pulse-glow 1.0s ease-out 2;
  pointer-events: none;
}
@keyframes wp-pulse-glow {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ===========================================================
   Map overlay controls — follow-cam toggle + step scrubber + timeline
   =========================================================== */
.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
  z-index: 30;
}
.map-controls > * { pointer-events: auto; }

/* 2D/3D toggle — anchored top-left of the map, immediately right of the
   MapLibre NavigationControl stack. Small round floating button styled to
   match the scrubber controls' dark-glass language. */
/* Shared toolbar at top-right of the map, sibling to the zoom-control stack.
   Wraps both 3D and SAT toggles in a semi-opaque box that reads clearly
   over satellite imagery. Centered vertically against the NavigationControl
   on the left (top: 10px + height matches its visual mass). */
.map-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: rgba(13,17,23,0.75);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.map-3d-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(22,27,34,0.92);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}
.map-3d-toggle:hover {
  border-color: var(--accent-warm);
  color: var(--text-0);
}
.map-3d-toggle.is-3d {
  background: rgba(240,136,62,0.18);
  color: var(--accent-warm);
  border-color: rgba(240,136,62,0.55);
}

/* Basemap toggle — stacks below the 3D toggle inside .map-toolbar. */
.map-basemap-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(22,27,34,0.92);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}
.map-basemap-toggle:hover {
  border-color: var(--accent-warm);
  color: var(--text-0);
}

.followcam-toggle {
  background: rgba(22,27,34,0.92);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.followcam-toggle:hover {
  border-color: var(--accent-warm);
  color: var(--text-0);
}
.followcam-toggle.followcam-on {
  background: rgba(240,136,62,0.18);
  color: var(--accent-warm);
  border-color: rgba(240,136,62,0.55);
}
.followcam-toggle .fc-ico { font-size: 13px; line-height: 1; }

/* ----- Step scrubber (Prev / counter / Next) ----- */
.step-scrubber {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22,27,34,0.92);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 6px;
  box-shadow: var(--shadow);
}
.ss-btn {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}
.ss-btn:hover:not(:disabled) {
  color: var(--text-0);
  border-color: var(--accent);
}
.ss-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ss-counter {
  font-size: 12px;
  color: var(--text-2);
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}

/* ----- Unified bottom bar (state pill + clock + clicker + scrubber) ----- */
.tracker-bottom-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}

.bb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bb-meta-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bb-meta-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.time-state-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.time-state-pill[data-state="live"] {
  background: rgba(63,185,80,0.14);
  color: var(--accent-live);
  border-color: rgba(63,185,80,0.45);
  animation: live-pulse 2s ease-in-out infinite;
}
.time-state-pill[data-state="preview"] {
  background: rgba(88,166,255,0.12);
  color: var(--accent-pre);
  border-color: rgba(88,166,255,0.40);
}
.time-state-pill[data-state="replay"] {
  background: rgba(139,148,158,0.14);
  color: var(--text-2);
  border-color: rgba(139,148,158,0.35);
}
.time-state-pill[data-state="peek"] {
  background: rgba(163,113,247,0.14);
  color: var(--accent-media);
  border-color: rgba(163,113,247,0.40);
}
.time-state-pill[data-state="archive"] {
  background: rgba(110,118,129,0.16);
  color: var(--text-1);
  border-color: rgba(110,118,129,0.45);
}

.bb-clock {
  color: var(--text-1);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bb-step-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.bb-step-btn:hover:not(:disabled) {
  color: var(--text-0);
  border-color: var(--accent-warm);
}
.bb-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.bb-step-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-0);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bb-step-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bb-step-dot {
  flex: 0 0 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-nav);
}
.bb-step-dot[data-kind="camp"],
.bb-step-dot[data-kind="planned_stop"] { background: var(--accent-camp); }
.bb-step-dot[data-kind="aid_station"]  { background: var(--accent-aid); }
.bb-step-dot[data-kind="info_point"]   { background: var(--accent-info); }
.bb-step-dot[data-kind="media_point"]  { background: var(--accent-media); }
.bb-step-dot[data-kind="nav"]          { background: var(--accent-nav); }

.bb-scrubber { width: 100%; }
.bb-scrubber .timeline-scrubber {
  background: transparent;
  padding: 0;
  border-top: none;
}
.bb-scrubber .ts-row { gap: 10px; }

.bb-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.4px;
  color: var(--text-3);
  padding: 0 4px;
  text-transform: uppercase;
}

/* ----- Timeline scrubber (legacy free-floating; now hosted in bottom bar) ----- */
.timeline-scrubber[hidden] { display: none; }
.timeline-scrubber {
  background: linear-gradient(180deg, rgba(13,17,23,0.4) 0%, rgba(13,17,23,0.92) 70%);
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
}
.ts-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ts-btn {
  background: rgba(22,27,34,0.92);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ts-btn:hover { color: var(--text-0); border-color: var(--accent); }
.ts-btn.ts-speed { min-width: 44px; justify-content: center; font-variant-numeric: tabular-nums; }
.ts-btn .ts-ico { font-size: 11px; }
.ts-btn.ts-live { color: var(--accent-live); border-color: rgba(63,185,80,0.35); }
.ts-btn.ts-live:hover { background: rgba(63,185,80,0.10); }

.ts-track-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ts-track {
  position: relative;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.ts-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  border-radius: 999px;
  pointer-events: none;
}
.ts-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 18px; height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-warm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: grab;
  z-index: 2;
}
.ts-handle:active { cursor: grabbing; }
.ts-label {
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: 0.3px;
}

/* Tablet/mobile: hide the verbose wall-clock and compress the waypoint label */
@media (max-width: 1023px) {
  .bb-clock { display: none; }
  .bb-step-label { max-width: 110px; }
}

/* Mobile: stack controls more compactly */
@media (max-width: 640px) {
  .map-controls { top: 8px; right: 8px; gap: 6px; }
  .map-toolbar { top: 8px; right: 8px; padding: 6px; gap: 6px; }
  .map-3d-toggle { width: 32px; height: 32px; font-size: 11px; }
  .map-basemap-toggle { width: 32px; height: 32px; font-size: 11px; }
  .followcam-toggle { padding: 6px 10px; font-size: 11.5px; }
  .step-scrubber { padding: 3px 4px; }
  .ss-btn { padding: 4px 8px; font-size: 11px; }
  .timeline-scrubber { padding: 10px 10px 12px; }
  .ts-btn { padding: 5px 8px; font-size: 11.5px; }
  .tracker-bottom-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 8px 10px 10px;
  }
  .bb-step-label { max-width: 90px; font-size: 12px; }
  .bb-step-btn { width: 26px; height: 26px; }
  .bb-endpoints { font-size: 9px; }
}

/* ===========================================================
   Waypoint detail — lightbox modal
   =========================================================== */

/* MapLibre Popup base theme (used by tour-mode.js tour-popup) */
.maplibregl-popup-content {
  background: #161b22 !important;
  color: var(--text-0);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 16px 12px;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.maplibregl-popup-tip {
  border-top-color: #161b22 !important;
  border-bottom-color: #161b22 !important;
}
.maplibregl-popup-close-button {
  color: var(--text-2);
  font-size: 22px;
  padding: 4px 10px;
  right: 2px; top: 2px;
  background: transparent;
}
.maplibregl-popup-close-button:hover {
  color: var(--text-0);
  background: transparent;
}

/* Lightbox root — wraps overlay + modal, full-viewport stacking context */
.wp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.wp-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.wp-lightbox.is-closing {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.wp-lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.78);
  backdrop-filter: blur(4px);
}

.wp-lightbox-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}
.wp-lightbox.is-open .wp-lightbox-modal {
  transform: scale(1);
}

/* Header */
.wp-lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 14px 16px;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.wp-lightbox-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wp-lightbox-kind-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6e7681;
}
.wp-lightbox-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wp-lightbox-mile {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wp-lightbox-close {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 26px;
  line-height: 1;
  padding: 2px 6px;
  flex-shrink: 0;
  border-radius: var(--radius);
  transition: color 0.1s;
}
.wp-lightbox-close:hover { color: var(--text-0); }

/* Scrollable body */
.wp-lightbox-body {
  overflow-y: auto;
  padding: 18px 20px 22px;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.wp-lightbox-body::-webkit-scrollbar { width: 6px; }
.wp-lightbox-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}

/* Main image */
.wp-lightbox-main-img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* Thumbnail row */
.wp-lightbox-thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.wp-lightbox-thumb {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
}
.wp-lightbox-thumb:hover { opacity: 0.9; }
.wp-lightbox-thumb.is-active {
  border-color: var(--accent);
  opacity: 1;
}

/* Text */
.wp-lightbox-text {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #e6edf3;
}
.wp-lightbox-text p { margin-bottom: 10px; }
.wp-lightbox-text p:last-child { margin-bottom: 0; }

/* Video embed (16:9) */
.wp-lightbox-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 14px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.wp-lightbox-video iframe,
.wp-lightbox-video video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* Links */
.wp-lightbox-links {
  margin-top: 14px;
  font-size: 13px;
}
.wp-lightbox-links a {
  color: var(--accent);
  display: block;
  padding: 2px 0;
}

/* ===========================================================
   Landing card extras (status pill row, description, countdown)
   =========================================================== */
.event-card-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.event-card-description {
  color: var(--text-2); font-size: 13.5px; line-height: 1.55;
  margin-top: 2px;
}
.event-card-countdown {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.4px;
  margin-top: 2px;
}
.event-card-cta {
  color: var(--text-2); font-size: 12px; margin-top: 2px;
}
.event-card:hover .event-card-cta { color: var(--accent); }

/* ===========================================================
   Section sub-heading (used under message-board / predictions section titles)
   =========================================================== */
.section-sub {
  color: var(--text-2);
  font-size: 13px;
  margin-top: -6px;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ===========================================================
   Countdown widget (Chunk 5 — upcoming events only)
   =========================================================== */
.panel-countdown { padding-top: 18px; padding-bottom: 18px; }
.countdown-widget {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: 18px 14px;
  background:
    radial-gradient(circle at top, rgba(88,166,255,0.10), transparent 60%),
    var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.countdown-label {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}
.countdown-digits {
  display: flex; gap: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.countdown-cell {
  display: flex; flex-direction: column; align-items: center;
  min-width: 56px;
  padding: 8px 10px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.countdown-num {
  font-size: clamp(22px, 4vw, 30px);
  color: var(--text-0);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(88,166,255,0.25);
}
.countdown-unit {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 2px;
}
.countdown-tagline {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

/* ===========================================================
   Hero countdown — PREVIEW (wallPhase=pre) side-panel hero
   =========================================================== */
.panel-countdown-hero {
  padding: 28px 24px 24px;
  background:
    radial-gradient(ellipse at top, rgba(88,166,255,0.14), transparent 65%),
    var(--bg-0);
  border-bottom: 1px solid var(--border);
}

.countdown-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.countdown-hero-status {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-pre);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}
.countdown-hero-status::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-pre);
  box-shadow: 0 0 8px var(--accent-pre);
  flex: 0 0 auto;
}

.countdown-hero-name {
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--text-0);
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.25;
}

/* Two-row layout: line 1 = months/weeks/days (large); line 2 = hrs/min/sec (smaller) */
.countdown-hero-rows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  margin-top: 4px;
}

.countdown-hero-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  max-width: 460px;
}

/* All cells identical: same size, same backdrop, same number scale.
   Hidden cells (months/weeks when zero) collapse out of the row; the
   adjacent separator hides with them via the sibling-selector rule below. */
.countdown-hero-cell {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-width: 0;
}

.countdown-hero-cell[hidden] {
  display: none;
}

/* Tasteful separators between cells. Comma on line 1 (date-like),
   colon on line 2 (clock-like). Hidden whenever an adjacent cell is. */
.countdown-hero-sep {
  flex: 0 0 auto;
  align-self: center;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  color: var(--text-3);
  line-height: 1;
  padding: 0 2px 12px;
  user-select: none;
}

/* Comma row (months/weeks/days): drop the commas to sit near the bottom
   of the cells, level with the unit labels. Colon row stays centered. */
.countdown-hero-row:first-child .countdown-hero-sep {
  align-self: flex-end;
  padding: 0 2px 14px;
}

.countdown-hero-cell[hidden] + .countdown-hero-sep,
.countdown-hero-sep + .countdown-hero-cell[hidden] {
  display: none;
}

.countdown-hero-num {
  font-size: clamp(34px, 5.5vw, 48px);
  color: var(--text-0);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 14px rgba(88,166,255,0.25);
  font-variant-numeric: tabular-nums;
}

.countdown-hero-unit {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}

.countdown-hero-start {
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.2px;
  margin-top: 2px;
}

/* Legacy selectors kept for any existing refs — now handled by .countdown-hero-rows */
.countdown-hero-digits { display: none; }

/* ===========================================================
   Pill clickability — PREVIEW / ARCHIVE / touring states
   =========================================================== */
.time-state-pill[data-state="preview"]:is([role="button"]),
.time-state-pill[data-state="archive"]:is([role="button"]) {
  cursor: pointer;
  user-select: none;
}
.time-state-pill[data-state="preview"]:is([role="button"]):hover {
  background: rgba(88,166,255,0.22);
  border-color: rgba(88,166,255,0.65);
}
.time-state-pill[data-state="archive"]:is([role="button"]):hover {
  background: rgba(110,118,129,0.28);
  color: var(--text-0);
}
.time-state-pill[data-state="touring"] {
  background: rgba(240,136,62,0.16);
  color: var(--accent-warm);
  border-color: rgba(240,136,62,0.50);
  cursor: pointer;
  animation: none;
}
.time-state-pill[data-state="touring"]:hover {
  background: rgba(240,136,62,0.28);
}

/* ===========================================================
   Tour popup — auto-sizes to fit content (text + gallery + video).
   maxWidth: 'none' is set in JS; CSS caps via max-width/height here so
   the popup grows to fit the waypoint's content but stays sane.
   =========================================================== */
.maplibregl-popup.tour-popup .maplibregl-popup-content {
  max-width: 560px;
  width: max-content;
  /* Reserve space for bottom-bar + HUD + safe areas so popup never clips. */
  max-height: calc(100vh - var(--bottom-bar-h, 110px) - 80px - 40px);
  overflow-y: auto;
  padding: 12px 16px 14px;
  background: rgba(13,17,23,0.97);
  color: var(--text-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.maplibregl-popup.tour-popup .maplibregl-popup-tip {
  border-top-color: rgba(13,17,23,0.97);
  border-bottom-color: rgba(13,17,23,0.97);
}
/* Slim themed scrollbar for long content */
.maplibregl-popup.tour-popup .maplibregl-popup-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.maplibregl-popup.tour-popup .maplibregl-popup-content::-webkit-scrollbar { width: 6px; }
.maplibregl-popup.tour-popup .maplibregl-popup-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
}

.tour-popup-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 6px;
  line-height: 1.3;
}

/* Mini variant used by the auto-tour: small card with a summary + "See more". */
.maplibregl-popup.tour-popup--mini .maplibregl-popup-content {
  max-width: 320px;
  max-height: none;
  padding: 12px 14px 12px;
}
.tour-popup-mini .tour-popup-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  margin: 0 0 10px;
}
.tour-popup-more {
  display: inline-block;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--accent-warm, #f0883e);
  border-radius: 999px;
  color: var(--accent-warm, #f0883e);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.tour-popup-more:hover {
  background: rgba(240, 136, 62, 0.12);
}
.tour-popup-body {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.55;
}
.tour-popup-body p + p { margin-top: 8px; }

.tour-popup-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}
.tour-popup-gallery img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.tour-popup-video {
  margin-top: 10px;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
}
.tour-popup-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===========================================================
   Record mode — body class applied by TourMode.start({ mode: 'record' }).
   Hides all interactive chrome so the map canvas is clean for capture.
   =========================================================== */
.is-recording .event-panel,
.is-recording .tracker-bottom-bar,
.is-recording .tour-hud,
.is-recording .map-3d-toggle,
.is-recording .map-basemap-toggle {
  display: none !important;
}

/* ===========================================================
   Tour HUD — thin strip above the bottom-bar during guided tour
   =========================================================== */
.tour-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--bottom-bar-h, 110px) + 10px);
  z-index: 29;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  /* Fade in/out; respect reduced-motion */
  transition: opacity 0.25s ease;
  opacity: 1;
}
.tour-hud[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .tour-hud { transition: none; }
}

.tour-hud-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.tour-hud-now {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tour-hud-now-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-warm);
  white-space: nowrap;
}

.tour-hud-current {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.tour-hud-bar-track {
  flex: 1;
  min-width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.tour-hud-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-warm);
  border-radius: 999px;
}

/* Moving state: flowing shimmer instead of fill bar */
.tour-hud[data-moving] .tour-hud-bar-fill {
  width: 100% !important;
  transition: none !important;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-warm) 40%,
    transparent 80%
  );
  background-size: 200% 100%;
  animation: tour-hud-shimmer 1.2s linear infinite;
}

@keyframes tour-hud-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-hud[data-moving] .tour-hud-bar-fill { animation: none; }
}

.tour-hud-next-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tour-hud-next-arrow {
  font-size: 8px;
  color: var(--text-3);
}

.tour-hud-next-word {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.tour-hud-next {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.tour-hud-count-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour-hud-count {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tour-hud-skip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  background: rgba(240,136,62,0.14);
  color: var(--accent-warm);
  border: 1px solid rgba(240,136,62,0.45);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  white-space: nowrap;
}
.tour-hud-skip:hover {
  background: rgba(240,136,62,0.28);
  border-color: rgba(240,136,62,0.7);
}
.tour-hud-skip:active {
  transform: scale(0.96);
}

/* Mobile: stack current + progress above next label */
@media (max-width: 640px) {
  .tour-hud-body {
    flex-wrap: wrap;
    gap: 6px;
  }
  .tour-hud-next-group { order: 3; }
  .tour-hud-current { max-width: 120px; }
  .tour-hud-next    { max-width: 90px; }
}

/* ===========================================================
   Inline comments on journal entries (Chunk 5 mockup)
   =========================================================== */
.comments-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.comments-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.comments-toggle:hover { color: var(--text-0); border-color: var(--border-strong); }
.comments-toggle-icon { line-height: 1; }
.comments-toggle-count { font-weight: 700; color: var(--text-0); }

.comments-panel { margin-top: 12px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment-row {
  display: flex; gap: 10px;
}
.comment-avatar {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  color: var(--text-1);
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-3);
}
.comment-author { color: var(--text-1); font-weight: 600; }
.comment-time   { color: var(--text-3); }
.comment-text   {
  color: var(--text-1); font-size: 13.5px; line-height: 1.5;
  margin-top: 2px;
  word-wrap: break-word;
}

/* ===========================================================
   Disabled / "coming soon" treatment
   =========================================================== */
.coming-soon {
  position: relative;
  border: 1px dashed rgba(240,136,62,0.35);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
  background: rgba(240,136,62,0.04);
}
.coming-soon-banner {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-warm);
  font-weight: 700;
  margin-bottom: 8px;
}
.btn-disabled {
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: not-allowed;
  filter: grayscale(40%);
  opacity: 0.7;
}
.btn-disabled:hover { text-decoration: none; }

.composer-row { margin-bottom: 6px; }
.comment-composer input,
.comment-composer textarea,
.message-composer input,
.message-composer textarea {
  width: 100%;
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
  margin-bottom: 6px;
  resize: vertical;
}
.composer-actions { display: flex; justify-content: flex-end; }

/* ===========================================================
   Team message board (audience → team)
   =========================================================== */
.message-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.message-row {
  display: flex; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.message-body { flex: 1; min-width: 0; }
.badge-team-replied {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(63,185,80,0.12);
  color: var(--accent-live);
  border: 1px solid rgba(63,185,80,0.35);
  font-weight: 700;
  margin-left: 4px;
}

/* ===========================================================
   Predictions / fantasy mockup
   =========================================================== */
.predictions-signin { margin: 4px 0 14px; }
.predictions { display: flex; flex-direction: column; gap: 12px; }
.prediction-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.prediction-title {
  font-size: 14px;
  color: var(--text-0);
  margin-bottom: 10px;
  font-weight: 600;
}
.prediction-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.prediction-bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.prediction-bar-label { color: var(--text-2); }
.prediction-bar-track {
  background: var(--bg-2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.prediction-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-media));
  height: 100%;
}
.prediction-bar-pct {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}
.prediction-input-row {
  display: flex; gap: 8px; align-items: center; margin-top: 4px;
}
.prediction-input-row input {
  flex: 1;
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
}
.prediction-pick-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px;
}
.prediction-pick {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
}
.prediction-meta {
  font-size: 12px;
  color: var(--text-2);
}
.prediction-meta strong { color: var(--text-1); }

/* ===========================================================
   Elevation profile graph
   =========================================================== */
.panel-elevation { padding-bottom: 4px; }

.elev-graph-svg {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}

/* Clickable waypoint ticks on the elevation chart. The hit area extends
   below the visible tick for forgiving taps; hover/focus grows the tick
   and lights it up. */
.elev-tick-group { cursor: pointer; outline: none; }
.elev-tick { transition: height 120ms ease-out, opacity 120ms ease-out; }
.elev-tick-group:hover .elev-tick,
.elev-tick-group:focus-visible .elev-tick {
  height: 14px;
  opacity: 1;
  filter: drop-shadow(0 0 4px currentColor);
}
.elev-tick-group:focus-visible .elev-tick-hit {
  stroke: rgba(255,255,255,0.5);
  stroke-width: 1;
}

.elev-readout-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.elev-readout-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .elev-graph-svg { height: 100px; }
}


/* Waypoint pins are now rendered as GL layers (circle + symbol) in
   event-map.js — see waypoints-bg / waypoints-icon. Styling lives in the
   layer paint properties. CSS for HTML markers was removed when pins
   started visibly lagging during 3D-terrain tour flights. */

/* ===========================================================
   Tour canvas overlay modules (stats HUD + elevation overlay).
   Both are position:absolute children of .event-map-wrap.
   z-index 30 = above map, below tour-hud (z-index 29 is the hud,
   above the bottom-bar at 30; we use 28 to stay below both).
   =========================================================== */
.tour-overlay-canvas {
  position: absolute;
  pointer-events: none;
  z-index: 28;
}

/* Stats HUD positions (aspect-dependent) */
.tour-overlay-canvas.pos-bottom-left {
  left: 16px;
  bottom: calc(var(--bottom-bar-h, 110px) + 16px);
}
.tour-overlay-canvas.pos-top-right {
  right: 16px;
  top: 16px;
}
.tour-overlay-canvas.pos-top-center {
  left: 50%;
  transform: translateX(-50%);
  top: 16px;
}

/* Elevation ribbon positions (full-width) */
.tour-overlay-canvas.pos-bottom-ribbon {
  left: 0;
  right: 0;
  bottom: var(--bottom-bar-h, 110px);
  width: 100% !important;
}
.tour-overlay-canvas.pos-top-ribbon {
  left: 0;
  right: 0;
  top: 0;
  width: 100% !important;
}

/* ===========================================================
   Story Panel — right-side storymap drawer (desktop) /
   drag-up bottom sheet (mobile ≤768px).
   =========================================================== */

/* ---- Desktop: right-edge slide-in drawer ---- */
.story-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: var(--bottom-bar-h, 110px);
  width: 360px;
  z-index: 50;
  background: rgba(13,17,23,0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 280ms ease, opacity 280ms ease;
  opacity: 0;
  pointer-events: none;
}
.story-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.story-panel-backdrop {
  display: none;
}

/* ---- Panel header ---- */
.story-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.story-panel-header h2 {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 700;
  margin: 0;
}
.story-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.story-panel-close:hover {
  background: var(--bg-2);
  color: var(--text-0);
}

/* ---- Scrollable list ---- */
.story-panel-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.story-panel-list::-webkit-scrollbar { width: 4px; }
.story-panel-list::-webkit-scrollbar-track { background: transparent; }
.story-panel-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
}

/* ---- Story entry card (timeline rail + content) ----
   Padding lives on .story-entry-content (not .story-entry) so the rail
   spans the full entry height edge-to-edge — that lets each entry's
   connecting line touch the next entry's, producing one continuous line. */
.story-entry {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.15s;
  outline: none;
  position: relative;
}
.story-entry:hover,
.story-entry:focus-visible {
  background: rgba(255,255,255,0.04);
}

/* Rail: mile label sits LEFT of the track so it never overlaps the line. */
.story-entry-rail {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.story-entry-mile {
  flex: 0 0 auto;
  font-size: 9px;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 16px;            /* aligns mile label vertically with the dot */
  min-width: 32px;
  text-align: right;
}

/* Track: 14px-wide column holding the continuous line + dot. */
.story-entry-track {
  flex: 0 0 14px;
  align-self: stretch;
  position: relative;
}
.story-entry-track::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.12);
  transform: translateX(-50%);
  z-index: 0;
}
/* Trim line above the first dot and below the last dot. */
.story-entry:first-child .story-entry-track::before { top: 18px; }
.story-entry:last-child  .story-entry-track::before { bottom: auto; height: 18px; }

.story-entry-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid rgba(255,255,255,0.25);
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translate(-50%, 0);
  z-index: 1;
  transition: background 200ms ease, border-color 200ms ease, width 200ms ease, height 200ms ease;
}

/* Past: filled green */
.story-entry.is-past .story-entry-dot {
  background: #3fb950;
  border-color: #3fb950;
}
.story-entry.is-past .story-entry-mile {
  color: rgba(63,185,80,0.85);
}

/* Current: violet filled + pulsing ring */
.story-entry.is-current .story-entry-dot {
  width: 18px;
  height: 18px;
  background: rgba(187,128,255,1);
  border-color: rgba(187,128,255,1);
  box-shadow: 0 0 0 4px rgba(187,128,255,0.18);
}
.story-entry.is-current .story-entry-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(187,128,255,0.7);
  animation: story-dot-pulse 1.8s ease-in-out infinite;
}
.story-entry.is-current .story-entry-mile {
  color: rgba(187,128,255,1);
}
@keyframes story-dot-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.8; }
  50%      { transform: scale(1.6); opacity: 0;   }
}

/* Content column owns the vertical padding so the rail/line stays
   edge-to-edge across entries. */
.story-entry-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 0 18px;
}

.story-entry-header {
  display: block;
  margin-bottom: 10px;
}
.story-entry-stop {
  display: block;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 2px;
}
.story-entry-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.3;
  margin: 0;
}

/* Status badge below the title — hidden by default; shown by state class.
   Pre-event there's no past/current → no badge renders, keeping the panel
   clean. */
.story-entry-status {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  min-height: 0;
}
.story-status { display: none; }
.story-entry.is-past .story-status-past {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3fb950;
}
.story-entry.is-current .story-status-current {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(212,184,255,1);
}

.story-entry-body {
  color: var(--text-1);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 10px;
}
.story-entry-body p {
  margin: 0 0 8px;
}
.story-entry-body p:last-child {
  margin-bottom: 0;
}

.story-entry-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.story-entry-gallery img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

.story-entry-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin-bottom: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}
.story-entry-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Live-state modifiers ----
   Past entries dim only the content column so the rail's green dot stays
   readable. Current entry gets a soft violet background tint via the rail
   (left border accent is provided by the rail itself). */
.story-entry.is-past .story-entry-content {
  opacity: 0.55;
}
.story-entry.is-current {
  background: rgba(187,128,255,0.05);
}

/* ---- STORY pill in the bottom bar ---- */
.bb-pill-story {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(187,128,255,0.14);
  color: #d4b8ff;
  border: 1px solid rgba(187,128,255,0.45);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.bb-pill-story:hover {
  background: rgba(187,128,255,0.26);
  border-color: rgba(187,128,255,0.70);
}
.bb-pill-story.is-active {
  background: rgba(187,128,255,0.30);
  border-color: rgba(187,128,255,0.80);
  color: #e8d5ff;
}

/* ---- Continuous pulse marker (story panel hover) ---- */
.waypoint-pulse-continuous {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(187,128,255,0.18);
  border: 2px solid rgba(187,128,255,0.85);
  box-shadow: 0 0 18px rgba(187,128,255,0.7);
  animation: wp-pulse-continuous 1.1s ease-out infinite;
  pointer-events: none;
}
@keyframes wp-pulse-continuous {
  0%   { transform: scale(0.7); opacity: 1; }
  80%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---- Desktop (≥1024px): panel is the 4th grid column inside .event-shell.
   No transform; width animates via the parent's grid-template-columns
   transition. Children clip while the column is collapsing. ---- */
@media (min-width: 1024px) {
  .story-panel {
    position: static;
    width: 100%;
    height: 100%;
    top: auto;
    right: auto;
    bottom: auto;
    transform: none;
    transition: opacity 200ms ease;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: auto;
  }
  .story-panel.is-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  /* Backdrop is mobile-only — keep hidden on desktop. */
  .story-panel-backdrop { display: none !important; }
}

/* ---- Mobile: bottom sheet (≤768px) ---- */
@media (max-width: 768px) {
  .story-panel {
    width: auto;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 300ms ease, opacity 300ms ease;
    opacity: 0;
  }
  .story-panel.is-open {
    transform: translateY(0);
    opacity: 1;
  }
  .story-panel-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }
  .story-panel-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  /* Drag handle visual cue */
  .story-panel-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
  .story-panel-header {
    position: relative;
    padding-top: 20px;
  }
}

/* ===========================================================
   Brand CSS variables — defaults match historyexp palette.
   Overridden per-brand by event-page.js reading window.BRAND.
   =========================================================== */
:root {
  --brand-accent: #f0883e;
  --brand-bg: #0d1117;
}

/* ===========================================================
   Right-sidebar layout (per-event override via events.layout)
   Panel renders on the right; map fills the left. Only applies
   on desktop — mobile collapses identically to left-panel.
   All rules scoped under body[data-layout="right-sidebar"] so
   left-panel (Frémont) is completely unaffected.
   =========================================================== */
@media (min-width: 1024px) {
  body[data-layout="right-sidebar"] .event-shell {
    grid-template-columns: 1fr 6px minmax(360px, 38%);
  }
  body[data-layout="right-sidebar"] .event-panel {
    order: 3;
    border-left: 1px solid var(--border);
    border-right: none;
  }
  body[data-layout="right-sidebar"] .panel-resizer { order: 2; }
  body[data-layout="right-sidebar"] .event-map-wrap { order: 1; }
}

@media (max-width: 768px) {
  /* Both layouts collapse to map-on-top, panel-bottom on mobile */
  body[data-layout="right-sidebar"] .event-shell,
  body[data-layout="left-panel"] .event-shell {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Schedule cards module
   =========================================================== */
.schedule-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--day-accent, var(--brand-accent, var(--accent-warm)));
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Per-day accent colors sampled from the Cincy→CBUS infographic.
   Frémont (no events.days) never renders schedule cards so this is inert there. */
.schedule-card[data-day-index="1"] { --day-accent: #475233; }
.schedule-card[data-day-index="2"] { --day-accent: #404a4b; }
.schedule-card[data-day-index="3"] { --day-accent: #6f765d; }

.schedule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-card-day-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--day-accent, var(--brand-accent, var(--accent-warm)));
}

.schedule-card-date {
  font-size: 12px;
  color: var(--text-2);
}

.schedule-card-route {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-0);
}

.schedule-card-arrow {
  color: var(--text-3);
  margin: 0 4px;
}

.schedule-card-stats {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
}

.schedule-card-stats span::before {
  content: '';
}

.schedule-card-subtitle {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

.schedule-card-overnight {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s ease;
}

.schedule-card-overnight:hover {
  color: var(--text-0);
  text-decoration: none;
}

.schedule-card-overnight-icon {
  flex-shrink: 0;
}

.schedule-card-overnight-label {
  line-height: 1.3;
}
