/* ══════════════════════════════════════════════════════════════════════════
   Journey page — the trip replayed on the 3D globe (pages/journey.py).

   Everything is scoped under .replay-page (Dash loads this file on every
   page). Colors come from the --hero-* tokens emitted by theme.py, so the
   replay shares the homepage's holographic look whatever skin is active.

   Desktop (≥992px): the globe fills one screen with glass panels floating
   over it. Narrower screens stack globe, controls and panels instead.
   ══════════════════════════════════════════════════════════════════════════ */

.replay-page {
  --replay-top-offset: 2.6rem;             /* sticky navbar height */
  --replay-gutter: 1.25rem;
  position: relative;
  margin-top: -0.5rem;                     /* sit flush under the navbar */
  color: var(--hero-text);
  background:
    radial-gradient(ellipse 45% 55% at 50% 48%,
      rgba(var(--hero-holo-rgb), 0.16), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 33% 82%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 88% 70%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 56% 8%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 6% 62%, rgba(255, 255, 255, 0.45), transparent),
    rgb(var(--hero-shade-rgb));
}

.replay-stage {
  position: relative;
  height: calc(100svh - var(--replay-top-offset));
  min-height: 560px;
  overflow: hidden;
}

.replay-globe {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.replay-page.is-globe-ready .replay-globe { opacity: 1; }

/* ── Glass panels ───────────────────────────────────────────────────────── */

.replay-panel {
  position: absolute;
  z-index: 2;
  padding: 16px 18px;
  background: var(--hero-panel-bg);
  border: 1px solid rgba(var(--hero-holo-rgb), 0.5);
  border-radius: 12px;
  box-shadow:
    0 0 22px rgba(var(--hero-holo-rgb), 0.22),
    inset 0 0 24px rgba(var(--hero-holo-rgb), 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.replay-now {
  top: var(--replay-gutter);
  left: var(--replay-gutter);
  width: min(340px, 30%);
}

.replay-totals {
  top: var(--replay-gutter);
  right: var(--replay-gutter);
  width: min(300px, 26%);
}

.replay-kicker,
.replay-stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hero-text-dim);
}

.replay-city {
  margin: 4px 0 2px;
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.15;
  color: var(--hero-text);
  text-shadow: 0 0 14px rgba(var(--hero-holo-rgb), 0.55);
}

.replay-place { color: var(--hero-text-dim); }

.replay-dates {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--hero-cyan);
  font-variant-numeric: tabular-nums;
}

.replay-arrival {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--hero-holo-rgb), 0.2);
  font-size: 0.9rem;
}

.replay-mode-icon,
.replay-button-icon {
  flex: none;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.replay-mode-icon {
  width: 22px;
  height: 22px;
  color: var(--hero-holo);
  filter: drop-shadow(0 0 4px currentColor);
}

.replay-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

.replay-stat-value {
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(var(--hero-holo-rgb), 0.45);
}

.replay-post {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--hero-holo-rgb), 0.2);
  font-size: 0.88rem;
}

.replay-post a { color: var(--hero-cyan); }

/* ── Controls ───────────────────────────────────────────────────────────── */

.replay-controls {
  left: var(--replay-gutter);
  right: var(--replay-gutter);
  bottom: var(--replay-gutter);
  max-width: 1040px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
}

.replay-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(var(--hero-holo-rgb), 0.5);
  border-radius: 999px;
  background: rgba(var(--hero-holo-rgb), 0.08);
  color: var(--hero-text);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.replay-button:hover,
.replay-button:focus-visible {
  border-color: var(--hero-cyan);
  background: rgba(var(--hero-holo-rgb), 0.18);
}

.replay-button:focus-visible,
.replay-scrub-input:focus-visible {
  outline: 2px solid var(--hero-cyan);
  outline-offset: 2px;
}

.replay-play {
  min-width: 104px;
  justify-content: center;
  font-weight: 600;
  border-color: var(--hero-cyan);
  box-shadow: 0 0 14px rgba(var(--hero-holo-rgb), 0.35);
}

.replay-button-icon { width: 12px; height: 12px; color: var(--hero-cyan); }
.replay-icon-pause { display: none; }
.replay-page.is-playing .replay-icon-play { display: none; }
.replay-page.is-playing .replay-icon-pause { display: inline-block; }

.replay-speed { min-width: 52px; justify-content: center; font-variant-numeric: tabular-nums; }

.replay-follow[aria-pressed="false"] {
  color: var(--hero-text-dim);
  background: transparent;
  border-color: rgba(var(--hero-holo-rgb), 0.25);
}

.replay-scrub {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding-bottom: 14px;
}

.replay-scrub-input {
  display: block;
  width: 100%;
  accent-color: var(--hero-holo);
  cursor: pointer;
}

.replay-years {
  position: absolute;
  inset: auto 0 0;
  height: 12px;
  pointer-events: none;
}

.replay-years span {
  position: absolute;
  top: 0;
  font-size: 0.66rem;
  line-height: 1;
  color: var(--hero-text-dim);
}

/* ── Globe markers (positioned by Globe.gl) ─────────────────────────────── */

.replay-home {
  font-size: 18px;
  line-height: 1;
  color: var(--hero-gold);
  text-shadow: 0 0 8px rgba(var(--hero-gold-rgb), 0.9);
  cursor: default;
}

/* `top` rather than `transform`: Globe.gl owns the transform. */
.replay-label {
  position: relative;
  top: -24px;
  padding: 2px 9px;
  border: 1px solid rgba(var(--hero-holo-rgb), 0.6);
  border-radius: 999px;
  background: var(--hero-panel-bg);
  color: var(--hero-text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* Travel mode emoji: rides the leg as it draws, then waits at the stop.
   Never animate its transform, scale or translate: Globe.gl positions it
   with a CSS transform, so those would drag it across the screen. */
.replay-mode-badge {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(var(--hero-holo-rgb), 0.85));
  pointer-events: none;
}

/* ── No WebGL ───────────────────────────────────────────────────────────── */

.replay-fallback {
  display: none;
  position: absolute;
  inset: 40% 15% auto;
  z-index: 1;
  text-align: center;
  color: var(--hero-text-dim);
}

.replay-fallback a { color: var(--hero-cyan); }
.replay-page.is-globe-fallback .replay-fallback { display: block; }

/* ── Tablets and phones: stack globe, controls and panels ───────────────── */

@media (max-width: 991.98px) {
  .replay-stage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "globe globe"
      "controls controls"
      "now totals";
    gap: 12px;
    height: auto;
    min-height: 0;
    padding: 0 16px 20px;
  }

  .replay-globe {
    position: relative;
    grid-area: globe;
    height: 56svh;
    margin-inline: -16px;
  }

  .replay-panel {
    position: static;
    width: auto;
    max-width: none;
  }

  .replay-now { grid-area: now; }
  .replay-totals { grid-area: totals; }

  .replay-controls {
    grid-area: controls;
    flex-wrap: wrap;
    border-radius: 16px;
  }

  .replay-scrub { flex-basis: 100%; order: 5; }
  .replay-fallback { grid-area: globe; position: static; align-self: center; }
}

@media (max-width: 575.98px) {
  .replay-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "globe" "controls" "now" "totals";
  }

  .replay-city { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .replay-globe,
  .replay-button { transition: none; }
}
