/* The frame and captions stay registered to the page. Only the media moves. */
.reel-frame picture,
.drawing-landscape {
  overflow: hidden;
}

@media screen and (prefers-reduced-motion: no-preference) {
  html.reading-motion-ready:not([data-motion="off"]) .reel-frame img,
  html.reading-motion-ready:not([data-motion="off"]) .drawing-landscape img {
    transform: translateY(var(--image-travel, 0%)) scale(1.075);
  }

  html.reading-motion-ready:not([data-motion="off"]) .drawing img {
    opacity: calc(1 - var(--sheet-entry, 0) * .45);
    transform: translateY(calc(var(--sheet-entry, 0) * 18px));
  }

  html.reading-motion-ready:not([data-motion="off"]) .drawing-dimension::before,
  html.reading-motion-ready:not([data-motion="off"]) .drawing-dimension::after {
    transform: scaleX(calc(1 - var(--sheet-entry, 0) * .84));
  }
  .drawing-dimension::before { transform-origin: right center; }
  .drawing-dimension::after { transform-origin: left center; }
}

/* The portrait advances along the optical axis as the title scrolls away.
   Keep the entire image, including the reflected frame, on one plane. */
@media screen and (prefers-reduced-motion: no-preference) {
  html.reading-motion-ready:not([data-motion="off"]) .hero-portrait picture {
    transform-origin: 50% 64%;
    transform: translateY(calc((1 - var(--hero-progress, 0)) * 4%))
               scale(calc(var(--hero-initial-scale) + (1 - var(--hero-initial-scale)) * var(--hero-progress, 0)));
  }
  @supports (animation-timeline: scroll(root block)) and (animation-range: 0px 220px) {
    html.reading-motion-ready:not([data-motion="off"]) .hero-portrait picture {
      animation: hero-approach 1s linear both;
      animation-timeline: scroll(root block);
      animation-range: 0px var(--hero-travel);
    }
  }
}

@keyframes hero-approach {
  from { transform: translateY(4%) scale(var(--hero-initial-scale)); }
  to   { transform: translateY(0) scale(1); }
}
