/*
 * AMSODE — C2 GLOBAL MARGINS
 *
 * Référence géométrique officielle :
 * Desktop : 72px
 * Mobile  : 22px
 *
 * Cette feuille est volontairement chargée en dernier.
 * Elle normalise uniquement la géométrie horizontale.
 * Elle ne change ni couleurs, ni typographie, ni composants.
 */

@media screen {

    body.bk-body {
        --c2-gutter: 72px;
        --c2-gutter-total: 144px;
    }


    /* ==========================================================
       1. STRUCTURE COMMUNE DU LECTEUR
       ========================================================== */

    body.bk-body .bk-chapter-top,
    body.bk-body .bk-chapter-heading,
    body.bk-body .bk-chapter-bottom,
    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content {
        padding-left: var(--c2-gutter) !important;
        padding-right: var(--c2-gutter) !important;
        box-sizing: border-box;
    }


    /*
     * Les anciens blocs éditoriaux étaient limités artificiellement
     * par max-width, ce qui produisait une marge différente de CH04.
     */

    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content {
        width: auto !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    /* ==========================================================
       2. CHAPITRES A SECTIONS PLEINE LARGEUR
       Logo / P4 / P5 / P6 / P7
       ========================================================== */

    body.bk-body :is(
        .logo-hero,
        .logo-section,
        .p4-hero,
        .p4-section,
        .p5-hero,
        .p5-section,
        .p6-hero,
        .p6-section,
        .p7-hero,
        .p7-section,
        .p7-final-note
    ) {
        padding-left: var(--c2-gutter) !important;
        padding-right: var(--c2-gutter) !important;
        box-sizing: border-box;
    }


    /*
     * Même largeur éditoriale maximale que CH04.
     * Ces conteneurs restent centrés à l'intérieur des 72px.
     */

    body.bk-body :is(
        .p4-container,
        .p5-width,
        .p6-wrap,
        .p7-wrap
    ) {
        width: 100% !important;
        max-width: 1270px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box;
    }


    /* ==========================================================
       3. CHAPITRES PILOTES PAR WRAPPER
       P8 / P9 / P10
       ========================================================== */

    /*
     * Ces familles n'utilisent pas le padding horizontal de section.
     * Leurs anciennes largeurs étaient du type :
     * calc(100% - 44px), calc(100% - 42px), etc.
     *
     * On impose donc directement 72px de chaque côté.
     */

    body.bk-body :is(
        .p8-wrap,
        .p9-container,
        .p10-wrap
    ) {
        width: min(
            1270px,
            calc(100% - var(--c2-gutter-total))
        ) !important;

        max-width: 1270px !important;

        margin-left: auto !important;
        margin-right: auto !important;

        box-sizing: border-box;
    }


    /* ==========================================================
       4. SECURITE LARGEUR
       ========================================================== */

    body.bk-body .bk-chapter,
    body.bk-body .bk-sourced,
    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content,
    body.bk-body :is(
        .p4-main,
        .p5-page,
        .p6-main,
        .p7-main,
        .p8-main,
        .p9-page,
        .p10-page
    ) {
        min-width: 0 !important;
    }
}


/* ==============================================================
   MOBILE
   ============================================================== */

@media screen and (max-width: 700px) {

    body.bk-body {
        --c2-gutter: 22px;
        --c2-gutter-total: 44px;
    }


    body.bk-body .bk-chapter-top,
    body.bk-body .bk-chapter-heading,
    body.bk-body .bk-chapter-bottom,
    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content,

    body.bk-body :is(
        .logo-hero,
        .logo-section,
        .p4-hero,
        .p4-section,
        .p5-hero,
        .p5-section,
        .p6-hero,
        .p6-section,
        .p7-hero,
        .p7-section,
        .p7-final-note
    ) {
        padding-left: 22px !important;
        padding-right: 22px !important;
    }


    body.bk-body :is(
        .p8-wrap,
        .p9-container,
        .p10-wrap
    ) {
        width: calc(100% - 44px) !important;
        max-width: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* C2-R2-INNER-WIDTH-BEGIN */

/*
 * Aligne les contenus éditoriaux classiques sur la respiration
 * du chapitre 04 :
 *
 * 1270px de contenu utile maximum
 * + 72px gauche
 * + 72px droite
 * = 1414px maximum au total.
 */

@media screen and (min-width:701px) {

    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content {
        box-sizing: border-box !important;

        width: min(100%, 1414px) !important;
        max-width: 1414px !important;

        margin-left: auto !important;
        margin-right: auto !important;

        padding-left: 72px !important;
        padding-right: 72px !important;
    }
}


/*
 * Sur mobile on conserve strictement la référence :
 * 22px de chaque côté.
 */

@media screen and (max-width:700px) {

    body.bk-body .bk-editorial,
    body.bk-body .bk-en-content {
        width: 100% !important;
        max-width: none !important;

        margin-left: 0 !important;
        margin-right: 0 !important;

        padding-left: 22px !important;
        padding-right: 22px !important;
    }
}

/* C2-R2-INNER-WIDTH-END */

/* C2-FR11-INTERNAL-TOC-BEGIN */

/*
 * CH11 intégré au lecteur FR :
 * le sommaire général du lecteur suffit.
 * Suppression du second sommaire latéral afin de retrouver
 * la même largeur de lecture que les autres chapitres.
 */

@media screen {

    body.bk-fr-reader #bk-11 .p10-index {
        display: none !important;
    }

    body.bk-fr-reader #bk-11 .p10-doc {
        display: block !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.bk-fr-reader #bk-11 .p10-content {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }
}

/* C2-FR11-INTERNAL-TOC-END */

/* C2-EN-RESOURCE-CARDS-R3-BEGIN */

/*
 * EN07 / EN08 / EN10
 * Présentation compacte des modèles.
 *
 * Objectif :
 * - moins de surcharge visuelle ;
 * - davantage de modèles visibles simultanément ;
 * - aperçu secondaire par rapport au titre ;
 * - actions clairement hiérarchisées.
 */

@media screen {

    /* ----------------------------------------------------------
       GRILLE
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-grid {
        display: grid !important;
        grid-template-columns: repeat(3,minmax(0,1fr)) !important;

        gap: 16px !important;

        align-items: stretch !important;

        margin-top: 18px !important;
        margin-bottom: 26px !important;
    }


    /* ----------------------------------------------------------
       CARTE
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-card {
        display: flex !important;
        flex-direction: column !important;

        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;

        overflow: hidden !important;

        margin: 0 !important;
        padding: 0 !important;

        background: #fff !important;

        border: 1px solid #d8e6eb !important;
        border-radius: 13px !important;

        box-shadow:
            0 3px 12px rgba(15,61,79,.045) !important;
    }


    /* ----------------------------------------------------------
       APERÇU
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-image {
        position: static !important;

        display: grid !important;
        place-items: center !important;

        width: 100% !important;

        height: 165px !important;
        min-height: 165px !important;
        max-height: 165px !important;

        margin: 0 !important;

        padding: 8px 12px !important;

        box-sizing: border-box !important;

        overflow: hidden !important;

        background: #f6f9fa !important;

        border: 0 !important;
        border-bottom: 1px solid #e1ebef !important;

        border-radius: 0 !important;

        text-decoration: none !important;

        transform: none !important;
    }


    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-image img {
        display: block !important;

        position: static !important;

        width: 100% !important;
        height: 100% !important;

        max-width: 100% !important;
        max-height: 100% !important;

        margin: 0 auto !important;

        padding: 0 !important;

        object-fit: contain !important;
        object-position: center !important;

        transform: none !important;
    }


    /* ----------------------------------------------------------
       TEXTE
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-body {
        position: static !important;

        display: flex !important;
        flex-direction: column !important;

        flex: 1 1 auto !important;

        min-width: 0 !important;
        min-height: 0 !important;

        padding: 12px 13px 13px !important;

        box-sizing: border-box !important;

        background: #fff !important;

        transform: none !important;
    }


    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-body h3 {
        position: static !important;

        margin: 0 0 4px !important;

        font-size: 18px !important;
        line-height: 1.18 !important;

        color: #123c4d !important;

        transform: none !important;
    }


    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-annotation {
        position: static !important;

        margin: 0 0 10px !important;

        font: 12px/1.35 Arial,sans-serif !important;

        color: #607984 !important;

        transform: none !important;
    }


    /* ----------------------------------------------------------
       ACTIONS
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-actions {
        position: static !important;

        display: flex !important;
        flex-wrap: wrap !important;

        align-items: center !important;

        gap: 6px !important;

        margin-top: auto !important;

        padding: 0 !important;

        transform: none !important;
    }


    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-actions a {
        position: static !important;

        display: inline-flex !important;

        align-items: center !important;
        justify-content: center !important;

        width: auto !important;

        min-height: 32px !important;

        margin: 0 !important;

        padding: 6px 9px !important;

        box-sizing: border-box !important;

        border: 1px solid #bdd8e2 !important;
        border-radius: 7px !important;

        background: #fff !important;

        color: #075b79 !important;

        font: 700 11px/1.2 Arial,sans-serif !important;

        white-space: normal !important;

        text-decoration: none !important;

        float: none !important;
        inset: auto !important;

        transform: none !important;
    }


    /*
     * Action principale.
     */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-actions a:first-child {
        background: #0785ad !important;

        border-color: #0785ad !important;

        color: #fff !important;
    }


    /* ----------------------------------------------------------
       PANNEAU DE RESSOURCES
       ---------------------------------------------------------- */

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-resource-panel {
        margin-top: 20px !important;
        margin-bottom: 34px !important;

        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}


/* =============================================================
   ÉCRANS MOYENS
   ============================================================= */

@media screen and (max-width:1400px) {

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-grid {
        grid-template-columns:
            repeat(2,minmax(0,1fr)) !important;
    }
}


/* =============================================================
   TABLETTE
   ============================================================= */

@media screen and (max-width:900px) {

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-grid {
        grid-template-columns: 1fr !important;
    }

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-image {
        height: 190px !important;
        min-height: 190px !important;
        max-height: 190px !important;
    }
}


/* =============================================================
   MOBILE
   ============================================================= */

@media screen and (max-width:700px) {

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-grid {
        gap: 14px !important;
    }

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-image {
        height: 155px !important;
        min-height: 155px !important;
        max-height: 155px !important;

        padding: 7px !important;
    }

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-body {
        padding: 11px 12px 12px !important;
    }

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-body h3 {
        font-size: 17px !important;
    }

    body.bk-en-reader :is(#bk-07,#bk-08,#bk-10)
    .en-model-actions a {
        flex: 1 1 auto !important;

        min-height: 34px !important;
    }
}

/* C2-EN-RESOURCE-CARDS-R3-END */

