/*
  Lightbox genérico: se usa con cualquier contenedor [data-lightbox]
  cuyos <a> apunten a la imagen grande (ver assets/js/lightbox.js).
*/
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: var(--c-bg);
  color: var(--c-fg);
  overflow: hidden;
}

.lightbox::backdrop {
  background: var(--c-bg);
}

.lightbox[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: lightbox-in 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes lightbox-in {
  from { opacity: 0; }
}

.lightbox-top {
  display: flex;
  justify-content: flex-end;
  padding: 0.9rem var(--space-3);
}

.lightbox-close {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--c-fg);
  cursor: pointer;
}

.lightbox-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  touch-action: pan-y;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
}

.lightbox-stage img.is-loading {
  opacity: 0;
}

/*
  Modo zoom (grupos con data-lightbox-zoom): la imagen abre a tamaño
  moderado y se amplía con click, rueda o pellizco (lightbox.js).
*/
.lightbox--zoom .lightbox-stage {
  overflow: hidden;
  touch-action: none;
}

.lightbox--zoom .lightbox-stage img {
  max-width: min(100%, 60rem);
  max-height: 86%;
  transform-origin: 0 0;
  cursor: zoom-in;
}

.lightbox--zoom.is-zoomed .lightbox-stage img {
  cursor: grab;
}

.lightbox--zoom.is-zoomed .lightbox-stage img:active {
  cursor: grabbing;
}

.lightbox-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-3);
}

/* mismos controles que la rockola, para que el sitio hable un solo idioma */
.lightbox-bottom button {
  background: none;
  border: 1px solid var(--c-line);
  color: var(--c-fg);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
}

.lightbox-bottom button:disabled {
  opacity: 0.3;
  cursor: default;
}

.lightbox-count {
  color: var(--c-fg-muted);
  font-size: 0.85rem;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  min-width: 4.5ch;
  text-align: center;
}

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

@media (max-width: 640px) {
  .lightbox-stage {
    padding: 0;
  }
}
