/* Galería: muro tipo mosaico con proporciones naturales y visor a pantalla completa. */
.gallery {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.gallery-wall {
  columns: 3 300px;
  column-gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1.75rem;
}

.gallery-item figure {
  margin: 0;
}

.gallery-item__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ui-night);
  cursor: zoom-in;
}

.gallery-item__media {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--ui-night);
}

.gallery-item__open .gallery-item__media {
  border-radius: 0;
  transition: transform var(--portal-dur-slow) var(--portal-ease), opacity var(--portal-dur-base) var(--portal-ease);
}

.gallery-item__open:hover .gallery-item__media {
  transform: scale(1.03);
}

.gallery-item__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ui-night);
}

.gallery-item__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gallery-item figcaption {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.15rem 0;
}

.gallery-item figcaption strong {
  color: var(--portal-ink);
  font-weight: 700;
}

.gallery-item figcaption span {
  color: var(--portal-muted);
  font-size: 0.925rem;
}

/* ---------- Visor ---------- */
.gallery-lightbox {
  width: min(1100px, 100% - 2rem);
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.gallery-lightbox::backdrop {
  background: rgba(5, 12, 26, 0.88);
  backdrop-filter: blur(4px);
}

.gallery-lightbox figure {
  margin: 0;
  text-align: center;
}

.gallery-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  border-radius: 10px;
  object-fit: contain;
}

.gallery-lightbox figcaption {
  margin-top: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.gallery-lightbox__close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.1rem;
}

.gallery-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.gallery-lightbox[open] {
  animation: galleryZoom var(--portal-dur-base) var(--portal-ease);
}

@keyframes galleryZoom {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}
