.gallery-page #gallery-container > button.gallery-image-container,
.gallery-page #gallery-container > button.gallery-image-container:first-child:nth-last-child(n+5) {
  grid-column: auto;
  grid-row: auto;
  aspect-ratio: 4 / 5;
  width: 100%;
}

@media (min-width: 20rem) and (max-width: 60rem) {
  .gallery-page #gallery-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.gallery-page #gallery-container.sl-deal-grid {
  isolation: isolate;
  overflow-anchor: none;
}

@supports (overflow: clip) {
  body.gallery-page { overflow-x: clip; }
}

.gallery-page #gallery-container.sl-deal-grid > button.gallery-image-container {
  transform-origin: 0 0;
  opacity: 1;
  transform: none;
  translate: none;
  rotate: none;
  scale: none;
  transition: box-shadow .2s ease;
  --sl-drift-a: -1.2%;
  --sl-drift-b: 1.35%;
  --sl-drift-offset: -1.2s;
}

.gallery-page #gallery-container.sl-deal-grid > .loaded.is-reveal-ready.revealed:not([data-deal-animation]),
.gallery-page #gallery-container.sl-deal-grid > .loaded.is-reveal-ready.revealed .gallery-image {
  animation: none;
}

.gallery-page #gallery-container.sl-deal-grid > .gallery-image-container.sl-deal-moving {
  z-index: var(--sl-deal-layer, 4);
  will-change: translate, rotate, scale, filter;
  box-shadow: 0 1.3rem 2.4rem rgba(16, 11, 8, .32), 0 .15rem .35rem rgba(16, 11, 8, .2);
}

.gallery-page #gallery-container.sl-deal-grid > .sl-deal-moving::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255, 242, 220, .65), inset 0 0 0 2px rgba(255, 235, 204, .28);
  pointer-events: none;
}

@media screen {
  .gallery-page #gallery-container.sl-deal-grid.sl-deal-preparing {
    animation: slGalleryPreparation 1.2s steps(1, end) forwards;
    animation-duration: 1.2s !important;
    animation-iteration-count: 1 !important;
  }
  .gallery-page #gallery-container.sl-deal-grid > .gallery-image-container[data-deal-animation] {
    animation: slGalleryCardMove var(--sl-deal-duration, 1.04s) cubic-bezier(.37,.06,.18,1) var(--sl-deal-delay, 0ms) both;
    animation-duration: var(--sl-deal-duration, 1.04s) !important;
    animation-iteration-count: 1 !important;
  }
  .gallery-page #gallery-container.sl-deal-grid > button.gallery-image-container.loaded.sl-deal-near > img.gallery-image {
    animation: slGalleryPhotoDrift 6.4s linear var(--sl-drift-offset) infinite alternate both;
    animation-duration: 6.4s !important;
    animation-iteration-count: infinite !important;
    animation-play-state: paused;
  }
  .gallery-page #gallery-container.sl-deal-grid.sl-deal-active > button.gallery-image-container.loaded.sl-deal-near > img.gallery-image {
    animation-play-state: running;
  }
}

@keyframes slGalleryPreparation {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slGalleryCardMove {
  0% {
    translate: var(--sl-deal-from-translate, 0px 0px);
    rotate: var(--sl-deal-from-rotate, 0deg);
    scale: var(--sl-deal-from-scale, 1 1);
    filter: opacity(var(--sl-deal-fade-from, 1));
  }
  48% {
    translate: var(--sl-deal-mid-translate, 0px 0px);
    rotate: var(--sl-deal-mid-rotate, 0deg);
    scale: var(--sl-deal-mid-scale, 1 1);
    filter: opacity(var(--sl-deal-fade-mid, 1));
  }
  100% {
    translate: var(--sl-deal-to-translate, 0px 0px);
    rotate: var(--sl-deal-to-rotate, 0deg);
    scale: var(--sl-deal-to-scale, 1 1);
    filter: opacity(var(--sl-deal-fade-to, 1));
  }
}

@keyframes slGalleryPhotoDrift {
  from { translate: var(--sl-drift-a) -.65%; scale: 1.045; }
  to { translate: var(--sl-drift-b) 1%; scale: 1.135; }
}

@supports not (translate: 0px 0px) {
  .gallery-page #gallery-container.sl-deal-grid > .gallery-image-container[data-deal-animation] {
    animation-name: slGalleryLegacyCardMove;
  }
  @keyframes slGalleryLegacyCardMove {
    0% { transform: var(--sl-deal-from); filter: opacity(var(--sl-deal-fade-from, 1)); }
    48% { transform: var(--sl-deal-mid); filter: opacity(var(--sl-deal-fade-mid, 1)); }
    100% { transform: var(--sl-deal-to); filter: opacity(var(--sl-deal-fade-to, 1)); }
  }
}

@media print {
  .gallery-page #gallery-container.sl-deal-grid,
  .gallery-page #gallery-container.sl-deal-grid > button.gallery-image-container,
  .gallery-page #gallery-container.sl-deal-grid > button.gallery-image-container > img {
    animation: none !important;
    transform: none !important;
    translate: none !important;
    rotate: none !important;
    scale: none !important;
    filter: none !important;
    opacity: 1 !important;
  }
}
