/* ==========================================================================
   Visor de imágenes (lightbox.js): <dialog> a pantalla completa sobre fondo oscuro.
   ========================================================================== */

html.lightbox-open {
  overflow: hidden; /* bloqueo del scroll de la página */
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-white);
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.92);
}

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 70px;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox__img.is-loaded {
  opacity: 1;
}

/* Zoom: la imagen a su tamaño real dentro de un área desplazable */
.lightbox.is-zoomed .lightbox__stage {
  display: block;
  padding: 0;
  overflow: auto;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.lightbox.is-zoomed .lightbox__img {
  max-width: none;
  max-height: none;
  margin: auto;
  cursor: zoom-out;
}

.lightbox__counter {
  position: absolute;
  top: 18px;
  left: 20px;
  font-family: var(--font-text);
  font-size: var(--fs-ui);
  font-weight: var(--fw-light);
  letter-spacing: 0.05em;
}

.lightbox__btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.35);
  color: var(--color-white);
  font-size: 28px;
  transition: background-color var(--t-fast);
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  background: rgb(255 255 255 / 0.18);
}

.lightbox__btn:focus-visible {
  outline-color: var(--color-white);
}

.lightbox__btn--close { top: 8px; right: 8px; }
.lightbox__btn--zoom { top: 8px; right: 64px; }
.lightbox__btn--prev { top: 50%; left: 12px; transform: translateY(-50%); }
.lightbox__btn--next { top: 50%; right: 12px; transform: translateY(-50%); }

.lightbox__btn[aria-pressed="true"] {
  background: rgb(255 255 255 / 0.25);
}

@media (max-width: 767px) {
  .lightbox__stage { padding: 56px 8px; }
  .lightbox__btn--prev, .lightbox__btn--next { top: auto; bottom: 8px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__img { transition: none; }
}
