/* ============================================================
   GALERÍA DE PROYECTOS — gallery.css
   Estilos del grid de miniaturas + overlay + lightbox overrides
   Carga solo en páginas con $hasGallery = true
   ============================================================ */

/* ---- Sección contenedora ---------------------------------- */
.gallery-section {
  background: #f7f8f6;
  border-top: 1px solid #e2e5de;
}

.gallery-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.gallery-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: #173355;
  margin: 0.25rem 0 0.5rem;
}

.gallery-sub {
  font-size: 0.95rem;
  color: #5a6a5e;
  margin: 0;
}

/* ---- Grid de miniaturas ----------------------------------- */
.gallery-grid-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .gallery-grid-photos {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid-photos {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* ---- Tarjeta individual ----------------------------------- */
.gallery-photo-item {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(23, 51, 85, 0.08);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.gallery-photo-item:hover {
  box-shadow: 0 8px 28px rgba(23, 51, 85, 0.18);
  transform: translateY(-3px);
}

/* ---- Enlace / imagen -------------------------------------- */
.gallery-photo-link {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e2e5de;
  flex-shrink: 0;
}

.gallery-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.gallery-photo-item:hover .gallery-photo-img {
  transform: scale(1.06);
}

/* ---- Overlay con icono zoom ------------------------------- */
.gallery-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(23, 51, 85, 0) 40%,
    rgba(23, 51, 85, 0.55) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-photo-item:hover .gallery-photo-overlay {
  opacity: 1;
}

.gallery-zoom-icon {
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.gallery-photo-item:hover .gallery-zoom-icon {
  transform: scale(1);
}

/* ---- Caption de la figura --------------------------------- */
.gallery-photo-caption {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2a3f2e;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-align: center;
  background: #fff;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- GLightbox overrides (mínimos, no sobrescribir core) -- */
.glightbox-clean .gslide-description {
  background: rgba(23, 51, 85, 0.92);
}

.glightbox-clean .gslide-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 4px;
}

.glightbox-clean .gslide-desc {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.8);
}

.glightbox-clean .gnext,
.glightbox-clean .gprev {
  background: rgba(23, 51, 85, 0.75);
  border-radius: 50%;
  width: 42px;
  height: 42px;
}

.glightbox-clean .gnext:hover,
.glightbox-clean .gprev:hover {
  background: rgba(23, 51, 85, 0.95);
}

/* ---- Accesibilidad: foco visible -------------------------- */
.gallery-photo-link:focus-visible {
  outline: 3px solid #2e7d32;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---- Estado vacío (sin fotos aún) — se oculta si el array
        está vacío porque gallery.php hace early-return ---------- */
.gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #5a6a5e;
  font-style: italic;
}
