/**
 * Shared product image gallery (post-ATC + cart drawer).
 * Scroll-snap carousel with optional ×N badges and pagination dots.
 */

.product-gallery {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--spacing, 0.25rem) * 2);
  width: 7rem;
}

.product-gallery[hidden] {
  display: none;
}

.product-gallery__viewport {
  position: relative;
  width: 7rem;
  height: 7rem;
  overflow: hidden;
  border-radius: var(--radius-lg, 0.75rem);
  background: var(--color-natural-white-25, #f5f3ef);
}

.product-gallery__link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.product-gallery__track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}

.product-gallery__track::-webkit-scrollbar {
  display: none;
}

.product-gallery__track:focus-visible {
  outline: 2px solid var(--color-black, #212121);
  outline-offset: 2px;
}

.product-gallery__slide {
  position: relative;
  display: flex;
  flex: 0 0 100%;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.product-gallery__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}

.product-gallery__qty {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  min-width: 1.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  background: rgb(0 0 0 / 78%);
  color: var(--color-white, #fff);
  font-size: 0.65rem;
  font-weight: var(--font-weight-medium, 500);
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
}

.product-gallery__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 0.5rem;
}

.product-gallery__dots[hidden] {
  display: none;
}

.product-gallery__dot {
  width: 0.4rem;
  height: 0.4rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: var(--color-black, #212121);
  opacity: 0.22;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-gallery__dot.is-active {
  opacity: 1;
  transform: scale(1.15);
}

.product-gallery__dot:focus-visible {
  outline: 2px solid var(--color-black, #212121);
  outline-offset: 2px;
}

/* Post-ATC size */
.post-atc-modal .product-gallery,
.post-atc-modal .product-gallery__viewport {
  width: 7rem;
}

.post-atc-modal .product-gallery__viewport {
  height: 7rem;
}

@media (min-width: 48rem) {
  .post-atc-modal .product-gallery,
  .post-atc-modal .product-gallery__viewport {
    width: 8rem;
  }

  .post-atc-modal .product-gallery__viewport {
    height: 8rem;
  }
}

/* Cart drawer size — match prior 85px thumb; tighter on narrow panels */
.cart-drawer .product-gallery,
.cart-drawer .product-gallery__viewport {
  width: 85px;
}

.cart-drawer .product-gallery__viewport {
  height: 85px;
  border-radius: var(--radius, 20px);
}

@media (max-width: 47.9375rem) {
  .cart-drawer .product-gallery,
  .cart-drawer .product-gallery__viewport {
    width: 64px;
  }

  .cart-drawer .product-gallery__viewport {
    height: 64px;
  }
}

.cart-drawer .product-gallery__qty {
  right: 0.25rem;
  bottom: 0.25rem;
  min-width: 1.25rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.6rem;
}

.cart-drawer .product-gallery__dots {
  gap: 0.25rem;
}

.cart-drawer .product-gallery__dot {
  width: 0.3rem;
  height: 0.3rem;
}
