/* =========================================
   Estilos de la Galería (Masonry JS + Lightbox)
   ========================================= */

.section-gallery {
  padding: 120px 0 60px; /* Espacio superior para el header fijo */
  min-height: 100vh;
  /* Fondo oscuro coherente con el sitio */
  background: var(--bg-section, linear-gradient(90deg, #584990 -6.14%, #040615 63.98%));
}

.gallery-title {
  font-size: clamp(36px, 6vw, 70px);
  text-align: center;
  margin-bottom: 16px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.gallery-intro {
  text-align: center;
  font-size: clamp(18px, 2vw, 22px);
  opacity: 0.9;
  margin-bottom: 50px;
  max-width: 700px;
  margin-inline: auto;
  color: #e0e0e0;
}

/* --- GRID FLEXBOX (Columnas Físicas) --- */
.gallery-wrapper {
  display: flex;
  gap: 20px; /* Espacio horizontal entre columnas */
  align-items: flex-start; /* Permite alturas desiguales */
  justify-content: center;
}

.gallery-column {
  flex: 1; /* Todas las columnas mismo ancho */
  display: flex;
  flex-direction: column;
  gap: 20px; /* Espacio vertical entre fotos */
  min-width: 0; /* Evita desbordes en flexbox */
}

/* --- TARJETA DE FOTO --- */
.gallery-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05); /* Placeholder gris */
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in; /* Lupa al pasar el mouse */
}

/* Efecto Hover */
.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 209, 255, 0.25); /* Glow Neón */
  z-index: 2;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0; /* Inicia invisible para fade-in */
  transition: opacity 0.6s ease;
}

.gallery-item img.loaded {
  opacity: 1; /* Aparece suavemente */
}

/* --- LOADER (Spinner) --- */
.loading-trigger {
  text-align: center;
  padding: 60px 0;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.7);
}
.loading-trigger.show {
  opacity: 1;
}

.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,0.1);
  border-left-color: #00D1FF; /* Azul cian */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- LIGHTBOX (Modal Zoom) --- */
.lightbox-modal {
    display: none;
    position: fixed; 
    z-index: 9999; 
    padding-top: 50px; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%; 
    overflow: hidden; 
    background-color: rgba(4, 6, 21, 0.95); /* Fondo muy oscuro */
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    object-fit: contain;
}

.lightbox-modal.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 50px;
    font-weight: 300;
    line-height: 1;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-close:hover {
    color: #00D1FF;
    transform: scale(1.1);
}

/* --- RESPONSIVE --- */

/* Tablet (max 1024px) -> 3 Columnas */
@media (max-width: 1024px) {
   .gallery-column:nth-child(4) { display: none; }
}

/* Mobile Grande (max 768px) -> 2 Columnas */
@media (max-width: 768px) {
   .gallery-column:nth-child(3), 
   .gallery-column:nth-child(4) { display: none; }
   
   .section-gallery { padding-top: 100px; }
}

/* Mobile Pequeño (max 480px) -> 1 Columna */
@media (max-width: 480px) {
   .gallery-wrapper { display: block; } /* Block para apilar */
   .gallery-column { width: 100%; margin-bottom: 20px; }
   
   /* Ocultamos las extras, el JS detectará y usará solo la columna 1 */
   .gallery-column:nth-child(2), 
   .gallery-column:nth-child(3), 
   .gallery-column:nth-child(4) { display: none; }
}