/* BrandsAI scrollytelling explainer styles.
 * Pairs with assets/web/js/scrollytell.js (the scroll-math derivations live
 * there). Sticky pinning only: position:sticky, passive scroll, no hijack.
 * Self-hosted everything; no external resource. */

/* Wrapper height H = 400vh; sticky pane hv = 100vh; scrub span = 300vh.
   (Formula 1 in scrollytell.js.) */
.st-wrap { position: relative; height: 400vh; }
.st-pin {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(139,92,246,0.16), transparent 65%),
    radial-gradient(ellipse 60% 45% at 50% 42%, rgba(139,92,246,0.10), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 95%, rgba(232,121,249,0.10), transparent 65%),
    #030305;
}
.st-canvas { position: absolute; inset: 0; display: block; }

/* Legibility scrim under the beat copy band (canvas band ends at 67vh). */
.st-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 58%, rgba(3,3,5,0.55) 78%, rgba(3,3,5,0.85) 100%);
}

/* Beat copy: centered in the band below the letterboxed frame
   (frame band = [0.07, 0.67] of viewport height; copy sits at 70%). */
.st-beat {
  position: absolute; left: 50%; top: 70%;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 48px));
  text-align: center; opacity: 0;
  will-change: opacity, transform; pointer-events: none;
}
.st-beat h3 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4.2vw, 52px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.02;
  text-wrap: balance;
}
.st-beat h3 .st-it {
  font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400;
  background: linear-gradient(90deg, #7dd3fc, #a78bfa, #f0abfc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.st-beat p {
  margin: 0;
  font-size: clamp(14px, 1.5vw, 18px); line-height: 1.5;
  color: rgba(255,255,255,0.78); text-wrap: balance;
}

/* "Watch with sound": the scrub is silent by nature; the sound design stays
   one tap away. Below the fixed nav, clear of the bottom CTA dock. */
.st-sound {
  position: absolute; top: calc(98px + env(safe-area-inset-top, 0px)); right: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(10,10,15,0.72); border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  cursor: pointer; z-index: 6; min-height: 44px;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.st-sound:hover { border-color: rgba(167,139,250,0.6); background: rgba(139,92,246,0.18); }
.st-sound .st-sound-ic { width: 14px; height: 14px; display: block; }

/* Scrub progress hairline. */
.st-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: rgba(255,255,255,0.08);
}
.st-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #38bdf8, #8b5cf6, #e879f9);
}

/* Fallback (prefers-reduced-motion, or frames not on disk yet): the real
   sound-designed video, plain controls, no scrub. */
.st-fallback { display: none; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
html.st-reduced .st-wrap, html.st-failed .st-wrap { display: none; }
html.st-reduced .st-fallback, html.st-failed .st-fallback { display: block; }

/* Modal: the explainer with sound. Self-contained, Escape / backdrop close. */
.st-modal {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 24px;
  background: rgba(3,3,5,0.88);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.st-modal[hidden] { display: none; }
.st-modal-card { position: relative; width: min(1040px, 100%); }
.st-modal-card video {
  display: block; width: 100%; height: auto; border-radius: 16px;
  background: #000; box-shadow: 0 40px 120px -30px rgba(139,92,246,0.45);
}
.st-modal-close {
  position: absolute; top: -52px; right: 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.st-modal-close:hover { background: rgba(139,92,246,0.25); border-color: rgba(167,139,250,0.6); }
html.st-modal-open { overflow: hidden; }

@media (max-width: 768px) {
  /* The 16:9 frame is width-bound on portrait phones and bottoms out near 49%
     of the viewport (formula 5), so the copy rises to sit just under it
     instead of leaving a black band between frame and copy. */
  .st-beat { top: 56%; }
  /* Mobile nav bottoms out at ~101px (measured in the 390x844 probe):
     keep the sound pill fully clear of it. */
  .st-sound { top: calc(112px + env(safe-area-inset-top, 0px)); right: 14px; padding: 9px 14px; font-size: 11px; }
  .st-modal { padding: 14px; align-items: center; }
  .st-modal-close { top: auto; bottom: -56px; right: calc(50% - 22px); }
}
