/* Product detail overlay: image-first stage and mixed-media contact sheet. */
.product-gallery-video-expand {
  position: absolute;
  z-index: 4;
  right: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fffdfa;
  color: var(--ink);
  cursor: pointer;
}
.product-gallery-video-expand[hidden] { display: none; }
.product-gallery-video-expand i { font-size: 21px; }
.product-gallery-viewer {
  --gallery-accent: #bda6e4;
  z-index: 100001;
  color: #fff;
  background: rgba(24, 21, 27, 0.82);
}
.product-gallery-viewer [hidden] { display: none !important; }
.product-gallery-viewer__dialog {
  grid-template-columns: minmax(0, 1fr) clamp(220px, 19vw, 340px);
  grid-template-rows: 52px minmax(0, 1fr);
  gap: 12px 24px;
  height: 100%;
  height: 100dvh;
  padding: 14px 24px 24px;
  overflow: hidden;
}
.product-gallery-viewer__toolbar {
  grid-column: 1 / -1;
  min-height: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.product-gallery-viewer button {
  border-color: transparent;
  color: #302b34;
  background: #fffdfa;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.12);
}
.product-gallery-viewer button:focus-visible {
  outline: 3px solid var(--gallery-accent);
  outline-offset: 3px;
}
.product-gallery-viewer__stage {
  position: relative;
  display: flex;
  justify-content: center;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  height: 100%;
  gap: 0;
}
.product-gallery-viewer__media {
  flex: 1;
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  border-radius: 6px;
}
.product-gallery-viewer__media > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.product-gallery-viewer__media > video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.product-gallery-viewer__media.is-video {
  touch-action: auto;
  cursor: default;
}
.product-gallery-viewer__status {
  position: absolute;
  left: 15%;
  right: 15%;
  top: 45%;
  color: #fff;
  text-align: center;
  font-family: var(--sans);
  font-size: 14px;
}
.product-gallery-viewer__arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
}
.product-gallery-viewer__arrow--previous { left: min(calc(var(--gallery-media-left, 0px) + 16px), calc(50% - 52px)); }
.product-gallery-viewer__arrow--next { right: min(calc(var(--gallery-media-right, 0px) + 16px), calc(50% - 52px)); }
.product-gallery-viewer .product-gallery-viewer__zoom-hint {
  position: absolute;
  z-index: 2;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 13px;
  gap: 7px;
  border-radius: 20px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}
.product-gallery-viewer__zoom-hint i { font-size: 16px !important; }
.product-gallery-viewer__thumbnails {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-items: start;
  align-content: start;
  gap: 12px;
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 4px 7px 4px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.5) transparent;
}
.product-gallery-viewer__thumbnails button {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 10px;
  opacity: 0.86;
  background: transparent;
  box-shadow: none;
}
.product-gallery-viewer__thumbnails button:nth-child(3n) {
  grid-column: 1 / -1;
}
.product-gallery-viewer__thumbnails button.is-active {
  border-color: #fffdfa;
  box-shadow: 0 0 0 2px var(--gallery-accent);
  opacity: 1;
}
.product-gallery-viewer__thumbnails button:hover { opacity: 1; }
.product-gallery-viewer__thumbnails img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.product-gallery-viewer__thumbnails button > i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #302b34;
  background: #fffdfa;
  pointer-events: none;
}
@media (max-width: 760px) {
  .product-gallery-viewer__dialog {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 46px minmax(0, 1fr) 86px;
    gap: 10px;
    padding: max(8px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }
  .product-gallery-viewer__toolbar { grid-column: 1; }
  .product-gallery-viewer button { width: 44px; height: 44px; }
  .product-gallery-viewer__arrow--previous { left: min(calc(var(--gallery-media-left, 0px) + 6px), calc(50% - 48px)); }
  .product-gallery-viewer__arrow--next { right: min(calc(var(--gallery-media-right, 0px) + 6px), calc(50% - 48px)); }
  .product-gallery-viewer__thumbnails {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    height: 86px;
    padding: 4px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .product-gallery-viewer__thumbnails button {
    flex: 0 0 74px;
    width: 74px;
    height: 74px;
    border-radius: 7px;
  }
  .product-gallery-viewer .product-gallery-viewer__zoom-hint { height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .product-gallery-viewer__media > img { transition: none; }
}
