#grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    grid-auto-rows: 10px;
    /* unité fine pour le masonry JS */
    gap: 10px;
}

#grid-container>* {
    overflow: hidden;
}

@media (max-width: 1024px) {
    #grid-container {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 0 6px;
    }

    #grid-container>* {
        width: 100%;
    }

    #grid-container img,
    #grid-container video {
        width: 100%;
        height: auto;
        display: block;
    }
}

#grid-container img,
#grid-container video {
    width: 100%;
    height: auto;
    /* ✅ ratio maintenu */
    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;
}

@media (max-width: 768px) {
    #myModal {
        padding: 0;
    }
}

/* 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;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .modal-left {
        flex: 1;
        min-height: auto;
    }

    .modal-right {
        flex: 1;
        border-left: none;
        border-top: 1px solid #222;
        max-width: 100%;
        min-height: 200px;
        padding: 15px;
    }

    .modal-img {
        max-height: 60vh;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-split {
        width: 100%;
        height: 100%;
    }

    .modal-right {
        min-height: 150px;
        padding: 12px;
    }

    .modal-right h2 {
        font-size: 1.4em;
    }

    .modal-right p {
        font-size: 13px;
    }
}

.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;
}

@media (max-width: 768px) {
    .modal-img {
        max-height: 50vh;
        max-width: 100%;
        width: 100%;
    }
}

/* --- 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;
}

@media (max-width: 768px) {
    .modal-iframe-container {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }
}

@media (max-width: 480px) {
    .modal-iframe-container {
        width: 94%;
        height: 88vh;
        max-width: 1600px;
        border-radius: 16px;
    }
    
    .modal-iframe-container iframe {
        opacity: 1;
    }
    
    #myModal {
        padding: 0;
        align-items: center;
        justify-content: center;
    }
}

.modal-close-btn {
    display: none;
}

@media (max-width: 768px) {
    .modal-close-btn {
        display: flex;
        position: fixed;
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
        border: 2px solid rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        color: white;
        cursor: pointer;
        z-index: 100001;
        align-items: center;
        justify-content: center;
        padding: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        box-shadow: 
            0 0 20px rgba(255, 255, 255, 0.2),
            inset 0 0 10px rgba(255, 255, 255, 0.1);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        transform: scale(0.9);
        opacity: 0;
        animation: none;
    }
    
    .modal-close-btn.visible {
        opacity: 1;
        transform: scale(1);
    }
    
    .modal-close-btn:hover {
        transform: scale(1.1);
        box-shadow: 
            0 0 30px rgba(255, 255, 255, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.15);
        animation: closePulse 1.5s ease-in-out infinite;
    }
    
    .modal-close-btn:active {
        transform: scale(0.95);
    }
    
    .modal-close-btn svg {
        pointer-events: none;
        stroke: white;
        stroke-width: 2.5;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    }
    
    @keyframes closePulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.05); }
    }
}

.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;
}

/* ── modal-iframe : hover overlay + icône info ── */

.modal-iframe {
    position: relative;
    display: block; /* <a> doit être block pour overflow: hidden */
}

/* Overlay sombre */
.modal-iframe::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-iframe:hover::after {
    opacity: 1;
}

/* Icône info */
.modal-iframe__info-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: white;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    box-shadow: 
        0 0 0 0 rgba(255, 255, 255, 0),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.modal-iframe__info-icon::before {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s ease;
}

.modal-iframe__info-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
    stroke-width: 2.5;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.modal-iframe:hover .modal-iframe__info-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.15);
    animation: infoPulse 1.5s ease-in-out infinite;
}

.modal-iframe:hover .modal-iframe__info-icon::before {
    opacity: 1;
    transform: scale(1.1);
    animation: infoRing 1.5s ease-in-out infinite;
}

@keyframes infoPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes infoRing {
    0%, 100% {
        transform: scale(1.1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* ── Titres toujours visibles — bas de l'asset ── */

#grid-container > * {
    position: relative;
}

.asset-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 20px 10px 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
    pointer-events: none;
    overflow: hidden;
}

.asset-label__title {
    display: block;
    font-family: 'Fragment Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: rgba(255,255,255,0.75);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.asset-label__sub {
    display: block;
    font-family: 'Fragment Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    color: rgba(255,255,255,0.35);
    margin-top: 2px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

@media (max-width: 768px) {
    #grid-container {
        gap: 6px;
    }

    .asset-label {
        padding: 12px 6px 5px;
    }

    .asset-label__title {
        font-size: 10px;
        white-space: normal;
    }

    .asset-label__sub {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .all_content {
        padding: 0 4px;
    }

    #grid-container {
        gap: 5px;
    }

    .asset-label {
        padding: 10px 5px 4px;
    }

    .asset-label__title {
        font-size: 10px;
        white-space: normal;
    }

    .asset-label__sub {
        font-size: 8px;
    }

    .modal-iframe__info-icon {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

@media (max-width: 430px) {
    .all_content {
        padding: 0 4px;
    }

    #grid-container {
        gap: 4px;
    }
}

@media (max-width: 375px) {
    .all_content {
        padding: 0 2px;
    }

    #grid-container {
        gap: 3px;
    }

    .asset-label {
        padding: 8px 4px 2px;
    }

    .asset-label__title {
        font-size: 9px;
        white-space: normal;
    }

    .asset-label__sub {
        font-size: 7px;
    }
}

@media (max-width: 414px) {
    .all_content {
        padding: 0 4px;
    }

    #grid-container {
        gap: 4px;
    }
}

@media (max-width: 360px) {
    .all_content {
        padding: 0;
    }

    #grid-container {
        gap: 3px;
    }

    .asset-label {
        padding: 6px 4px 2px;
    }

    .asset-label__title {
        font-size: 7px;
    }

    .asset-label__sub {
        display: none;
    }
}