@font-face {
  font-family: "Inter var";
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono var";
  src: url("/fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #030409;
  --ink: #e9edf5;
  --dim: #8b93a7;
  --faint: #565e73;
  --line: rgba(233, 237, 245, 0.09);
  --glow: #c9d6ea;
  --mono: "JetBrains Mono var", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter var", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#veil {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 6;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.6s ease 0.15s;
}
#veil.off { opacity: 0; }

#space {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  cursor: grab;
  touch-action: pan-y;
}
#space.dragging { cursor: grabbing; }

/* Static fallback if WebGL declines to participate */
#fallback-moon { display: none; }
body.no3d #space { display: none; }
body.no3d #fallback-moon {
  display: block;
  position: fixed;
  top: 18vh;
  left: 50%;
  width: min(52vmin, 420px);
  height: min(52vmin, 420px);
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, #d9dde4 0%, #b3b8c2 42%, #6f7480 78%, #3a3e49 100%);
  box-shadow: 0 0 120px 12px rgba(201, 214, 234, 0.18);
  z-index: 0;
}
body.no3d #fallback-moon::after {
  content: "Your device declined to render the Moon. The Moon remains unbothered.";
  position: absolute;
  top: calc(100% + 1rem);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

main {
  position: relative;
  z-index: 1;
  pointer-events: none; /* the canvas owns drag; interactive bits opt back in */
}
main a, main button { pointer-events: auto; }

section.s {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14vh 6vw;
  position: relative;
}
.inner { width: min(1060px, 100%); }

/* ---- reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- hero ---- */
.hero { text-align: center; justify-content: center; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1.4rem;
}
h1 {
  font-size: clamp(4.6rem, 21vw, 15rem);
  font-weight: 900;
  letter-spacing: 0.045em;
  line-height: 0.95;
  text-shadow: 0 0 90px rgba(201, 214, 234, 0.35);
  user-select: none;
}
.tag {
  margin-top: 1.6rem;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--dim);
  font-weight: 450;
}
.cue {
  position: absolute;
  bottom: 4.5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  animation: cue-bob 2.6s ease-in-out infinite;
}
@keyframes cue-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.75; }
  50% { transform: translateX(-50%) translateY(8px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .cue { animation: none; } }

/* ---- shared type ---- */
h2 {
  font-size: clamp(2.3rem, 6vw, 4.4rem);
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1.04;
  margin-bottom: 1.2rem;
}
.lede {
  color: var(--dim);
  max-width: 44ch;
  margin-bottom: 2.6rem;
  font-size: clamp(0.98rem, 1.8vw, 1.15rem);
}

/* ---- features ---- */
.features .inner { text-align: left; }
.grid {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.6rem 1.4rem;
  background: rgba(3, 4, 9, 0.55);
  backdrop-filter: blur(6px);
}
.card svg { color: var(--glow); margin-bottom: 0.9rem; }
.card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 0.45rem; letter-spacing: -0.01em; }
.card p { font-size: 0.9rem; color: var(--dim); }

/* ---- live stats ---- */
.live .inner { text-align: left; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.8rem 1.5rem;
  background: rgba(3, 4, 9, 0.55);
  backdrop-filter: blur(6px);
}
.num {
  display: block;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(201, 214, 234, 0.25);
  white-space: nowrap;
}
.num--small { font-size: clamp(0.82rem, 1.9vw, 1.35rem); }
.unit {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 0.5rem;
}
.stat .note { margin-top: 1rem; font-size: 0.85rem; color: var(--dim); }

/* ---- shared legibility over the bright surface ---- */
h2, .lede { text-shadow: 0 2px 28px rgba(3, 4, 9, 0.9), 0 0 8px rgba(3, 4, 9, 0.6); }

/* ---- specs ---- */
.specs .inner { text-align: left; }
.spectable {
  margin-top: 2.4rem;
  background: rgba(3, 4, 9, 0.62);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.3rem 1.3rem;
}
.spectable > div {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 1rem;
  align-items: baseline;
  padding: 1.05rem 0.2rem;
  border-bottom: 1px solid var(--line);
}
.spectable > div:last-child { border-bottom: none; }
.spectable dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}
.spectable dd { font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 650; letter-spacing: -0.01em; }
.spectable dd.aside { font-size: 0.85rem; font-weight: 400; color: var(--dim); text-align: right; }
@media (max-width: 640px) {
  .spectable > div { grid-template-columns: 1fr 1fr; }
  .spectable dd.aside { grid-column: 1 / -1; text-align: left; margin-top: -0.4rem; }
}

/* ---- reviews ---- */
.reviews .inner { text-align: left; }
.rgrid {
  margin-top: 2.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}
.review {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem 1.4rem;
  background: rgba(3, 4, 9, 0.55);
  backdrop-filter: blur(6px);
}
.stars { display: flex; gap: 0.2rem; margin-bottom: 0.8rem; }
.stars svg { width: 15px; height: 15px; }
.stars .on { fill: var(--glow); }
.stars .off { fill: none; stroke: var(--faint); stroke-width: 1.4; }
.review blockquote { font-size: 0.95rem; }
.review figcaption {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- claim ---- */
.claim { text-align: center; }
.claim .lede { margin-left: auto; margin-right: auto; }
#claim-btn {
  font-family: var(--sans);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 750;
  letter-spacing: 0.01em;
  color: #0a0c14;
  background: linear-gradient(160deg, #f2f5fb, #c3cfe2);
  border: none;
  border-radius: 999px;
  padding: 1.05em 2.6em;
  cursor: pointer;
  box-shadow: 0 0 42px rgba(201, 214, 234, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#claim-btn:hover { transform: translateY(-2px); box-shadow: 0 0 68px rgba(201, 214, 234, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.7); }
#claim-btn:active { transform: translateY(0) scale(0.98); }
#claim-result {
  margin-top: 2.2rem;
  min-height: 4.6em;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
  color: var(--dim);
  font-size: clamp(0.95rem, 1.9vw, 1.12rem);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
#claim-result.show { opacity: 1; transform: none; }
#claim-result .verdict {
  display: block;
  font-weight: 800;
  font-size: 1.35em;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.35em;
}
#claim-result .fine {
  display: block;
  margin-top: 0.8em;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

body.jolt #space { animation: jolt 0.5s ease; }
@keyframes jolt {
  0% { transform: scale(1); }
  30% { transform: scale(1.025); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { body.jolt #space { animation: none; } }

/* ---- footer ---- */
footer {
  min-height: 46vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  text-align: center;
  padding: 0 6vw 5vh;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.06em;
}
footer strong { color: var(--dim); font-weight: 650; }

::selection { background: rgba(201, 214, 234, 0.25); }

/* ============================================================
   v3 — the instrument layer
   ============================================================ */
:root { --hud: #86dcff; --hud-dim: rgba(134, 220, 255, 0.55); }

/* ---- boot sequence ---- */
#veil { display: flex; align-items: center; justify-content: center; }
#boot {
  font-family: var(--mono);
  font-size: clamp(0.68rem, 1.6vw, 0.82rem);
  line-height: 1.75;
  color: var(--hud);
  text-shadow: 0 0 12px rgba(134, 220, 255, 0.35);
  white-space: pre-wrap;
  min-width: min(560px, 86vw);
  min-height: 12em;
}
#boot .ok { color: var(--dim); }

/* ---- section tags ---- */
.sec-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--hud-dim);
  margin-bottom: 0.9rem;
}

/* ---- scanlines (subtle, everywhere) ---- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.014) 0 1px, transparent 1px 3px);
}

/* ---- HUD chrome ---- */
#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; font-family: var(--mono); }
.hud-corner {
  position: fixed;
  width: 26px; height: 26px;
  border: 1px solid rgba(134, 220, 255, 0.35);
}
.hud-corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.hud-corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.hud-corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.hud-corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }
.hud-brand {
  position: fixed;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  color: var(--hud);
  white-space: nowrap;
}
.hud-brand .dim { color: var(--faint); }
.hud-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--hud);
  margin-right: 0.7em;
  vertical-align: 1px;
  animation: hud-pulse 2.2s ease-in-out infinite;
}
@keyframes hud-pulse { 0%,100% { opacity: 1; box-shadow: 0 0 8px var(--hud); } 50% { opacity: 0.35; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .hud-dot { animation: none; } }

#hud-telemetry {
  position: fixed;
  left: 26px; bottom: 30px;
  display: grid;
  gap: 0.28rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
}
#hud-telemetry div { display: flex; gap: 0.8em; }
#hud-telemetry span { color: var(--faint); width: 6.5em; }
#hud-telemetry b { color: var(--hud); font-weight: 500; min-width: 9em; text-align: left; }

#hud-hint {
  position: fixed;
  right: 26px; bottom: 30px;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--faint);
  transition: opacity 1s ease;
}
#hud-hint.gone { opacity: 0; }

#hud-toast {
  position: fixed;
  left: 50%; bottom: 9vh;
  transform: translateX(-50%) translateY(8px);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--hud);
  text-shadow: 0 0 14px rgba(134, 220, 255, 0.4);
  background: rgba(3, 4, 9, 0.7);
  border: 1px solid rgba(134, 220, 255, 0.25);
  padding: 0.55em 1.1em;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
  max-width: 92vw;
  text-overflow: ellipsis;
  overflow: hidden;
}
#hud-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- HUD action buttons ---- */
.hud-actions {
  position: fixed;
  top: 16px; right: 52px;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
}
.hud-actions button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hud);
  background: rgba(3, 4, 9, 0.6);
  border: 1px solid rgba(134, 220, 255, 0.3);
  border-radius: 4px;
  padding: 0.55em 0.9em;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.hud-actions button:hover { background: rgba(134, 220, 255, 0.12); box-shadow: 0 0 18px rgba(134, 220, 255, 0.2); }
.hud-actions button.active { background: rgba(134, 220, 255, 0.18); box-shadow: 0 0 22px rgba(134, 220, 255, 0.3); }

/* ---- marker labels (AR tags projected from 3D) ---- */
#marker-labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.mlabel {
  position: absolute;
  transform: translate(10px, -50%);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hud);
  text-shadow: 0 0 10px rgba(3, 4, 9, 0.9);
  white-space: nowrap;
  padding-left: 14px;
}
.mlabel::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 10px; height: 1px;
  background: var(--hud-dim);
}

/* ---- scan data card ---- */
#scan-card {
  position: fixed;
  right: 26px; bottom: 64px;
  z-index: 6;
  width: min(330px, calc(100vw - 52px));
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(134, 220, 255, 0.3);
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: 0 0 40px rgba(3, 4, 9, 0.8), 0 0 24px rgba(134, 220, 255, 0.07);
  animation: card-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #scan-card { animation: none; } }
#scan-card .sc-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  color: var(--hud);
  margin-bottom: 0.5rem;
}
#scan-card h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
#sc-type {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0.2rem 0 0.8rem;
}
#scan-card dl { border-top: 1px solid var(--line); }
#scan-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.42em 0;
  border-bottom: 1px solid var(--line);
}
#scan-card dt { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
#scan-card dd { font-family: var(--mono); font-size: 0.72rem; color: var(--ink); }
#sc-note { margin-top: 0.8rem; font-size: 0.85rem; color: var(--dim); }
#sc-close {
  pointer-events: auto;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5em 1em;
  cursor: pointer;
}
#sc-close:hover { color: var(--ink); border-color: var(--dim); }

/* ---- time control ---- */
.timectl {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.3rem 1.5rem;
  background: rgba(3, 4, 9, 0.55);
  backdrop-filter: blur(6px);
}
.timectl-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.tc-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--hud-dim);
}
#time-readout {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}
#time-readout.warped { color: var(--hud); text-shadow: 0 0 14px rgba(134, 220, 255, 0.35); }
#time-now {
  pointer-events: auto;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hud);
  background: none;
  border: 1px solid rgba(134, 220, 255, 0.35);
  border-radius: 4px;
  padding: 0.4em 0.9em;
  cursor: pointer;
}
#time-slider {
  pointer-events: auto;
  width: 100%;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(134,220,255,0.1), rgba(134,220,255,0.45), rgba(134,220,255,0.1));
  outline: none;
  cursor: ew-resize;
}
#time-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #dfe9f5;
  border: 2px solid var(--hud);
  box-shadow: 0 0 16px rgba(134, 220, 255, 0.5);
  cursor: ew-resize;
}
#time-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #dfe9f5;
  border: 2px solid var(--hud);
  box-shadow: 0 0 16px rgba(134, 220, 255, 0.5);
  cursor: ew-resize;
}
.timectl .note { margin-top: 0.9rem; font-size: 0.82rem; color: var(--dim); }

/* ---- corner ticks on panels ---- */
.card, .stat, .review, .spectable, .timectl { position: relative; }
.card::before, .stat::before, .review::before, .spectable::before, .timectl::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--hud-dim);
  border-left: 1px solid var(--hud-dim);
  border-top-left-radius: 6px;
}
.card::after, .stat::after, .review::after, .spectable::after, .timectl::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 1px solid var(--hud-dim);
  border-right: 1px solid var(--hud-dim);
  border-bottom-right-radius: 6px;
}

/* ---- explore mode ---- */
body.explore-on main { opacity: 0; pointer-events: none; transition: opacity 0.5s ease; }
main { transition: opacity 0.5s ease; }
body.explore-on #space { cursor: move; }
body.explore-on #hud-hint { opacity: 1; }

/* interactive elements inside main need pointer events despite the shield */
main a, main button, main input { pointer-events: auto; }

@media (max-width: 760px) {
  #hud-telemetry div:nth-child(n+3):not(:nth-child(4)) { display: none; }
  #hud-hint { display: none; }
  .hud-brand { font-size: 0.52rem; letter-spacing: 0.18em; }
  .hud-actions { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); }
  #hud-telemetry { bottom: 64px; }
  #scan-card { right: 50%; transform: translateX(50%); bottom: 70px; }
  #hud-toast { bottom: 16vh; font-size: 0.58rem; }
}
