/**
 * intro.css — intro curtain, hero and board ticker (workstream A).
 * Tokens only: every colour, font and easing comes from tokens.css.
 * Three degradation paths are first-class here:
 *   1. no JS   → curtain never renders, hero is fully visible.
 *   2. reduced motion → curtain never renders, all loops frozen.
 *   3. JS present → curtain renders, hero holds its layout but stays invisible until reveal.
 */

/* ==========================================================================
   1. Intro curtain
   ========================================================================== */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: transparent; /* the two panels paint the ink, so they can wipe apart */
  overflow: hidden;
  contain: layout paint;
}

/* Inert without JS: nothing to skip, nothing to reveal. */
html:not(.js) .curtain {
  display: none;
}

/* Two halves that wipe up/down at the split beat. */
.curtain-panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.2%; /* 0.2% overlap kills a sub-pixel seam on fractional viewports */
  background: var(--ink);
  will-change: clip-path;
}
.curtain-panel--top {
  top: 0;
  background: linear-gradient(180deg, var(--ink) 0%, #061309 100%);
}
.curtain-panel--bottom {
  bottom: 0;
  background: linear-gradient(0deg, var(--ink) 0%, #061309 100%);
}

.curtain-stage {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  padding-inline: var(--gutter);
  text-align: center;
}

.curtain-mark {
  width: clamp(104px, 22vw, 168px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 10px 34px rgba(212, 175, 55, 0.18));
}

/* The bone face of the W flashes to gold on the sweep beat. */
.curtain-mark-face {
  transition: stroke 220ms var(--ease-out);
}

.curtain-sweep {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(56vw, 420px);
  height: 3px;
  translate: -50% -50%;
  background: linear-gradient(
    90deg,
    rgba(212, 175, 55, 0) 0%,
    var(--gold-bright) 45%,
    var(--bone) 55%,
    rgba(212, 175, 55, 0) 100%
  );
  opacity: 0;
  pointer-events: none;
}

.curtain-line {
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-height: 1.4em; /* reserved so the text swap cannot nudge the stage */
}
.curtain-line::after {
  content: '';
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 0.25em;
  translate: 0 0.15em;
  background: var(--gold);
  opacity: 0.9;
}

.curtain-count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 0;
}
.curtain-count [data-curtain-count] {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.curtain-skip {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 88px;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--transition-interactive),
    border-color var(--transition-interactive);
}
.curtain-skip:hover {
  color: var(--bone);
  border-color: var(--gold);
}

/* Reduced motion: SPEC-002 §5 — no curtain at all. */
@media (prefers-reduced-motion: reduce) {
  .curtain {
    display: none !important;
  }
}

/* ==========================================================================
   2. Hero
   ========================================================================== */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(5rem, 11vh, 8.5rem) 0;
  overflow: clip;
}

/* While the curtain is on screen the hero keeps its box but paints nothing —
   layout is already settled, so the reveal costs zero CLS. */
html.js body.is-intro .hero {
  visibility: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  pointer-events: none;
}

.hero::after {
  /* Midnight vignette so the floodlight bloom has an edge to fall off against. */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, rgba(11, 61, 46, 0.42) 0%, transparent 62%);
}

.hero-spot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0) 68%);
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease-out);
  will-change: transform;
}
.hero.is-pointing .hero-spot {
  opacity: 1;
}
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .hero-spot {
    display: none;
  }
}

/* ── Hero composition ──────────────────────────────────────────────────────
   Three bands on a shared grid, so the section uses its full width instead of
   stacking a narrow column against dead space:

     rail   wordmark ....................................... meta
     copy   headline / lede / actions ............... mascot (bleeds right)
     foot   founder meter ......................... three standing facts

   `rail` and `foot` span both columns, which is what stops the right half from
   reading as empty at 1440px. Every band keeps its own baseline, so nothing
   relies on `align-items: end` matching two columns of unequal height — that
   mismatch is what pushed the old copy block up and away from the mascot.
   ────────────────────────────────────────────────────────────────────────── */

.hero-inner {
  display: grid;
  gap: clamp(1.75rem, 3.5vw, 2.75rem);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'rail'
    'copy'
    'media'
    'foot';
}

/* ── Band 1: the rail ── */

.hero-rail {
  grid-area: rail;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem clamp(1.5rem, 4vw, 3rem);
}

.hero-lockup {
  width: min(300px, 56vw);
  /* The supplied vector is tightly framed; no traced-art offset is needed. */
  margin-left: 0;
}
.hero-wordmark {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1685.67 / 566.68;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding-bottom: 0.4rem;
}
.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
/* Separators only where the row is guaranteed to fit on one line. When the row wraps, the
   divider lands at the start of the new line and reads as a stray pipe. */
@media (min-width: 560px) {
  .hero-meta-item + .hero-meta-item::before {
    content: '';
    width: 1px;
    height: 0.9em;
    margin-right: 0.3rem;
    background: var(--line-strong);
  }
}
.hero-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--win);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.16);
}
@media (prefers-reduced-motion: no-preference) {
  .hero-meta-dot {
    animation: hero-pulse 2.4s var(--ease-in-out) infinite;
  }
}
@keyframes hero-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.16);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(61, 220, 132, 0);
  }
}

/* ── Band 2: the copy ── */

.hero-copy {
  grid-area: copy;
  align-self: center;
  display: grid;
  justify-items: start;
  gap: clamp(1.1rem, 2vw, 1.6rem);
}

.hero-title {
  margin: 0;
  font-size: var(--text-hero);
  line-height: 0.9;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  /* No `text-wrap: balance`: the line breaks are authored as `.hero-line` spans so the
     gold "9AM." always lands at the end of line two. */
}
.hero-line {
  display: block;
}
.hero-word {
  display: inline-block;
  /* Reveal state is clip-path only (SPEC-002 §6: no vertical transform on reveals). */
  clip-path: inset(0 0 0 0);
  will-change: clip-path;
}
.hero-word--gold {
  color: var(--gold);
}
html.js body.is-intro .hero-word {
  clip-path: inset(0 0 105% 0);
}

.hero-lede {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(1.0625rem, 1.25vw, 1.25rem);
  color: var(--text-muted);
  border-left: 2px solid rgba(212, 175, 55, 0.5);
  padding-left: clamp(0.85rem, 1.2vw, 1.15rem);
}

/* One horizontal band: price, then the buttons, sharing a baseline. On the old layout
   these stacked into three short rows inside a narrow column, which is what made the
   whole block read as clustered in the corner. */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem clamp(1.25rem, 2.5vw, 2rem);
  margin: 0;
  padding-top: 0.25rem;
}

.hero-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0;
}
.hero-price-amount {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  line-height: 0.9;
  color: var(--bone);
  perspective: 400px; /* pricing-view.js flips this on geo resolve */
}
.hero-price-period {
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.hero-price-chip {
  align-self: center;
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.4);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.hero-cta {
  min-width: 200px;
}

.hero-fineprint {
  margin: 0;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── Band 2: the mascot ── */

.hero-media {
  grid-area: media;
  position: relative;
  align-self: end;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  /* Pointer parallax (mascot.js) writes these; the idle bob is a GSAP transform on the
     stage, so the two never fight over the same property. */
  --lean-x: 0px;
  --lean-y: 0px;
  --lean-rot: 0deg;
}
.hero-mascot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1958.4 / 1584; /* reserved box: the art can never shift the grid */
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6));
  transform: translate3d(var(--lean-x), var(--lean-y), 0) rotate(var(--lean-rot));
  transition: transform 120ms linear;
}
.hero-media.is-live .hero-mascot {
  transition: none; /* the rAF lerp is the smoothing once parallax is driving */
}

/* Gold floor glow, so the dog sits in the scene instead of floating on the gradient. */
.hero-media::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -2%;
  height: 14%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(212, 175, 55, 0.22), transparent 70%);
  pointer-events: none;
}

/* ── Band 3: the foot ── */

.hero-foot {
  grid-area: foot;
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-top: clamp(1.1rem, 2vw, 1.6rem);
  border-top: 1px solid var(--line);
}

.hero-founders {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}
.hero-founders[hidden] {
  display: none;
}
.hero-founder-figure {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--gold);
}
.hero-founder-sep,
.hero-founder-cap {
  color: var(--text-faint);
  font-size: 1.05rem;
}
.hero-founder-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* Progress track. `--claimed` is set by pricing-view.js; 0% is a valid resting state. */
.hero-meter {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: rgba(248, 245, 233, 0.12);
  overflow: hidden;
}
.hero-meter::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--claimed, 0%);
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 900ms var(--ease-out);
}

/* Three standing facts. These are the reason the foot band is worth its width: they
   turn the old empty rail into information, and they hold the layout when the founder
   meter is hidden (JS off, or before /api/config resolves). */
.hero-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.hero-fact {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.hero-fact-value {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  line-height: 1;
  color: var(--bone);
}
.hero-fact-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── Wide: two columns, mascot bleeding into the right gutter ── */

@media (min-width: 1040px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    /* The art column runs the FULL height of the section, alongside both the wordmark row
       and the copy row. Letting it start below the wordmark left a dead rectangle in the
       top-right corner of the viewport — the single largest void in the old layout. */
    grid-template-areas:
      'rail media'
      'copy media'
      'foot foot';
    column-gap: clamp(2rem, 4vw, 4rem);
  }
  .hero-rail {
    /* Wordmark and meta stack in the left column now that the art owns the right. */
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: clamp(0.75rem, 1.5vw, 1.25rem);
  }
  .hero-media {
    max-width: none;
    justify-self: stretch;
    align-self: center;
    /* Bleeds into the page gutter: the art runs to the edge of the viewport instead of
       stopping short and leaving a channel of background between it and the frame. */
    margin-right: calc(var(--gutter) * -1);
    margin-bottom: clamp(0.5rem, 1.5vw, 1.5rem);
    z-index: 1;
  }
  .hero-mascot {
    margin-left: auto;
    width: min(100%, 700px);
  }
  .hero-foot {
    /* Explicit tracks, and explicit placement below: the founder meter starts the page
       `hidden` (it needs /api/config), and with implicit placement the facts slid into
       column 1 and the whole band collapsed to half width. */
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.55fr);
    align-items: center;
    column-gap: clamp(2rem, 5vw, 5rem);
  }
  .hero-founders {
    grid-column: 1;
    grid-row: 1;
  }
  .hero-facts {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* Divider drawn as a border on the facts themselves, so it cannot escape the
       container the way an absolutely placed grid sibling did. */
    border-left: 1px solid var(--line);
    padding-left: clamp(2rem, 5vw, 5rem);
    margin-left: calc(clamp(2rem, 5vw, 5rem) * -1);
  }
  /* With the meter hidden there is nothing to divide, so the facts take the full band. */
  .hero-founders[hidden] + .hero-facts {
    grid-column: 1 / -1;
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
  }
}

@media (min-width: 1040px) and (max-width: 1240px) {
  .hero-lede {
    max-width: 30ch;
  }
}

@media (max-width: 1039px) {
  .hero-media {
    max-width: 340px;
    justify-self: start;
  }
  .hero-facts {
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  }
}

/* ==========================================================================
   3. Board ticker
   ========================================================================== */

.ticker {
  position: relative;
  border-block: 1px solid var(--line);
  background: linear-gradient(180deg, var(--field-deep) 0%, var(--ink) 100%);
  padding-block: 0.75rem;
  overflow: hidden;
  --ticker-dur: 46s;
}
.ticker::before,
.ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(40px, 8vw, 120px);
  z-index: 2;
  pointer-events: none;
}
.ticker::before {
  left: 0;
  background: linear-gradient(90deg, var(--ink), transparent);
}
.ticker::after {
  right: 0;
  background: linear-gradient(270deg, var(--ink), transparent);
}

.ticker-row {
  overflow: hidden;
}
.ticker-row--alt {
  --ticker-dur: 58s;
  border-top: 1px solid var(--line);
  margin-top: 0.65rem;
  padding-top: 0.65rem;
}

.ticker-track {
  display: flex;
  width: max-content;
}

.ticker-group {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
  margin: 0;
  padding: 0 clamp(0.75rem, 1.5vw, 1.5rem);
  list-style: none;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
  font-size: 0.8125rem;
}
.ticker-league {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold);
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(212, 175, 55, 0.32);
  border-radius: 4px;
}
.ticker-pick {
  color: var(--text-muted);
}
.ticker-odds {
  font-weight: 700;
  color: var(--bone);
}
.ticker-flag {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 3px;
}
/* Glyph carries the result as well as the colour (SPEC-002 §9). */
.ticker-flag--win {
  color: var(--win);
  background: rgba(61, 220, 132, 0.14);
}
.ticker-flag--loss {
  color: var(--loss);
  background: rgba(226, 86, 79, 0.14);
}

@media (prefers-reduced-motion: no-preference) {
  .ticker-row[data-marquee-dir='left'] .ticker-track {
    animation: ticker-left var(--ticker-dur) linear infinite;
  }
  .ticker-row[data-marquee-dir='right'] .ticker-track {
    animation: ticker-right var(--ticker-dur) linear infinite;
  }
  /* Paused on hover, and while the intro is still up. */
  .ticker-row:hover .ticker-track,
  .ticker-row:focus-within .ticker-track,
  body.is-locked .ticker-track,
  .ticker-row.is-paused .ticker-track {
    animation-play-state: paused;
  }
}

@keyframes ticker-left {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}
@keyframes ticker-right {
  from {
    transform: translate3d(-50%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

/* ==========================================================================
   4. Shared reveal states used by motion.js
   ========================================================================== */

/* Pre-reveal state is applied by JS (.is-hidden) rather than by default CSS, so a
   JS-off or failed-JS page always shows finished content. */
@media (prefers-reduced-motion: no-preference) {
  html.js [data-reveal].is-hidden {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    filter: blur(6px);
  }
  html.js [data-reveal].is-revealed {
    opacity: 1;
    clip-path: inset(0 0 -20% 0);
    filter: blur(0);
    transition:
      opacity 620ms var(--ease-out),
      clip-path 720ms var(--ease-out),
      filter 620ms var(--ease-out);
  }
}

/* Card tilt (motion.js writes the angles as custom properties). */
.tilt {
  transform: perspective(700px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
    translate3d(0, var(--tilt-lift, 0px), 0);
  transition: transform 220ms var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .tilt {
    transform: none;
  }
}

/* ── Polish pass: keep the primary call to action above the fold on short,
   wide displays (laptops at 1440x900 and below) without shrinking mobile. ── */
@media (min-width: 900px) and (max-height: 960px) {
  .hero {
    padding-block: 2.5rem 0;
  }
  .hero-lockup {
    width: min(252px, 42vw);
  }
  .hero-title {
    font-size: clamp(2.5rem, 5.2vw, 5rem);
  }
  .hero-inner {
    gap: clamp(1.25rem, 2.4vw, 2rem);
  }
  .hero-foot {
    padding-top: 1rem;
  }
}
