/* ============================================================================
   MASSSTAB — Design-System
   void #05070f · ink #e9edf6 · solar #f0a832 · ice #7cc4ff · mute #8a93a8
   Display: Space Grotesk · Fließtext: Inter · Daten: ui-monospace
   ========================================================================== */

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/SpaceGrotesk-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --void: #05070f;
  --ink: #e9edf6;
  --solar: #f0a832;
  --ice: #7cc4ff;
  --mute: #8a93a8;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { background: var(--void); }

body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#spacer { position: relative; width: 1px; }

/* ---------- Bühne ---------- */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
#scene { position: absolute; inset: 0; display: block; }

#vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 58%, rgba(2, 3, 8, 0.42) 100%);
}
#scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(3, 5, 10, 0.38), transparent 20%),
    linear-gradient(to top, rgba(3, 5, 10, 0.55), transparent 34%);
}
#grain {
  position: absolute; inset: -50%;
  width: 200%; height: 200%;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Brand ---------- */
#brand {
  position: fixed;
  top: max(22px, env(safe-area-inset-top));
  left: 26px;
  z-index: 10;
  pointer-events: none;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.34em;
  color: var(--ink);
}
.wordmark::after {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 2px;
  background: var(--solar);
  border-radius: 50%;
  transform: translateY(-1px);
}
#stationCounter {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mute);
}

/* ---------- Lineal ---------- */
#rail {
  position: fixed;
  right: 20px;
  top: 14vh;
  height: 72vh;
  width: 1px;
  background: rgba(233, 237, 246, 0.13);
  z-index: 10;
  pointer-events: none;
}
#rail .tick {
  position: absolute;
  right: 0;
  width: 6px;
  height: 1px;
  background: rgba(233, 237, 246, 0.25);
}
#rail .tick.major {
  width: 12px;
  background: rgba(233, 237, 246, 0.5);
}
#rail .tick.major span {
  position: absolute;
  right: 18px;
  top: -5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--mute);
  white-space: nowrap;
}
#railMarker {
  position: absolute;
  right: -3px;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--solar);
  box-shadow: 0 0 10px 1px rgba(240, 168, 50, 0.7);
}
#railNow {
  position: absolute;
  right: 14px;
  top: -6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--solar);
  white-space: nowrap;
}

/* ---------- Stations-Text ---------- */
#caption {
  position: fixed;
  left: 26px;
  bottom: calc(30px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: min(38ch, 62vw);
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
}
#capEyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ice);
  margin-bottom: 10px;
}
#capTitle {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 4.6vw, 52px);
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
  text-shadow: 0 2px 26px rgba(3, 5, 10, 0.7);
}
#capSize {
  font-family: var(--mono);
  font-size: clamp(11px, 1.4vw, 13px);
  letter-spacing: 0.1em;
  color: var(--solar);
  margin-bottom: 12px;
}
#capLine {
  font-family: var(--body);
  font-weight: 400;
  font-size: clamp(14px, 1.7vw, 17px);
  line-height: 1.45;
  color: rgba(233, 237, 246, 0.82);
  max-width: 34ch;
  text-shadow: 0 1px 12px rgba(3, 5, 10, 0.75);
}

/* ---------- Odometer ---------- */
#hud {
  position: fixed;
  right: 34px;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 10;
  text-align: right;
  pointer-events: none;
}
#sizeReadout {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(34px, 5.4vw, 76px);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 30px rgba(5, 7, 15, 0.8);
}
#sizeUnit {
  font-size: 0.42em;
  font-weight: 500;
  color: rgba(233, 237, 246, 0.65);
  letter-spacing: 0.04em;
}
#sciReadout {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: clamp(10px, 1.2vw, 12px);
  letter-spacing: 0.14em;
  color: var(--mute);
}
#sciReadout sup { color: var(--ice); }

/* ---------- Intro ---------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 15, 0.5);
  backdrop-filter: blur(9px) brightness(0.75);
  -webkit-backdrop-filter: blur(9px) brightness(0.75);
  pointer-events: none;
}
.intro-inner { text-align: center; padding: 0 24px; }
.intro-eyebrow {
  font-family: var(--mono);
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.34em;
  color: var(--ice);
  margin-bottom: 22px;
}
.intro-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 12.5vw, 168px);
  line-height: 0.95;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin-bottom: 26px;
}
.intro-word.split span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.35em);
  animation: letterIn 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes letterIn {
  to { opacity: 1; transform: none; }
}
.intro-sub {
  font-family: var(--body);
  font-size: clamp(14px, 1.8vw, 18px);
  line-height: 1.55;
  color: rgba(233, 237, 246, 0.75);
  margin-bottom: 54px;
}
.cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--mute);
}
.cue i {
  display: block;
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--solar), transparent);
  animation: cueDrop 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  transform-origin: top;
}
@keyframes cueDrop {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(20px); opacity: 0; }
}

/* ---------- Outro ---------- */
#outro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 3, 8, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.outro-inner { text-align: center; padding: 0 24px; max-width: 640px; }
.outro-eyebrow {
  font-family: var(--mono);
  font-size: clamp(10px, 1.3vw, 12px);
  letter-spacing: 0.26em;
  color: var(--ice);
  margin-bottom: 30px;
}
.outro-line {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 3.6vw, 40px);
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 44px;
}
#restart {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--void);
  background: var(--solar);
  border: none;
  padding: 15px 34px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  margin-bottom: 40px;
}
#restart:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(240, 168, 50, 0.35); }
#restart:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }
.outro-credit {
  font-family: var(--body);
  font-size: 12px;
  line-height: 1.7;
  color: var(--mute);
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  #brand { left: 18px; }
  #rail { display: none; }
  #caption { left: 18px; max-width: 72vw; }
  /* Odometer auf Mobile nach oben rechts (unter das Brand), Kollision mit Caption vermeiden */
  #hud {
    right: 18px;
    bottom: auto;
    top: calc(max(22px, env(safe-area-inset-top)) + 2px);
  }
  #sizeReadout { font-size: clamp(24px, 7.4vw, 34px); }
  #sciReadout { margin-top: 4px; }
  .wordmark { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .cue i { animation: none; }
  #outro, #restart { transition: none; }
  .intro-word.split span { animation: none; opacity: 1; transform: none; }
}
