/* Full-bleed scroll-told hero. Self-contained; reuses :root tokens from styles.css.
   The map is the whole stage; a camera (SVG viewBox) moves across it as you scroll,
   and the pitch + story copy sit over a paper scrim. Removable without touching styles.css. */

.story {
  position: relative;
  height: 320vh;            /* scroll track the sticky stage travels through */
  background: var(--paper);
}

.story-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--paper-2);
}

/* the map fills the stage and is cropped to cover (camera set via viewBox in JS) */
.story-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* legibility scrim: paper fading away from the copy */
.story-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right,
      rgba(246, 242, 234, 0.97) 0%,
      rgba(246, 242, 234, 0.90) 26%,
      rgba(246, 242, 234, 0.45) 46%,
      rgba(246, 242, 234, 0.00) 62%);
}

.story-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 clamp(24px, 6vw, 84px);
  pointer-events: none;
}
.story-inner { width: 100%; max-width: 580px; }
.story-inner .hero-actions { pointer-events: auto; }

.story-inner .eyebrow { margin-bottom: 18px; }

.story-pitch {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 20px;
  text-wrap: balance;
  min-height: 2.1em;          /* hold height so copy below doesn't jump between beats */
  transition: opacity .32s ease, transform .32s ease;
}
.story-caption {
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 30em;
  min-height: 2.8em;
  transition: opacity .32s ease, transform .32s ease;
}
.story-pitch.is-swapping, .story-caption.is-swapping { opacity: 0; transform: translateY(8px); }

.story-inner .hero-actions { margin-bottom: 24px; }

/* opt-in control, shown only to reduced-motion visitors (JS unhides it) */
.story-play {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  margin: 2px 0 20px;
  padding: 11px 18px;
  font-family: var(--sans); font-size: 15px; font-weight: 700; color: var(--green);
  background: transparent; border: 1.5px solid var(--green); border-radius: 100px;
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.story-play:hover { background: var(--green); color: #fff; }
.story-play svg { flex-shrink: 0; }

.story-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: -10px 0 0; pointer-events: auto; }
/* each step is a button: a tall invisible hit area around the thin visible bar */
.story-steps button {
  display: block; width: 34px; height: 24px; padding: 0; margin: 0;
  background: none; border: 0; border-radius: 4px; cursor: pointer;
  position: relative; transition: width .3s ease;
}
.story-steps button::before {
  content: ""; position: absolute; left: 2px; right: 2px; top: 10px; height: 4px;
  border-radius: 100px; background: var(--line); transition: background-color .3s ease;
}
.story-steps button:hover::before { background: var(--ink-faint); }
.story-steps li.is-active button { width: 48px; }
.story-steps li.is-active button::before { background: var(--green); }

/* Dad's gentle "alive" pulse (independent of scroll) */
.st-pulse { transform-box: fill-box; transform-origin: center; animation: st-breathe 3.4s ease-in-out infinite; }
@keyframes st-breathe { 0%,100% { transform: scale(0.7); opacity: 0.35; } 50% { transform: scale(1.25); opacity: 0.08; } }

/* Continue control: advances the story a beat at a time (and into the page at
   the end). Pinned bottom-centre of the stage on desktop; on phones it sits in
   the copy block under the buttons (see the mobile rules). Shown only while the
   story is active (JS unhides it). */
/* The nav is sized to the Continue button, so Continue stays centred; Back hangs
   off its left edge and is hidden (but keeps its space) on the first beat. */
.story-nav {
  position: absolute;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  pointer-events: auto;
}
.story-next {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  font-family: var(--sans); font-size: 15px; font-weight: 700; color: #fff;
  background: var(--green); border: none; border-radius: 100px;
  cursor: pointer; pointer-events: auto;
  box-shadow: 0 8px 20px -10px rgba(36, 32, 27, 0.55);
  transition: background-color .15s ease;
}
.story-next:hover { background: var(--green-dark); }
.story-next:active { transform: translateY(1px); }
.story-back {
  position: absolute; right: calc(100% + 10px); top: 0; bottom: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px;
  font-family: var(--sans); font-size: 15px; font-weight: 700; color: var(--green);
  background: var(--paper); border: 1.5px solid var(--green); border-radius: 100px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, opacity .2s ease;
}
.story-back:hover { background: var(--green-wash); }
.story-back svg { flex-shrink: 0; max-width: none; }  /* the global svg max-width would squash it to 0 here */
.story-back:active { transform: translateY(1px); }
.story-back.is-off { visibility: hidden; opacity: 0; }
.story-next .st-next-icon { transition: transform .2s ease; }
.story-next.is-end .st-next-icon { transform: rotate(90deg); }
.story.is-playing .story-nav { display: flex; }  /* visible after opt-in play */

/* Caregiver alert card: what "your phone" sees once the app notices.
   Top-right of the stage on desktop, top-centre on phones. JS adds .is-shown. */
.story-alert {
  position: absolute;
  top: calc(var(--header-h, 69px) + 28px);
  right: clamp(20px, 5vw, 72px);
  width: 300px;
  padding: 14px 16px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px -22px rgba(36, 32, 27, 0.45), 0 2px 8px -4px rgba(36, 32, 27, 0.18);
  font-family: var(--sans);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .35s ease, transform .35s ease;
}
.story-alert.is-shown { opacity: 1; transform: none; }
.sa-app { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.sa-app svg { flex-shrink: 0; }
.sa-when { margin-left: auto; }
.sa-title { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.sa-body { font-size: 15px; color: var(--ink-soft); line-height: 1.4; margin-top: 3px; }
.sa-actions { display: flex; gap: 8px; margin-top: 12px; }
.sa-btn {
  flex: 1; text-align: center; padding: 8px 10px; border-radius: 100px;
  font-size: 14px; font-weight: 700; line-height: 1.2;
  border: 1.5px solid var(--green); color: var(--green-dark);
}
.sa-btn-primary { background: var(--green); color: #fff; }
.sa-actions.is-hidden { display: none; }
.story.no-js .story-alert { display: none; }

/* these buttons set display, so make the hidden attribute still win */
.story-nav[hidden], .story-play[hidden] { display: none; }

/* ---- Mobile: copy drops to the bottom, scrim fades upward ---- */
@media (max-width: 760px) {
  .story { height: 300vh; }
  .story-scrim {
    background:
      linear-gradient(to top,
        rgba(246, 242, 234, 0.98) 0%,
        rgba(246, 242, 234, 0.92) 30%,
        rgba(246, 242, 234, 0.45) 56%,
        rgba(246, 242, 234, 0.00) 74%);
  }
  .story-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0 20px calc(30px + env(safe-area-inset-bottom, 0px));
  }
  .story-inner { max-width: 560px; }
  .story-inner .eyebrow { margin-bottom: 12px; }
  .story-pitch { font-size: clamp(30px, 8vw, 42px); line-height: 1.08; min-height: 0; margin-bottom: 12px; }
  .story-caption { font-size: clamp(17px, 4.6vw, 20px); min-height: 0; margin-bottom: 18px; }
  .story-inner .hero-actions { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 0; }
  .story-inner .btn-primary { min-height: 50px; }
  /* secondary becomes a compact link on phones so the bottom-anchored block always fits */
  .story-inner .btn-ghost {
    min-height: 0; border: none; background: none; padding: 6px;
    align-self: center; font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
  }
  .story-inner .btn-ghost:hover { background: none; color: var(--green-dark); }
  .story-steps { display: none; }
  /* on phones the Continue control joins the copy block, under the buttons, as a
     quieter outline pill so "Request early access" stays the main action */
  .story-nav {
    position: relative; left: auto; bottom: auto; transform: none;
    width: fit-content; margin: 10px auto 0;
  }
  .story-next {
    padding: 9px 18px;
    background: transparent; color: var(--green); border: 1.5px solid var(--green);
    box-shadow: none;
  }
  .story-next:hover { background: transparent; }
  @media (hover: hover) { .story-next:hover { background: var(--green-wash); } }  /* no sticky tint after a tap */
  /* arrow-only on phones so Back and Continue both fit beside each other */
  .story-back { padding: 0; width: 42px; justify-content: center; right: calc(100% + 8px); }
  .story-back .sb-label { display: none; }
  .story-alert {
    top: calc(var(--header-h, 69px) + 12px);
    left: 50%; right: auto;
    width: min(320px, calc(100% - 32px));
    padding: 12px 14px 13px;
    transform: translate(-50%, -10px);
  }
  .story-alert.is-shown { transform: translate(-50%, 0); }
  .sa-title { font-size: 17px; }
  .sa-body { font-size: 14px; }
  .sa-actions { margin-top: 10px; }
}

/* ---- No JS / reduced motion: no pinning, a single resting frame ---- */
@media (prefers-reduced-motion: reduce) {
  .story, .story.is-done { height: auto; }
  .story-stage { position: static; height: 72vh; min-height: 440px; }
  .st-pulse { animation: none; }
}
.story.no-js, .story.is-done { height: auto; }
.story.no-js .story-stage, .story.is-done .story-stage { position: static; height: 86vh; min-height: 520px; }
.story.no-js .story-nav, .story.is-done .story-nav { display: none; }

/* Reduced-motion visitor who tapped "Play": restore the scroll track + pinned
   stage, overriding the reduced-motion static rules (higher specificity). */
.story.is-playing { height: 320vh; }
.story.is-playing .story-stage { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 0; }
@media (max-width: 760px) { .story.is-playing { height: 300vh; } }
