/* ─────────────────────────────────────────────────────────────────────────
   NIGHTCURRENT LINE — pixel train experience
   Procedural pixel-art rendered to canvas, editorial typography overlaid.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --ink:        #07080d;
  --ink-deep:   #04050a;
  --char:       #14151f;
  --steel:      #5a5b6e;
  --bone:       #ece7d5;
  --bone-dim:   #aea995;
  --bone-low:   #74705e;
  --amber:      #f4b454;
  --amber-glow: #ffd087;
  --rule:       rgba(236,231,213,.14);
  --rule-soft:  rgba(236,231,213,.07);

  --serif: "Spectral", "Source Serif Pro", Georgia, serif;
  --sans:  "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pixel: "Silkscreen", "VT323", ui-monospace, monospace;
}

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

html, body {
  background: var(--ink-deep);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ─── Stage ───────────────────────────────────────────────────────────── */

.stage {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, transparent 35%, rgba(0,0,0,.55) 100%),
    var(--ink-deep);
}

/* ─── Top concourse rail ──────────────────────────────────────────────── */

.rail {
  position: relative; z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: linear-gradient(180deg, rgba(7,8,13,.92), rgba(7,8,13,.6) 70%, transparent);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.rail-id { display: flex; align-items: center; gap: 12px; }
.rail-id .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
  animation: pulse 2.6s ease-in-out infinite;
}
.rail-id .glyph { color: var(--bone); font-weight: 500; }
.rail-id .sep { color: var(--steel); }
.rail-title {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(15px, 1.3vw, 19px);
  letter-spacing: -0.005em; color: var(--bone);
  text-transform: none; line-height: 1; justify-self: center;
}
.rail-title .num { font-family: var(--mono); font-style: normal; font-weight: 500; color: var(--amber); margin-right: 8px; font-size: 0.7em; letter-spacing: .14em; text-transform: uppercase; }
.rail-clock { justify-self: end; }
.rail-clock b { color: var(--bone); font-weight: 500; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

@media (max-width: 760px) {
  .rail { grid-template-columns: auto auto; gap: 12px; padding: 10px 14px; }
  .rail-title { display: none; }
}

/* ─── Canvas viewport (the world) ─────────────────────────────────────── */

.viewport {
  position: relative;
  overflow: hidden;
  background: #000;
}
canvas.world {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Letterbox overlay: dust & vignette */
.viewport::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 50%, transparent 35%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
  mix-blend-mode: normal;
}

/* Caption: editorial overlay on the scene */
.caption {
  position: absolute; left: clamp(20px, 4vw, 56px); top: clamp(20px, 5vh, 60px);
  z-index: 5;
  max-width: 460px;
  pointer-events: none;
  transition: opacity .5s ease, transform .5s ease;
}
.caption.hidden { opacity: 0; transform: translateY(-8px); }
.caption .platform {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber);
  margin-bottom: 14px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.caption .platform .led {
  width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
  animation: pulse 1.6s ease-in-out infinite;
}
.caption .dest {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(40px, 6vw, 84px);
  line-height: 0.95; letter-spacing: -0.02em;
  color: var(--bone);
  text-shadow: 0 2px 12px rgba(0,0,0,.65), 0 0 40px rgba(0,0,0,.4);
}
.caption .dest .it { font-style: italic; color: var(--bone-dim); }
.caption .line {
  font-family: var(--sans);
  font-size: clamp(13px, 1.1vw, 15px);
  color: var(--bone-dim);
  margin-top: 14px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  max-width: 42ch;
  line-height: 1.55;
}
.caption .meta {
  margin-top: 18px;
  display: flex; gap: 18px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bone-low);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.caption .meta b { color: var(--bone); font-weight: 500; }

/* Disembark CTA — right-side platform sign */
.disembark {
  position: absolute; right: clamp(20px, 4vw, 56px); bottom: clamp(80px, 14vh, 130px);
  z-index: 5;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  pointer-events: auto;
  transition: opacity .5s ease, transform .5s ease;
}
.disembark.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }
.disembark .arrival {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--bone-dim);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.disembark .btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: rgba(7,8,13,.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--amber);
  color: var(--amber);
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  transition: background .25s, color .25s, transform .25s;
}
.disembark .btn:hover, .disembark .btn:focus-visible {
  background: var(--amber); color: var(--ink); outline: none;
  transform: translateX(-4px);
}
.disembark .btn .ar { font-size: 14px; }
.disembark .url {
  font-family: var(--mono); font-size: 10.5px; color: var(--bone-low);
  letter-spacing: .12em;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Travel state HUD — shows during transit */
.travel-hud {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}
.travel-hud.active { opacity: 1; }
.travel-hud .label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--amber);
  text-shadow: 0 0 16px rgba(244,180,84,.7), 0 2px 6px rgba(0,0,0,.7);
}
.travel-hud .arrow {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 10px;
  font-family: var(--mono); font-size: 18px; color: var(--bone);
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}
.travel-hud .arrow span { opacity: .25; animation: marchin .8s linear infinite; }
.travel-hud .arrow span:nth-child(2) { animation-delay: .1s; }
.travel-hud .arrow span:nth-child(3) { animation-delay: .2s; }
.travel-hud .arrow span:nth-child(4) { animation-delay: .3s; }
.travel-hud .arrow span:nth-child(5) { animation-delay: .4s; }
@keyframes marchin {
  0%, 100% { opacity: .2; }
  50%      { opacity: 1; }
}

/* ─── Bottom: line map (transit diagram) ──────────────────────────────── */

.linemap {
  position: relative; z-index: 20;
  padding: 16px clamp(16px, 3vw, 36px) 18px;
  background: linear-gradient(0deg, rgba(7,8,13,.96), rgba(7,8,13,.7) 70%, transparent);
}
.linemap .row {
  display: flex; align-items: center;
  gap: 0;
  position: relative;
  max-width: 1200px; margin: 0 auto;
}
.linemap .track {
  position: absolute; left: 24px; right: 24px; top: 50%;
  height: 1px; background: linear-gradient(90deg, var(--rule), var(--steel), var(--rule));
  transform: translateY(-50%);
  z-index: 0;
}
.linemap .stop {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 12px 4px;
  cursor: pointer;
  color: var(--bone-low);
  transition: color .25s;
}
.linemap .stop:hover, .linemap .stop:focus-visible {
  color: var(--bone); outline: none;
}
.linemap .stop .marker {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); border: 1.5px solid var(--steel);
  box-shadow: 0 0 0 3px var(--ink);
  transition: all .25s;
}
.linemap .stop:hover .marker { border-color: var(--bone); }
.linemap .stop.active { color: var(--amber); }
.linemap .stop.active .marker {
  background: var(--amber); border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--ink), 0 0 10px var(--amber-glow);
}
.linemap .stop .pid {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase;
}
.linemap .stop .nm {
  font-family: var(--serif); font-style: italic; font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .linemap .stop .nm { display: none; }
  .linemap { padding: 10px 14px 14px; }
}

/* ─── Side controls (prev/next) ───────────────────────────────────────── */

.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(7,8,13,.55);
  backdrop-filter: blur(6px);
  border: 1px solid var(--rule);
  color: var(--bone-dim);
  font-family: var(--mono); font-size: 18px;
  border-radius: 50%;
  transition: all .2s;
}
.nav-arrow:hover, .nav-arrow:focus-visible {
  color: var(--amber); border-color: var(--amber);
  background: rgba(7,8,13,.85);
  outline: none;
}
.nav-arrow.prev { left: clamp(12px, 2vw, 24px); }
.nav-arrow.next { right: clamp(12px, 2vw, 24px); }

/* ─── Audio toggle (optional ambient) ─────────────────────────────────── */

.audio-toggle {
  position: absolute; top: clamp(18px, 3vh, 28px); right: clamp(18px, 3vw, 28px);
  z-index: 25;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: rgba(7,8,13,.55);
  border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--bone-dim);
  border-radius: 2px;
  backdrop-filter: blur(6px);
}
.audio-toggle:hover { color: var(--bone); border-color: var(--steel); }

/* ─── Skip link ───────────────────────────────────────────────────────── */

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--bone); color: var(--ink); padding: 8px 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 2px; z-index: 999;
}
.skip:focus { left: 16px; }

/* ─── Reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .rail-id .dot, .caption .platform .led, .travel-hud .arrow span { animation: none !important; }
}

/* ─── Focus visibility ────────────────────────────────────────────────── */
button:focus-visible, a:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 3px;
}
