/* ==========================================================================
   8xy — foundation
   Tokens, reset, typography. No framework, no build step, no dependencies —
   the same discipline the applications are written with.
   ========================================================================== */

:root {
  /* Ink. The site is almost entirely black; these are the few steps above it. */
  --ink-0: #000000;
  --ink-1: #06070a;
  --ink-2: #0b0d12;

  --tx-0: #f4f6fa;
  --tx-1: #aeb6c4;
  --tx-2: #6e7686;
  --tx-3: #414958;

  --accent: #9ba8b5;
  --accent-soft: rgba(155, 168, 181, 0.14);

  --hair: rgba(255, 255, 255, 0.10);
  --hair-strong: rgba(255, 255, 255, 0.22);

  /* Segoe UI Variable on Windows, SF Pro on macOS — both are display-grade
     and neither costs a network request. */
  --font: 'Segoe UI Variable Display', 'Segoe UI Variable', -apple-system,
          BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --mono: 'Cascadia Code', 'SF Mono', 'JetBrains Mono', ui-monospace,
          Consolas, 'Courier New', monospace;

  --gutter: clamp(1.5rem, 5vw, 5.5rem);

  /* One easing curve for everything that is not physics-driven. */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink-0);
}

body {
  font-family: var(--font);
  color: var(--tx-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The cinematic canvas experience (index.html only) owns a single virtual
   viewport — no native scroll until the intro hands off to real content. */
body.experience {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
body.experience.is-live {
  overflow-y: auto;
  touch-action: pan-y;
}

canvas#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

::selection { background: var(--accent); color: #000; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

/* ── Type scale ──────────────────────────────────────────────────────────
   The small mono labels used throughout the chrome — the sound toggle and
   the skip control. */

.ctl__label, .skip {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Reduced motion: the experience still plays, but the shake, the glitch and
   the pointer inertia are pulled out in JS. Nothing here should jitter. */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* ── Fallback prose ──────────────────────────────────────────────────────
   Real content, present in the document from the first byte. It is what
   crawlers and screen readers get, and what stays if WebGL2 is missing. */

.fallback {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: clamp(2rem, 8vw, 7rem) var(--gutter) 6rem;
  max-width: 68ch;
  z-index: 1;
  background: var(--ink-0);
  transition: opacity 0.8s var(--ease);
}
.fallback h1 {
  font-size: clamp(3rem, 12vw, 7rem);
  letter-spacing: -0.05em;
  margin: 0 0 0.4em;
  font-weight: 800;
}
.fallback h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 2.6em 0 0.5em;
  font-weight: 600;
}
.fallback p {
  color: var(--tx-1);
  line-height: 1.66;
  margin: 0 0 1em;
  font-size: 0.95rem;
}
/* Once the canvas is live the prose is removed from view and from the
   accessibility tree — it would otherwise be read twice. */
body.is-webgl .fallback {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.unsupported {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 40;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--tx-2);
  border: 1px solid var(--hair);
  padding: 0.7rem 1.1rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}
.unsupported[hidden] { display: none; }
