/* Carrusel y visor ampliado de productos */

.product-gallery__arrow:focus-visible,
.product-lightbox button:focus-visible {
  outline-color: var(--color-white);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-dark);
}

.product-detail-page--gallery .product-detail__grid {
  grid-template-columns: minmax(310px, 0.94fr) minmax(0, 1.45fr);
  gap: clamp(3rem, 6vw, 6rem);
}

.product-gallery {
  min-width: 0;
}

.product-gallery__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: var(--color-mist);
  isolation: isolate;
}

.product-gallery__track,
.product-gallery__slide,
.product-gallery__open {
  position: absolute;
  inset: 0;
}

.product-gallery__slide {
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 420ms var(--ease), visibility 420ms;
}

.product-gallery__slide.is-active {
  opacity: 1;
  visibility: visible;
}

.product-gallery__open {
  width: 100%;
  padding: clamp(1.1rem, 4vw, 2rem);
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.product-gallery__open img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 520ms var(--ease);
}

.product-gallery__open:hover img {
  transform: scale(1.035);
}

.product-gallery__arrow,
.product-lightbox__arrow,
.product-lightbox__tools button {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--color-white);
  background: var(--color-brand-teal);
  cursor: pointer;
  transition: background-color 220ms ease, transform 300ms var(--ease);
}

.product-gallery__arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
}

.product-gallery__arrow:hover,
.product-lightbox__arrow:hover,
.product-lightbox__tools button:hover {
  background: #0a4a5b;
}

.product-gallery__arrow--previous {
  left: 0.75rem;
}

.product-gallery__arrow--next {
  right: 0.75rem;
}

.product-gallery__arrow svg,
.product-lightbox__arrow svg,
.product-lightbox__tools svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.product-gallery__thumbnails {
  display: grid;
  grid-template-columns: none;
  grid-auto-columns: 76px;
  grid-auto-flow: column;
  justify-content: start;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding: 0.1rem 0 0.45rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-color: var(--color-secondary) var(--color-mist);
  scrollbar-width: thin;
}

.product-gallery__thumbnail {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  padding: 0.3rem;
  border: 1px solid rgba(8, 47, 67, 0.14);
  border-radius: 11px;
  background: var(--color-mist);
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 220ms ease, transform 300ms var(--ease);
}

.product-gallery__thumbnail::after {
  position: absolute;
  right: 0.5rem;
  bottom: 0.35rem;
  left: 0.5rem;
  height: 2px;
  border-radius: 999px;
  background: var(--color-primary);
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 220ms ease, transform 300ms var(--ease);
}

.product-gallery__thumbnail:hover {
  border-color: rgba(8, 47, 67, 0.35);
  transform: translateY(-2px);
}

.product-gallery__thumbnail.is-active {
  border-color: var(--color-brand-teal);
}

.product-gallery__thumbnail.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.product-gallery__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-gallery__help {
  max-width: 25rem;
  margin: 0.75rem 0 0;
  color: #526a73;
  font-size: 0.72rem;
  line-height: 1.45;
}

body.lightbox-open,
body:has(.product-lightbox[open]) {
  overflow: hidden;
}

.product-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--color-white);
  background: #07141b;
  overflow: hidden;
}

.product-lightbox::backdrop {
  background: rgba(2, 13, 18, 0.92);
}

.product-lightbox__shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
}

.product-lightbox__header {
  position: relative;
  z-index: 4;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  background: rgba(7, 20, 27, 0.94);
}

.product-lightbox__count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

.product-lightbox__tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-lightbox__tools button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.product-lightbox__tools button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.product-lightbox__tools [data-zoom-reset] {
  min-width: 68px;
  padding-inline: 0.65rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

.product-lightbox__viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0a1a22;
  cursor: zoom-in;
  touch-action: none;
}

.product-lightbox__viewport.is-zoomed {
  cursor: grab;
}

.product-lightbox__viewport.is-dragging {
  cursor: grabbing;
}

.product-lightbox__viewport img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(82vw, 1120px);
  height: min(72dvh, 940px);
  object-fit: contain;
  user-select: none;
  transform: translate(calc(-50% + var(--pan-x, 0px)), calc(-50% + var(--pan-y, 0px))) scale(var(--zoom, 1));
  transform-origin: center;
  transition: transform 220ms var(--ease);
  pointer-events: none;
  -webkit-user-drag: none;
}

.product-lightbox__viewport.is-dragging img,
.product-lightbox__viewport.is-pinching img {
  transition: none;
}

.product-lightbox__arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(7, 20, 27, 0.88);
  transform: translateY(-50%);
}

.product-lightbox__arrow--previous {
  left: clamp(0.75rem, 2vw, 1.5rem);
}

.product-lightbox__arrow--next {
  right: clamp(0.75rem, 2vw, 1.5rem);
}

.product-lightbox__footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  background: rgba(7, 20, 27, 0.94);
}

.product-lightbox__footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.76rem;
}

.product-lightbox__instructions {
  text-align: right;
}

@media (max-width: 660px) {
  .product-detail-page--gallery .product-detail__grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .product-gallery {
    width: min(100%, 430px);
    margin-inline: auto;
  }

  .product-gallery__arrow {
    width: 42px;
    height: 42px;
  }

  .product-gallery__thumbnails {
    grid-auto-columns: 64px;
  }

  .product-lightbox__header {
    min-height: 64px;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
  }

  .product-lightbox__tools {
    gap: 0.3rem;
  }

  .product-lightbox__tools button {
    min-width: 42px;
    min-height: 42px;
  }

  .product-lightbox__tools [data-zoom-reset] {
    min-width: 58px;
    padding-inline: 0.4rem;
  }

  .product-lightbox__viewport img {
    width: 92vw;
    height: 74dvh;
  }

  .product-lightbox__arrow {
    top: auto;
    bottom: 4.25rem;
    width: 46px;
    height: 46px;
    transform: none;
  }

  .product-lightbox__arrow--previous {
    left: 0.75rem;
  }

  .product-lightbox__arrow--next {
    right: 0.75rem;
  }

  .product-lightbox__footer {
    min-height: 58px;
    padding: 0.7rem 4.25rem;
    justify-content: center;
    text-align: center;
  }

  .product-lightbox__instructions {
    display: none;
  }
}
