/* ═══════════════════════════════════════════════════════════════
   Savario · promo film player
   Loaded after styles.css (which supplies tokens + .device/.scr-*
   markup styles). The film follows the landing page theme:
   data-theme is set by the inline bootstrap in promo.html
   (?theme= param → localStorage "savario:theme" → system), and
   updates live via postMessage when the landing toggle flips.
   Layout: a fixed 1280×720 design frame, zoom-scaled to fit any
   window / iframe while keeping a 16:9 letterboxed stage.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Shell: viewport → frame ──────────────────────────────── */
body { overflow: hidden; }

.promo__player {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  cursor: pointer;
}

.promo__frame {
  position: relative;
  width: 1280px;
  height: 720px;
  flex: none;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--rule);
  /* scale the fixed design frame to the viewport, preserving 16:9 */
  zoom: min(calc(100vw / 1280px), calc(100vh / 720px));
}

/* ─── Letterbox ────────────────────────────────────────────── */
.promo__bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 34px;
  background: color-mix(in srgb, var(--paper) 94%, var(--ink));
  z-index: 6;
  pointer-events: none;
}
.promo__bar--top { top: 0; }
.promo__bar--bottom { bottom: 0; }

/* ─── Progress (one segment per scene, built by JS) ────────── */
.promo__progress {
  position: absolute;
  left: 56px;
  right: 56px;
  bottom: 15px;
  z-index: 7;
  display: flex;
  gap: 5px;
}

.promo__seg {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  overflow: hidden;
}

.promo__seg::before {
  content: "";
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
}

/* ─── Scene label / timecode / play button ─────────────────── */
.promo__scene-name,
.promo__time {
  position: absolute;
  bottom: 42px;
  z-index: 7;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.promo__scene-name { left: 56px; }
.promo__time { right: 56px; }

.promo__play {
  position: absolute;
  right: 50px;
  bottom: 58px;
  z-index: 8;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  color: var(--ink);
  opacity: 0.5;
  transition: opacity var(--dur-ui) ease, border-color var(--dur-ui) ease,
              transform var(--dur-press) var(--ease-out);
}

.promo__play.is-paused { opacity: 1; border-color: var(--ink-faint); }

@media (hover: hover) and (pointer: fine) {
  .promo__play:hover { opacity: 1; border-color: var(--ink-muted); }
}

/* ─── End overlay ──────────────────────────────────────────── */
.promo__end {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.promo.is-ended .promo__end { opacity: 1; pointer-events: auto; }

.promo__replay {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 26px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform var(--dur-press) var(--ease-out);
}

.promo__replay:active { transform: scale(0.96); }

/* ─── Scenes base ──────────────────────────────────────────── */
.promo__stage { position: absolute; inset: 0; }

.scene {
  position: absolute;
  inset: 0;
  padding: 72px 96px 108px;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms ease;
}

.scene.is-active { opacity: 1; }

.scene__inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Shared film type */
.mono-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.film-h {
  font-family: var(--display);
  font-weight: 600;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.film-h em { font-style: italic; color: var(--accent); }
.film-h--lg { font-size: 52px; }

.film-sub {
  font-size: 15px;
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 30rem;
}

/* ─── Timed reveal utility (JS toggles .on from data-at) ───── */
.js .rv {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 560ms var(--ease-out), transform 560ms var(--ease-out);
}

.js .rv.on { opacity: 1; transform: none; }

.js .rv--wordmark { transform: scale(0.94); transition-duration: 1100ms; }
.js .rv--pop { transform: scale(0.8); transition-duration: 380ms; }
.js .rv--hit { transform: translateY(10px); transition-duration: 420ms; }
.js .rv--row { transform: translateX(-8px); transition-duration: 420ms; }

/* ─── Scene 1 · Wordmark ───────────────────────────────────── */
.scene-1__word {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 104px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.scene-1__sub { margin-top: 26px; color: var(--ink-faint); }

/* ─── Scene 2 · The problem ────────────────────────────────── */
.scene-2__inner { align-items: flex-start; text-align: left; max-width: 560px; margin: 0 auto; }

.scene-2__plat { color: var(--ink-faint); margin: 2px 0 4px; }

.scene-2__stat {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 20px;
}

.scene-2__num {
  font-size: 92px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.scene-2__unit { font-size: 26px; color: var(--ink-muted); }

.scene-2__stat--mute .scene-2__num,
.scene-2__stat--mute .scene-2__unit { color: var(--ink-faint); }

.scene-2__ask {
  margin-top: 34px;
  font-family: var(--display);
  font-style: italic;
  font-size: 27px;
  color: var(--ink-muted);
}

.scene-2__ask em { color: var(--accent); }

/* ─── Scene 3 · Capture ────────────────────────────────────── */
.scene-3__inner {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 72px;
  text-align: left;
}

.scene-3__copy { max-width: 380px; }
.scene-3__copy .film-h { margin: 14px 0 16px; }

/* device is drawn at its native 320×~642px, scaled down to fit */
.scene-3__device { zoom: 0.84; }

.scene-3__device .device {
  border-color: var(--rule);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.45); /* the one soft device shadow */
}

.scene-3__screen { position: relative; }

.s3-app { position: absolute; inset: 0; background: var(--paper); }

.s3-app--article { z-index: 1; }

.s3-urlbar {
  margin: 8px 16px 0;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-faint);
  text-align: center;
}

.s3-article { padding: 18px 20px; }

.s3-article h4 { font-size: 16px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; margin-bottom: 10px; }

.s3-article p {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.s3-share {
  position: absolute;
  right: 16px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #FAF8F4;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
}

.s3-share.on { opacity: 1; transform: none; }

.s3-share.on::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  animation: s3-pulse 1.6s var(--ease-out) 0.5s infinite;
}

@keyframes s3-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  70%, 100% { transform: scale(1.55); opacity: 0; }
}

/* share sheet */
.s3-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-radius: 18px 18px 0 0;
  padding: 10px 18px 26px;
  transform: translateY(103%);
  transition: transform 620ms var(--ease-in-out);
}

.s3-sheet.on { transform: none; }

.s3-sheet-grab {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
  margin: 0 auto 10px;
}

.s3-sheet-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.s3-sheet-row { display: flex; gap: 18px; }

.s3-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.s3-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  transition: transform 300ms var(--ease-out), border-color 300ms ease,
              background-color 300ms ease, color 300ms ease;
}

.s3-action-label { font-size: 10px; color: var(--ink-muted); }

.s3-action--savario .s3-action-icon {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 21px;
  background: var(--accent);
  border-color: var(--accent);
  color: #FAF8F4;
}

.s3-action--savario.on .s3-action-icon { transform: scale(1.12); }

/* timeline layer */
.s3-app--timeline {
  z-index: 2;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 480ms ease;
}

.s3-app--timeline.on { opacity: 1; }

.s3-new {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 520ms var(--ease-out), transform 520ms var(--ease-out);
}

.s3-new.on { opacity: 1; transform: none; }

/* saved toast */
.s3-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -10px);
  z-index: 3;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
}

.s3-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ─── Scene 4 · Keep (hero): the original 404s, snapshot survives ── */
.scene-4__inner { display: flex; flex-direction: column; align-items: center; }
.scene-4 .film-h { margin: 8px 0 18px; }

.scene-4__card {
  width: 660px;
  text-align: left;
  background: var(--paper-2);
  padding: 18px 24px 20px;
  border-color: var(--rule);
}

.scene-4 .keep__bar { margin-bottom: 14px; padding-bottom: 12px; }
.scene-4 .keep__title { font-size: 19px; margin-bottom: 14px; }
.scene-4 .keep__text { font-size: 13px; }
.scene-4 .keep__compare { gap: 12px; }

/* the original URL, struck through when the 404 lands */
.s4-url { transition: color 300ms ease; }

.s4-url.on {
  color: var(--ink-faint);
  text-decoration: line-through;
}

/* the 404 badge keeps its own visibility from .rv; just size it here */
.scene-4 .keep__dead { margin-top: 10px; }

/* highlight sweep, timed by .on */
.s4-mark { transition: background-size 900ms var(--ease-in-out); }
.s4-mark.on { background-size: 100% 100%; }

.scene-4 .keep__note-inline.rv { transform: translateY(6px); }
.scene-4 .keep__note-inline.rv.on { transform: none; }

.scene-4__foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
}

/* ─── Scene 5 · Recall ─────────────────────────────────────── */
.scene-5__inner { max-width: 620px; margin: 0 auto; }
.scene-5__inner .film-h { font-size: 34px; margin: 12px 0 24px; }

.scene-5__box { width: 100%; padding: 13px 20px; }

.scene-5__meta { width: 100%; padding: 12px 6px 14px; }

/* styles.css hides .recall__hit until .is-in; the film times it with .on */
.scene-5 .recall__hit { opacity: 1; transform: none; background: var(--paper-2); }
.js .scene-5 .recall__hit.rv { opacity: 0; transform: translateY(10px); }
.js .scene-5 .recall__hit.rv.on { opacity: 1; transform: none; }
.scene-5 .recall__hit .scr-card-sum { -webkit-line-clamp: 1; }

/* ─── Scene 6 · Privacy ────────────────────────────────────── */
.scene-6 .film-h { margin: 18px 0 30px; }
.scene-6 .film-h .rv { display: inline-block; }

.scene-6__mono {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
}

/* ─── Scene 7 · Pricing + CTA ──────────────────────────────── */
.scene-7 .film-h { margin-top: 16px; }

.scene-7__pro {
  margin-top: 14px;
  font-size: 24px;
  font-weight: 500;
  color: var(--ink-muted);
}

.scene-7__pro b { color: var(--accent); font-weight: 700; letter-spacing: -0.01em; }

.scene-7__founding {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
}

.scene-7__cta { margin-top: 32px; }

.scene-7__note {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
}

/* ─── Scene 8 · Outro ──────────────────────────────────────── */
.scene-8__slogan {
  font-family: var(--display);
  font-weight: 600;
  font-size: 58px;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.scene-8__slogan em { font-style: italic; color: var(--accent); }

.scene-8__sub { margin-top: 24px; color: var(--ink-faint); }

/* ─── Reduced motion: final states, crossfades only ────────── */
@media (prefers-reduced-motion: reduce) {
  .promo .rv,
  .promo .s3-share,
  .promo .s3-sheet,
  .promo .s3-app--timeline,
  .promo .s3-new,
  .promo .s3-toast,
  .promo .s4-mark,
  .promo .recall__hit {
    transition: none !important;
    animation: none !important;
  }

  .promo .s4-mark.on { background-size: 100% 100%; }

  .promo .s3-share.on::after { animation: none; content: none; }
}
