@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Instrument Serif"; font-style: italic; src: url("../fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #030308;
  --text: #f3efe6;
  --dim: rgba(243, 239, 230, 0.62);
  --faint: rgba(243, 239, 230, 0.18);
  --sun: #ffb067;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --out: cubic-bezier(0.16, 0.84, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Darker edges, and a soft shade behind the text so it stays readable */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 60% 50%, transparent 45%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(90deg, rgba(3, 3, 8, 0.78) 0%, rgba(3, 3, 8, 0.35) 32%, transparent 52%);
  transition: opacity 1.2s;
}
.intro .vignette { background: radial-gradient(ellipse at 50% 50%, rgba(3, 3, 8, 0.25) 20%, rgba(0, 0, 0, 0.75) 100%); }

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sun);
}

/* ---------- Top bar ---------- */

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 40px;
  z-index: 5;
}

.brand { font-family: var(--serif); font-size: 24px; color: var(--text); text-decoration: none; }

.ghost {
  background: none;
  border: 1px solid var(--faint);
  padding: 7px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}
.ghost:hover { border-color: var(--text); }
.overview .ghost { background: var(--text); color: var(--bg); border-color: var(--text); }
.intro .ghost { opacity: 0; pointer-events: none; }

/* ---------- Intro ---------- */

.intro-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  z-index: 4;
  transition: opacity 0.9s, transform 1.4s var(--out), filter 0.9s;
}

body:not(.intro) .intro-screen { opacity: 0; transform: scale(1.12); filter: blur(8px); pointer-events: none; }

.intro-screen h1 {
  margin: 18px 0 22px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 10vw, 148px);
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.intro-screen h1 em { color: var(--sun); }
.intro-screen .lead { max-width: 30em; margin: 0 0 34px; color: var(--dim); font-size: 18px; }

.intro-screen > * { animation: rise 1.4s var(--out) both; }
.intro-screen .kicker { animation-delay: 0.3s; }
.intro-screen h1 { animation-delay: 0.45s; }
.intro-screen .lead { animation-delay: 0.7s; }
.intro-screen .start { animation-delay: 0.9s; }
.intro-screen .hint { animation-delay: 1.1s; }
.loading .intro-screen > * { animation-play-state: paused; }

.start {
  position: relative;
  padding: 16px 34px;
  border: 1px solid var(--sun);
  background: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.4s;
}
.start::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sun);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--out);
  z-index: -1;
}
.start:hover { color: var(--bg); }
.start:hover::before { transform: scaleX(1); }

.hint { margin: 22px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }

/* ---------- The text for each stop ---------- */

.info {
  position: fixed;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: min(430px, 40vw);
  z-index: 3;
  pointer-events: none;
}
.info.in { pointer-events: auto; }

.info h2 {
  margin: 12px 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 7vw, 108px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  overflow: hidden;
  padding-bottom: 0.08em;
}
.info h2.long { font-size: clamp(50px, 5.6vw, 84px); }
.info h2 .word { display: inline-block; white-space: nowrap; }
.info h2 .word span { display: inline-block; transform: translateY(105%); }
.info.in h2 .word span { animation: letter 1s var(--out) var(--d) both; }

.info .lead { margin: 0 0 26px; color: var(--dim); font-size: 17px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 26px; border-top: 1px solid var(--faint); }
.stats div { padding: 12px 0; border-bottom: 1px solid var(--faint); }
.stats div:nth-child(odd) { padding-right: 14px; }
.stats dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.stats dd { margin: 2px 0 0; font-family: var(--serif); font-size: 24px; line-height: 1.2; }

.fact { margin: 0; padding-left: 16px; border-left: 2px solid var(--sun); font-size: 15px; }
.fact span:first-child { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sun); margin-bottom: 2px; }

.reveal { opacity: 0; transform: translateY(14px); }
.info.in .reveal { animation: rise 0.9s var(--out) var(--d) both; }
.info:not(.in) .reveal, .info:not(.in) h2 .word span { transition: opacity 0.35s, transform 0.35s; opacity: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes letter { from { transform: translateY(105%) rotate(6deg); } to { transform: none; } }

/* ---------- Distance meter ---------- */

.meter {
  position: fixed;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: right;
  z-index: 3;
  transition: opacity 0.8s;
}
.meter span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.meter b { font-family: var(--mono); font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }
.meter span, .meter b { text-shadow: 0 0 12px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.8); }
.intro .meter, .overview .meter { opacity: 0; }

/* ---------- Timeline ---------- */

.timeline {
  --progress: 0;
  position: fixed;
  left: 40px;
  right: 40px;
  bottom: 28px;
  display: flex;
  justify-content: space-between;
  z-index: 3;
  transition: opacity 1s 0.4s, transform 1s var(--out) 0.4s;
}
.intro .timeline { opacity: 0; transform: translateY(20px); pointer-events: none; }

.timeline::before, .timeline::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  height: 1px;
  background: var(--faint);
}
.timeline::after { background: var(--sun); right: auto; width: calc((100% - 8px) * var(--progress)); transition: width 1.6s var(--out); }

.timeline button {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 0;
}
.timeline button:first-child { align-items: flex-start; }
.timeline button:last-child { align-items: flex-end; }
.timeline i { width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1px solid var(--dim); transition: transform 0.4s var(--out), background 0.4s, border-color 0.4s; }
.timeline span { white-space: nowrap; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); transition: color 0.3s; }
.timeline button:hover span { color: var(--text); }
.timeline button.past i { background: var(--sun); border-color: var(--sun); }
.timeline button.on i { background: var(--sun); border-color: var(--sun); transform: scale(1.7); box-shadow: 0 0 14px var(--sun); }
.timeline button.on span { color: var(--text); }

/* ---------- Labels in the overview, tooltip ---------- */

.labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity 0.6s; }
.overview .labels { opacity: 1; }
.label {
  position: absolute;
  left: 0;
  top: 0;
  background: none;
  border: 0;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.overview .label { pointer-events: auto; }
.label:hover { color: var(--sun); }

.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  padding: 5px 9px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.tip.on { opacity: 1; }

/* ---------- Loading and no WebGL ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  transition: opacity 1.2s, visibility 1.2s;
}
body:not(.loading) .loader { opacity: 0; visibility: hidden; }

.no-webgl-text { display: none; }
.no-webgl .no-webgl-text { display: block; position: fixed; inset: auto 24px 40% 24px; text-align: center; z-index: 11; }
.no-webgl .loader span { display: none; }

/* ---------- Phone ---------- */

@media (max-width: 760px) {
  .top { padding: 16px 18px; }
  .brand { font-size: 20px; }
  .vignette { background: linear-gradient(0deg, rgba(3, 3, 8, 0.92) 0%, rgba(3, 3, 8, 0.6) 40%, transparent 62%); }
  .info { left: 18px; right: 18px; top: auto; bottom: 74px; transform: none; width: auto; }
  .info h2 { font-size: 52px; margin: 6px 0 10px; }
  .info .lead { font-size: 15px; margin-bottom: 14px; }
  .stats { margin-bottom: 14px; }
  .stats div { padding: 7px 0; }
  .stats dd { font-size: 19px; }
  .fact { font-size: 14px; }
  .meter { display: none; }
  .info h2.long { font-size: 44px; }
  .timeline { left: 18px; right: 18px; bottom: 20px; }
  .timeline span { display: none; }
  .timeline button.on span { display: block; position: absolute; top: 20px; }
  .timeline { bottom: 34px; }
}

@media (max-width: 760px) and (max-height: 760px) {
  .fact { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}
