:root {
  --bg: #04060A;
  --surface: #0A0E15;
  --primary: #E3A765;
  --accent: #9FB2C4;
  --text: #D9E0E8;
  --muted: #586271;

  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.21, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; overscroll-behavior: none; }

body {
  min-height: 100%;
  overflow: hidden;
  font-family: var(--display);
  color: var(--text);
  background:
    radial-gradient(135% 110% at 50% 38%, var(--surface) 0%, var(--bg) 58%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- atmosphere layers ---------- */
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 120% at 50% 42%, transparent 40%, rgba(0,0,0,0.6) 100%);
}

.noise {
  position: fixed; inset: -2%; z-index: 2; pointer-events: none;
  display: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%200.33%200.33%200.33%200%200'/%3E%3C/filter%3E%3Crect%20width='180'%20height='180'%20filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
html.scan .noise { display: block; animation: drift 32s linear infinite; }
@keyframes drift {
  from { background-position: 0 0; }
  to   { background-position: 180px 90px; }
}

/* ---------- stage ---------- */
.scene { position: fixed; inset: 0; z-index: 3; touch-action: none; }

.content, .lit {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  padding: clamp(1.6rem, 5vh, 3.2rem) 1.25rem;
  text-align: center;
}
.lit {
  display: none; /* enabled only in scan mode */
  pointer-events: none;
  z-index: 2;
  --mx: 50%; --my: 42%; --r: 240px;
}
.content { z-index: 1; }

/* shared sizing (identical in .content + cloned .lit so the mask aligns) */
.tag {
  font-family: var(--mono);
  font-size: clamp(0.62rem, 1.7vw, 0.8rem);
  letter-spacing: 0.46em;
  text-transform: uppercase;
  padding-left: 0.46em;
}
.wordmark {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 13vw, 7.5rem);
  letter-spacing: clamp(0.08em, 2vw, 0.22em);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  padding-left: clamp(0.08em, 2vw, 0.22em);
  padding-block: 0.12em;
}
.coord {
  font-family: var(--mono);
  font-size: clamp(0.66rem, 1.5vw, 0.72rem);
  letter-spacing: 0.22em;
}

/* ---------- the radar blip (always-alive signal) ---------- */
.blip {
  position: absolute; z-index: 3; pointer-events: none;
  left: 50%; top: calc(50% - clamp(3.2rem, 11vw, 5.4rem));
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px 1px rgba(227,167,101,0.5), 0 0 0 6px rgba(227,167,101,0.06);
  opacity: 0.35;
}

/* ---------- LEGIBLE state: no-js + reduced motion ---------- */
html.no-js .content .tag,
html.static .content .tag { opacity: 0.4; color: var(--muted); }
html.no-js .content .wordmark,
html.static .content .wordmark { opacity: 0.92; color: var(--text); text-shadow: 0 0 30px rgba(227,167,101,0.18); }
html.no-js .content .coord,
html.static .content .coord { opacity: 0.45; color: var(--muted); }
html.no-js .blip,
html.static .blip { opacity: 0.45; }

/* ---------- SCAN state: dark void, content revealed by the beam ---------- */
html.scan .content .tag    { opacity: 0.05; color: var(--accent); }
html.scan .content .wordmark { opacity: 0.07; color: var(--accent); animation: breathe 6s ease-in-out infinite; }
html.scan .content .coord  { opacity: 0.05; color: var(--accent); }

html.scan .lit { display: grid; }
html.scan .lit .tag    { opacity: 0.85; color: var(--accent); }
html.scan .lit .wordmark { opacity: 1; color: var(--text); text-shadow: 0 0 34px rgba(227,167,101,0.4), 0 0 8px rgba(227,167,101,0.25); }
html.scan .lit .coord  { opacity: 0.75; color: var(--accent); }

html.scan .lit {
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0%, #000 32%, transparent 72%);
  mask-image: radial-gradient(circle var(--r) at var(--mx) var(--my), #000 0%, #000 32%, transparent 72%);
}

html.scan .blip { animation: pulse 3.6s ease-in-out infinite; }
html.scan .scene { cursor: crosshair; }

@keyframes breathe {
  0%, 100% { opacity: 0.05; text-shadow: 0 0 16px rgba(227,167,101,0.05); }
  50%      { opacity: 0.09; text-shadow: 0 0 26px rgba(227,167,101,0.14); }
}
@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.7); opacity: 0.22; }
  50%      { transform: translate(-50%, -50%) scale(1.18); opacity: 0.68; }
}

/* ---------- the flashlight glow ---------- */
.beam {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  display: none;
  mix-blend-mode: screen;
  --mx: 50%; --my: 42%; --r: 240px;
  background: radial-gradient(circle calc(var(--r) * 1.15) at var(--mx) var(--my),
    rgba(159,178,196,0.10) 0%,
    rgba(227,167,101,0.07) 28%,
    rgba(227,167,101,0.02) 50%,
    transparent 70%);
}
html.scan .beam { display: block; }

/* ---------- the subtle redirect (wordmark link) ---------- */
.wordmark { cursor: pointer; transition: text-shadow 0.4s var(--ease), opacity 0.4s var(--ease); }
html.no-js .content .wordmark:hover,
html.static .content .wordmark:hover { text-shadow: 0 0 42px rgba(227,167,101,0.34); }
.content .wordmark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.3em;
  opacity: 0.9 !important;
  color: var(--text) !important;
  animation: none !important;
}

/* ---------- touch / coarse pointer: keep content legible, beam is a sparkle ---------- */
@media (hover: none) {
  html.scan .content .tag { opacity: 0.35; color: var(--muted); }
  html.scan .content .wordmark {
    opacity: 0.85; color: var(--text); animation: none;
    text-shadow: 0 0 30px rgba(227,167,101,0.18);
  }
  html.scan .content .coord { opacity: 0.45; color: var(--muted); }
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .tag { letter-spacing: 0.34em; }
}
@media (min-width: 1280px) {
  .content, .lit { padding: 3.5rem 2rem; }
}

/* ---------- reduced motion safety net ---------- */
@media (prefers-reduced-motion: reduce) {
  .noise, html.scan .lit, .beam, .blip { animation: none !important; }
  html.scan .content .wordmark {
    opacity: 0.9 !important; color: var(--text) !important; animation: none !important;
  }
  html.scan .content .tag,
  html.scan .content .coord { opacity: 0.5 !important; animation: none !important; }
}
