/* ═══════════════════════════════════════════════════════
   ASTRONATIONS.WORLD — journey.css
   Scroll-driven postcard route (index.html). Loads after base.css
   ═══════════════════════════════════════════════════════ */

:root { --card-w: min(30vw, calc(62svh * 0.8), 440px); }

html { scroll-snap-type: y proximity; }

/* ── JOURNEY ─────────────────────────────────────────── */
.journey {
  position: relative;
  height: calc(var(--span, 8) * 100vh);
  height: calc(var(--span, 8) * 100svh);
}

.snap {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  scroll-snap-align: start;
  pointer-events: none;
}

.stage {
  --bg: #070914;
  --glow: #3b4a8a;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 50% 58%, color-mix(in srgb, var(--glow) 26%, transparent), transparent 72%),
    var(--bg);
}

.stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Dotted globe between the intro and the first postcard */
.globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.globe-caption {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 5svh, 48px);
  transform: translateX(-50%);
  width: min(90vw, 520px);
  text-align: center;
  font-size: 15px;
  color: var(--text-dim);
  opacity: 0;
}

/* Giant country names behind the card */
.names { position: absolute; inset: 0; pointer-events: none; }

.name {
  position: absolute;
  left: 50%;
  top: 25%;
  transform: translate(-50%, -50%);
  font: 900 clamp(110px, min(16vw, 28svh), 300px) / 0.8 var(--display);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  will-change: translate, opacity;
}

/* Intro */
.intro {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1080px);
  text-align: center;
  will-change: translate, opacity;
}
.intro h1 {
  font: 900 clamp(54px, 9vw, 146px) / 0.86 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}
.intro p {
  max-width: 44ch;
  margin: 26px auto 0;
  font-size: clamp(16px, 1.35vw, 19px);
  color: var(--text-dim);
  text-wrap: pretty;
}

/* ── POSTCARD DECK ───────────────────────────────────── */
.deck {
  position: absolute;
  left: 50%;
  top: 53%;
  width: var(--card-w);
  aspect-ratio: 100 / 124;
  transform: translate(-50%, -50%);
}

/* ── CHROME: rail, info, hud ─────────────────────────── */
.chrome { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.chrome a, .chrome button { pointer-events: auto; }

/* Route rail */
.rail {
  position: absolute;
  left: var(--edge);
  top: 50%;
  transform: translateY(-50%);
}
.rail ol { position: relative; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rail ol::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: linear-gradient(var(--text-faint) 55%, transparent 0) 0 0 / 1px 7px;
}

.rail button {
  display: grid;
  grid-template-columns: 11px auto;
  column-gap: 14px;
  align-items: center;
  padding: 6px 0;
  text-align: left;
}
.rail-dot {
  grid-row: span 2;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--text-faint);
  background: var(--bg);
  transition: background .3s, border-color .3s;
}
.rail-country { font-weight: 600; font-size: 15px; line-height: 1.2; color: var(--text-dim); transition: color .3s; }
.rail-city { grid-column: 2; font-size: 12.5px; line-height: 1.3; color: var(--text-faint); }
.rail li.is-visited .rail-dot { background: var(--text-dim); border-color: var(--text-dim); }
.rail li.is-current .rail-country,
.rail button:hover .rail-country { color: var(--text); }

.rail-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--glow) 30%, transparent), 0 0 18px var(--glow);
  will-change: transform;
}

.rail-more {
  margin-top: 12px;
  padding-left: 25px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* Country info */
.info {
  position: absolute;
  right: var(--edge);
  top: 56%;
  width: min(330px, 25vw);
}
.stop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  transform: translateY(-50%);
  opacity: 0;
  will-change: translate, opacity;
}

.stop-no { font-size: 13px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.stop-place { margin: 6px 0 14px; font: 600 30px / 1.1 var(--sans); letter-spacing: -.01em; }
.stop-line { font-size: 17px; line-height: 1.5; color: var(--text-dim); text-wrap: pretty; }

.stop-links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 22px; font-size: 15px; }
.stop-links a,
.stop-links button {
  color: var(--text-dim);
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 4px;
  transition: color .2s;
}
.stop-links a:hover,
.stop-links button:hover { color: var(--text); }

/* Flight readout */
.hud {
  position: absolute;
  left: var(--edge);
  bottom: clamp(18px, 4svh, 40px);
  display: grid;
  gap: 2px;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.hud span + span { color: var(--text-faint); }

/* ── NEXT STOP ───────────────────────────────────────── */
.next {
  position: relative;
  min-height: 100svh;
  padding: 18svh var(--edge) 12svh;
  text-align: center;
  scroll-snap-align: start;
  background: linear-gradient(var(--end-bg, #151a30), var(--space) 75%);
}

.spread {
  display: flex;
  justify-content: center;
  margin-bottom: 72px;
  padding: 0 4vw;
}
.spread button {
  width: clamp(76px, 10.5vw, 150px);
  margin: 0 -1vw;
  padding: clamp(4px, .55vw, 8px);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 22px 40px -18px rgba(0, 0, 0, .8);
  rotate: var(--r, 0deg);
  transition: translate .3s cubic-bezier(.2, .7, .2, 1), rotate .3s;
}
.spread button:hover { translate: 0 -12px; rotate: 0deg; }
.spread img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

.next h2 {
  font: 900 clamp(56px, 10vw, 160px) / 0.86 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}
.next p {
  max-width: 46ch;
  margin: 24px auto 0;
  font-size: 18px;
  color: var(--text-dim);
  text-wrap: pretty;
}
.next-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

/* ── MOBILE ──────────────────────────────────────────── */
@media (max-width: 820px) {
  :root { --card-w: min(78vw, calc(50svh * 0.8)); }

  .name { top: 20%; font-size: 23vw; }
  .intro { top: 40%; }
  .intro h1 { font-size: 15vw; }

  .deck { top: 49%; }

  .rail { left: 50%; top: 64px; transform: translateX(-50%); }
  .rail ol { flex-direction: row; gap: 14px; }
  .rail ol::before { left: 14px; right: 14px; top: 50%; bottom: auto; width: auto; height: 1px; background: linear-gradient(90deg, var(--text-faint) 55%, transparent 0) 0 0 / 7px 1px; }
  .rail button { display: block; padding: 8px; }
  .rail-country, .rail-city, .rail-more {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .rail-dot { display: block; }

  .info { left: 20px; right: 20px; top: auto; bottom: 22px; width: auto; }
  .stop { top: auto; bottom: 0; transform: none; text-align: center; }
  .stop-no, .stop-line { display: none; }
  .stop-place { margin: 0; font-size: 22px; }
  .stop-links { justify-content: center; margin-top: 12px; }

  .hud { display: none; }

  .spread button { margin: 0 -3vw; }
}

@media (max-height: 560px) and (min-width: 821px) {
  .stop-line { display: none; }
}

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