/* =============================================
   Galerie Personnalisée - Layout
   ============================================= */

/* Conteneur principal */
.nids-custom-gallery {
    max-width: 1200px;
    margin: 0 auto;
}

/* Layout desktop : 1 grande image + 4 miniatures en 2x2 */
.nids-custom-gallery .blocks-gallery-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin: 0;
    padding: 0;
}

/* Grande image (première image de la galerie) */
.nids-custom-gallery .blocks-gallery-item:first-child {
    grid-row: span 2;
}

.nids-custom-gallery .blocks-gallery-item:first-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Miniatures (2x2) */
.nids-custom-gallery .blocks-gallery-grid > :nth-child(n+2) {
    grid-column: 2;
}

.nids-custom-gallery .blocks-gallery-item:nth-child(n+2) img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Bouton slideshow (si +4 images) */
.nids-custom-gallery .nids-gallery-slideshow-button {
    grid-column: 1 / -1;
    padding: 10px 20px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 16px;
}

.nids-custom-gallery .nids-gallery-slideshow-button:hover {
    background: #135e96;
}

/* Mobile : 1 grande image + 4 miniatures en ligne */
@media (max-width: 768px) {
    .nids-custom-gallery .blocks-gallery-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .nids-custom-gallery .blocks-gallery-item:first-child {
        flex: 1 0 100%;
        grid-row: auto;
        margin-bottom: 8px;
    }

    .nids-custom-gallery .blocks-gallery-item:nth-child(n+2) {
        flex: 1 0 calc(25% - 6px);
        grid-column: auto;
    }
}

/* Slideshow dialog */
.nids-gallery-slideshow {
    max-width: 90vw;
    max-height: 90vh;
    padding: 20px;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.nids-gallery-slideshow img {
    max-width: 100%;
    max-height: 70vh;
    margin-bottom: 16px;
    border-radius: 4px;
}

.nids-gallery-slideshow button {
    display: block;
    margin: 0 auto;
    padding: 8px 16px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}