/* ==========================================================================
   Memmy World — scroll-scrubbed film experience
   --------------------------------------------------------------------------
   One design language: night-time storybook cinema. The film is the page
   background, its characters carry the accents, and the copy sits on warm
   paper cards that stay readable over any frame.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --accent: #ffc83d;
  --accent-2: #ffe9a8;
  --aura: #ffc83d;
  --deep: #120d06;
  --deep-90: rgba(18, 13, 6, 0.9);
  --deep-70: rgba(18, 13, 6, 0.7);
  --deep-45: rgba(18, 13, 6, 0.45);
  --deep-20: rgba(18, 13, 6, 0.2);
  --accent-soft: rgba(255, 200, 61, 0.15);
  --accent-line: rgba(255, 200, 61, 0.36);
  --accent-glow: rgba(255, 200, 61, 0.48);
  /* The accent, darkened until it is readable as *text* on the cream story
     cards. Honey yellow (#ffb800) on --paper is 1.6:1 — the card CTA was
     invisible on Bella, and Splash's and Flora's accents were nearly as bad.
     Mixing toward the paper ink keeps the mascot's hue but lands every one of
     the five palettes above 4.5:1. The literal first value is the fallback for
     engines without color-mix(); they get a neutral warm brown instead. */
  --accent-ink: #8a5a12;
  --accent-ink: color-mix(in oklab, var(--accent) 42%, var(--paper-ink));

  --ink: #fff6e9;
  --ink-soft: rgba(255, 246, 233, 0.74);
  --ink-faint: rgba(255, 246, 233, 0.48);
  --paper: #fffaf1;
  --paper-ink: #241a0d;
  --paper-ink-soft: rgba(36, 26, 13, 0.72);

  --display: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, sans-serif;

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 30px;

  --shell: clamp(16px, 4vw, 64px);
  --topbar-h: clamp(56px, 7vh, 74px);
  /* Clear space kept on the inline-start side for the pinned chapter rail, so
     the rail never sits on top of the copy. It matches the rail's *expanded*
     width, so hovering a chapter cannot cover the mascot medallion either.
     Reset to 0 when the rail moves to the bottom of the screen
     (css/world/responsive.css). */
  --rail-gutter: 108px;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: #07050b;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* The document element is the scroller here, so the story sheet has to lock
   <html>; locking <body> alone left the film scrubbing behind the open sheet.
   `scrollbar-gutter: stable` keeps the page from jumping when the bar goes. */
html {
  scrollbar-gutter: stable;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent);
  color: #1a1206;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   2. The film
   -------------------------------------------------------------------------- */
.film {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* A decode gap (long seek, chapter jump) paints the video black for a frame
     or two. A warm backdrop under it turns that flash into a soft dip instead
     of a black screen. */
  background:
    radial-gradient(120% 90% at 50% 32%, #1c1430 0%, #0d0918 58%, #07050b 100%);
}

/* The source film is 1280 × 720. Keep its 16:9 frame intact and at or below
   native resolution; a softened poster fills the surrounding space so the
   letterbox feels like part of the night-time scene instead of an empty bar. */
.film::before {
  content: '';
  position: absolute;
  inset: -4%;
  background: url('../media/memmy-world-poster.jpg') center / cover no-repeat;
  filter: blur(28px) brightness(0.42) saturate(1.18);
  transform: scale(1.04);
}

.film__video {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Fit both viewport axes, then stop enlarging at the 1280px source width.
     At every viewport ratio the complete video frame remains visible. */
  width: min(100vw, 177.7778vh, 1280px);
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  transform: translate(-50%, -50%);
  /* the frames are already graded — this keeps them from washing out on HDR */
  filter: saturate(1.06) contrast(1.03);
}

/* Deepens the bottom half so the paper cards always have a floor to sit on. */
.film__tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      var(--deep-90) 0%,
      var(--deep-70) 26%,
      var(--deep-45) 52%,
      rgba(7, 5, 11, 0.12) 74%,
      rgba(7, 5, 11, 0.05) 100%
    ),
    radial-gradient(
      120% 80% at 50% 0%,
      transparent 40%,
      rgba(7, 5, 11, 0.55) 100%
    );
  transition: background 0.6s var(--ease-soft);
}

.film__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    130% 110% at 50% 48%,
    transparent 46%,
    rgba(4, 3, 8, 0.55) 82%,
    rgba(4, 3, 8, 0.86) 100%
  );
  pointer-events: none;
}

.film__grain {
  position: absolute;
  inset: -50%;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain 5s steps(4) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(-1%, -1%); }
}

/* scroll position through the whole film */
.film-progress {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 40;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.film-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: transform 0.08s linear;
}

[dir='rtl'] .film-progress span {
  transform-origin: 100% 50%;
}

.sparkles {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   3. Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 var(--shell);
  /* A real scrim, not a hint of one: the finale's packs and QR card scroll
     under this bar on a bright frame, and at 0.82 → 0 the brand ended up drawn
     straight over a price. */
  background: linear-gradient(
    to bottom,
    rgba(7, 5, 11, 0.96) 0%,
    rgba(7, 5, 11, 0.88) 58%,
    rgba(7, 5, 11, 0.42) 86%,
    rgba(7, 5, 11, 0) 100%
  );
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  /* On a 390px phone the three topbar groups are within a few pixels of the
     width, and a wrapping wordmark ("Memmy" / "World") pushed the bar to
     two lines. */
  white-space: nowrap;
  flex: 0 0 auto;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 18px -6px var(--accent-glow);
}

.brand__mark svg {
  width: 20px;
  height: 20px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ambient-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s,
    transform 0.2s var(--ease-out);
}

.ambient-toggle:hover {
  color: var(--ink);
  border-color: var(--accent-line);
  transform: translateY(-1px);
}

.ambient-toggle svg {
  width: 19px;
  height: 19px;
}

.ambient-toggle__waves,
.ambient-toggle__mute {
  transition: opacity 0.2s;
}

.ambient-toggle__waves {
  opacity: 0;
}

.ambient-toggle__mute {
  opacity: 1;
}

.ambient-toggle[aria-pressed='true'] {
  color: #1a1206;
  background: var(--accent);
  border-color: var(--accent-line);
  box-shadow: 0 0 18px -6px var(--accent-glow);
}

.ambient-toggle[aria-pressed='true'] .ambient-toggle__waves {
  opacity: 1;
}

.ambient-toggle[aria-pressed='true'] .ambient-toggle__mute {
  opacity: 0;
}

.lang {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.lang__btn {
  padding: 5px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: color 0.2s, background 0.2s;
}

.lang__btn[aria-pressed='true'] {
  color: #1a1206;
  background: var(--accent);
  box-shadow: 0 0 18px -6px var(--accent-glow);
}

.lang__btn:hover {
  color: var(--ink);
}

.lang__btn[aria-pressed='true']:hover {
  color: #1a1206;
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--body);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-out), background 0.2s, border-color 0.2s,
    box-shadow 0.2s, color 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--accent-line);
}

.btn--solid {
  color: #1a1206;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px -12px var(--accent-glow), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.btn--solid:hover {
  box-shadow: 0 16px 40px -14px var(--accent-glow), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.btn--lg {
  padding: 14px 26px;
  font-size: 0.95rem;
}

.btn__icon {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   5. Chapter rail
   -------------------------------------------------------------------------- */
.rail {
  position: fixed;
  z-index: 45;
  inset-inline-start: clamp(8px, 1.4vw, 22px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(9, 6, 14, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  max-height: min(74vh, 560px);
  overflow: hidden;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

/* Hovering reveals the chapter names, which makes the rail wider than the
   gutter reserved for it. Opaque it up so the labels sit on their own panel
   instead of on top of muddy, half-visible copy. */
.rail:hover,
.rail:focus-within {
  background: rgba(9, 6, 14, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 26px 60px -30px #000;
}

.rail__chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-faint);
  text-align: start;
  transition: background 0.25s, color 0.25s;
}

.rail__chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.rail__num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: all 0.25s;
}

.rail__label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: max-width 0.35s var(--ease-out), opacity 0.25s;
}

.rail:hover .rail__label,
.rail__chip:focus-visible .rail__label {
  max-width: 140px;
  opacity: 1;
}

.rail__chip.is-active {
  color: var(--ink);
  background: var(--accent-soft);
}

.rail__chip.is-active .rail__num {
  color: #17100a;
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 0 14px -4px var(--accent-glow);
}

/* The active chip keeps its number lit; its name is written on hover or focus so
   the rail stays a slim column that never covers the copy. */
/* --------------------------------------------------------------------------
   6. Acts and the pinned stage
   -------------------------------------------------------------------------- */
.act {
  position: relative;
  z-index: 1;
}

/* The scroll distance an act owns. The film's own timecodes set the pacing,
   this sets how much wheel it takes to travel them. */
.act--intro {
  height: 170vh;
}

.act[data-act]:not(.act--intro):not(.act--finale) {
  height: 300vh;
}

.act--finale {
  height: auto;
  padding: calc(var(--topbar-h) + clamp(40px, 8vh, 90px)) 0 clamp(40px, 8vh, 80px);
}

.stage {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  padding: calc(var(--topbar-h) + 12px) var(--shell) clamp(20px, 4vh, 46px);
  padding-inline-start: calc(var(--shell) + var(--rail-gutter));
  /* sticky only pins while the act is on screen */
  overflow: hidden;
}

.stage--finale {
  position: relative;
  height: auto;
  min-height: 0;
  overflow: visible;
  display: block;
  padding: 0 var(--shell);
}

.act:not(.is-active) .stage {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Intro
   -------------------------------------------------------------------------- */
.stage--intro {
  align-items: flex-start;
  justify-content: center;
  gap: clamp(12px, 2vh, 22px);
  max-width: min(1180px, 100%);
  margin-inline: auto;
  opacity: var(--vis, 0);
}

/* The opening frame is the family on the sofa, and the hero copy lands straight
   on their faces. A soft pool of night behind the words keeps the headline
   legible without putting a box over the film. */
.stage--intro::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(64% 78% at 24% 52%, rgba(7, 5, 11, 0.82) 0%, rgba(7, 5, 11, 0.5) 52%, transparent 78%),
    linear-gradient(to top, rgba(7, 5, 11, 0.55), transparent 46%);
}

[dir='rtl'] .stage--intro::before {
  background:
    radial-gradient(64% 78% at 76% 52%, rgba(7, 5, 11, 0.82) 0%, rgba(7, 5, 11, 0.5) 52%, transparent 78%),
    linear-gradient(to top, rgba(7, 5, 11, 0.55), transparent 46%);
}

.intro__kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: rgba(9, 6, 14, 0.5);
  backdrop-filter: blur(12px);
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.intro__title {
  max-width: 15ch;
  font-size: clamp(2.4rem, 6.4vw, 5.1rem);
  letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.intro__title span,
.intro__title em {
  display: block;
}

.intro__title em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  text-shadow: 0 0 46px var(--accent-glow);
}

.intro__sub {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 1.25vw, 1.12rem);
  line-height: 1.62;
}

.intro__chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.intro__chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 16px var(--accent-glow);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  50% { transform: scale(0.72); opacity: 0.65; }
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: clamp(10px, 3vh, 30px);
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.scroll-hint__wheel {
  position: relative;
  width: 20px;
  height: 32px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.scroll-hint__wheel::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 7px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 999px;
  background: var(--accent);
  animation: wheel 1.9s var(--ease-soft) infinite;
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(11px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* --------------------------------------------------------------------------
   8. Character act
   -------------------------------------------------------------------------- */
.act__inner {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  max-width: min(1320px, 100%);
  margin-inline: auto;
  /* The act is NOT a scroll container.
     It used to be `overflow-y: auto; overscroll-behavior: contain` with the
     scrollbar hidden, to keep a short window from clipping the shelf. That made
     the copy a scroll port of its own: whenever the content was a few pixels
     taller than the stage (412px of copy in a 390px stage on a 900×600 window)
     the wheel scrolled *this box*, and `contain` refused to chain the gesture to
     the page. The page then genuinely could not be scrolled over the copy — the
     only way down was to grab the root scrollbar and drag it, which is exactly
     the reported "scrolling blocks" defect.
     The copy must belong to the page: the wheel always scrolls the document, the
     film follows it, and the shelf is sized to fit the stage instead of hiding
     its overflow. See `.stage`'s own clipping and the fit rules below. */
  opacity: var(--vis, 0);
  transform: translate3d(0, calc((1 - var(--vis, 0)) * 26px), 0);
  transition: opacity 0.12s linear;
}

/* Only the act on screen is promoted. Hints on every act (5 × inner + portrait +
   4 cards + lantern) kept ~30 composited layers with masks and filters alive for
   the whole session, which is what made Chromium drop the frame to black during
   long seeks. */
.act.is-active .act__inner,
.act.is-active .act__character,
.act.is-active .story,
.act.is-active .act__lantern {
  will-change: opacity, transform;
}

.act:not(.is-active) .act__inner,
.act:not(.is-active) .act__character,
.act:not(.is-active) .story,
.act:not(.is-active) .act__lantern {
  will-change: auto;
}


/* Avatar + title share the first line of the copy, so the story shelf gets the
   full column width underneath. */
.act__head {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 20px);
}

.act__heading {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.6vh, 8px);
  min-width: 0;
}

/* ---------------------------- the portrait ---------------------------- */
/* A round portrait avatar in the copy header: big enough to admire the painted
   mascot, small enough to leave the film's own character in view. */
.act__character {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(78px, 9vw, 122px);
  aspect-ratio: 1;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(var(--tilt, 0deg));
  transition: transform 0.45s var(--ease-out);
  will-change: transform;
}

.act__halo {
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 46%, var(--accent-soft), transparent 62%),
    radial-gradient(circle at 50% 62%, var(--accent-glow), transparent 70%);
  filter: blur(18px);
  opacity: 0.9;
  animation: halo 7s ease-in-out infinite;
}

@keyframes halo {
  50% { transform: scale(1.06); opacity: 1; }
}

.act__ring {
  position: absolute;
  inset: 4%;
  border-radius: 46% 46% 42% 42% / 50% 50% 44% 44%;
  border: 1px solid var(--accent-line);
  background: rgba(9, 6, 14, 0.28);
  backdrop-filter: blur(2px);
  box-shadow: inset 0 0 60px -20px var(--accent-glow), 0 30px 60px -34px #000;
}

.act__portrait {
  position: relative;
  z-index: 2;
  margin: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  /* Softens the rectangular source photos into a round avatar without cropping
     the painted mascots that already ship with transparency. */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 66%, rgba(0, 0, 0, 0.5) 84%, transparent 100%);
  mask-image: radial-gradient(circle at 50% 50%, #000 66%, rgba(0, 0, 0, 0.5) 84%, transparent 100%);
}

.act__portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 45%;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 30px var(--accent-soft));
  animation: bob 6.5s ease-in-out infinite;
}

@keyframes bob {
  50% { transform: translateY(-12px); }
}

/* The glow name from caracters.txt, under the mascot's name. */
.act__glow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-faint);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.act__glow::before {
  content: '';
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent), transparent);
}

/* ------------------------------ the copy ------------------------------ */
/* The copy takes the half of the frame the mascot is NOT flying through. Bella
   works the lower-left of the film, so her column sits on the inline-end side;
   the other four work the right side, so their column sits on the inline-start
   one. The film is never covered where the character actually is. */
.act__content {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 15px);
  min-width: 0;
  width: min(60%, 640px);
  margin-inline-start: auto;
  margin-inline-end: 0;
}

.act[data-side='end'] .act__content {
  margin-inline-start: 0;
  margin-inline-end: auto;
}

.act__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.act__title {
  font-size: clamp(1.85rem, 3.9vw, 3.35rem);
  letter-spacing: -0.025em;
  text-wrap: balance;
  text-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.act__blurb {
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: clamp(0.86rem, 1.05vw, 1rem);
  line-height: 1.6;
}

.act__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.act__tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.act__tag-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
/* --------------------------------------------------------------------------
   9. Story cards — warm paper over the film
   -------------------------------------------------------------------------- */
.stories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: clamp(8px, 1.1vw, 15px);
  margin-top: clamp(4px, 1vh, 12px);
}

.story {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--paper-ink);
  text-align: start;
  overflow: hidden;
  isolation: isolate;
  /* the scroll-linked reveal writes --r */
  opacity: var(--r, 0);
  transform: translate3d(0, calc((1 - var(--r, 0)) * 26px), 0) scale(calc(0.965 + var(--r, 0) * 0.035));
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.3s var(--ease-out), border-color 0.3s, transform 0.35s var(--ease-out);
  will-change: transform, opacity;
}

/* inner light that follows the pointer across the card */
.story::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(
    220px circle at var(--cx, 50%) var(--cy, 50%),
    var(--accent-soft),
    transparent 62%
  );
  transition: opacity 0.3s;
}

/* The card is no longer a single button, so the lift follows `focus-within`:
   tabbing to either control lights the whole card. */
.story:hover,
.story:focus-within {
  border-color: var(--accent);
  box-shadow: 0 26px 54px -24px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--accent),
    0 0 44px -12px var(--accent-glow);
  transform: translate3d(0, -6px, 0) scale(1.012);
}

.story:hover::after,
.story:focus-within::after {
  opacity: 1;
}

.story__cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--accent-soft), rgba(0, 0, 0, 0.4));
  overflow: hidden;
}

.story__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 0.6s var(--ease-out), filter 0.4s;
  filter: saturate(0.94);
}

.story:hover .story__cover img {
  transform: scale(1.07);
  filter: saturate(1.06);
}

.story__order {
  position: absolute;
  z-index: 2;
  top: 8px;
  inset-inline-start: 8px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 8px;
  background: rgba(9, 6, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.story__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  padding: 11px 13px 12px;
  background: linear-gradient(to bottom, var(--paper), #fff4e2);
}

.story__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--paper-ink);
}

/* The card's two controls.
   `.story__preview` holds the cover and the teaser — everything a visitor may
   read before paying. `.story__buy` is the only affordance that leads to the
   story, and it leads to the purchase entry point, not to the tale. */
.story__preview {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
}

.story__buy {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid rgba(36, 26, 13, 0.12);
  /* A tint of the mascot's own colour, dark enough for the label to stay
     readable on the cream card. */
  background: color-mix(in srgb, var(--accent) 16%, #fff4e2);
  color: var(--accent-ink);
  font-family: var(--body);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s;
}

.story__buy svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.story__price {
  letter-spacing: 0.02em;
}

.story__buy-label {
  margin-inline-start: auto;
}

.story__buy:hover,
.story__buy:focus-visible {
  background: var(--accent);
  color: #1a1206;
}

.story:hover .story__buy {
  border-top-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* A character with a single story gets a featured card with a tall cover and
   title beside it. */
.stories:has(.story:only-child) {
  grid-template-columns: minmax(0, 1fr);
  max-width: 470px;
}

/* The featured card keeps its jacket-and-copy row, but inside the preview
   control: the buy row still spans the full width underneath. */
.stories:has(.story:only-child) .story {
  min-height: 196px;
}

.stories:has(.story:only-child) .story__preview {
  flex-direction: row;
  align-items: stretch;
}

/* A fixed-basis cover, full card height: the featured card reads as a book
   jacket rather than a stamp. */
.stories:has(.story:only-child) .story__cover {
  flex: 0 0 40%;
  aspect-ratio: auto;
}

.stories:has(.story:only-child) .story__body {
  justify-content: center;
  padding: 14px 16px 15px;
}

.stories:has(.story:only-child) .story__title {
  font-size: 1.02rem;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

