/* Product detail — lightbox gallery navigation */

.product-lightbox {
  position: fixed;
  inset: 0;
  width: min(96vw, 64rem);
  max-width: 96vw;
  max-height: min(94vh, 100dvh);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.product-lightbox::backdrop {
  background: rgb(108 86 133 / 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.product-lightbox__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.product-lightbox__frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 56rem);
  max-height: min(72vh, 72dvh);
  margin: 0 auto;
  border-radius: 1rem;
  background: #d6e4eb;
  object-fit: contain;
  pointer-events: none;
}

.product-lightbox__close {
  position: absolute;
  top: calc(0.35rem + env(safe-area-inset-top, 0px));
  right: calc(0.35rem + env(safe-area-inset-right, 0px));
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--c-brand);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0.35rem 1rem rgb(0 0 0 / 0.12);
}

.product-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--c-brand);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  box-shadow: 0 0.35rem 1rem rgb(0 0 0 / 0.12);
}

.product-lightbox__nav[hidden] {
  display: none;
}

.product-lightbox__nav--prev {
  left: 0.35rem;
}

.product-lightbox__nav--next {
  right: 0.35rem;
}

.product-lightbox__nav:hover,
.product-lightbox__nav:focus-visible,
.product-lightbox__close:hover,
.product-lightbox__close:focus-visible {
  background: #f6f2f7;
}

.product-lightbox__counter {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}

.product-lightbox__counter[hidden] {
  display: none;
}

.product-lightbox__thumbs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: min(92vw, 36rem);
  margin: 0.75rem auto 0;
  padding: 0.15rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.product-lightbox__thumbs[hidden] {
  display: none;
}

.product-lightbox__thumb {
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0.25rem;
  border: 2px solid transparent;
  border-radius: 0.65rem;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.product-lightbox__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.product-lightbox__thumb.is-active {
  border-color: #e6861a;
  box-shadow: 0 0 0 2px rgb(230 134 26 / 0.35);
}

@media (max-width: 639px) {
  .product-lightbox__nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }

  .product-lightbox__nav--prev {
    left: 0.15rem;
  }

  .product-lightbox__nav--next {
    right: 0.15rem;
  }

  .product-lightbox__frame img {
    max-width: 100%;
    max-height: min(62vh, 62dvh);
    border-radius: 0.85rem;
  }

  .product-lightbox__thumb {
    width: 3.15rem;
    height: 3.15rem;
  }
}

@supports (-webkit-touch-callout: none) {
  .product-lightbox__frame {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .product-lightbox__nav,
  .product-lightbox__close {
    -webkit-touch-callout: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-lightbox__nav,
  .product-lightbox__close,
  .product-lightbox__thumb {
    transition: none;
  }
}
