/* ============ Bauhaus tokens ============ */
:root {
  --red: #E63329;
  --blue: #1B3B8B;
  --yellow: #F2B705;
  --black: #111111;
  --paper: #F4F1EA;
  --white: #FFFFFF;
  --display: 'Archivo Black', Futura, 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
  --body: 'Space Grotesk', Futura, 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
}

@font-face {
  font-family: 'Archivo Black';
  src: url('/fonts/archivo-black.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/space-grotesk-var.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--black);
}

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.noise {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

.line-bullet {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--yellow); color: var(--black);
  font-family: var(--display); font-size: 15px;
  flex: 0 0 auto;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 72vh;
  min-height: 72dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(24px, 6vw, 90px);
  overflow: hidden;
  border-bottom: 4px solid var(--black);
}

.hero-shapes { position: absolute; inset: 0; pointer-events: none; }
.hs { position: absolute; mix-blend-mode: multiply; will-change: transform; }
.hs-circle {
  width: clamp(120px, 22vw, 320px); height: clamp(120px, 22vw, 320px);
  border-radius: 50%; background: var(--red);
  right: 8%; top: 10%;
  animation: drift1 11s ease-in-out infinite;
}
.hs-square {
  width: clamp(80px, 14vw, 200px); height: clamp(80px, 14vw, 200px);
  background: var(--blue);
  right: 24%; bottom: 12%;
  animation: spinDrift 26s linear infinite;
}
.hs-triangle {
  width: clamp(100px, 16vw, 240px); height: clamp(86px, 14vw, 208px);
  background: var(--yellow);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  right: 16%; top: 46%;
  animation: drift2 14s ease-in-out infinite;
}
.hs-ring {
  width: clamp(60px, 9vw, 130px); height: clamp(60px, 9vw, 130px);
  border-radius: 50%; border: clamp(10px, 1.6vw, 22px) solid var(--black);
  left: 55%; top: 12%;
  animation: drift2 17s ease-in-out infinite reverse;
}
.hs-bar {
  width: clamp(140px, 24vw, 380px); height: clamp(14px, 2vw, 26px);
  background: var(--black);
  left: 48%; bottom: 20%;
  transform: rotate(-24deg);
  animation: drift1 19s ease-in-out infinite reverse;
}
.hs-dot {
  width: clamp(24px, 3.4vw, 48px); height: clamp(24px, 3.4vw, 48px);
  border-radius: 50%; background: var(--black);
  right: 40%; top: 22%;
  animation: drift1 8s ease-in-out infinite;
}
@keyframes drift1 {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -26px; }
}
@keyframes drift2 {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 20px; rotate: 6deg; }
}
@keyframes spinDrift {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}

.hero-kicker {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .22em; font-size: clamp(11px, 1.3vw, 15px);
  margin-bottom: 14px;
}

.wordmark {
  position: relative; z-index: 1;
  font-family: var(--display);
  font-size: clamp(56px, 13vw, 190px);
  line-height: .92;
  letter-spacing: -.015em;
  display: flex;
}
.wordmark span {
  display: inline-block;
  transition: transform .18s ease, color .18s ease;
}
.wordmark span:hover { transform: translateY(-.08em) rotate(-4deg); color: var(--blue); }
.wm-dot { color: var(--red); }
.wordmark .wm-dot:hover { color: var(--yellow); transform: translateY(-.12em) scale(1.15); }

.strapline {
  margin-top: 18px;
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 500;
}

.cta {
  display: inline-block; align-self: flex-start;
  margin-top: 26px;
  background: var(--black); color: var(--white);
  font-family: var(--display); font-size: clamp(14px, 1.5vw, 18px);
  letter-spacing: .08em;
  padding: 16px 26px;
  text-decoration: none;
  box-shadow: 6px 6px 0 var(--red);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.cta:hover {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 var(--red);
  background: var(--blue);
}

/* ============ TICKER ============ */
.ticker {
  overflow: hidden;
  background: var(--black); color: var(--paper);
  border-bottom: 4px solid var(--black);
  padding: 10px 0;
}
.ticker-track {
  display: inline-flex; gap: 2.2em; white-space: nowrap;
  font-family: var(--display); font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: .1em;
  animation: ticker 28s linear infinite;
}
.ticker-track .t-dot { color: var(--yellow); }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============ CONTENT ============ */
.content { padding: clamp(24px, 5vw, 70px); }

.section-title {
  font-family: var(--display);
  font-size: clamp(24px, 4vw, 48px);
  margin-bottom: clamp(18px, 3vw, 36px);
  display: flex; align-items: center; gap: 16px;
}
.section-title::after {
  content: '';
  flex: 1; height: 6px; background: var(--black);
}
.section-title.light { color: var(--paper); }
.section-title.light::after { background: var(--paper); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: clamp(14px, 2vw, 26px);
}
.pcard {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border: 4px solid var(--black);
  background: var(--white);
  padding: 20px;
  cursor: pointer;
  text-align: left;
  font-family: var(--body);
  transition: transform .16s ease, box-shadow .16s ease;
  box-shadow: 0 0 0 var(--black);
  overflow: hidden;
}
.pcard:hover, .pcard:focus-visible {
  transform: translate(-4px, -4px);
  box-shadow: 8px 8px 0 var(--pc-accent, var(--black));
}
.pcard.current { outline: 4px solid var(--pc-accent, var(--red)); outline-offset: 3px; }
.pcard-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pcard-num {
  font-family: var(--display);
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--pc-accent, var(--black)); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex: 0 0 auto;
}
.pcard-name {
  font-family: var(--display);
  font-size: clamp(17px, 1.8vw, 22px);
  text-transform: uppercase;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.pcard-tagline { font-size: 14px; min-height: 2.6em; }
.pcard-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
}
.pcard-ride {
  font-family: var(--display); font-size: 12px; letter-spacing: .1em;
  color: var(--black);
}
.pcard:hover .pcard-ride { color: var(--pc-accent, var(--red)); }
.pcard-visit {
  font-family: var(--display); font-size: 12px; letter-spacing: .1em;
  background: var(--black); color: var(--white);
  padding: 9px 14px; text-decoration: none;
}
.pcard-visit:hover { background: var(--pc-accent, var(--red)); }
.pcard-shape {
  position: absolute; right: -18px; bottom: -18px;
  width: 74px; height: 74px;
  background: var(--pc-accent, var(--red));
  opacity: .16;
  transition: transform .3s ease, opacity .2s;
}
.pcard:nth-child(3n+1) .pcard-shape { border-radius: 50%; }
.pcard:nth-child(3n+2) .pcard-shape { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.pcard:hover .pcard-shape { transform: rotate(22deg) scale(1.25); opacity: .3; }

/* ============ LINE MAP ============ */
.linemap-wrap { overflow-x: auto; margin-top: clamp(28px, 4vw, 54px); scrollbar-width: thin; }
.linemap {
  position: relative;
  display: flex; justify-content: space-between;
  min-width: 460px;
  padding: 8px 84px 84px 10px;
}
.line-rail {
  position: absolute; left: 10px; right: 84px; top: 23px;
  height: 6px; background: var(--black);
}
.line-train {
  position: absolute; top: 17px; left: 0;
  width: 26px; height: 12px;
  background: var(--red);
  border: 2px solid var(--black);
  transition: left .1s linear;
}
.stop {
  position: relative; z-index: 1;
  display: block;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--white);
  border: 4px solid var(--black);
  cursor: pointer; padding: 0;
  transition: transform .2s;
}
.stop:hover { transform: scale(1.2); }
.stop[aria-current="true"] {
  transform: scale(1.35);
  background: var(--stop-color, var(--red));
}
.stop-label {
  position: absolute; top: 36px; left: 50%;
  transform-origin: top left;
  transform: rotate(45deg);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  white-space: nowrap;
  color: var(--black);
  pointer-events: none;
}

/* --- fallback static list: visually hidden when JS boots --- */
.stations-list { display: flex; flex-direction: column; gap: 6px; font-size: 14px; margin-top: 20px; }
.stations-list a { color: var(--blue); }
body.js .stations-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ============ GAME SECTION (bottom) ============ */
.game-section {
  background: var(--black);
  padding: clamp(20px, 4vw, 60px);
  border-top: 4px solid var(--black);
}
.game-header { margin-bottom: 18px; }
.game-sub {
  color: rgba(244,241,234,.75);
  font-size: clamp(13px, 1.4vw, 16px);
  margin-top: -8px;
}
.game-sub kbd {
  font-family: var(--body);
  background: rgba(244,241,234,.15); color: var(--paper);
  border: 1px solid rgba(244,241,234,.4);
  border-radius: 4px; padding: 1px 6px; font-size: .9em;
}

.game-frame {
  position: relative;
  height: 78vh;
  height: 78dvh;
  min-height: 380px;
  border: 4px solid var(--paper);
  overflow: hidden;
  background: #141419;
}
#metro-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

body.no-3d .game-section { display: none; }

.banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); color: var(--black);
  font-family: var(--display);
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: .06em;
  padding: 12px 18px;
  transform: translateY(-100%);
  transition: transform .3s ease;
}
.banner.show { transform: translateY(0); }
.banner-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); flex: 0 0 auto;
}

.joystick {
  position: absolute; z-index: 5;
  width: 104px; height: 104px;
  pointer-events: none;
}
.joy-base {
  position: absolute; inset: 0;
  border: 3px solid rgba(244,241,234,.7); border-radius: 50%;
  background: rgba(17,17,17,.35);
}
.joy-nub {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid var(--black);
}

.lock-tip {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4; pointer-events: none;
  background: rgba(17,17,17,.65); color: var(--paper);
  font-family: var(--display); font-size: 14px; letter-spacing: .14em;
  padding: 12px 20px;
  border: 2px solid rgba(244,241,234,.5);
}

.enter-chip {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 6;
  background: var(--paper); color: var(--black);
  font-family: var(--display); font-size: 15px; letter-spacing: .08em;
  border: none; padding: 14px 22px; cursor: pointer;
  box-shadow: 5px 5px 0 var(--red);
  animation: chip-pulse 1.4s ease-in-out infinite;
}
.enter-chip:hover { background: var(--yellow); }
@keyframes chip-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}

.hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 4;
  font-size: 11px; letter-spacing: .18em; font-weight: 600;
  color: rgba(244,241,234,.6);
  white-space: nowrap;
  transition: opacity .6s;
}
.hint.fade { opacity: 0; }

.whiteout {
  position: absolute; inset: 0; z-index: 8;
  background: var(--paper);
  opacity: 0; pointer-events: none;
  transition: opacity .7s ease;
}
.whiteout.on { opacity: 1; }

/* ============ FOOTER ============ */
.foot {
  font-size: 12px; color: rgba(17,17,17,.7);
  padding: clamp(20px, 3vw, 40px) clamp(24px, 5vw, 70px);
}
.foot-shapes { display: flex; gap: 6px; margin-bottom: 8px; }
.foot-shapes span:nth-child(1) { width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.foot-shapes span:nth-child(2) { width: 12px; height: 12px; background: var(--blue); }
.foot-shapes span:nth-child(3) { width: 12px; height: 12px; background: var(--yellow); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.foot-joke { margin-top: 2px; font-style: italic; }

/* ============ Mobile ============ */
@media (max-width: 640px) {
  .hero { min-height: 60vh; min-height: 60dvh; }
  .game-frame { height: 70vh; height: 70dvh; }
  .hint { display: none; }
  .pcard-tagline { min-height: 0; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hs, .ticker-track, .enter-chip { animation: none !important; }
  .banner, .pcard, .cta, .line-train, .wordmark span { transition: none; }
}

/* ---------- rail-safety help dialog (metro:edge) ---------- */
.help-dialog {
  margin: auto; /* the global reset kills the UA centering — restore it */
  border: 4px solid var(--black);
  background: var(--paper);
  color: var(--black);
  padding: 26px 30px 22px;
  max-width: min(480px, calc(100vw - 40px));
  box-shadow: 10px 10px 0 var(--red);
  font-family: var(--body);
}
.help-dialog::backdrop { background: rgba(17, 17, 17, 0.72); }
.help-kicker {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 12px;
  letter-spacing: .14em; color: var(--blue);
  margin: 0 0 12px;
}
.help-dialog h2 {
  font-family: var(--display);
  font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 14px;
}
.help-dialog p { margin: 0 0 12px; line-height: 1.55; }
.help-number { text-align: center; margin: 20px 0 6px; }
.help-number a {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(36px, 7vw, 50px);
  text-decoration: none;
  background: var(--yellow); color: var(--black);
  padding: 2px 26px;
  border: 4px solid var(--black);
}
.help-number a:hover { background: var(--white); }
.help-sub { text-align: center; font-size: 14px; }
.help-intl {
  font-size: 14px;
  border-top: 3px solid var(--black);
  padding-top: 12px; margin-top: 16px;
}
.help-intl a { color: var(--blue); font-weight: 700; }
.help-close {
  display: block; width: 100%; margin-top: 8px;
  font-family: var(--display); font-size: 15px; letter-spacing: .06em;
  background: var(--black); color: var(--paper);
  border: 0; padding: 13px; cursor: pointer;
}
.help-close:hover { background: var(--blue); }
