/* shell styles — consume tokens only; no literal colors below this line.
   Layout geometry (z-index, percentages, gradient stop positions) stays literal. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  background: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--color-accent-deep);
  color: var(--color-surface);
}

a {
  color: var(--color-on-surface);
  text-decoration: none;
  transition: color .25s ease;
}

a:hover {
  color: var(--color-accent-hover);
}

:focus-visible {
  outline: 2px solid var(--color-outline);
  outline-offset: 2px;
}

/* fixed background stack, bottom to top: wash → fog canvas → shaft → vignette → grain */
.wash,
.fog,
.shaft,
.vignette,
.grain {
  position: fixed;
  pointer-events: none;
}

.wash {
  inset: 0;
  z-index: 0;
  background: radial-gradient(90% 70% at 50% 8%, var(--color-surface-wash) 0%, var(--color-surface) 70%);
}

.fog {
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.shaft {
  left: -20%;
  top: -40%;
  width: 80%;
  height: 190%;
  z-index: 2;
  background: linear-gradient(100deg, var(--color-shaft-transparent) 0%, var(--color-shaft) 45%, var(--color-shaft-transparent) 62%);
  filter: blur(28px);
  animation: shaft var(--duration-shaft) ease-in-out infinite;
}

/* The clear middle is deliberate: an earlier, tighter vignette erased the outer 40% of
   the frame — exactly where rolling fog is most legible — and the page read as a flat
   blue gradient. Do not tighten it. */
.vignette {
  inset: 0;
  z-index: 2;
  background: radial-gradient(135% 115% at 50% 45%, var(--color-vignette-transparent) 46%, var(--color-vignette-mid) 80%, var(--color-vignette-edge) 100%);
}

.grain {
  inset: 0;
  z-index: 2;
  opacity: var(--grain-opacity);
  background-image: url('/images/grain.svg');
}

main {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100svh;
  padding: var(--space-page-block) var(--space-page-inline);
}

.hero-center {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.halo {
  position: absolute;
  width: var(--size-halo-width);
  height: var(--size-halo-height);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--color-halo), var(--color-halo-transparent) 72%);
  filter: blur(26px);
  animation: haloPulse var(--duration-loop) var(--ease-loop) infinite;
  pointer-events: none;
}

/* the collapsing letter-spacing is what sells it — the words condense as they arrive
   rather than merely fading in; blur and tracking must animate together */
.type {
  margin: 0;
  position: relative;
  font-weight: var(--font-weight-display);
  font-size: var(--font-size-display);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: var(--tracking-display);
  color: var(--color-on-surface-strong);
  white-space: nowrap;
  animation: surface var(--duration-loop) var(--ease-loop) infinite;
  will-change: opacity, filter, letter-spacing;
}

@keyframes surface {
  0%   { opacity: 0; filter: blur(26px); letter-spacing: var(--tracking-display-wide); transform: scale(1.07); }
  16%  { opacity: 1; filter: blur(0);    letter-spacing: var(--tracking-display);      transform: scale(1); }
  58%  { opacity: 1; filter: blur(0);    letter-spacing: var(--tracking-display);      transform: scale(1); }
  82%  { opacity: 0; filter: blur(24px); letter-spacing: var(--tracking-display-mid);  transform: scale(.98); }
  100% { opacity: 0; filter: blur(26px); letter-spacing: var(--tracking-display-wide); transform: scale(1.07); }
}

@keyframes haloPulse {
  0%   { opacity: 0;  transform: scale(.7); }
  18%  { opacity: .5; transform: scale(1); }
  58%  { opacity: .5; transform: scale(1); }
  86%  { opacity: 0;  transform: scale(1.25); }
  100% { opacity: 0;  transform: scale(.7); }
}

@keyframes shaft {
  0%   { opacity: .22; transform: translate3d(-4%, 0, 0) rotate(-2deg); }
  50%  { opacity: .5;  transform: translate3d(4%, 0, 0) rotate(2deg); }
  100% { opacity: .22; transform: translate3d(-4%, 0, 0) rotate(-2deg); }
}

/* The static state (S4): type fully surfaced as at the 16–58% keyframe, halo at its
   plateau, shaft parked. Disabling `surface` alone would render the page blank — the
   animation carries the type's resting opacity. The fog freezes in fog.js. */
@media (prefers-reduced-motion: reduce) {
  .type {
    animation: none;
    opacity: 1;
    filter: none;
    letter-spacing: var(--tracking-display);
  }

  .halo {
    animation: none;
    opacity: .5;
  }

  .shaft {
    animation: none;
    opacity: .35;
  }
}

/* 404 */
.notice {
  max-width: 44ch;
}

.notice h1 {
  margin: 0;
  font-weight: var(--font-weight-display);
  font-size: clamp(24px, 3.4vw, 40px);
  letter-spacing: .04em;
  color: var(--color-on-surface-strong);
}

.notice p {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-on-surface-muted);
}

.notice a {
  color: var(--color-on-surface-strong);
  border-bottom: 1px solid var(--color-accent-hover);
  padding-bottom: 2px;
}
