
/* Conteneur principal en arrière-plan */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.95); /* UPDATE : Fond noir renforcé pour l'immersion */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Gestion de l'affichage via ta fonction toggleModal */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Classe ajoutée par toggleModal pour ouvrir */
.lightbox-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Enveloppe du contenu (Image + Bouton) */
.lightbox-wrapper {
    position: relative;
    max-width: 95vw;   /* UPDATE : Élargi à 95vw pour maximiser l'espace */
    max-height: 95vh;  /* UPDATE : Élevé à 95vh pour maximiser l'espace */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* L'image dans la lightbox */
#lightbox-img {
    max-width: 95vw;   /* UPDATE : Maximise la largeur sans déformer */
    max-height: 95vh;  /* UPDATE : Maximise la hauteur sans déformer */
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

/* Bouton Fermer dédié */
.lightbox-close-btn {
    position: absolute;
    top: 15px;         /* UPDATE : Placé à l'intérieur de l'image (en haut à droite) */
    right: 15px;       /* UPDATE : Évite de pousser le layout et d'ouvrir une scrollbar */
    z-index: 10001;    /* UPDATE : Reste toujours visible au-dessus de l'image */
    background: rgba(0, 0, 0, 0.5); /* UPDATE : Fond semi-transparent pour lisibilité */
    border: none;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%; /* UPDATE : Bouton rond propre */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Effet au survol sans casser le flux ni provoquer de scrollbar */
.lightbox-close-btn:hover {
    transform: rotate(90deg);
    background-color: rgba(0, 0, 0, 0.8); /* UPDATE : Assombrit le bouton au survol */
}

/* Ajustements adaptatifs pour Mobile */
@media screen and (max-width: 600px) {
    .lightbox-wrapper {
        max-width: 100vw;  /* UPDATE : Utilise 100% de la largeur sur mobile */
        max-height: 100vh; /* UPDATE : Utilise 100% de la hauteur sur mobile */
    }
    
    #lightbox-img {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .lightbox-close-btn {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 26px;
    }
}
