/* story-layers.1.css (/story, story-animate-1118, partner 2026-11-18, the stronger values kept): the hook picture as two layers instead of one baked composite.
   Layer 1: the AI-generated background (the same raw Djinn picture as story-hook-*.6.webp, light-a / dark-a, encoded at its own 1376 x 768).
   Layer 2: the real capture (screen-story-priced-*.2.webp, the same file "The question, answered" shows), placed by the c139 place_card numbers
   (86 percent of the height, centre at x 66 / y 50 percent, tilted 5 degrees clockwise, rounded, a pale rim and a soft shadow).
   At rest the stack draws what the composite drew. While the visitor scrolls the first 60 percent of a screen (45 percent on a phone), the scene
   sinks and grows and the card rises and grows a little: depth, tied to the scroll, compositor only (transform), no script. Without scroll-driven animations
   (Firefox today, older Safari), under prefers-reduced-motion and in print, the layers do not move. A page opened below the top shows them at their
   end position. Colours are tokens only. */

.hook-stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; container-type: inline-size;
  border-radius: 16px; border: 1px solid var(--border-color);
}
.hook-bg, .hook-card { position: absolute; }
.hook-bg { inset: 0; }
/* left = 66 - 32.83 / 2; top 7.5 rather than the computed 7, measured against the composite at 1440 and 375 px (the baked card sits a little lower); the card box keeps the capture's own ratio (1032 x 1521) at 86 percent of a 16:9 stage */
.hook-card { left: 49.59%; top: 7.5%; width: 32.83%; height: 86%; }

.story-hook .hook-stage img { width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }
.story-hook .hook-bg img { object-fit: cover; }
.story-hook .hook-card img {
  object-fit: fill;
  border-radius: 2.9% / 1.98%;
  border: max(1px, 0.19cqw) solid var(--glass-border);
  box-shadow: 0 1.2cqw 2.9cqw var(--shadow-lift);
  transform: rotate(5deg);
}

/* the depth: 0 at the top of the page (so the first paint is the composite), full after 60 percent of a screen of scroll (0 60vh); linear, because the scroll is the clock */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .hook-bg, .hook-card {
      animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
      animation-timeline: scroll(root block); animation-range: 0 60vh;
    }
    .hook-bg { animation-name: hook-bg; }
    .hook-card { animation-name: hook-card; }
  }
  /* on a phone the picture sits lower in the first screen and has left it after about 70 percent of a screen of scroll (measured at 375 x 812:
     its bottom at 563 px), so the depth plays over the first 45 percent of a small screen (0 45svh), while the picture is still in view */
  @media (prefers-reduced-motion: no-preference) and (max-width: 900px) {
    .hook-bg, .hook-card { animation-range: 0 45svh; }
  }
}
/* the scene grows 25 percent and sinks 12 percent of its height: its edges never show inside the stage (12 < 25 / 2; at the end 0.5 percent of the
   stage height stays covered at the top, measured 0.9 px at 375 px and 3 px at 1440 px). The card rises 1.5 percent of its height and grows 6 percent:
   the most that keeps the tilted card wholly inside the stage at every scroll point (partner 2026-11-18: never clipped). Measured, both themes,
   smallest margin to the stage edge: 2.0 px at 375 px, 2.1 px at 390 px, 6.7 px at 1440 px (its top corner); -10% / 1.12 cut up to 53 px */
@keyframes hook-bg { from { transform: none; } to { transform: translateY(12%) scale(1.25); } }
@keyframes hook-card { from { transform: none; } to { transform: translateY(-1.5%) scale(1.06); } }

@media print {
  .hook-bg, .hook-card { animation: none !important; transform: none !important; }
}
