/* =====================================================================
   story.css - the scroll-driven "how a packet is born" 3D scene,
   plus the sale bump-backs (CTA bands + floating order button).
   All animation is transform/opacity only, driven by js/build-story.js.
   ===================================================================== */

/* ---------------------------- the story ------------------------------ */
.story { position: relative; margin: var(--space-4) 0 var(--space-6); }
.story__spacer { height: 430vh; }
.story__stage {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow: hidden; border-radius: var(--radius-lg);
  background: radial-gradient(120% 90% at 50% 20%, var(--panel-fill), transparent 70%);
}
.story__scene {
  position: absolute; inset: 0;
  perspective: 1100px; perspective-origin: 50% 42%;
}
.story__sprite {
  position: absolute; left: 50%; top: 42%;
  width: 74px; height: 74px; margin: -37px 0 0 -37px;
  will-change: transform, opacity;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .18));
}
.story__sprite svg { width: 100%; height: 100%; }
.story__packet {
  position: absolute; left: 50%; top: 42%;
  width: 210px; height: 300px; margin: -150px 0 0 -105px;
  will-change: transform, opacity;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, .28));
}
.story__packet svg { width: 100%; height: 100%; }
.story__glow {
  position: absolute; left: 50%; top: 42%; width: 340px; height: 340px; margin: -170px 0 0 -170px;
  border-radius: 50%; opacity: 0; will-change: opacity, transform;
  background: radial-gradient(circle, rgba(246, 184, 71, .45), transparent 65%);
}
[data-theme="dark"] .story__glow { background: radial-gradient(circle, rgba(232, 163, 60, .35), transparent 65%); }

/* step captions: cards that crossfade at the bottom of the stage */
.story__caption {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(14px);
  width: min(560px, calc(100% - 32px));
  background: var(--receipt-bg); border-radius: var(--radius);
  padding: 16px 20px; opacity: 0; pointer-events: none;
  box-shadow: var(--shadow-soft);
  transition: none; will-change: transform, opacity;
}
.story__caption.is-on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.story__caption-step {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
  color: var(--color-ink-2); background: var(--chip); border-radius: var(--radius-pill);
  padding: 3px 10px; margin-bottom: 7px;
}
.story__caption h3 { font-family: var(--font-serif); font-size: 21px; margin: 0 0 4px; }
.story__caption p { font-size: 13.5px; color: var(--color-ink-2); margin: 0 0 8px; line-height: 1.5; }
.story__caption a.story__more {
  font-size: 13px; font-weight: 700; color: var(--ink-bright); text-decoration: none;
  background: var(--chip); padding: 6px 13px; border-radius: var(--radius-pill);
  display: inline-block; transition: background .2s;
}
.story__caption a.story__more:hover { background: var(--chip-hover); }
.story__caption .btn { margin: 8px 8px 0 0; padding: 13px 24px; }

/* progress rail */
.story__rail {
  position: absolute; right: 16px; top: 18%; bottom: 30%;
  width: 3px; border-radius: 3px; background: var(--hairline);
}
.story__rail-fill { position: absolute; top: 0; left: 0; width: 100%; height: 0; border-radius: 3px; background: var(--accent); }
.story__dot {
  position: absolute; left: 50%; width: 11px; height: 11px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--color-bg);
  border: 2.5px solid var(--hairline); box-sizing: border-box;
}
.story__dot.is-done { background: var(--accent); border-color: var(--accent); }

/* scroll hint + skip */
.story__hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--color-ink-2); opacity: .85;
}
.story__hint span { display: inline-block; animation: storybob 1.6s ease-in-out infinite; }
@keyframes storybob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
.story__skip {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  font-size: 12px; font-weight: 700; color: var(--ink-bright);
  background: var(--chip); border: 0; border-radius: var(--radius-pill);
  padding: 7px 14px; cursor: pointer; transition: background .2s;
}
.story__skip:hover { background: var(--chip-hover); }

/* static fallback (no JS animation / reduced motion) */
.story--static .story__spacer { height: auto; }
.story--static .story__stage { position: static; height: auto; overflow: visible; padding: 20px 0; }
.story--static .story__scene { position: relative; height: 320px; perspective: none; }
.story--static .story__sprite { display: none; }
.story--static .story__packet { transform: translateZ(0) scale(.9); opacity: 1; }
.story--static .story__caption {
  position: static; transform: none; opacity: 1; pointer-events: auto;
  width: auto; margin: 10px auto; max-width: 560px;
}
.story--static .story__rail, .story--static .story__hint, .story--static .story__skip { display: none; }

@media (max-width: 640px) {
  .story__spacer { height: 460vh; }
  .story__packet { width: 165px; height: 236px; margin: -118px 0 0 -82px; }
  .story__sprite { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
  .story__caption { bottom: 14px; padding: 13px 16px; }
  .story__caption h3 { font-size: 18px; }
}

/* ------------------------- sale bump-backs ---------------------------- */
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--receipt-bg), var(--panel-fill));
  border: 1.5px solid var(--hairline);
}
.cta-band__title { font-family: var(--font-serif); font-weight: 600; font-size: clamp(20px, 3.4vw, 27px); margin: 0 0 4px; }
.cta-band__sub { font-size: 13.5px; color: var(--color-ink-2); margin: 0; }
.cta-band .btn { margin: 0; flex: 0 0 auto; }

/* floating "Order now" pill (site-wide, added by ui-enhance.js) */
.order-fab {
  position: fixed; left: 18px; bottom: 18px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 14px; text-decoration: none;
  padding: 13px 20px; border-radius: var(--radius-pill);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .45);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s;
}
.order-fab.is-in { opacity: 1; visibility: visible; transform: none; }
.order-fab:hover { transform: translateY(-2px); }
.order-fab svg { width: 17px; height: 17px; }
@media print { .order-fab, .story, .cta-band { display: none !important; } }

/* ===================== godmode story additions ======================= */
.story__mood { position: absolute; inset: 0; transition: background .25s linear; }
.story__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, .16) 100%);
}
.story__dustwrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.story__dust {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--color-ink); opacity: .12; will-change: transform;
  animation: dusttwinkle 3.2s ease-in-out infinite;
}
@keyframes dusttwinkle { 0%, 100% { opacity: .06; } 50% { opacity: .2; } }

.story__packetwrap { position: absolute; inset: 0; pointer-events: none; }
.story__packetwrap .story__packet { pointer-events: none; }
.story__packetwrap.is-gulp .story__packet svg { animation: gulp .45s cubic-bezier(.3, 1.6, .4, 1); }
@keyframes gulp {
  0% { transform: scale(1, 1); }
  35% { transform: scale(1.08, 0.92); }
  65% { transform: scale(0.96, 1.06); }
  100% { transform: scale(1, 1); }
}
.story__packetwrap.is-finale .story__packet svg { animation: packetjump .8s cubic-bezier(.3, 1.5, .4, 1); }
@keyframes packetjump {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-26px) rotate(-3deg); }
  60% { transform: translateY(0) rotate(2deg); }
  80% { transform: translateY(-8px) rotate(0); }
  100% { transform: translateY(0); }
}

.story__ringwrap { position: absolute; left: 50%; top: 42%; width: 0; height: 0; pointer-events: none; }
.story__ring {
  position: absolute; left: 0; top: 0; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 3px solid var(--accent); border-radius: 50%; opacity: .9;
  animation: ringout .7s ease-out forwards;
}
@keyframes ringout { to { width: 240px; height: 240px; margin: -120px 0 0 -120px; opacity: 0; border-width: 1px; } }
.story__spark {
  position: absolute; left: 0; top: 0; width: 9px; height: 9px; margin: -4px 0 0 -4px;
  border-radius: 2px; opacity: 1; animation: sparkfly .9s ease-out forwards;
}
@keyframes sparkfly {
  to { transform: translate(var(--sx), var(--sy)) rotate(260deg) scale(.3); opacity: 0; }
}

.story__caption {
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.story--static .story__mood, .story--static .story__dustwrap,
.story--static .story__vignette, .story--static .story__ringwrap { display: none; }
