/* ============================================================
   Obventus — design system per design/DESIGN.md
   Primary reference: Dala (constellation on black velvet)
   ============================================================ */

:root {
  /* Colors */
  --color-void: #000000;
  --color-bone-white: #ffffff;
  --color-ash-gray: #9a9a9a;
  --color-silver-mist: #bdbdbd;
  --color-signal-red: #e50914;   /* primary accent — the pill, brand mark */
  --color-ember: #ff5a5f;        /* light red — eyebrows, emphasis, hovers */
  --color-blood: #8f0610;        /* deep red — gradient stop, subtle tint */

  /* Type — "Instrument" system.
     Archivo speaks in the brand's voice; Martian Mono is the machine talking:
     every label, index, unit and control is set in it. */
  --font-sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Martian Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Spacing (base 6px) */
  --sp-6: 6px;  --sp-12: 12px; --sp-18: 18px; --sp-24: 24px;
  --sp-30: 30px; --sp-36: 36px; --sp-60: 60px; --sp-96: 96px; --sp-120: 120px;

  --page-max: 1280px;
  --radius: 24px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--color-void);
  color: var(--color-bone-white);
  font-family: var(--font-sans);
  font-weight: 200;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--color-signal-red); color: #fff; }

/* Generated hero ambience — sits beneath the engine, never competes with type */
#ambience {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  opacity: 0;                 /* JS fades it in and out with the hero */
  mix-blend-mode: screen;
  transition: opacity 0.4s linear;
}

#backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

/* The Signal Engine canvas — fixed behind all content */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Reveal choreography ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

main, .footer { position: relative; z-index: 2; }

/* Layer order, high to low: access overlay > header (so the close toggle stays
   reachable) > mobile menu > engine canvas > ambience. */
.nav { position: relative; z-index: 60; }

/* ---------- Typography ---------- */

.display {
  font-size: clamp(46px, 7.8vw, 108px);
  font-weight: 400;
  font-stretch: 105%;
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.display-sm {
  font-size: clamp(38px, 5.7vw, 74px);
  font-weight: 400;
  font-stretch: 105%;
  line-height: 1.06;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.heading-lg {
  font-size: clamp(34px, 5.2vw, 74px);
  font-weight: 400;
  font-stretch: 108%;
  line-height: 1.06;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.heading {
  font-size: clamp(30px, 3.6vw, 46px);
  font-weight: 400;
  font-stretch: 108%;
  line-height: 1.08;
  letter-spacing: -0.038em;
  text-wrap: balance;
}

.body-lg {
  font-size: 17px;
  font-weight: 300;
  line-height: 1.62;
  color: var(--color-bone-white);
  max-width: 34em;
}

.quiet { color: var(--color-silver-mist); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-ember);
  margin-bottom: var(--sp-24);
}

em { font-style: normal; color: var(--color-ember); }

/* ---------- Buttons & links ---------- */

.btn-pill {
  display: inline-block;
  position: relative;
  overflow: hidden;
  background: var(--color-signal-red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 15px 26px;
  border-radius: 9999px;
  white-space: nowrap;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* red energy travelling through the button */
.btn-pill::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s ease;
}

.btn-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(229, 9, 20, 0.5);
}

.btn-pill:hover::after { left: 120%; }

@media (prefers-reduced-motion: reduce) {
  .btn-pill::after { display: none; }
}

.btn-lg { padding: 18px 36px; }

.ghost-link {
  color: var(--color-ash-gray);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.ghost-link:hover { color: var(--color-ember); }

/* ---------- Nav ---------- */

.nav {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-30) var(--sp-24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-24);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  text-decoration: none;
  color: var(--color-bone-white);
}

.logo-mark { width: 26px; height: 26px; }

.logo-word {
  font-size: 19px;
  font-weight: 500;
  font-stretch: 108%;
  letter-spacing: -0.015em;
}

.nav-links {
  display: flex;
  gap: var(--sp-30);
}

.nav-links a {
  position: relative;
  color: var(--color-ash-gray);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%;
  height: 1px;
  background: var(--color-signal-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-links a:hover { color: var(--color-bone-white); }
.nav-links a:hover::after { transform: scaleX(1); }

/* ---------- Hero ---------- */

.hero {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-60) var(--sp-24) var(--sp-120);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: var(--sp-36);
  min-height: 82vh;
}

.hero-copy .body-lg { margin-top: var(--sp-30); }

.hero-actions {
  margin-top: var(--sp-36);
  display: flex;
  align-items: center;
  gap: var(--sp-30);
}

.hero-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 420px;
}

#constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Stats ---------- */

.stats {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-96) var(--sp-24);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-60);
}

.stat-number {
  display: block;
  font-size: clamp(54px, 5.8vw, 92px);
  font-weight: 400;
  font-stretch: 108%;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: var(--color-bone-white);
}

.stat-unit {
  font-family: var(--font-mono);
  font-size: 0.3em;
  font-weight: 400;
  color: var(--color-ember);
  margin-left: 8px;
  letter-spacing: 0.02em;
}

.stat-label {
  display: block;
  margin-top: var(--sp-24);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ash-gray);
  max-width: 250px;
  line-height: 1.7;
}

/* ---------- Split sections (zigzag) ---------- */

.split {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-120) var(--sp-24);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--sp-60);
  align-items: start;
}

.split.reverse { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
.split.reverse .split-head { order: 2; }
.split.reverse .split-body { order: 1; }

@media (min-width: 901px) {
  .split.reverse .split-head { order: 1; }
  .split.reverse .split-body { order: 2; }
}

.split-body { padding-top: var(--sp-12); }
.split-body .body-lg + .body-lg { margin-top: var(--sp-24); }

/* ---------- Channels ---------- */

.channels {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-120) var(--sp-24);
}

.channels .heading { margin-bottom: var(--sp-60); max-width: 720px; }

.channel-list { list-style: none; }

.channel {
  display: grid;
  grid-template-columns: 64px minmax(200px, 340px) 1fr;
  align-items: baseline;
  gap: var(--sp-24);
  padding: var(--sp-30) 0;
}

.channel-index {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--color-signal-red);
}

.channel-name {
  font-size: clamp(26px, 3.2vw, 40px);
  font-weight: 400;
  font-stretch: 110%;
  line-height: 1.2;
  letter-spacing: -0.04em;
  color: var(--color-bone-white);
  transition: color 0.25s ease;
}

.channel:hover .channel-name,
.channel:focus-visible .channel-name { color: var(--color-ember); }

.channel:focus-visible {
  outline: 1px solid var(--color-signal-red);
  outline-offset: 8px;
}

.channel-desc {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--color-silver-mist);
  max-width: 34em;
}

/* ---------- Steps ---------- */

.step-list {
  list-style: none;
  margin-top: var(--sp-36);
  display: flex;
  flex-direction: column;
  gap: var(--sp-24);
}

.step-list li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-24);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--color-signal-red);
}

.step-text {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--color-bone-white);
}

/* ---------- Voice ---------- */

.voice {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-120) var(--sp-24);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.voice-copy { max-width: 620px; }
.voice-copy .body-lg { margin-top: var(--sp-30); }

/* ---------- Reactivation set piece ---------- */

.reactivation {
  position: relative;
  min-height: 220vh;   /* scroll length = the wavefront's timeline */
}

.reactivation-copy {
  position: sticky;
  top: 18vh;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--sp-24);
}

.reactivation-copy .body-lg { margin-top: var(--sp-30); }

.reactivation-payoff { margin-top: var(--sp-36); }

/* ---------- Manifesto ---------- */

.manifesto {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-120) var(--sp-24);
  text-align: left;
}

.manifesto-body { margin-top: var(--sp-36); }

/* ---------- CTA ---------- */

.cta {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-120) var(--sp-24);
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-30);
}

/* ---------- Footer ---------- */

.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-60) var(--sp-24) var(--sp-96);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-24);
  flex-wrap: wrap;
}

.footer-links { display: flex; gap: var(--sp-24); }

.footer-links a {
  color: var(--color-ash-gray);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.footer-links a:hover { color: var(--color-bone-white); }

.footer-note {
  width: 100%;
  margin-top: var(--sp-24);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--color-ash-gray);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: unset;
    padding-top: var(--sp-36);
  }

  /* the fixed stage canvas covers the viewport — no spacer needed on mobile */
  .hero-visual { display: none; }

  .hero { min-height: 88vh; align-content: center; }

  .nav-links { display: none; }

  .stats { grid-template-columns: 1fr; gap: var(--sp-36); padding: var(--sp-60) var(--sp-24); }

  .split, .split.reverse { grid-template-columns: 1fr; padding: var(--sp-60) var(--sp-24); }

  .channel {
    grid-template-columns: 40px 1fr;
    grid-template-areas: "idx name" ". desc";
  }
  .channel-index { grid-area: idx; }
  .channel-name  { grid-area: name; }
  .channel-desc  { grid-area: desc; }

  .channels, .manifesto, .cta { padding: var(--sp-60) var(--sp-24); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn-pill { transition: none; }
}

/* ============================================================
   Request Access overlay — same language as the page:
   void ground, instrument labels, one red signal.
   ============================================================ */

.access {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  /* MUST come with the [hidden] rule below: a class-level `display` beats the
     UA stylesheet's [hidden]{display:none}, which would leave this invisible
     overlay on top of the page swallowing every click. */
  align-items: center;
  justify-content: center;
  padding: var(--sp-24);
}

.access[hidden] { display: none; }

.access-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.access.is-open .access-scrim { opacity: 1; }

.access-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(28px, 4vw, 52px);
  background: var(--color-void);
  border: 1px solid rgba(229, 9, 20, 0.28);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.access.is-open .access-panel { opacity: 1; transform: none; }

.access-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--color-ash-gray);
  cursor: pointer;
  border-radius: 9999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.access-close:hover { color: var(--color-bone-white); background: rgba(255,255,255,0.06); }

.access-sub { margin-top: var(--sp-18); }

/* ---- fields ---- */

.field {
  position: relative;
  margin-top: var(--sp-30);
  padding-bottom: 18px;        /* reserved space for the error line */
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ash-gray);
  margin-bottom: var(--sp-12);
}

.field input,
.field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  padding: 10px 0;
  color: var(--color-bone-white);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.5;
  border-radius: 0;                 /* iOS strips its own styling */
  -webkit-appearance: none;
  transition: border-color 0.25s ease;
}

.field textarea { resize: vertical; min-height: 76px; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--color-signal-red);
}

/* red signal travelling along the active field's underline */
.field::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 18px;                /* matches .field padding-bottom */
  height: 1px;
  width: 100%;
  background: var(--color-signal-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.field:focus-within::after { transform: scaleX(1); }

.field.has-error input,
.field.has-error textarea { border-bottom-color: var(--color-ember); }

.field-error {
  position: absolute;
  left: 0;
  bottom: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--color-ember);
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.access-submit {
  margin-top: var(--sp-36);
  width: 100%;
  text-align: center;
  border: none;
  cursor: pointer;
}

.access-submit:disabled { opacity: 0.6; cursor: default; }

.access-note {
  margin-top: var(--sp-18);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.7;
  color: var(--color-ash-gray);
  text-align: center;
}

/* ---- confirmation ---- */

.access-done { text-align: center; padding: var(--sp-30) 0; }

.access-done .body-lg { margin: var(--sp-18) auto 0; }

.access-mark {
  width: 46px;
  height: 46px;
  margin-bottom: var(--sp-30);
  opacity: 0;
  transform: translateY(10px);
  animation: mark-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes mark-in { to { opacity: 1; transform: none; } }

.access-dismiss {
  margin-top: var(--sp-36);
  background: none;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .access-scrim,
  .access-panel,
  .field::after { transition: none; }
  .access-mark { animation: none; opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .access { padding: var(--sp-12); align-items: flex-start; padding-top: var(--sp-36); }
  .access-panel { max-height: 88vh; }
}

/* keep the panel's scrollbar inside the palette */
.access-panel { scrollbar-width: thin; scrollbar-color: rgba(229,9,20,0.5) transparent; }
.access-panel::-webkit-scrollbar { width: 6px; }
.access-panel::-webkit-scrollbar-track { background: transparent; }
.access-panel::-webkit-scrollbar-thumb {
  background: rgba(229, 9, 20, 0.45);
  border-radius: 9999px;
}
.access-panel::-webkit-scrollbar-thumb:hover { background: rgba(229, 9, 20, 0.7); }

.field label .opt {
  color: rgba(154, 154, 154, 0.6);
  letter-spacing: 0.04em;
  text-transform: none;
}

.access-note.is-error { color: var(--color-ember); }
.access-mail { color: var(--color-ember); text-decoration: underline; }

/* ============================================================
   Mobile menu
   ============================================================ */

.nav-toggle {
  display: none;              /* desktop shows the real links instead */
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 60;
}

.nav-toggle-bar {
  position: absolute;
  left: 11px;
  width: 22px;
  height: 1px;
  background: var(--color-bone-white);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s linear;
}

.nav-toggle-bar:nth-child(1) { top: 18px; }
.nav-toggle-bar:nth-child(2) { top: 25px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(3.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  transform: translateY(-3.5px) rotate(-45deg);
}

.nav-menu {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--color-void);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-36);
  padding: var(--sp-96) var(--sp-24) var(--sp-60);
  opacity: 0;
  transition: opacity 0.32s ease;
}

/* a class-level display must always ship with its own [hidden] rule,
   or the attribute silently does nothing and this covers the page */
.nav-menu[hidden] { display: none; }

.nav-menu.is-open { opacity: 1; }

.nav-menu nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-24);
}

.nav-menu a {
  display: flex;
  align-items: baseline;
  gap: var(--sp-18);
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 400;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  color: var(--color-bone-white);
  text-decoration: none;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.4s ease, color 0.2s ease;
}

.nav-menu.is-open a { transform: none; opacity: 1; }

.nav-menu.is-open a:nth-child(1) { transition-delay: 0.04s; }
.nav-menu.is-open a:nth-child(2) { transition-delay: 0.08s; }
.nav-menu.is-open a:nth-child(3) { transition-delay: 0.12s; }
.nav-menu.is-open a:nth-child(4) { transition-delay: 0.16s; }
.nav-menu.is-open a:nth-child(5) { transition-delay: 0.20s; }
.nav-menu.is-open a:nth-child(6) { transition-delay: 0.24s; }

.nav-menu a:active { color: var(--color-ember); }

.nav-menu-index {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-signal-red);
}

.nav-menu-cta {
  align-self: flex-start;
  opacity: 0;
  transform: translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.28s,
              opacity 0.4s ease 0.28s;
}

.nav-menu.is-open .nav-menu-cta { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-cta { display: none; }        /* the CTA lives inside the menu instead */
}

@media (prefers-reduced-motion: reduce) {
  .nav-menu, .nav-menu a, .nav-menu-cta, .nav-toggle-bar { transition: none; }
}
