.article-gallery-track {
  background: #050505;
  overflow: hidden;
  position: relative;
}

/* Exactly one slide is allowed to render. The hidden attribute must always win. */
.article-gallery .article-hero-image.has-photo[hidden] {
  display: none !important;
}

.article-gallery .article-hero-image.has-photo:not([hidden]) {
  display: block;
  height: 100%;
  inset: 0;
  overflow: hidden;
  position: absolute;
  width: 100%;
}

/* Give every photo the full gallery frame as its own box, then contain the
   image inside it. Portrait images therefore shrink until the entire photo is
   visible; landscape images also stay uncropped. */
.article-gallery .article-hero-image.has-photo img {
  display: block;
  height: 100%;
  inset: 0;
  max-height: none;
  max-width: none;
  object-fit: contain;
  object-position: center;
  position: absolute;
  width: 100%;
}

.article-gallery-track.gallery-loading-enabled .article-hero-image.has-photo img {
  opacity: 0;
  transition: opacity 220ms ease;
}

.article-gallery-track.gallery-loading-enabled .article-hero-image.has-photo.is-loaded img {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .article-gallery-track.gallery-loading-enabled .article-hero-image.has-photo img {
    transition-duration: 0ms;
  }
}
