/*webdesign et animations par: Malka Tutt*/
/*frontend et backend par: Alexandre Sticher*/
html,
body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

#gallery {
    margin: 12vw 5vw 10vw 5.75vw;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#gallery img {
    flex-grow: 1;
    height: 400px;
    /* Hauteur par défaut pour les grands écrans */
    object-fit: cover;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity .2s;
}

#gallery img:hover {
    opacity: .85;
}

/* ── Lightbox ── */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

#lightbox.open {
    display: flex;
    z-index: 1001;
}

#lightbox img {
    max-width: 91vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 0 40px rgba(0, 0, 0, .6);
}

#lightbox .close {
    position: fixed;
    top: 18px;
    right: 24px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    z-index: 1002;
    /* Sécurité pour rester au-dessus de l'image */
}

#lightbox .prev,
#lightbox .next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 10px;
    user-select: none;
    z-index: 1002;
}

#lightbox .prev {
    left: 16px;
}

#lightbox .next {
    right: 16px;
}


@media screen and (max-width: 768px) {
    #gallery {
        margin: 15vh 15px;
        gap: 6px;
    }

    #gallery img {
        height: 200px;
    }

    #lightbox img {
        max-width: 95vw;
        max-height: 75vh;
    }

    #lightbox .close {
        top: 15px;
        right: 20px;
        font-size: 2rem;
    }

    #lightbox .prev,
    #lightbox .next {
        font-size: 2rem;
        background: rgba(0, 0, 0, 0.4);
        border-radius: 50%;
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #lightbox .prev {
        left: 8px;
    }

    #lightbox .next {
        right: 8px;
    }
}