/* =========================================================================
   Blocs ACF du Carnet — chargé sur le site ET dans l'éditeur (inc/acf-blocks.php)
   Blocs : template-parts/blocks/carnet-*.php
   ========================================================================= */

/* --- Police "machine à écrire" (essai) : Special Elite, auto-hébergée, licence Apache 2.0 (fonts/special-elite/LICENSE.txt).
       Une seule graisse : le gras et l'italique sont simulés par le navigateur. --- */
@font-face {
    font-family: 'Special Elite';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/special-elite/special-elite-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Special Elite';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/special-elite/special-elite-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Police "machine à écrire" précédente : Courier Prime (auto-hébergée, licence OFL : fonts/courier-prime/OFL.txt) --- */
@font-face {
    font-family: 'Courier Prime';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Courier Prime';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Courier Prime';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-400i-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Courier Prime';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-400i-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Courier Prime';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Courier Prime';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/courier-prime/courier-prime-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.carnet-it,
.carnet-duo,
.carnet-texte {
    --carnet-encre: #261A0F;
    --carnet-titre: #5b4636;
    --carnet-gouttiere: clamp(24px, 6vw, 90px);
    /* Marge latérale du bloc Image + texte (plus réduite que la gouttière générale) */
    --carnet-it-marge: clamp(35px, 5.2vw, 78px);
    /* Police des paragraphes : pour revenir à Courier Prime, remplacer 'Special Elite' par 'Courier Prime'. */
    --carnet-police-texte: 'Special Elite', 'Courier Prime', 'Courier New', monospace;
    box-sizing: border-box;
    width: 100%;
}
.carnet-it *,
.carnet-duo *,
.carnet-texte * {
    box-sizing: border-box;
}

/* --- Typographie commune --- */
.carnet-titre {
    margin: 0 0 30px !important;
    font-family: 'accentgraphic', serif !important;
    font-size: clamp(1.375rem, 2vw, 1.6875rem) !important;
    line-height: 1.25 !important;
    font-weight: 400 !important;
    letter-spacing: .01em !important;
    text-transform: uppercase !important;
    color: var(--carnet-titre) !important;
}
.carnet-prose,
.carnet-prose p,
.carnet-prose li {
    font-family: var(--carnet-police-texte) !important;
    font-size: 0.90625rem;
    line-height: 1.45;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--carnet-encre);
    text-align: justify;
    hyphens: auto;
}
.carnet-prose p {
    margin: 0 !important;
}
.carnet-prose p + p,
.carnet-prose p + ul,
.carnet-prose ul + p {
    margin-top: 1.4em !important;
}
.carnet-prose strong {
    font-weight: 700;
}
.carnet-prose a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.carnet-it img,
.carnet-duo img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
}

/* --- Image + texte : conteneur et colonnes ---
   Le bloc reste dans la largeur du contenu (1366px max) quel que soit le format.
   --col-image / --col-texte = proportions des deux colonnes (en fr).
   Image à gauche : colonnes [image | texte] ; image à droite : [texte | image]. */
.carnet-it {
    --col-image: 1fr;
    --col-texte: 1fr;
    display: grid;
    grid-template-columns: minmax(0, var(--col-image)) minmax(0, var(--col-texte));
    max-width: 1366px;
    margin: 0 auto;
    padding: 0 var(--carnet-it-marge);
}
.carnet-it.carnet-it--image-droite {
    grid-template-columns: minmax(0, var(--col-texte)) minmax(0, var(--col-image));
}
.carnet-it--image-droite .carnet-it__media {
    order: 2;
}

/* Proportions par défaut (maquette) */
.carnet-it--cadree {
    --col-image: .88fr;
}
.carnet-it--cadree.carnet-it--image-droite {
    --col-image: 1.1fr;
}

/* Proportions choisies dans le bloc (champ "Colonnes") : image / texte */
.carnet-it.carnet-it--cols-50-50 {
    --col-image: 1fr;
    --col-texte: 1fr;
}
.carnet-it.carnet-it--cols-38-62 {
    --col-image: 38fr;
    --col-texte: 62fr;
}
.carnet-it.carnet-it--cols-62-38 {
    --col-image: 62fr;
    --col-texte: 38fr;
}

/* --- Texte et espacement, sans gouttière entre les colonnes ---
   --texte-max    : largeur maximale du texte (selon le format et les colonnes) ;
                    le texte est centré dans sa colonne et peut l'occuper entièrement.
   --espace-image : marge intérieure qui sépare l'image du texte. Elle est portée par la
                    colonne la plus large (62fr), du côté de l'autre colonne :
                    - 62 / 38, par défaut et 50 / 50 : par la colonne image ;
                    - 38 / 62 : par la colonne texte (l'image n'a alors pas de marge). */
.carnet-it {
    --texte-max: 520px;
    --espace-image: clamp(40px, 7.5vw, 110px);
    column-gap: 0;
}
.carnet-it__texte {
    justify-self: center;
    width: min(var(--texte-max), 100%);
}
.carnet-it--image-gauche .carnet-it__media {
    padding-right: var(--espace-image);
}
.carnet-it--image-droite .carnet-it__media {
    padding-left: var(--espace-image);
}
.carnet-it--pleine,
.carnet-it--debord {
    --texte-max: 460px;
}
/* Texte dans la colonne large (38 / 62) ou étroite (62 / 38) */
.carnet-it.carnet-it--cols-38-62 {
    --texte-max: 560px;
}
.carnet-it.carnet-it--cols-62-38 {
    --texte-max: 455px;
}
/* 38 / 62 : la marge passe de la colonne image (38) à la colonne texte (62) ;
   le texte garde --texte-max de largeur utile, la marge s'y ajoute. */
.carnet-it.carnet-it--cols-38-62 .carnet-it__media {
    padding-left: 0;
    padding-right: 0;
}
.carnet-it.carnet-it--cols-38-62 .carnet-it__texte {
    width: min(calc(var(--texte-max) + var(--espace-image)), 100%);
}
.carnet-it.carnet-it--cols-38-62.carnet-it--image-gauche .carnet-it__texte {
    padding-left: var(--espace-image);
}
.carnet-it.carnet-it--cols-38-62.carnet-it--image-droite .carnet-it__texte {
    padding-right: var(--espace-image);
}

/* --- Format "Cadrée" : image et texte centrés verticalement, grand espacement --- */
.carnet-it--cadree {
    align-items: center;
    padding-top: 180px;
    padding-bottom: 180px;
}

/* --- Formats "Pleine hauteur" et "Pleine hauteur + bord de la fenêtre" :
       l'image occupe toute la hauteur du bloc --- */
.carnet-it--pleine,
.carnet-it--debord {
    align-items: stretch;
}
.carnet-it--pleine .carnet-it__media img,
.carnet-it--debord .carnet-it__media img {
    height: 100%;
    min-height: 620px;
    object-fit: cover;
}
.carnet-it--pleine .carnet-it__texte,
.carnet-it--debord .carnet-it__texte {
    align-self: center;
    padding: 150px 0;
}

/* "+ bord de la fenêtre" : le bloc occupe toute la largeur de la page, en deux
   colonnes 50 / 50 (le choix des colonnes est ignoré, cf. le gabarit PHP).
   L'image remplit sa moitié jusqu'au bord ; le texte est centré dans l'autre. */
.carnet-it.carnet-it--debord {
    --col-image: 1fr;
    --col-texte: 1fr;
    max-width: none;
    padding: 0;
}
.carnet-it.carnet-it--debord .carnet-it__media {
    padding: 0;
}
.carnet-it.carnet-it--debord .carnet-it__texte {
    width: min(calc(var(--texte-max) + 2 * var(--carnet-it-marge)), 100%);
    padding: 150px var(--carnet-it-marge);
}

/* --- Duo d'images --- */
.carnet-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0;
}
.carnet-duo__image {
    margin: 0;
}
.carnet-duo img {
    aspect-ratio: 683 / 730;
    height: auto;
    object-fit: cover;
}

/* --- Texte centré --- */
.carnet-texte {
    max-width: calc(560px + 2 * var(--carnet-gouttiere));
    margin: 0 auto;
    padding: 160px var(--carnet-gouttiere);
}
.carnet-texte .carnet-titre {
    text-align: center;
}

/* --- Aperçu dans l'éditeur quand un bloc est vide --- */
.carnet-vide {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    border: 1px dashed #b5a998;
    font-family: sans-serif;
    font-size: 0.8125rem;
    color: #8a8178;
}
.carnet-vide-texte {
    font-style: italic;
    color: #8a8178 !important;
}

/* --- Tablette portrait / mobile (800px : la zone d'édition reste en 2 colonnes) --- */
@media (max-width: 800px) {
    .carnet-it,
    .carnet-it.carnet-it--image-droite {
        grid-template-columns: 1fr;
        row-gap: 50px;
    }
    .carnet-it--cadree {
        padding-top: 90px;
        padding-bottom: 90px;
    }
    .carnet-it--image-droite .carnet-it__media {
        order: 0;
    }
    .carnet-it__texte {
        width: 100%;
    }
    /* Image et texte empilés : plus d'espacement latéral, ni sur l'image ni sur le texte */
    .carnet-it.carnet-it--image-gauche .carnet-it__media,
    .carnet-it.carnet-it--image-droite .carnet-it__media,
    .carnet-it.carnet-it--cols-38-62.carnet-it--image-gauche .carnet-it__texte,
    .carnet-it.carnet-it--cols-38-62.carnet-it--image-droite .carnet-it__texte {
        padding-left: 0;
        padding-right: 0;
    }
    .carnet-it.carnet-it--cols-38-62 .carnet-it__texte {
        width: 100%;
    }
    .carnet-it--pleine,
    .carnet-it--debord {
        row-gap: 0;
    }
    .carnet-it--pleine .carnet-it__media img,
    .carnet-it--debord .carnet-it__media img {
        min-height: 0;
        aspect-ratio: 4 / 3;
    }
    .carnet-it--pleine .carnet-it__texte,
    .carnet-it--debord .carnet-it__texte {
        padding: 60px 0 90px;
    }
    /* "+ bord de la fenêtre" sur mobile : l'image va d'un bord à l'autre, le texte garde ses marges */
    .carnet-it.carnet-it--debord .carnet-it__texte {
        width: 100%;
        padding: 60px var(--carnet-it-marge) 90px;
    }
    .carnet-texte {
        padding-top: 90px;
        padding-bottom: 90px;
    }
}
@media (max-width: 680px) {
    .carnet-duo {
        grid-template-columns: 1fr;
    }
    .carnet-prose,
    .carnet-prose p,
    .carnet-prose li {
        text-align: left;
    }
}
