.product-gallery {
  --gallery-gold: #a87c34;
  --gallery-radius: clamp(1.15rem, 1.8vw, 1.75rem);

  position: relative;
  min-width: 0;
}

.product-gallery__layout {
  display: grid;
  gap: clamp(0.9rem, 1.5vw, 1.35rem);
}

.product-gallery__stage,
.product-gallery__frame,
.product-gallery__viewport {
  min-width: 0;
}

.product-gallery__frame {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgb(8 71 66 / 56%), transparent 48%),
    linear-gradient(145deg, #071411, #0b1916 62%, #171208);
  border: 1px solid rgb(91 65 27 / 26%);
  border-radius: var(--gallery-radius);
  box-shadow:
    0 2.1rem 5.5rem rgb(25 18 10 / 17%),
    inset 0 0 0 1px rgb(255 255 255 / 5%);
}

.product-gallery__viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  aspect-ratio: 4 / 5;
  overscroll-behavior-inline: contain;
  scroll-behavior: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pan-y pinch-zoom;
}

.product-gallery__viewport::-webkit-scrollbar,
.product-gallery__rail::-webkit-scrollbar {
  display: none;
}

.product-gallery__viewport:focus-visible {
  outline: 2px solid var(--gallery-gold);
  outline-offset: 4px;
}

.product-gallery__track {
  display: flex;
  width: 100%;
  min-width: 100%;
  height: 100%;
}

.product-gallery__slide {
  position: relative;
  width: 100%;
  min-width: 100%;
  height: 100%;
  flex: 0 0 100%;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.product-gallery__slide::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, transparent 70%, rgb(4 9 8 / 8%));
  opacity: 0;
  transition: opacity 500ms var(--ease-standard);
}

.product-gallery__slide.is-current::after {
  opacity: 1;
}

.product-gallery__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--product-image-position, 50% 50%);
  opacity: 0.62;
  transform: scale(1.006);
  transition:
    opacity 700ms var(--site-reveal-ease, var(--ease-luxury)),
    transform 700ms var(--site-reveal-ease, var(--ease-luxury));
}

.product-gallery__slide.is-image-loaded .product-gallery__image {
  opacity: 0.9;
}

.product-gallery__slide.is-current.is-image-loaded
  .product-gallery__image {
  opacity: 1;
  transform: scale(1);
}

.product-gallery__slide.is-image-unavailable {
  background:
    radial-gradient(circle at 50% 45%, rgb(11 94 86 / 28%), transparent 32%),
    linear-gradient(145deg, #071411, #171208);
}

.product-gallery__slide.is-image-unavailable::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgb(213 179 106 / 34%);
  transform: translate(-50%, -50%) rotate(45deg);
}

.product-gallery__frame-line {
  position: absolute;
  inset: clamp(0.55rem, 0.8vw, 0.8rem);
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgb(229 207 154 / 22%);
  border-radius: calc(var(--gallery-radius) * 0.7);
}

.product-gallery__controls {
  display: grid;
  grid-template-columns: 3rem minmax(4.8rem, auto) 3rem;
  align-items: center;
  justify-content: end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.product-gallery__controls[hidden],
.product-gallery__dots[hidden],
.product-gallery__rail[hidden] {
  display: none;
}

.product-gallery__controls button {
  display: grid;
  width: 3rem;
  min-height: 3rem;
  place-items: center;
  color: #0a1110;
  background: rgb(255 255 255 / 18%);
  border: 1px solid rgb(8 11 11 / 23%);
  border-radius: 0.8rem;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-base) var(--ease-luxury);
}

.product-gallery__controls button:not(:disabled):hover,
.product-gallery__controls button:not(:disabled):focus-visible {
  color: #f2eadd;
  background: #0b3734;
  border-color: #0b3734;
  transform: translateY(-1px);
}

.product-gallery__controls button:disabled {
  opacity: 0.34;
  cursor: default;
}

.product-gallery__controls p {
  color: rgb(8 11 11 / 58%);
  font-family: var(--font-brand);
  font-size: 0.61rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-align: center;
}

.product-gallery__rail {
  min-width: 0;
  overflow-x: auto;
  padding: 0.15rem 0 0.35rem;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.product-gallery__thumbnails {
  display: flex;
  width: max-content;
  gap: 0.7rem;
}

.product-gallery__thumbnail {
  position: relative;
  display: block;
  width: clamp(4.3rem, 5.2vw, 5.2rem);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  padding: 0;
  background: #111817;
  border: 1px solid rgb(8 11 11 / 14%);
  border-radius: 0.75rem;
}

.product-gallery__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--product-image-position, 50% 50%);
  opacity: 0.72;
  filter: saturate(0.78);
  transition:
    opacity var(--duration-base) var(--ease-luxury),
    filter var(--duration-base) var(--ease-standard),
    transform 650ms var(--ease-luxury);
}

.product-gallery__thumbnail-line {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--gallery-gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 500ms var(--ease-luxury);
}

.product-gallery__thumbnail:hover img,
.product-gallery__thumbnail:focus-visible img,
.product-gallery__thumbnail.is-current img {
  opacity: 1;
  filter: none;
  transform: scale(1.02);
}

.product-gallery__thumbnail.is-current {
  border-color: rgb(168 124 52 / 72%);
}

.product-gallery__thumbnail.is-current
  .product-gallery__thumbnail-line {
  transform: scaleX(1);
  transform-origin: left;
}

.product-gallery__dots {
  display: none;
}

.product-gallery__disclosure {
  max-width: 43rem;
  margin-top: 1rem;
}

.product-gallery__curtain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgb(7 58 55 / 80%), transparent),
    #080b0b;
  border-radius: var(--gallery-radius);
  transform: scaleY(0);
  transform-origin: bottom;
}

.product-gallery.is-motion-ready .product-gallery__curtain {
  transform: scaleY(0);
}

.product-gallery.is-motion-ready .product-gallery__layout {
  opacity: 0;
  transform: translateY(1.125rem);
}

.product-gallery.is-gallery-visible .product-gallery__curtain {
  transform: scaleY(0);
}

.product-gallery.is-gallery-visible .product-gallery__layout {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 720ms var(--ease-luxury),
    transform 820ms var(--ease-luxury);
}

@media (max-width: 899px) {
  .product-gallery__thumbnail {
    width: 4.8rem;
  }
}

@media (max-width: 599px) {
  .product-gallery {
    --gallery-radius: 1.2rem;
  }

  .product-gallery__layout {
    gap: 0.75rem;
  }

  .product-gallery__frame {
    box-shadow: 0 1.4rem 3.5rem rgb(25 18 10 / 16%);
  }

  .product-gallery__rail {
    display: none;
  }

  .product-gallery__controls {
    grid-template-columns: 3rem minmax(4.5rem, 1fr) 3rem;
    justify-content: stretch;
    margin-top: 0.8rem;
  }

  .product-gallery__dots {
    display: flex;
    min-height: 1.5rem;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    padding-inline: 3.75rem;
  }

  .product-gallery__dot {
    width: 0.42rem;
    height: 0.42rem;
    flex: 0 0 auto;
    padding: 0;
    background: rgb(8 11 11 / 24%);
    border-radius: 50%;
    transition:
      background var(--duration-base) var(--ease-standard),
      transform var(--duration-base) var(--ease-luxury);
  }

  .product-gallery__dot.is-current {
    width: 1.35rem;
    background: #926b2e;
    border-radius: var(--radius-pill);
    transform: scaleY(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-gallery__curtain {
    display: none;
  }

  .product-gallery__layout,
  .product-gallery.is-motion-ready .product-gallery__layout {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .product-gallery__image,
  .product-gallery__thumbnail img,
  .product-gallery__controls button,
  .product-gallery__dot {
    transition: none;
  }
}
