/* Landing v3 — the "See how it works" scroll story. Layers on landing-v2.css
   (the fold, header, scroll line, beta form, footer are v2's). Scoped to
   .sl-landing-v3 so nothing here leaks into `/` until the promote.
   Plan: docs/plan-landing-v3-story.md */

.sl-landing-v3 {
  /* The two voices. Publisher = Snapi blue family, Audience = one warm accent.
     Both token pairs carry their own dark values via <html data-theme>. */
  --sl-pub: var(--chakra-colors-accent-blue-fg);
  --sl-pub-bg: var(--chakra-colors-accent-blue-bg);
  --sl-aud: var(--chakra-colors-accent-amber-fg);
  --sl-aud-bg: var(--chakra-colors-accent-amber-bg);
  /* Opaque page-matching fill: occludes the dotted centre line (z-index -1)
     behind text, invisible against the page (same fixed gradient as v2). */
  --sl-occlude: linear-gradient(155deg, var(--sl-bg) 0%, var(--sl-bg-gradient-tint) 100%) fixed;
  /* Illustration palette (the Open Peeps-style scenes in landing-v3/kit.tsx
     read ONLY these). Ink + hair follow the page's foreground so the line art
     survives dark mode; the fills are flat and few. */
  --sl-ink: var(--sl-fg);
  --sl-hair: var(--sl-fg);
  --sl-paper: var(--sl-card-bg);
  --sl-panel: var(--sl-surface-alt);
  --sl-skin-a: #f3c6a5;
  --sl-skin-b: #d39a6c;
  --sl-skin-c: #8d5a3b;
  --sl-shirt-a: #cbd5e1;
  --sl-shirt-b: #e2e8f0;
  --sl-shirt-c: #94a3b8;
  --sl-trousers: #475569;
}
[data-theme="dark"] .sl-landing-v3 {
  /* Hair and shoes keep a dark mass with the light ink outline — filled with
     the ink itself they read as white hair on the slate canvas. */
  --sl-hair: #334155;
  --sl-skin-a: #e8b48f;
  --sl-skin-b: #c08a5f;
  --sl-skin-c: #7c4f33;
  --sl-shirt-a: #64748b;
  --sl-shirt-b: #475569;
  --sl-shirt-c: #64748b;
  --sl-trousers: #94a3b8;
}

/* ---------- Section ---------- */
.sl-landing-v3 .sl-story {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  /* A panel waiting for its entrance sits 24 px toward its own edge; clip
     that sideways (clip, not hidden: no scroll container, nothing sticky
     breaks) so the page never scrolls horizontally on a phone. */
  overflow-x: clip;
}
.sl-landing-v3 .sl-story__intro {
  text-align: center;
  padding: 48px 0 8px;
}
.sl-landing-v3 .sl-story__lede {
  font-size: 18px;
  line-height: 1.5;
  color: var(--sl-fg-muted);
  max-width: 560px;
  margin: 12px auto 0;
  background: var(--sl-occlude);
}
.sl-landing-v3 .sl-story__legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  background: var(--sl-occlude);
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  padding: 6px 10px;
}

/* ---------- Rows ---------- */
.sl-landing-v3 .sl-story__row {
  min-height: 70vh;
  padding: 56px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sl-landing-v3 .sl-story__headline {
  margin-bottom: 36px;
  padding: 0 12px;
  font-size: clamp(26px, 3.4vw, 36px);
}
.sl-landing-v3 .sl-story__num {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  margin-inline-end: 0.45em;
  border-radius: 999px;
  font-family: var(--font-face-sans, 'Geist'), system-ui, sans-serif;
  font-size: 0.5em;
  font-weight: 700;
  vertical-align: 0.35em;
  background: var(--sl-fg);
  color: var(--sl-bg);
}
.sl-landing-v3 .sl-story__grid {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: center;
}
.sl-landing-v3 .sl-story__gutter {
  min-height: 1px;
  /* The crossing tokens (motion.tsx GutterTravel) ride above both panels. */
  position: relative;
  z-index: 3;
}
/* One travelling token: centred on the line; motion moves it from there. */
.sl-landing-v3 .sl-story__token {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  color: var(--sl-ink);
  pointer-events: none;
}
.sl-landing-v3 .sl-story__token svg {
  display: block;
}
.sl-landing-v3 .sl-story__count {
  font-variant-numeric: tabular-nums;
}

/* ---------- Panels ---------- */
.sl-landing-v3 .sl-story__panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sl-landing-v3 .sl-story__panel--publisher {
  /* Logical: each panel leans toward the line; under dir="rtl" the grid
     mirrors (publisher right, audience left) and so does this. */
  align-items: flex-end;
  text-align: end;
}
.sl-landing-v3 .sl-story__panel--audience {
  align-items: flex-start;
  text-align: start;
}
.sl-landing-v3 .sl-story__tag {
  display: inline-block;
  font-family: var(--font-face-sans, 'Geist'), system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
}
.sl-landing-v3 .sl-story__panel--publisher .sl-story__tag,
.sl-landing-v3 .sl-story__tag--publisher {
  background: var(--sl-pub-bg);
  color: var(--sl-pub);
}
.sl-landing-v3 .sl-story__panel--audience .sl-story__tag,
.sl-landing-v3 .sl-story__tag--audience {
  background: var(--sl-aud-bg);
  color: var(--sl-aud);
}

/* The art box. With a scene inside it is a soft panel; without one (no scene
   yet) it is the P1 dashed placeholder showing the illustrator's brief
   through attr(data-note). */
.sl-landing-v3 .sl-story__art {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 4 / 3;
  border: 2px dashed var(--sl-pub-bg);
  border-radius: 20px;
  background: var(--sl-surface-alt);
  display: grid;
  place-items: center;
  color: var(--sl-fg-soft);
}
.sl-landing-v3 .sl-story__panel--audience .sl-story__art {
  border-color: var(--sl-aud-bg);
}
.sl-landing-v3 .sl-story__art:has(.sl-scene) {
  border-color: transparent;
  overflow: hidden;
}
.sl-landing-v3 .sl-scene {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--sl-ink);
}
/* Beat 4's greeting in the question bubble (scenes.tsx ScriptMorph). */
.sl-landing-v3 .sl-scene__script {
  font-family: var(--font-face-sans, 'Geist'), system-ui, sans-serif;
  font-weight: 600;
}
.sl-landing-v3 .sl-story__art:not(:has(.sl-scene))::after {
  content: attr(data-note);
  font-family: var(--font-face-sans, 'Geist'), system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  padding: 20px;
  max-width: 320px;
}
.sl-landing-v3 .sl-story__copy {
  margin: 0;
  max-width: 400px;
  font-size: 19px;
  line-height: 1.45;
  color: var(--sl-fg);
  background: var(--sl-occlude);
}
.sl-landing-v3 .sl-story__copy--publisher {
  justify-self: end;
  text-align: end;
}
.sl-landing-v3 .sl-story__copy--audience {
  justify-self: start;
  text-align: start;
}

/* ---------- Row 9: the map ---------- */
.sl-landing-v3 .sl-story__row--map {
  min-height: 0;
}
.sl-landing-v3 .sl-story__row--map .sl-reach {
  margin-top: 0;
}
/* The publisher's light + arcs over the map (ReachArcs.tsx). */
.sl-landing-v3 .sl-story__map {
  position: relative;
}
.sl-landing-v3 .sl-story__arcs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
}
.sl-landing-v3 .sl-story__caption {
  margin: 28px auto 24px;
  font-size: clamp(32px, 5vw, 52px);
}
.sl-landing-v3 .sl-story__grid--lines {
  align-items: start;
}

/* ---------- Row 10: the close ---------- */
.sl-landing-v3 .sl-story__row--close {
  padding-bottom: 24px;
}
.sl-landing-v3 .sl-story__cta {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-face-sans, 'Geist'), system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.sl-landing-v3 .sl-story__cta:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}
.sl-landing-v3 .sl-story__cta--publisher {
  background: var(--sl-pub);
}
.sl-landing-v3 .sl-story__cta--audience {
  background: var(--sl-aud);
}
/* The beta form (#beta) slides up under the publisher panel. One DOM node:
   column 1 of the second grid row on desktop, full width after the stacked
   panels on mobile. */
.sl-landing-v3 .sl-story__grid--close .sl-story__beta {
  grid-column: 1;
  grid-row: 2;
  justify-self: end;
  width: 100%;
  max-width: 440px;
  margin-top: 28px;
}
.sl-landing-v3 .sl-story__beta .sl-beta {
  padding: 0;
  max-width: none;
  text-align: end;
  scroll-margin-top: 120px;
}
.sl-landing-v3 .sl-story__beta .sl-beta__form {
  margin-top: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
}
.sl-landing-v3 .sl-story__beta .sl-beta__name-group {
  grid-column: 1 / -1;
}
.sl-landing-v3 .sl-story__end {
  height: 1px;
  margin-top: 56px;
}

/* ---------- Mobile: the panels stack around the centre line ---------- */
@media (max-width: 899px) {
  .sl-landing-v3 .sl-story {
    padding: 16px 20px 24px;
  }
  .sl-landing-v3 .sl-story__row {
    min-height: 0;
    padding: 40px 0;
  }
  .sl-landing-v3 .sl-story__headline {
    margin-bottom: 24px;
  }
  .sl-landing-v3 .sl-story__grid {
    grid-template-columns: 1fr;
    row-gap: 28px;
  }
  /* The gutter becomes a zero-height row between the stacked panels — the
     crossing is a short vertical hop through it (negative margins cancel
     the extra row gap). */
  .sl-landing-v3 .sl-story__gutter {
    height: 0;
    min-height: 0;
    margin: -14px 0;
  }
  .sl-landing-v3 .sl-story__grid--lines .sl-story__gutter {
    display: none;
  }
  .sl-landing-v3 .sl-story__grid--close .sl-story__beta {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    max-width: none;
    margin-top: 0;
    background: var(--sl-occlude);
  }
  .sl-landing-v3 .sl-story__beta .sl-beta {
    text-align: start;
  }
  /* The line's end cap sits 40 px above this anchor; with the form now full
     width under it, push the anchor down so the cap clears the form. */
  .sl-landing-v3 .sl-story__end {
    margin-top: 96px;
  }
  .sl-landing-v3 .sl-story__panel,
  .sl-landing-v3 .sl-story__panel--publisher,
  .sl-landing-v3 .sl-story__panel--audience {
    align-items: flex-start;
    text-align: start;
    /* The centre line runs behind the stacked panels; keep it hidden under
       text the same way the headings do. */
    background: var(--sl-occlude);
    padding: 4px 0;
  }
  .sl-landing-v3 .sl-story__art {
    max-width: 100%;
  }
  .sl-landing-v3 .sl-story__copy,
  .sl-landing-v3 .sl-story__copy--publisher,
  .sl-landing-v3 .sl-story__copy--audience {
    max-width: none;
    text-align: start;
    justify-self: stretch;
  }
  .sl-landing-v3 .sl-story__grid--lines {
    row-gap: 12px;
  }
}
