/* ─────────────────────────────────────────────────────────
 * THE STORIES (js/stories.js): four scenes after the pull. Each
 * is a small Mac with one app open and the Kamui glass over it,
 * the real client writing inside. Values from MetalUI's tokens;
 * the depicted Mac keeps its own (mac/*.css).
 *
 *   .story          heading, stage, caption
 *   .story-stage    the Mac, scaled as one; the glass in real px
 *   .story-glass    the live window (the hero's .kwin, smaller)
 *   .story-cap      the hand-over line, shown when the scene ends
 * ───────────────────────────────────────────────────────── */

.stories { padding: 88px 0 24px; }
.stories .wrap { display: grid; gap: 96px; }
.story { display: grid; gap: 18px; }
.story-head { display: grid; gap: 10px; max-width: 40em; }
.story-who { margin: 0; font: var(--mu-type-label); letter-spacing: var(--mu-type-label-tracking); text-transform: uppercase; color: var(--mu-ink3); }
.story-head .display { font-size: clamp(30px, 2.4vw + 12px, 44px); }

/* ── The stage: a Mac screen in points, scaled to the stage's width ── */
.story-stage {
  --pts: 1440; --mac-h: 900; --s: 1;
  position: relative; width: 100%; aspect-ratio: var(--pts) / var(--mac-h);
  border-radius: var(--mu-radius-hero); overflow: hidden; isolation: isolate;
  background: var(--sand); box-shadow: var(--mu-raise);
}
.story-stage > .mac-screen { position: absolute; left: 0; top: 0; width: 1440px; height: calc(var(--mac-h) * 1px); transform: scale(var(--s)); transform-origin: 0 0; }
.story-stage .menubar { position: absolute; inset: 0 0 auto 0; z-index: 2; }
.story-stage .win { position: absolute; }
.story-stage > .notif-live { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.story-stage > .notif-live .notif { position: absolute; top: 46px; right: 16px; pointer-events: auto; }

/* The glass: the hero's window, over the app that was open */
.story-glass {
  position: absolute; left: 36%; top: 56px; right: 22px; bottom: 22px; z-index: 10;
  border-radius: 26px; overflow: hidden; isolation: isolate;
  background: rgba(250, 249, 246, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.14), inset 0 0.5px 0 rgba(255,255,255,0.8), 0 18px 36px rgba(0,0,0,0.26);
  opacity: 0; scale: 0.97;
  transition: opacity 520ms var(--mu-ease-slide), scale 620ms var(--mu-spring-surface), box-shadow 300ms;
}
.story.is-in .story-glass { opacity: 1; scale: 1; }
.story-glass iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.story-glass.is-taken { box-shadow: 0 0 0 0.5px rgba(0,0,0,0.14), inset 0 0.5px 0 rgba(255,255,255,0.8), 0 18px 36px rgba(0,0,0,0.26), 0 0 0 2px color-mix(in srgb, var(--mu-green) 55%, transparent); }

/* The Keeper, at half size, on the desk beside the app */
.story-kp { position: absolute; left: 26px; bottom: 18px; z-index: 11; scale: 0.5; transform-origin: 0 100%; }
.story-kp .kp-say { font-size: 22px; }

/* ── The caption: what the visitor can do now ── */
.story-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-height: 32px; }
.story-cap { margin: 0; font: var(--mu-type-lead); color: var(--mu-ink2); opacity: 0; translate: 0 6px; transition: opacity 320ms var(--mu-ease-slide), translate var(--mu-spring-settle-d) var(--mu-spring-settle); }
.story.is-done .story-cap { opacity: 1; translate: 0 0; }
.story-again { height: 30px; padding: 0 12px; font: var(--mu-type-ui); letter-spacing: var(--mu-type-ui-tracking); visibility: hidden; }
.story.is-done .story-again { visibility: visible; }

@media (max-width: 720px) {
  .stories { padding: 64px 0 0; }
  .stories .wrap { gap: 64px; }
  .story-stage { --pts: 780; --mac-h: 1140; }
  .story-glass { left: 12px; top: 78px; right: 12px; bottom: 12px; border-radius: 20px; }
  .story-stage > .notif-live .notif { top: 34px; right: 10px; width: 300px; }
  .story-kp { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .story-glass { transition: opacity 200ms; scale: 1; }
  .story-cap { transition: opacity 200ms; translate: 0 0; }
}
