/* Galería reutilizable (js/pdp-gallery.js): carrusel + lightbox. */

.pdp-gal {
  --gal-accent: var(--pdp-accent-text, #00cc00);
  --gal-line: var(--pdp-line, rgba(255, 255, 255, 0.14));
  --gal-text: var(--pdp-text, #fff);
  --gal-muted: var(--pdp-text-muted, rgba(255, 255, 255, 0.64));
  position: relative;
  width: 100%;
}

.pdp-gal__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 14px;
  background: #050505;
  touch-action: pan-y;
}

.pdp-gal__slide {
  position: absolute;
  inset: 0;
  animation: pdp-gal-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pdp-gal__slide[hidden] {
  display: none;
}

.pdp-gal__bg {
  position: absolute;
  inset: -24px;
  background-position: center;
  background-size: cover;
  filter: blur(26px) saturate(1.1) brightness(0.55);
  transform: scale(1.1);
}

.pdp-gal__open {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.pdp-gal .pdp-gal__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdp-gal__open:focus-visible {
  outline: 3px solid var(--gal-accent);
  outline-offset: -3px;
}

.pdp-gal__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.pdp-gal__badge svg,
.pdp-gal__nav svg,
.pdp-lbx__btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pdp-gal__open:hover .pdp-gal__badge,
.pdp-gal__open:focus-visible .pdp-gal__badge {
  opacity: 1;
  transform: none;
}

.pdp-gal__badge--play {
  inset: 50% auto auto 50%;
  width: 68px;
  height: 68px;
  background: rgba(0, 204, 0, 0.92);
  opacity: 1;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  transition: transform 220ms ease;
}

.pdp-gal__badge--play::after {
  content: "";
  margin-left: 5px;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #000;
}

.pdp-gal__open:hover .pdp-gal__badge--play,
.pdp-gal__open:focus-visible .pdp-gal__badge--play {
  transform: translate(-50%, -50%) scale(1.08);
}

.pdp-gal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 10px;
}

.pdp-gal__caption {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  margin: 0;
  color: var(--gal-text);
}

.pdp-gal__count {
  flex: none;
  color: var(--gal-accent);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}

.pdp-gal__text {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdp-gal__navs {
  display: flex;
  flex: none;
  gap: 8px;
}

.pdp-gal__nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--gal-line);
  border-radius: 50%;
  background: transparent;
  color: var(--gal-text);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.pdp-gal__nav:hover,
.pdp-gal__nav:focus-visible {
  border-color: #00cc00;
  background: #00cc00;
  color: #000;
  outline: none;
}

.pdp-gal__thumbs {
  display: flex;
  gap: 8px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.pdp-gal__thumb {
  position: relative;
  flex: none;
  width: 84px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #111;
  opacity: 0.55;
  cursor: pointer;
  scroll-snap-align: center;
  transition: opacity 180ms ease, border-color 180ms ease;
}

.pdp-gal .pdp-gal__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdp-gal__thumb--video::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-40%, -50%);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
}

.pdp-gal__thumb:hover,
.pdp-gal__thumb.is-active {
  opacity: 1;
}

.pdp-gal__thumb.is-active {
  border-color: #00cc00;
}

.pdp-gal__thumb:focus-visible {
  outline: 2px solid var(--gal-accent);
  outline-offset: 2px;
  opacity: 1;
}

@keyframes pdp-gal-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Lightbox ---------- */

.pdp-lbx {
  position: fixed;
  inset: 0;
  z-index: 200100;
  display: grid;
  place-items: center;
  padding: clamp(56px, 7vh, 72px) clamp(12px, 6vw, 96px) clamp(16px, 3vh, 28px);
  background: rgba(0, 0, 0, 0.97);
  opacity: 0;
  transition: opacity 220ms ease;
}

.pdp-lbx[hidden] {
  display: none;
}

.pdp-lbx.is-open {
  opacity: 1;
}

.pdp-lbx__stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  width: 100%;
  height: 100%;
  margin: 0;
}

.pdp-lbx__media {
  position: relative;
  min-height: 0;
  touch-action: pan-y;
}

.pdp-lbx .pdp-lbx__img,
.pdp-lbx .pdp-lbx__video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.pdp-lbx__caption {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 14px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.92rem;
  text-align: center;
}

.pdp-lbx__count {
  color: var(--pdp-green-text, #00cc00);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}

.pdp-lbx__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.72);
  color: #fff;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.pdp-lbx__btn[hidden] {
  display: none;
}

.pdp-lbx__btn:hover,
.pdp-lbx__btn:focus-visible {
  border-color: #00cc00;
  background: #00cc00;
  color: #000;
  outline: none;
}

.pdp-lbx__close {
  top: 12px;
  right: 12px;
}

.pdp-lbx__nav {
  top: 50%;
  transform: translateY(-50%);
}

.pdp-lbx__nav--prev {
  left: clamp(8px, 1.6vw, 28px);
}

.pdp-lbx__nav--next {
  right: clamp(8px, 1.6vw, 28px);
}

@media (max-width: 640px) {
  .pdp-gal__stage {
    aspect-ratio: 4 / 5;
    border-radius: 10px;
  }

  .pdp-gal__text {
    white-space: normal;
  }

  .pdp-gal__thumb {
    width: 64px;
  }

  .pdp-lbx {
    padding-inline: 8px;
  }

  .pdp-lbx__caption {
    align-items: center;
    min-height: 48px;
    padding-inline: 58px;
  }

  .pdp-lbx__nav {
    top: auto;
    bottom: clamp(16px, 3vh, 28px);
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pdp-gal__slide,
  .pdp-gal__badge,
  .pdp-lbx {
    animation: none;
    transition: none;
  }
}
