@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/Inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/Inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/Inter-600.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --font: "Inter", -apple-system, system-ui, sans-serif;
  --page: #000000;
  --ink: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.1);
  --glass: rgba(14, 14, 16, 0.72);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent: #5e5ce6;
  --accent-2: #ffc46b;
}

* { box-sizing: border-box; }
html { background: var(--page); overscroll-behavior: none; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.fallback-bg { display: none; }
.no-webgl .fallback-bg {
  display: block; position: fixed; inset: 0;
  background:
    radial-gradient(60% 50% at 70% 35%, rgba(94, 92, 230, 0.35), transparent 70%),
    radial-gradient(50% 40% at 25% 75%, rgba(204, 60, 150, 0.22), transparent 70%),
    #000;
}
.track { height: 3900vh; } /* ~3 screens of scrolling per stop */

/* glass. No backdrop-filter on purpose: over a canvas that changes every
   frame the browser would have to re-blur behind each panel on every frame. */
.glass, .cap, .brand, .chapters, .cta {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 40%), var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; padding: 20px 24px; pointer-events: none; }
.brand {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 16px; border-radius: 9999px;
  color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
}
.dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(255, 196, 107, 0.22); }
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid rgba(255, 196, 107, 0.6);
  animation: pulse 3.2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.8); opacity: 0.9; } 70%, 100% { transform: scale(2.1); opacity: 0; } }

/* chapter rail */
.chapters {
  position: fixed; z-index: 5; right: 24px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; border-radius: 9999px;
}
.chapters button {
  position: relative; width: 22px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; z-index: 1;
}
.chapters button::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.3);
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.chapters button.is-on::before { background: var(--ink); transform: scale(1.35); box-shadow: 0 0 12px rgba(255, 196, 107, 0.9); }
.chapters button span {
  position: absolute; right: calc(100% + 14px); top: 50%; transform: translate(6px, -50%);
  white-space: nowrap; font-size: 12px; color: var(--ink); opacity: 0; pointer-events: none;
  padding: 5px 10px; border-radius: 9999px; background: var(--glass); border: 1px solid var(--glass-border);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
@media (hover: hover) {
  .chapters button:hover span { opacity: 1; transform: translate(0, -50%); }
  .chapters button:hover::before { background: var(--ink); }
}
.chapters button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 50%; }
.chapters-fill {
  position: absolute; left: 50%; top: 21px; width: 1px; height: calc(100% - 42px); transform: translateX(-50%);
  background: linear-gradient(var(--accent-2), var(--accent-2)) no-repeat top / 100% var(--fill, 0%), rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

/* captions */
.captions { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.cap {
  position: absolute; left: 48px; bottom: 64px; width: min(420px, calc(100vw - 32px));
  padding: 22px 24px 24px; border-radius: 24px;
  opacity: 0; visibility: hidden;
  transform: translateY(var(--y, 16px));
  will-change: opacity, transform;
}
/* each card picks up a little colour from its world: a hairline on top and a soft glow in the corner */
.cap {
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--tint, #fff) 12%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 40%), var(--glass);
}
.cap::before {
  content: ""; position: absolute; top: -1px; left: 22px; right: 22px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--tint, #fff) 30%, color-mix(in srgb, var(--tint, #fff) 40%, #fff) 50%, var(--tint, #fff) 70%, transparent);
  opacity: 0.75;
}
/* content trails the card slightly as it slides, for a layered reveal */
.cap > * { transform: translateY(calc(var(--y, 0px) * var(--k, 0))); }
.cap > :nth-child(2) { --k: 0.35; }
.cap > :nth-child(3) { --k: 0.7; }
.cap > :nth-child(4) { --k: 1.05; }
.cap.is-vis { visibility: visible; }
.cap-final { pointer-events: auto; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tint, var(--accent-2)); box-shadow: 0 0 10px var(--tint, var(--accent-2)); flex: none; }
.cap h2 { margin: 0 0 8px; font-size: 30px; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }
.cap p:not(.eyebrow) { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.facts li {
  font-size: 12px; line-height: 1; padding: 6px 9px; border-radius: 9999px; white-space: nowrap;
  color: var(--ink); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.08);
}

/* floating name tags for moons, asteroids, comets (positioned by main.js) */
.tags { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--ink); white-space: nowrap;
  opacity: 0; will-change: transform, opacity;
}
.tag i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 6px rgba(255, 255, 255, 0.8); flex: none; }
.tag span { padding: 4px 8px; border-radius: 9999px; background: rgba(10, 10, 12, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); }
.tag.is-major span { font-size: 13px; font-weight: 600; }

/* loader */
.loader {
  position: fixed; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: #000; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; transition: opacity 0.6s ease, visibility 0.6s;
}
.loader p { margin: 0; }
.orbit {
  position: relative; width: 46px; height: 46px; margin-bottom: 6px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12); animation: spin 2.4s linear infinite;
}
.orbit::before {
  content: ""; position: absolute; inset: 16px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 16px rgba(255, 196, 107, 0.8);
}
.orbit b { position: absolute; left: 50%; top: -3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 8px rgba(255, 255, 255, 0.9); }
@keyframes spin { to { transform: rotate(360deg); } }
.loader i { display: block; width: 180px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loader b { display: block; height: 100%; width: var(--p, 0%); background: var(--ink); transition: width 0.2s ease; }
.loader.is-done { opacity: 0; visibility: hidden; }
.no-webgl .loader { display: none; }

.cap-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.cta {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 9999px;
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}
.cta svg { width: 16px; height: 16px; transition: transform 0.2s ease; }
@media (hover: hover) {
  .cta:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }
  .cta:hover svg { transform: translateY(-2px); }
}
.cta:active { transform: scale(0.98); }
.cta:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.credit { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.cap p.maps-credit { margin-top: 14px; font-size: 11px; line-height: 1.4; color: rgba(255, 255, 255, 0.4); }
.maps-credit a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25); text-underline-offset: 2px; }

/* ?fps readout */
.fps {
  position: fixed; z-index: 6; left: 50%; top: 72px; transform: translateX(-50%);
  padding: 6px 12px; border-radius: 9999px; background: rgba(0, 0, 0, 0.75); border: 1px solid var(--glass-border);
  font: 500 12px/1.2 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); white-space: nowrap; pointer-events: none;
}

/* scroll hint */
.hint {
  position: fixed; z-index: 4; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
  pointer-events: none; transition: opacity 0.4s ease;
}
.hint i { width: 1px; height: 40px; background: linear-gradient(transparent, rgba(255, 255, 255, 0.7)); animation: hint 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes hint { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
.hint.is-gone { opacity: 0; }

@media (max-width: 640px) {
  .top { padding: 14px 16px; }
  .chapters { display: none; } /* 13 dots would cover the name tags on a narrow screen */
  .chapters button { width: 18px; height: 18px; }
  .facts li { font-size: 11px; padding: 5px 8px; }
  .cap p:not(.eyebrow) { font-size: 13.5px; }
  .cap { left: 16px; right: 16px; width: auto; bottom: calc(20px + env(safe-area-inset-bottom)); padding: 18px 20px 20px; border-radius: 20px; }
  .cap h2 { font-size: 24px; }
  .hint { bottom: auto; top: 62%; }
}

@media (prefers-reduced-motion: reduce) {
  .hint i, .dot::after, .orbit { animation: none; }
  .cap, .cap > * { transform: none !important; }
}
