/* eveli.ai waitlist — editorial system.
   Paper white, near-black ink, 1px hairlines, 0 radius, no shadows.
   Type: Helvetica Neue body, Baskerville H1 (system fonts, no web-font load). */

:root {
  --paper: #ffffff;
  --ink: #000000;
  --ink-soft: #151515;
  --dim: #787878;
  --mute: #a0a3a2;
  --hair: #dcd9d4;
  --field: 360px;
  /* Authoritative EVELI type system (mirrored from app/src/theme.css). Body =
     Helvetica Neue stack; H1 = Baskerville stack @500. System fonts only. */
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: Baskerville, "Baskerville Old Face", Garamond, "Times New Roman", serif;
  --font-display-weight: 500;
  --font: var(--font-sans);

  /* ── EVELI grid system — 12 / 8 / 4 responsive grid ──
     Desktop 12 cols · tablet 8 · mobile 4. Breakpoints: tablet ≥768px,
     desktop ≥1024px. Mobile safe padding is exactly 20px. The waitlist is a
     centered single-column layout, so the grid governs it through the
     container + narrow/paragraph maxes below (these replace the old one-off
     520/620 widths). */
  --grid-columns-desktop: 12;
  --grid-columns-tablet: 8;
  --grid-columns-mobile: 4;

  --page-padding-mobile: 20px;
  --page-padding-tablet: 32px;
  --page-padding-desktop: 48px;

  --grid-gutter-mobile: 16px;
  --grid-gutter-tablet: 20px;
  --grid-gutter-desktop: 24px;

  --content-max: 1280px;
  --narrow-content-max: 620px;
  --paragraph-max: 520px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 24px;
}

/* margin:auto centers the active state vertically when it fits, and collapses to
   0 when content is taller than the viewport (so nothing is clipped — it scrolls). */
.state { width: 100%; max-width: var(--paragraph-max); text-align: center; display: none; margin: auto 0; }
.state.is-active { display: block; }

/* Type */
/* Every semantic H1 uses the Baskerville editorial stack @500 (matches the app). */
h1 {
  font-family: var(--font-display);
  font-weight: var(--font-display-weight);
}
.eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.headline {
  margin: 0 auto;
  max-width: 12em;
  font-size: 40px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.subtext {
  margin: 22px auto 0;
  max-width: 30em;
  font-size: 16px;
  line-height: 1.5;
  color: var(--dim);
}
.microlabel {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.number {
  margin: 0;
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.helper { margin: 22px 0 0; font-size: 12px; color: var(--mute); }

/* Minimal join line: "Join waitlist." bold black + "or don't." lighter gray. */
.join-line {
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: -0.01em;
  font-weight: var(--font-display-weight);
}
/* Spans inside the H1 inherit the display weight (no 700 bold inside an H1).
   Baskerville has no true 500, so this resolves to Regular — never synthesized
   bold. The two parts are differentiated by color, not weight. */
.join-strong { font-weight: var(--font-display-weight); color: var(--ink); }
.join-soft { font-weight: var(--font-display-weight); color: var(--dim); }

/* Phone priority screens (after questions / after phone). Sparse, monochrome. */
.eyebrow strong { font-weight: 700; color: var(--ink); }
#state-phone .number, #state-final .number { margin-top: 14px; }
.phone-offer { margin: 22px auto 0; max-width: 34em; font-size: 16px; line-height: 1.5; color: var(--ink); }
.phone-offer strong { font-weight: 700; }
.down-arrow { margin: 14px 0 22px; font-size: 20px; line-height: 1; color: var(--ink); }
.phone-row { width: 100%; max-width: var(--paragraph-max); margin: 0 auto; display: flex; justify-content: center; }
.phone-country {
  flex: 0 0 auto;
  height: 52px;
  border: 1px solid var(--hair);
  border-right: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  padding: 0 6px 0 12px;
  cursor: pointer;
}
.phone-row .field { flex: 1 1 auto; height: 52px; min-width: 0; }
.phone-row .btn-primary { width: auto; flex: 0 0 auto; height: 52px; padding: 0 30px; cursor: pointer; }
#phone-error { margin: 12px auto 0; max-width: var(--paragraph-max); }
.consent { margin: 18px auto 0; margin-inline: auto; max-width: min(100%, var(--paragraph-max)); font-size: 11px; line-height: 1.4; color: var(--mute); }

/* Double-opt-in confirmation + final reminder (v2 flow). Monochrome, minimal. */
/* Confirm + final content: responsive width, never hard-locked narrow, capped at
   620px (title fits one line on desktop). The 20px mobile gutters come from the
   .stage padding; content is centered with margin-inline. */
#state-confirm,
#state-final {
  width: min(100%, var(--narrow-content-max));
  max-width: var(--narrow-content-max);
  margin-inline: auto;
}
.confirm-title {
  margin: 0 auto;
  font-size: 26px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.confirm-body {
  margin: 16px auto 0;
  max-width: min(100%, var(--paragraph-max));
  margin-inline: auto;
  font-size: 15px;
  line-height: 1.4; /* 140% */
  color: var(--dim);
}
.confirm-body strong { color: var(--ink); font-weight: 600; }
.spam-note { max-width: min(100%, var(--paragraph-max)); margin-inline: auto; font-size: 13px; color: var(--mute); }
.phone-prompt { margin: 0 auto 14px; font-size: 15px; font-weight: 500; color: var(--ink); }
.phone-prompt strong { font-weight: 700; color: var(--ink); }
#state-confirm .btn-ghost { margin-top: 22px; }

/* Short HEADLINES only → balance: even, intentional line breaks, no orphans. */
.headline,
.join-line,
.confirm-title,
.q-headline,
.skip-title {
  text-wrap: balance;
}

/* Paragraph / BODY copy → pretty: fills the available width and only tidies the
   last line, so mobile copy never feels squeezed. (Browsers without `pretty`
   fall back to normal full-width wrapping — also not squeezed.) Not applied to
   buttons, inputs, labels/eyebrows, nav, the long privacy text, or tables. */
.subtext,
.helper,
.phone-offer,
.confirm-body,
.spam-note,
.phone-prompt,
.consent,
.dupe-note,
.skip-sub,
.q-subtext,
.q-context-sub {
  text-wrap: pretty;
}

/* Form */
.form {
  margin: 20px auto 0;
  width: 100%;
  max-width: var(--field);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--hair);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
}
.field::placeholder { color: var(--mute); }
.field:focus { border-color: var(--ink); }
.field.has-error { border-color: var(--ink); }

.btn-primary {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-ghost {
  margin: 18px auto 0;
  display: block;
  border: 0;
  background: none;
  color: var(--dim);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.error {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
}

.turnstile { display: flex; justify-content: center; }
.turnstile[hidden] { display: none; }
/* Invisible Turnstile: an empty container takes no space; it only appears if a
   challenge actually needs to be shown. */
.turnstile:empty { display: none; }

/* Minimal privacy link (required disclosure for invisible Turnstile). */
.footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px; text-align: center; }
.footer a {
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.footer a:hover { color: var(--dim); text-decoration: underline; }

/* Privacy page (doc layout). */
.stage--doc { align-items: flex-start; padding: 14vh 24px 12vh; }
.doc { max-width: 560px; text-align: left; }
.doc-title { margin: 14px 0 24px; font-size: 32px; font-weight: var(--font-display-weight); letter-spacing: -0.01em; color: var(--ink); }
.doc p { margin: 0 0 18px; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.doc a { color: var(--ink); text-decoration: underline; }
.doc .doc-back { margin-top: 28px; }
.doc .doc-back a { color: var(--dim); font-size: 13px; text-decoration: none; }

/* Position state */
.number { margin-top: 4px; }
.dupe-note { margin: 14px 0 0; font-size: 13px; color: var(--dim); }
.rule { width: var(--field); max-width: 100%; margin: 30px auto; border: 0; border-top: 1px solid var(--hair); }
.skip-title { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.skip-sub { margin: 10px auto 26px; max-width: 26em; font-size: 14px; line-height: 1.5; color: var(--dim); }
#state-position .btn-primary { max-width: var(--field); margin: 0 auto; }

/* Questions */
#state-questions { max-width: 560px; }
.q-headline {
  margin: 18px auto 28px;
  max-width: 16em;
  font-size: 30px;
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.q-subtext { margin: -14px auto 26px; max-width: 30em; font-size: 13px; line-height: 1.5; color: var(--dim); }

/* Original waitlist-number status note above Question 1 (Q1 only). */
#q-context { margin: 0 auto 30px; }
.q-context-num { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.q-context-sub { margin: 6px 0 0; font-size: 13px; color: var(--dim); }
.options {
  margin: 0 auto 12px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option {
  width: 100%;
  min-height: 48px;
  padding: 14px 20px;
  border: 1px solid var(--hair);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.option[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 500;
}
#state-questions .field { max-width: 480px; margin: 0 auto; }
#state-questions .btn-primary { max-width: 480px; margin: 20px auto 0; }
#q-error { max-width: 480px; margin: 10px auto 0; text-align: center; }

/* Footer dev note */
.env-note {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--mute);
  text-align: center;
  background: #faf9f8;
  border-top: 1px solid var(--hair);
}

@media (max-width: 600px) {
  .stage { padding: 6vh 20px; }
  .headline { font-size: 32px; }
  .number { font-size: 52px; }
  .q-headline { font-size: 24px; }
  .confirm-title { font-size: 22px; }
}

/* ════════════════════════ EVELI grid system ════════════════════════
   Reusable 12 / 8 / 4 responsive layout foundation (tokens in :root above).
   The waitlist is a centered single-column layout, so it is governed via
   .eveli-container + the narrow/paragraph maxes; the full column grid + spans
   are provided for parity with the beta app and any future multi-column pages. */

.eveli-container {
  width: min(100% - calc(var(--page-padding-mobile) * 2), var(--content-max));
  margin-inline: auto;
}

.eveli-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns-mobile), minmax(0, 1fr));
  column-gap: var(--grid-gutter-mobile);
}

.eveli-grid-span-full,
.eveli-grid-span-12,
.eveli-grid-span-9,
.eveli-grid-span-8,
.eveli-grid-span-6,
.eveli-grid-span-4,
.eveli-grid-span-3 { grid-column: 1 / -1; }

.eveli-grid-center-6,
.eveli-grid-center-8 { grid-column: 1 / -1; }

.eveli-narrow {
  width: min(100% - calc(var(--page-padding-mobile) * 2), var(--narrow-content-max));
  margin-inline: auto;
}
.eveli-paragraph {
  max-width: var(--paragraph-max);
  margin-inline: auto;
}

@media (min-width: 768px) { /* tablet — 8 columns */
  .eveli-container { width: min(100% - calc(var(--page-padding-tablet) * 2), var(--content-max)); }
  .eveli-grid {
    grid-template-columns: repeat(var(--grid-columns-tablet), minmax(0, 1fr));
    column-gap: var(--grid-gutter-tablet);
  }
  .eveli-grid-span-3 { grid-column: span 2; }
  .eveli-grid-span-4 { grid-column: span 4; }
  .eveli-grid-span-6 { grid-column: span 4; }
  .eveli-grid-span-8 { grid-column: span 6; }
  .eveli-grid-span-9 { grid-column: span 6; }
  .eveli-grid-span-12,
  .eveli-grid-span-full { grid-column: 1 / -1; }
  .eveli-grid-center-6 { grid-column: 3 / span 4; }
  .eveli-grid-center-8 { grid-column: 2 / span 6; }
}

@media (min-width: 1024px) { /* desktop — 12 columns */
  .eveli-container { width: min(100% - calc(var(--page-padding-desktop) * 2), var(--content-max)); }
  .eveli-grid {
    grid-template-columns: repeat(var(--grid-columns-desktop), minmax(0, 1fr));
    column-gap: var(--grid-gutter-desktop);
  }
  .eveli-grid-span-3 { grid-column: span 3; }
  .eveli-grid-span-4 { grid-column: span 4; }
  .eveli-grid-span-6 { grid-column: span 6; }
  .eveli-grid-span-8 { grid-column: span 8; }
  .eveli-grid-span-9 { grid-column: span 9; }
  .eveli-grid-span-12,
  .eveli-grid-span-full { grid-column: 1 / -1; }
  .eveli-grid-center-6 { grid-column: 4 / span 6; }
  .eveli-grid-center-8 { grid-column: 3 / span 8; }
}

/* ── Dev-only grid overlay ──────────────────────────────────────────────
   Off by default. Enable with ?grid=1 or localStorage.eveliGridDebug="true".
   Renders the current 4 / 8 / 12 columns. Never shown in normal usage. */
.eveli-grid-overlay { display: none; }
.eveli-grid-debug .eveli-grid-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}
.eveli-grid-debug .eveli-grid-overlay > .eveli-container { height: 100%; }
.eveli-grid-debug .eveli-grid-overlay .eveli-grid { height: 100%; grid-template-rows: 100%; }
.eveli-grid-debug .eveli-grid-overlay .eveli-grid > span {
  grid-row: 1;
  height: 100%;
  background: rgba(224, 30, 90, 0.06);
  outline: 1px solid rgba(224, 30, 90, 0.22);
}
.eveli-grid-debug .eveli-grid-overlay .eveli-grid > span:nth-child(n + 5) { display: none; }
@media (min-width: 768px) {
  .eveli-grid-debug .eveli-grid-overlay .eveli-grid > span:nth-child(-n + 8) { display: block; }
  .eveli-grid-debug .eveli-grid-overlay .eveli-grid > span:nth-child(n + 9) { display: none; }
}
@media (min-width: 1024px) {
  .eveli-grid-debug .eveli-grid-overlay .eveli-grid > span:nth-child(-n + 12) { display: block; }
}

/* ── Text-roll (Skiper58-style per-character hover roll) — SCOPED to 3 landing
   headlines only: "Join waitlist." (screen 1), "YOU ARE NOT ON THE LIST YET"
   (screen 2), "DON'T FORGET" (screen 3). NOT nav, footer, form, legal, or body
   copy. CSS + static markup — the per-character spans are generated at build
   time, so there is NO runtime JS.

   Accessibility: the full phrase is provided once as real .sr-only text; the
   entire visual per-character roll is aria-hidden, so each heading's accessible
   name is exactly the original phrase (never read letter-by-letter).

   Layout-stable by construction: each character's window is exactly one line
   tall and its duplicate is absolutely positioned at top:100% (out of flow),
   so nothing reflows/jumps. Word gaps are real spaces (wrap points preserved);
   letters carry no source whitespace, so they never gap or break mid-word. */

/* Screen-reader-only accessible phrase — visually hidden, zero layout impact. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.text-roll {
  display: inline-block;
  vertical-align: bottom;
  max-width: 100%;
}
/* Full-width headline variant (screen 2/3 h2) — preserves centering + wrap. */
.text-roll--block { display: block; }
/* Inline flow container so the phrase wraps like normal text. */
.text-roll__word { display: inline; }

/* One character = one clipped roll window. */
.tr-char {
  display: inline-block;
  position: relative;
  overflow: hidden;
  vertical-align: bottom;
}
.tr-inner {
  display: block;
  /* Per-character duration (organic speed variation); the pattern lives in the
     inline --duration on each .tr-char. */
  transition: transform var(--duration, 320ms) cubic-bezier(0.22, 0.61, 0.36, 1);
  transition-delay: 0s;
}
.tr-line { display: block; }
.tr-dup { position: absolute; top: 100%; left: 0; }

/* Roll on hover of the whole phrase. Each character uses a deterministic
   organic micro-offset (inline --delay, 0–60ms, non-sequential) and its own
   --duration, so letters roll with slight individual timing variation rather
   than a clean left-to-right wave. The stagger applies on the way in; the
   return is uniform (snappier, restrained). focus-* included for robustness
   (headings aren't focusable → no tabindex added; effect stays decorative). */
.text-roll:hover .tr-inner,
.text-roll:focus-within .tr-inner,
.text-roll:focus-visible .tr-inner {
  transform: translateY(-100%);
  transition-delay: var(--delay, 0ms);
}

/* Reduced motion: no roll, no stagger. */
@media (prefers-reduced-motion: reduce) {
  .tr-inner { transition: none; transition-delay: 0s; }
  .text-roll:hover .tr-inner,
  .text-roll:focus-within .tr-inner,
  .text-roll:focus-visible .tr-inner {
    transform: none;
    transition-delay: 0s;
  }
}
