/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Contenedor principal de la galería */
.custom-gallery-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Grid de la galería */
.custom-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Items de la galería */
.custom-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    aspect-ratio: 3/2;
    cursor: pointer;
}

.custom-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.custom-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.custom-gallery-item:hover img {
    transform: scale(1.05);
}

/* Overlay al hacer hover */
.custom-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-gallery-item:hover .custom-gallery-overlay {
    opacity: 1;
}

.custom-gallery-overlay-icon {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.custom-gallery-item:hover .custom-gallery-overlay-icon {
    transform: scale(1);
}

.custom-gallery-overlay-icon::before {
    content: "🔍";
    font-size: 20px;
}

/* Modal de Lightbox */
.custom-lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-lightbox-modal.active {
    opacity: 1;
    visibility: visible;
}

.custom-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.custom-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* Botones de navegación */
.custom-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.custom-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.custom-lightbox-nav:hover {
    color: #ddd;
}

.custom-lightbox-prev {
    left: -60px;
}

.custom-lightbox-next {
    right: -60px;
}

/* Responsive */
@media (max-width: 768px) {
    .custom-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .custom-lightbox-nav {
        width: 30px;
        height: 30px;
        font-size: 30px;
    }

    .custom-lightbox-prev {
        left: -40px;
    }

    .custom-lightbox-next {
        right: -40px;
    }
}

@media (max-width: 480px) {
    .custom-gallery-grid {
        grid-template-columns: 1fr;
    }
} 



/*FADE IN*/


/* Slow fade-in on scroll (sin movimiento) */
@keyframes customGallerySlowFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
  }
  
  .custom-gallery-item img {
    opacity: 0;
    transform: none !important;
    filter: none !important;
    animation: none !important; /* sin animación hasta que entre en viewport */
  }
  
  .custom-gallery-item img.is-visible {
    animation: customGallerySlowFadeIn 1800ms ease-out both !important;
  }
  
  @media (prefers-reduced-motion: reduce) {
    .custom-gallery-item img,
    .custom-gallery-item img.is-visible {
      animation: none !important;
      opacity: 1 !important;
      transform: none !important;
      filter: none !important;
    }
  }