/**
 * Section Galerie - SCROLL FLUIDE 50/50 AVEC PIN
 * Version améliorée avec split horizontal mobile
 * wp-content/themes/custom-theme/src/assets/css/galerie.css
 */

/* ====================================
   🖼️ BLOC GALERIE AVEC PIN ET SCROLL
   ==================================== */
.galerie-section {
    position: relative;
    background: var(--white);
}

.galerie-container {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    position: relative;
    height: 100vh;
}

.galerie-wrapper {
    width: 100%;
    height: 100vh;
    position: relative;
}

/* ====================================
   🎯 GRILLE 50/50 - 2 COLONNES (DESKTOP)
   ==================================== */
.galerie-grid {
    display: grid;
    grid-template-columns: 50% 50%;
    gap: 0;
    width: 100%;
    height: 100vh;
}

/* Colonnes gauche et droite */
.galerie-column {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Container qui va scroller à l'intérieur */
.galerie-column-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Item individuel */
.galerie-item {
    width: 100%;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Image */
.galerie-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ====================================
   🎨 OPTIMISATIONS
   ==================================== */
.galerie-item-image {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.galerie-column-track {
    will-change: transform;
    backface-visibility: hidden;
}

.galerie-section {
    contain: layout style;
}

/* ====================================
   📱 RESPONSIVE - EFFET SPLIT HORIZONTAL
   ==================================== */
@media (max-width: 968px) {
    .galerie-section {
        padding: 0;
    }

    .galerie-container {
        height: 100vh;
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }

    .galerie-wrapper {
        height: 100vh;
    }

    /* Grid en 1 seule colonne - images empilées */
    .galerie-grid {
        height: 100vh;
        grid-template-columns: 1fr;
        grid-template-rows: 50% 50%;
        gap: 0;
    }

    /* Les colonnes prennent 50% de la hauteur chacune */
    .galerie-column {
        height: 50vh;
        width: 100vw;
        overflow: hidden;
    }

    /* Track horizontal pour mobile */
    .galerie-column-track {
        position: absolute;
        top: 0;
        left: 0;
        width: auto;
        height: 100%;
        display: flex;
        flex-direction: row; /* Horizontal au lieu de vertical */
    }

    /* Items en largeur 100vw pour mobile */
    .galerie-item {
        width: 100vw;
        height: 50vh;
        flex-shrink: 0;
    }

    .galerie-item-image {
        object-fit: cover;
    }
}

@media (max-width: 768px) {
    /* Même comportement qu'au-dessus */
    .galerie-section {
        padding: 0;
    }

    .galerie-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 50% 50%;
        gap: 0;
    }

    .galerie-column {
        height: 50vh;
        width: 100vw;
    }

    .galerie-column-track {
        flex-direction: row;
    }

    .galerie-item {
        width: 100vw;
        height: 50vh;
    }
}

@media (max-width: 480px) {
    /* Même comportement qu'au-dessus */
    .galerie-section {
        padding: 0;
    }

    .galerie-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 50% 50%;
        gap: 0;
    }

    .galerie-column {
        height: 50vh;
        width: 100vw;
    }

    .galerie-column-track {
        flex-direction: row;
    }

    .galerie-item {
        width: 100vw;
        height: 50vh;
    }
}

/* ====================================
   🔧 FALLBACK SANS GSAP (DESKTOP UNIQUEMENT)
   ==================================== */
@media (min-width: 969px) {
    .galerie-section:not(.with-gsap) .galerie-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        height: auto;
    }

    .galerie-section:not(.with-gsap) .galerie-column {
        height: auto;
        overflow: visible;
    }

    .galerie-section:not(.with-gsap) .galerie-column-track {
        position: relative;
        display: grid;
        gap: 0;
    }

    .galerie-section:not(.with-gsap) .galerie-item {
        height: auto;
        aspect-ratio: 1 / 1;
    }
}