.panel-stage {
  --panel-h: calc(100vh - var(--header-h) - var(--dock-h));
  --panel-dwell: clamp(18px, 3vh, 32px);
  position: relative;
  isolation: isolate;
}

@supports (height: 100dvh) {
  .panel-stage {
    --panel-h: calc(100dvh - var(--header-h) - var(--dock-h));
  }
}

.panel-stage > .slide {
  position: relative;
  min-block-size: var(--panel-h);
  isolation: isolate;
  margin-block: 0;
}

.panel-stage > .slide > .slide-content {
  min-block-size: var(--panel-h);
}

/* The markers keep honest document offsets even when their panels are pinned. */
.panel-stop {
  height: 0;
  pointer-events: none;
}

.panel-video {
  pointer-events: none;
  opacity: 0;
}

.panel-video.is-playing {
  opacity: 1;
}

[data-motion][hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) and (min-height: 561px) {
  html.has-panel-deck {
    scroll-snap-type: y proximity;
    scroll-padding-block: var(--header-h) var(--dock-h);
  }

  .panel-stop {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }

  .panel-stop.for-tall-slide {
    scroll-snap-align: none;
  }

  .panel-stage.is-enhanced > .slide:not(.is-tall) {
    position: sticky;
    top: var(--header-h);
  }

  /* The next panel travels through this small gap behind the fixed dock.
     The settled frame stays still in both directions, with no gesture timer. */
  .panel-stage.is-enhanced > .slide:not(:last-child):not(.is-tall) {
    margin-block-end: var(--panel-dwell);
  }
}

@media (prefers-reduced-motion: reduce) {
  html.has-panel-deck {
    scroll-behavior: auto;
  }
}

/* The always-present picture is the still. Show this layer only for fallback
   movement after the active video has been refused or stopped advancing. */
.scene > .motion-backup {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.scene > .motion-backup[hidden] { display: none; }
