/* ==========================================================================
   "Reels": a full-screen video layer that the page sections slide over.
   js/reel.js adds .reel--live: the reel pulls itself up under the section above
   and down under the section below (negative margins), its stage sticks to the
   viewport, and the neighbouring sections (.reel-over) are lifted above it.
   So the video is already scrubbing while the section above scrolls away, holds
   full screen, and fades once the section below has covered about half the screen.
   Without JS, with reduced motion or with Save-Data, it is a plain still image.
   ========================================================================== */
.reel {
  position: relative;
  z-index: 0;
  background: var(--dark);
}
.reel__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 80vh;
  width: 100%;
}
.reel__media {
  position: absolute;
  inset: 0;
}
.reel__media img,
.reel__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reel__media video { display: none; }

/* darkens the frame while a section is passing over it, so text stays readable */
.reel__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--dark);
  opacity: 0;
}

/* ---------- live (JS, motion allowed) ---------- */
.reel--live {
  height: var(--reel-len, 380vh);
  margin-block: -100vh;
  margin-block: -100svh;
  background: none;
  pointer-events: none;
}
.reel--live .reel__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  max-height: none;
  aspect-ratio: auto;
}
.reel--live .reel__media {
  opacity: 0;
  will-change: opacity, transform;
}
.reel--live .reel__media video { display: block; }
.reel--live.reel--ready .reel__media img { visibility: hidden; }

/* the sections on either side slide over the video */
.reel-over { position: relative; z-index: 1; }

@media (max-width: 899px) {
  .reel--live { height: calc(var(--reel-len, 380vh) * .85); }
}

@media print {
  .reel { display: none; }
}
