#grid-container {
    display: grid;
    grid-template-columns: repeat(1200, 1fr);
    grid-auto-rows: 1px;
    grid-auto-flow: dense;
    gap: 0; /* Important: On gère les espaces via margin pour la précision */
    padding: 7.5px;
}

#grid-container>* {
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 7.5px; /* Crée un gap de 15px entre les items */
}

#grid-container img,
#grid-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

#grid-container>*:hover img,
#grid-container>*:hover video {
    transform: scale(1.05);
}



#myModal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    padding: 10vh 10vw;
    /* 10vh en haut et en bas, 10vw sur les côtés */
    box-sizing: border-box;
}

/* Modèle "Split" image + texte */
.modal-split {
    display: flex;
    flex-direction: row;
    /* On retire width et height 100% pour que la box "enveloppe" exactement l'image */
    max-height: 85vh;
    /* Limite la hauteur par rapport à l'écran */
    max-width: 1400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background-color: #0b0b0b;
}

.modal-left {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.modal-right {
    flex: 0 0 350px;
    /* Largeur fixe de 350px pour le panneau de droite */
    max-width: 550px;
    overflow-y: auto;
    padding: 30px;
    background: #0b0b0b;
    border-left: 1px solid #020202;
    color: #fff;
    box-sizing: border-box;
}

/* Styles pour le contenu détaillé */
.modal-right h2 {
    margin-top: 0;
    font-size: 2em;
    font-weight: 500;
}

.modal-right p {
    color: #bbb;
    line-height: 1.6;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    margin-top: 30px;
}

.details-grid img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

@media (max-width: 900px) {
    .modal-split {
        flex-direction: column;
    }

    .modal-left {
        flex: unset;
        min-height: 40%;
    }

    .modal-right {
        flex: 1;
        /* Remplit le reste de l'écran */
        border-left: none;
        border-top: 1px solid #222;
        max-width: 100%;
        min-height: 300px;
        /* Minimum syndical sur mobile */
        padding: 20px;
    }

    .modal-img {
        max-height: 50vh;
        /* Moins haut sur mobile pour laisser la place au texte */
        max-width: 100%;
    }
}

.modal-img {
    max-height: 85vh;
    /* Ne dépasse jamais la hauteur de l'écran */
    max-width: 100%;
    /* Prend jusqu'à 100% du bloc modal-left sans le dépasser ni se déformer */
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* --- NOUVEAU : MODALE IFRAME --- */
.modal-iframe-container {
    position: relative;
    width: 95%;
    height: 90vh;
    max-width: 1600px;
    background-color: #0b0b0b;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.modal-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-iframe-container iframe[src] {
    opacity: 1;
    /* Fade in when src is set */
}

/* Custom Scrollbar for Modal content */
.modal-right::-webkit-scrollbar {
    width: 6px;
}

.modal-right::-webkit-scrollbar-track {
    background: #0b0b0b;
}

.modal-right::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.modal-right::-webkit-scrollbar-thumb:hover {
    background: #444;
}