.product-gallery { --gallery-index: 0; }
.gallery-heading, .gallery-controls, .gallery-dialog-toolbar, .gallery-dialog-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gallery-heading { justify-content: space-between; margin-bottom: 12px; }
.gallery-heading strong { font-size: 18px; }
.gallery-controls { flex-shrink: 0; }
.gallery-count, .gallery-dialog-count { color: #64748b; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 36px; }
.gallery-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  background: #fff;
  color: #172333;
  cursor: pointer;
  touch-action: manipulation;
}
.gallery-icon:hover { background: #edf4ff; border-color: #86aeef; }
.product-preview .gallery-icon img, .gallery-dialog .gallery-icon img { width: 20px; height: 20px; }
.gallery-icon:focus-visible, .gallery-slide:focus-visible, .gallery-dots button:focus-visible {
  outline: 3px solid #3479ee;
  outline-offset: -3px;
}
.gallery-stage { position: relative; overflow: hidden; aspect-ratio: 8 / 5; background: #edf2f8; touch-action: pan-y pinch-zoom; }
.gallery-track { display: flex; height: 100%; transform: translateX(calc(var(--gallery-index) * -100%)); transition: transform 420ms ease; }
.gallery-slide { flex: 0 0 100%; min-width: 0; padding: 0; margin: 0; border: 0; background: #fff; cursor: zoom-in; }
.product-preview .gallery-slide img { width: 100%; height: 100%; object-fit: contain; }
.gallery-expand { position: absolute; right: 12px; bottom: 12px; box-shadow: 0 2px 10px #17233314; }
.gallery-dots { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.gallery-dots button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.gallery-dots button::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #bbc7d9; }
.gallery-dots button[aria-current="true"]::after { background: #3078ef; width: 22px; border-radius: 4px; }
.product-preview.product-gallery figcaption { margin-top: 0; text-align: center; line-height: 1.8; }
.gallery-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.gallery-dialog {
  width: min(1600px, calc(100vw - 40px));
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #172333;
  background: #fff;
  overflow: hidden;
}
.gallery-dialog::backdrop { background: rgb(15 23 42 / 76%); }
.gallery-dialog-layout { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.gallery-dialog-toolbar { justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #e3e9f0; }
.gallery-dialog-toolbar strong { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.gallery-dialog-image { overflow: auto; background: #edf2f8; overscroll-behavior: contain; }
.gallery-dialog-image img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.gallery-dialog-image.is-zoomed img { width: 1920px; height: 1200px; object-fit: initial; }
.gallery-dialog-footer { justify-content: space-between; padding: 8px 16px; color: #64748b; font-size: 13px; border-top: 1px solid #e3e9f0; }
@media (max-width: 600px) {
  .gallery-heading strong { font-size: 16px; }
  .gallery-dialog { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
  .gallery-dialog-toolbar { padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
  .gallery-dialog-footer { padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  .gallery-expand { right: 6px; bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) { .gallery-track { transition: none; } }
