.product-gallery {
  display: grid;
  gap: 12px;
  width: 100%;
}

.pdp .stage:has(.product-gallery) {
  align-self: start;
  padding: clamp(18px, 2.4vw, 32px);
}

.product-gallery .pdp-photo-frame {
  position: relative;
  display: grid;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: #fff;
}

.product-gallery .pdp-product-photo,
.pdp .stage .product-gallery .pdp-photo-frame[data-media-kind] .pdp-product-photo[src] {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: clamp(8px, 1.5vw, 18px);
  object-fit: contain;
  object-position: center;
  transform: none;
}

.product-gallery > .caption {
  margin: 0;
  line-height: 1.4;
}

.product-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-gallery__thumbs:has(> :nth-child(4)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-gallery__thumbs:has(> :nth-child(5)) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.product-gallery__thumb {
  min-width: 0;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dfe4f2;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.product-gallery__thumb:hover,
.product-gallery__thumb:focus-visible,
.product-gallery__thumb[aria-current="true"] {
  border-color: #334aa0;
  outline-offset: 3px;
}

.product-gallery__thumb[aria-current="true"] {
  box-shadow: inset 0 0 0 1px #334aa0;
}

.product-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 500px) {
  .product-gallery__thumbs { gap: 6px; }
  .product-gallery__thumb { border-radius: 8px; }
}
