/* ============================================================
   base.css — reset, fonts, type scale, section scaffolding,
   and the persistent UI shell (canvas / lockup / rail / status key)
   Depends on tokens.css being loaded first.
   ============================================================ */

/* ---------------------------------------------------------------
   1. Reset
   --------------------------------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ol, ul {
  list-style: none;
}

a:focus-visible,
button:focus-visible {
  outline: 1.5px solid var(--signal);
  outline-offset: 2px;
}

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

/* ---------------------------------------------------------------
   2. Fonts — self-hosted, variable, weight axis only
   --------------------------------------------------------------- */

@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../assets/fonts/outfit-variable.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../assets/fonts/inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../assets/fonts/jetbrains-mono-variable.woff2') format('woff2'); }

/* ---------------------------------------------------------------
   3. Type scale (DESIGN-SPEC §1.2)
   --------------------------------------------------------------- */

h1, .h1 {
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: clamp(3.5rem, 2.1rem + 5.2vw, 7.5rem); /* 56px – 120px desktop */
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 24px;
}

h2, .h2 {
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 1.9rem + 2.6vw, 4.5rem); /* 40px – 72px desktop */
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 20px;
}

h3, .h3 {
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
}

p, .body {
  font-family: var(--font-body), sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.55;
  max-width: 34ch;
  color: var(--text-2);
  margin-bottom: 16px;
}

.kicker {
  display: block;
  font-family: var(--font-mono), monospace;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------
   3b. Scaffold-level vertical rhythm — bug fix (CHAT-1 acceptance pass)
   The reset above zeroes all margins and no per-scene styling exists yet
   (scenes.css is intentionally empty stubs until P2-P5), which left every
   block of copy glued directly to the next with no gap at all — e.g. a
   band's closing sentence touching the next band's kicker with zero
   break. This is baseline legibility scaffolding, not a design decision:
   real spacing/rhythm gets refined per-scene in later build packages.
   --------------------------------------------------------------- */

.ring-stations li,
.ops-domains li {
  padding: 3px 0;
}

.nodes li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
}

.band {
  margin-bottom: 56px;
}

.capabilities {
  margin-bottom: 32px;
}

.capabilities dt {
  margin-top: 20px;
  margin-bottom: 6px;
}

.door {
  margin-bottom: 40px;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 4px;
}

footer p {
  margin-bottom: 12px;
}

footer nav a {
  margin-right: 16px;
}

.status-key {
  font-family: var(--font-mono), monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

@media (max-width: 640px) {
  h1, .h1 { font-size: 40px; }
  h2, .h2 { font-size: 32px; }
  h3, .h3 { font-size: 22px; }
  p, .body { font-size: 16px; }
}

@media (max-width: 768px) {
  main section[data-scene] {
    padding-top: 76px;
  }

  .rail {
    right: 14px;
  }

  .rail ol {
    gap: 11px;
  }

  .status-key {
    right: 18px;
    bottom: 16px;
    left: 18px;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 9.5px;
  }
}

/* ---------------------------------------------------------------
   4. Section scaffolding — LOCKED per-scene scroll footprint
   For pin:false scenes, min-height IS the scrub runway. s4 (pin:true)
   stays 100vh — ScrollTrigger's own pin-spacer (end:"+=420vh") builds
   that runway; stacking extra min-height here would double it.
   --------------------------------------------------------------- */

main {
  position: relative;
  z-index: 2;
}

main section[data-scene] {
  position: relative;
  width: 100%;
  /* Bug fix (CHAT-1 acceptance pass): with zero top padding, in-flow content
     (kicker/H1/H2/lists) renders flush at the section's top edge, so it
     collides with the fixed lockup (top:28px, z-index:10, always on top)
     and the canvas placeholder scene-id text every time a section's content
     scrolls near the top of the viewport — reproduced in every scene's
     screenshot. Padding-top is included in the box (border-box) so it does
     NOT change the section's total height/scroll footprint — the locked
     per-scene vh values above are unaffected.
  */
  padding-top: 100px;
}

section[data-scene="s0"] { min-height: 100vh; }  /* Ignition */
section[data-scene="s1"] { min-height: 130vh; }  /* Fragmentation */
section[data-scene="s2"] { min-height: 160vh; }  /* Thesis */
section[data-scene="s3"] { min-height: 260vh; }  /* The Ring */
section[data-scene="s4"] { min-height: 100vh; }  /* Revenue Engine — pinned, see note above */
section[data-scene="s5"] { min-height: 260vh; }  /* The Proof */
section[data-scene="s6"] { min-height: 180vh; }  /* Operations */
section[data-scene="s7"] { min-height: 300vh; }  /* Oracle */
section[data-scene="s8"] { min-height: 220vh; }  /* The Whole */
section[data-scene="s9"] { min-height: 180vh; }  /* Two Doors */

@media (max-width: 768px) {
  section[data-scene="s2"] { min-height: 150vh; }
  section[data-scene="s3"] { min-height: 300vh; }
  section[data-scene="s5"] { min-height: 300vh; }
  section[data-scene="s6"] { min-height: 220vh; }
  section[data-scene="s7"] { min-height: 320vh; }
  section[data-scene="s8"] { min-height: 240vh; }
  section[data-scene="s9"] { min-height: 200vh; }
}

/* ---------------------------------------------------------------
   5. Persistent UI shell — fixed ambient film + canvas + lockup + rail + status key
   These live outside <main>, as direct children of <body>, per the
   locked UI shell contract. Structural positioning only; per-scene
   drawing is the canvas's job (engine.js / scenes/*.js).
   --------------------------------------------------------------- */

.hero-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--hero-ambient-opacity, 0);
  transition: opacity 0.55s ease-out;
}

.hero-ambient__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  opacity: 0.64;
  filter: grayscale(1) saturate(0) contrast(1.06) brightness(0.82);
  transform: scale(1.03);
}

.hero-ambient::before,
.hero-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-ambient::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 48%, rgba(5, 6, 7, 0.34) 0%, rgba(5, 6, 7, 0.58) 44%, rgba(5, 6, 7, 0.92) 82%),
    linear-gradient(180deg, rgba(5, 6, 7, 0.84) 0%, rgba(5, 6, 7, 0.22) 34%, rgba(5, 6, 7, 0.76) 100%);
}

.hero-ambient::after {
  z-index: 2;
  background:
    linear-gradient(90deg, transparent 0%, rgba(154, 163, 169, 0.08) 50%, transparent 100%),
    radial-gradient(circle at 50% 36%, rgba(0, 255, 102, 0.08) 0%, transparent 38%);
  mix-blend-mode: screen;
  opacity: 0.32;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  background: transparent;
}

@media (max-width: 768px) {
  .hero-ambient__video {
    opacity: 0.52;
  }

  .hero-ambient::before {
    background:
      radial-gradient(circle at 50% 51%, rgba(5, 6, 7, 0.4) 0%, rgba(5, 6, 7, 0.66) 50%, rgba(5, 6, 7, 0.94) 86%),
      linear-gradient(180deg, rgba(5, 6, 7, 0.88) 0%, rgba(5, 6, 7, 0.3) 36%, rgba(5, 6, 7, 0.8) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-ambient {
    display: none;
  }
}

.lockup {
  position: fixed;
  top: 28px;
  left: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.lockup-logo {
  display: block;
  width: auto;
  object-fit: contain;
  filter: grayscale(1) saturate(0);
  opacity: 0.82;
}

.lockup-logo--dealer {
  height: 24px;
}

.lockup-logo--diablo {
  height: 22px;
}

.lockup-separator {
  font-family: var(--font-mono), monospace;
  font-weight: 500;
  font-size: 10px;
  line-height: 1;
  color: var(--text-3);
  opacity: 0.72;
}

@media (max-width: 768px) {
  .lockup {
    top: 17px;
    left: 18px;
    gap: 7px;
  }

  .lockup-logo--dealer {
    height: 16px;
  }

  .lockup-logo--diablo {
    height: 15px;
  }

  .lockup-separator {
    font-size: 9px;
  }
}

.rail {
  position: fixed;
  top: 50%;
  right: 24px;
  z-index: 10;
  transform: translateY(-50%);
  pointer-events: none;
}

.rail ol {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.rail-tick {
  width: 14px;
  height: 1.5px;
  background: var(--line);
  transition: background-color 0.3s ease, width 0.3s ease;
}

.rail-tick.rail-tick--active {
  width: 22px;
  background: var(--signal);
}

.status-key {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  pointer-events: none;
}

.status-key[hidden] {
  display: none;
}

.status-key .key-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mark-live {
  background: var(--status-live);
  border: 1.5px solid var(--status-live);
}

.mark-beta {
  background: transparent;
  border: 1.5px solid var(--status-beta);
}

/* DESIGN-SPEC §5.1 — "plugs in": a neutral SOLID ring with a small solid centre
   dot (an external node seated in its socket). Distinct at a glance from the
   green live/beta marks and the dotted-grey `coming` mark. */
.mark-plugsin {
  position: relative;
  background: transparent;
  border: 1.5px solid var(--status-plugsin);
}

.mark-plugsin::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--status-plugsin);
  transform: translate(-50%, -50%);
}

.mark-coming {
  background: transparent;
  border: 1.5px dotted var(--status-coming);
}

@media (max-width: 480px) {
  .rail {
    display: none;
  }
}
