/*
 * CSL – stabilisation du bandeau et du viewport mobile.
 * Ce fichier est volontairement séparé des styles du formulaire afin de
 * pouvoir corriger le thème du site sans modifier les écrans CSL.
 */

@media screen and (max-width: 782px) {
    html {
        overflow-x: hidden;
        overflow-x: clip;
        overscroll-behavior-x: none;
    }

    body.csl-mobile-layout {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
        overflow-x: clip;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }

    /* Le bandeau est retiré du flux par position:fixed. La place laissée
     * dans le flux est maintenant assurée par .csl-mobile-header-spacer,
     * placé juste après le bandeau par le script. Cela évite les effets de
     * marge du thème qui faisaient passer le haut des pages sous le bandeau. */
    body.csl-mobile-layout.csl-mobile-header-ready {
        padding-top: 0 !important;
    }

    body.csl-mobile-layout #page,
    body.csl-mobile-layout .site,
    body.csl-mobile-layout .site-content,
    body.csl-mobile-layout .site-main,
    body.csl-mobile-layout #content,
    body.csl-mobile-layout #main,
    body.csl-mobile-layout .content-wrap,
    body.csl-mobile-layout .content-area,
    body.csl-mobile-layout #primary {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* Le bandeau réellement trouvé par le petit script reste indépendant du
     * scroll du thème et ne peut plus se décaler horizontalement. */
    body.csl-mobile-layout .csl-mobile-sticky-header {
        position: fixed !important;
        z-index: 2147483000 !important;
        top: calc(
            env(safe-area-inset-top, 0px) +
            var(--csl-mobile-header-top, 0px)
        ) !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        transform: translate3d(0, 0, 0) !important;
        backface-visibility: hidden !important;
        will-change: transform;
        background: #fff !important;
    }

    body.csl-mobile-layout .csl-mobile-header-spacer {
        display: block !important;
        width: 100% !important;
        height: var(--csl-mobile-header-offset, 0px) !important;
        min-height: var(--csl-mobile-header-offset, 0px) !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.csl-mobile-layout .csl-mobile-sticky-header,
    body.csl-mobile-layout .csl-mobile-sticky-header * {
        box-sizing: border-box;
    }

    body.csl-mobile-layout .csl-mobile-sticky-header .container,
    body.csl-mobile-layout .csl-mobile-sticky-header .header--row-inner,
    body.csl-mobile-layout .csl-mobile-sticky-header .header-main-inner,
    body.csl-mobile-layout .csl-mobile-sticky-header .row {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    body.csl-mobile-layout img,
    body.csl-mobile-layout video,
    body.csl-mobile-layout iframe {
        max-width: 100%;
    }

    body.csl-mobile-layout input,
    body.csl-mobile-layout select,
    body.csl-mobile-layout textarea,
    body.csl-mobile-layout button {
        max-width: 100%;
    }
}

@media screen and (min-width: 783px) {
    body.csl-mobile-layout.csl-mobile-header-ready {
        padding-top: 0 !important;
    }
}
