/* Layout Griglia Principale */
div.custom-gallery-wrapper {
    display: grid !important;
    /* Griglia a 12 colonne */
    grid-template-columns: repeat(12, 1fr) !important;
    gap: 15px !important;
    width: 100%;
}

/* Stili Immagine Base */
.custom-gallery-wrapper .gallery-item {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

.custom-gallery-wrapper .gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.custom-gallery-wrapper .gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Assicura che l'immagine riempia lo spazio senza deformarsi */
    transition: transform 0.3s ease;
}

.custom-gallery-wrapper .gallery-item a:hover img {
    transform: scale(1.05);
}

/* LOGICA COLONNE (Pattern Fisso)
   - span 3 = 1/4 di riga (3 su 12)
   - span 6 = 1/2 di riga (6 su 12)
*/
.custom-gallery-wrapper .gallery-item.size-span-3 {
    grid-column: span 3 !important;
}

.custom-gallery-wrapper .gallery-item.size-span-6 {
    grid-column: span 6 !important;
}


/* RESPONSIVE */

/* Tablet (sotto 992px): 2 colonne */
@media (max-width: 992px) {
    div.custom-gallery-wrapper {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Resetta gli span per adattarsi a 2 colonne */
    .custom-gallery-wrapper .gallery-item.size-span-3,
    .custom-gallery-wrapper .gallery-item.size-span-6 {
        grid-column: span 1 !important;
    }
}

/* Mobile (sotto 600px): 1 colonna */
@media (max-width: 600px) {
    div.custom-gallery-wrapper {
        grid-template-columns: 1fr !important;
    }
}

/* FIX PER LE DIDASCALIE DI FANCYBOX
   Questo assicura che il testo sia leggibile e visibile
*/
.fancybox-caption {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    /* Sfondo gradiente scuro per far risaltare il testo bianco */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0) 100%) !important;
}

.fancybox-caption__body {
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    text-align: center !important;
}
