/* The hero's preview layer, shared by the home and the show page (spec 4.1; public/js/lib/hero-preview.js). The page's hero sets two custom properties: --art-h, the height of
   its art block on a phone, and --art-w, the width of its art on a wide page; the preview stands in the same box as the art. Only opacity moves. */
/* the hero's preview: a layer over the art (opacity only), under the copy; the speaker and replay button in the art block's corner */
.hero-preview { position: absolute; inset: 0; opacity: 0; transform: translateZ(0); transition: opacity var(--hero-fade-ms) ease-out; pointer-events: none; }
.hero-preview.is-on { opacity: 1; }
/* the video fills its frame, and the frame (the picture's own box, whatever shape the file is) carries the fade into the page */
.hero-stage { position: absolute; inset: 0; }
.hero-frame { position: absolute; inset: 0; -webkit-mask-image: var(--mask-bottom); mask-image: var(--mask-bottom); }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: translateZ(0); }
.hero-blur { display: none; }
.hero-controls { position: absolute; z-index: 6; right: 24px; top: calc(var(--art-h) - 24px - 40px); opacity: 0; transition: opacity var(--fade-ms) ease-out; }
.hero-controls.is-on { opacity: 1; }
.hero-sound { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(20, 20, 22, .55); border: 1px solid rgba(255, 255, 255, .55); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hero-sound svg { width: 22px; height: 22px; }

@container page (min-width: 700px) {
  .hero-preview { inset: 0; }
  .hero-stage { left: auto; width: var(--art-w); display: flex; justify-content: center; }
  /* A vertical clip on a wide page, as YouTube and Instagram show one: the clip whole and opaque, with straight sides, over a soft dimmed blur of itself. The layer stands over the hero's
     scrim (.hero-fade, whose side darkening would otherwise lie across the clip's left half), and the copy over the layer, so the words still read first. The clip keeps only a short
     fade at its foot (its last 14%), where the hero meets the rows under it. */
  .hero-preview { z-index: 1; }
  .hero-copy { z-index: 2; }
  .hero-frame { position: relative; inset: auto; height: 100%; max-width: 100%; aspect-ratio: var(--video-ratio, 9 / 16);
    -webkit-mask-image: linear-gradient(180deg, #000 86%, transparent 100%); mask-image: linear-gradient(180deg, #000 86%, transparent 100%); }
  /* The blurred copy takes the art's own place and covers it while the preview is on (the layer's opacity is the preview's fade: the art comes back under it when the preview ends).
     The small canvas (64 x 36: a blur needs no more) is stretched, then really blurred and dimmed, so it reads as the clip's colour behind it and never as blocks. Its box is the art's,
     grown by --hero-blur-bleed past the hero's top, right and bottom (the hero clips it), so the blur's own soft rim falls outside the hero. Since the layer stands over the hero's scrim,
     the blur carries the page's fades itself: the art's left fade, and a fade to the page at the hero's foot. */
  .hero-blur { --hero-blur-bleed: 120px; display: block; position: absolute; top: calc(-1 * var(--hero-blur-bleed)); right: calc(-1 * var(--hero-blur-bleed));
    width: calc(var(--art-w) + var(--hero-blur-bleed)); height: calc(100% + 2 * var(--hero-blur-bleed)); object-fit: cover; opacity: 1; image-rendering: auto; filter: blur(48px) brightness(.4) saturate(1.2);
    -webkit-mask-image: var(--mask-left-full), linear-gradient(0deg, transparent var(--hero-blur-bleed), #000 calc(var(--hero-blur-bleed) + 30%));
    mask-image: var(--mask-left-full), linear-gradient(0deg, transparent var(--hero-blur-bleed), #000 calc(var(--hero-blur-bleed) + 30%)); -webkit-mask-composite: source-in; mask-composite: intersect; }
  .hero-controls { top: auto; bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-preview, .hero-controls { transition-duration: var(--fade-ms); }
}
