/* ============================================
   SCROLL HORIZONTAL - NOUVELLE VERSION AVEC STICKY
   ============================================ */

/* Conteneur principal qui gère le scroll horizontal simulé */
.horizontal-scroll-container {
    position: relative;
    width: 100%;
}

/* Spacer pour créer la distance de scroll vertical */
.horizontal-scroll-spacer {
    width: 100%;
    pointer-events: none;
}

/* Wrapper de la galerie. C'est cet élément qui devient "collant" */
.research-gallery-wrapper {
    /* ▼▼▼ CHANGEMENT PRINCIPAL ▼▼▼ */
    position: sticky; /* On remplace 'relative' par 'sticky' */
    top: 50px;           /* Il se collera en haut du viewport */
    /* ▲▲▲ FIN DU CHANGEMENT ▲▲▲ */

    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    overflow: hidden !important;
    margin-left: calc(-50vw + 50%) !important;
    padding: 0 !important;
    z-index: 2; /* On lui donne un z-index pour qu'il passe au-dessus du reste */
    display: block !important;
    
    /* Optimisations */
    will-change: transform; /* 'position' n'est plus manipulé par JS */
    transform: translateZ(0);
}

/* La galerie elle-même (le reste du CSS est identique) */
.research-gallery {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4rem;
    width: auto !important;
    min-width: max-content !important;
    height: 100vh !important;
    align-items: center !important;
    padding: 0 5vw !important;
    margin: 0 !important;
    transition: none;
    will-change: transform;
    transform: translateX(0);
}

/* Les items de la galerie */
.research-gallery-item {
    flex-shrink: 0 !important;
    height: auto !important;
    width: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.research-gallery-item a {
    display: block !important;
    height: 60vh !important;
    width: auto !important;
}

/* Les images - règles ultra prioritaires */
.research-gallery-item img {
    height: 60vh !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    display: block !important;
}

/* === Responsive === */
@media screen and (max-width: 50em) {
    .research-gallery {
        gap: 1.5rem !important;
        padding: 0 2vw !important;
    }
    
    .research-gallery-item a,
    .research-gallery-item img {
        height: 70vh !important;
    }
}