/* Keep the complete 4:5 gallery visible beside the product information. */
@media (min-width: 981px) {
  .pdp-layout > .pdp-gallery {
    --rw-pdp-gallery-top: calc(var(--rw-pdp-header-height, var(--rw-header, 124px)) + 16px);
    --rw-pdp-gallery-space: max(1px, calc(100dvh - var(--rw-pdp-gallery-top) - 16px));
    position: sticky;
    top: var(--rw-pdp-gallery-top);
    align-self: start;
    justify-self: start;
    /* 74px thumbnail rail + 5px gap + the unchanged 4:5 image stage. */
    width: min(100%, calc(79px + var(--rw-pdp-gallery-space) * .8));
    min-height: 0;
    align-items: stretch;
  }
  .pdp-layout > .pdp-gallery > .pdp-image-stage {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    min-height: 0;
  }
  .pdp-layout > .pdp-gallery > .pdp-thumbnails {
    /* The stage determines the row height, even for very long photo rails. */
    contain: size;
    min-height: 0;
    max-height: none;
    align-self: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .pdp-layout > .pdp-gallery > .pdp-thumbnails > .pdp-thumbnail { flex: 0 0 auto; }
  .pdp-layout > .pdp-gallery > .pdp-thumbnails::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .pdp-layout > .pdp-gallery .pdp-image-scroll {
    /* Thumbnail buttons still scroll programmatically. Wheel scrolls the page. */
    overflow: hidden;
  }
}
