/* ─── GALERÍA ────────────────────────────────────────────── */
#galeria {
  padding: var(--section-padding) 0;
  background: #fff;
}

.gallery-mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 8rem;
}

.gallery-cell {
  background: var(--stone-dark);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 1; /* Cuadrado perfecto para todas */
}

/* Responsividad para la galería simétrica */
@media (max-width: 900px) {
  .gallery-mosaic {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .gallery-mosaic {
    grid-template-columns: repeat(1, 1fr);
  }
}

.gallery-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-silk);
}

.gallery-cell:hover img {
  transform: scale(1.04);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 23, 20, 0.5);
  opacity: 0;
  transition: opacity 0.4s;
  display: grid;
  place-items: center;
}

.gallery-cell:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay-icon {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(244, 240, 235, 0.5);
  display: grid;
  place-items: center;
  color: var(--stone);
  font-size: 1.2rem;
}

.gallery-caption {
  position: absolute;
  bottom: 1rem;
  left: 1.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--parchment);
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 2;
}

.gallery-cell:hover .gallery-caption {
  opacity: 1;
}



/* ─── GALLERY LIGHTBOX (MODAL) ──────────────────────────── */
.modal-gallery {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--parchment);
}

.modal-gallery.active {
  display: flex !important;
}

.gallery-modal-img-container {
  position: relative;
  max-width: 85%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}

#gallery-modal-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-modal-caption {
  margin-top: 1.5rem;
  font-family: var(--f-serif);
  font-size: 1.4rem;
  font-style: italic;
  text-align: center;
  color: var(--stone);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gallery-modal-counter {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(244, 240, 235, 0.4);
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--stone);
  transition: all 0.4s var(--ease-expo);
  z-index: 10;
  opacity: 0.4;
}

.gallery-nav-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
  color: var(--saffron);
}

.gallery-nav-btn.prev {
  left: 2rem;
}

.gallery-nav-btn.next {
  right: 2rem;
}

#gallery-close {
  color: var(--stone);
  opacity: 0.6;
  z-index: 50;
  font-size: 3rem;
  top: 2rem;
  right: 2rem;
}

#gallery-close:hover {
  opacity: 1;
  color: var(--saffron);
}

@media (max-width: 1024px) {
  .gallery-nav-btn {
    width: 60px;
    height: 60px;
  }

  .gallery-nav-btn.prev {
    left: 1rem;
  }

  .gallery-nav-btn.next {
    right: 1rem;
  }
}

@media (max-width: 640px) {
  .gallery-nav-btn {
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(5px);
  }

  .gallery-nav-btn.prev {
    left: 1rem;
  }

  .gallery-nav-btn.next {
    right: 1rem;
  }

  .gallery-modal-img-container {
    max-width: 90%;
  }

  .gallery-modal-caption {
    font-size: 1.1rem;
  }
}