/* The marker immediately after the hero has no net layout height. */
.cover-hero-snap {
  display: block;
  height: 1px;
  margin-bottom: -1px;
  pointer-events: none;
}

/* Large heroes use the same dimensions on all three page types. */
@media (min-width: 1001px) {
  body:is(.hub-page, .gallery-page, .article-page) .cover-hero {
    aspect-ratio: auto;
    height: 90vh;
    height: 90svh;
  }
}

/* Articles snap only at the hero and its end, never within the prose. */
@media (min-width: 1001px) and (prefers-reduced-motion: no-preference) {
  html {
    scroll-snap-type: y proximity;
  }

  body:is(.hub-page, .gallery-page, .article-page) main > :is(.cover-hero, .cover-hero-snap) {
    scroll-snap-align: start;
  }

  /* Later hub chapters; the first is covered by the hero marker. */
  body.hub-page .cover-hero-snap + .hub-inner > .hub-section:not(:first-of-type),
  body.homepage .cover-hero-snap + .hub-inner > .hub-section {
    scroll-snap-align: start;
  }

  @supports (animation-timeline: scroll(root block)) and (animation-range: 0px 90vh) {
    body:is(.hub-page, .gallery-page, .article-page) .cover-hero__zoom,
    body:is(.hub-page, .gallery-page, .article-page) .cover-hero__overlay {
      animation: cover-hero-settle 1s linear both;
      animation-timeline: scroll(root block);
      animation-range: 0px 90vh;
      animation-range: 0px 90svh;
    }

    body:is(.hub-page, .gallery-page, .article-page) main > .cover-hero-snap {
      scroll-margin-top: min(25vw, 40vh);
      scroll-margin-top: min(25vw, 40svh);
    }
  }
}

@keyframes cover-hero-settle {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 50%;
  }
}
