/* Shapesound 3D stage (tech/stage3d.js).
   The element keeps its static pictures. The WebGL canvas sits underneath them, at the bottom of the
   element's own stacking context, so captions and other content stay on top and clicks pass straight
   through to the link. When the first real frame has rendered, the element gets class "is-live": the
   canvas fades in under the pictures, then the pictures fade away, so there is never a dip or a flash.
   Pictures that fade: direct <img> children, .stage-glow, and anything marked data-stage3d-fallback. */

:where([data-stage3d]) { position: relative; }
[data-stage3d] { isolation: isolate; }

.stage3d-canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
}
[data-stage3d].is-live > .stage3d-canvas { opacity: 1; }

[data-stage3d] > img,
[data-stage3d] > .stage-glow,
[data-stage3d] > [data-stage3d-fallback] {
  transition: opacity .9s ease .3s, transform .45s ease;
}
[data-stage3d].is-live > img,
[data-stage3d].is-live > .stage-glow,
[data-stage3d].is-live > [data-stage3d-fallback] {
  opacity: 0;
}

/* WebGL context lost: back to the pictures at once, no fade from a blank canvas */
[data-stage3d].is-stage3d-lost > .stage3d-canvas,
[data-stage3d].is-stage3d-lost > img,
[data-stage3d].is-stage3d-lost > .stage-glow,
[data-stage3d].is-stage3d-lost > [data-stage3d-fallback] {
  transition: none;
}
[data-stage3d].is-stage3d-lost > .stage3d-canvas { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .stage3d-canvas,
  [data-stage3d] > img,
  [data-stage3d] > .stage-glow,
  [data-stage3d] > [data-stage3d-fallback] {
    transition-duration: .2s;
    transition-delay: 0s;
  }
}
