/*
 * Site public — charte « Tribune » (§8.6 ter), mobile d'abord (§8.6 bis).
 * Feuille unique sans framework ; media queries min-width : base 360 px, puis 600, 900 et 1200 px.
 * Monochrome : les seules couleurs vives sont celles des partis (badges) et des statuts.
 * Aucun border-radius sur le site public.
 */

/* Polices auto-hébergées (OFL), variables : un fichier par famille couvre toutes les graisses. */
@font-face {
    font-family: "Oswald";
    src: url("/assets/fonts/Oswald-latin-wght.woff2?v=5.3.0") format("woff2");
    font-weight: 200 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("/assets/fonts/Inter-latin-wght.woff2?v=5.3.0") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --encre: #0A0A0A;
    --fond: #FFFFFF;
    --secondaire: #444444;               /* 9,7:1 sur blanc */
    --encours: #FFD8A8;
    --favorable: #CFE0FA;
    --titre: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
    --texte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --gouttiere: 1rem;
    --ombre: 6px 6px 0 var(--encre);
    --ombre-pressee: 3px 3px 0 var(--encre);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--texte);
    font-size: 1rem;                     /* 16 px minimum */
    line-height: 1.5;
    color: var(--encre);
    background: var(--fond);
    overflow-wrap: anywhere;             /* les URLs longues sont coupées */
}
img { max-width: 100%; height: auto; }
a { color: var(--encre); text-underline-offset: .15em; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 3px; }
h1, h2, h3 { font-family: var(--titre); font-weight: 700; text-transform: uppercase; line-height: 1.05; margin: 0 0 .75rem; }
p, ul, ol { margin: 0 0 1rem; }
main { display: block; padding-bottom: 3rem; }
main:focus { outline: none; }

/* Focus clavier : 3 px encre décalé de 2 px, blanc sur les blocs noirs. Jamais supprimé. */
:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
.entete .marque:focus-visible, .pied :focus-visible, .bouton:not(.bouton-clair):focus-visible,
.bandeau-apercu :focus-visible { outline-color: var(--fond); }
.bouton:not(.bouton-clair):focus-visible { box-shadow: 0 0 0 5px var(--encre); }

[hidden] { display: none !important; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.evitement { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--encre); color: var(--fond); padding: .75rem 1rem; }
.evitement:focus { left: 0; }

.conteneur { width: 100%; max-width: 82.5rem; margin: 0 auto; padding: 0 var(--gouttiere); }
.conteneur-etroit { max-width: calc(46rem + 2 * var(--gouttiere)); }
.secondaire { color: var(--secondaire); font-size: .9375rem; }
.sur-titre { font-family: var(--titre); font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--secondaire); margin: 0 0 .25rem; }

/* ---------- En-tête : 56 px, logo blanc sur bloc noir, menu à droite, filet de 4 px ---------- */
.entete {
    position: relative; display: flex; align-items: stretch; justify-content: space-between;
    height: 60px;                        /* 56 px + filet inférieur de 4 px */
    border-bottom: 4px solid var(--encre); background: var(--fond);
}
.marque {
    display: flex; align-items: center; padding: 0 1rem; background: var(--encre); color: var(--fond);
    font-family: var(--titre); font-weight: 700; font-size: 1.375rem; letter-spacing: .04em;
    text-transform: uppercase; text-decoration: none; white-space: nowrap;
}
.nav-large { display: none; }
.menu summary {
    display: flex; align-items: center; gap: .5rem; height: 56px; min-width: 56px; padding: 0 1rem;
    font-family: var(--titre); font-weight: 500; text-transform: uppercase; letter-spacing: .07em;
    cursor: pointer; list-style: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu-icone, .menu-icone::before, .menu-icone::after { display: block; width: 22px; height: 3px; background: var(--encre); }
.menu-icone { position: relative; }
.menu-icone::before, .menu-icone::after { content: ""; position: absolute; left: 0; }
.menu-icone::before { top: -7px; }
.menu-icone::after { top: 7px; }
.menu[open] .menu-icone { background: transparent; }
.menu[open] .menu-icone::before { top: 0; transform: rotate(45deg); }
.menu[open] .menu-icone::after { top: 0; transform: rotate(-45deg); }
.menu nav {
    position: absolute; z-index: 20; left: 0; right: 0; top: 60px;
    background: var(--fond); border-bottom: 4px solid var(--encre);
}
.menu nav a {
    display: flex; align-items: center; min-height: 56px; padding: 0 1rem; border-top: 2px solid var(--encre);
    font-family: var(--titre); font-weight: 700; font-size: 1.25rem; text-transform: uppercase; text-decoration: none;
}

.bandeau-apercu { margin: 0; padding: .75rem 1rem; background: var(--encre); color: var(--fond); }
.bandeau-apercu a { color: var(--fond); }

/* ---------- Typographie des pages ---------- */
.accroche { padding: 1.75rem 0 .5rem; }
.accroche h1 { font-size: clamp(2.5rem, 1.6rem + 3.2vw, 4rem); margin-bottom: 1rem; }  /* 40 px sur mobile */
.titre-page { font-size: clamp(2.125rem, 1.6rem + 2vw, 3rem); margin: 1.5rem 0 .5rem; }
.chapo { font-size: 1.125rem; line-height: 1.55; max-width: 70ch; }
.compte { color: var(--secondaire); margin-bottom: 1rem; }
.message { border: 2px solid var(--encre); background: var(--encours); padding: .75rem 1rem; }
.vide { border: 3px solid var(--encre); padding: 1.25rem; font-weight: 600; }
.avertissement { border: 3px solid var(--encre); padding: 1rem; max-width: 70ch; font-size: .9375rem; }
.avertissement > :last-child { margin-bottom: 0; }
.page-texte ul { padding-left: 1.25rem; }
.page-texte li { margin-bottom: .6rem; }
.page-texte section { margin-top: 2rem; }
.page-texte .avertissement { margin-top: 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Étiquette de section : bloc noir, texte blanc en Oswald ; variante cadre 2 px (sections secondaires). */
.etiquette {
    display: inline-block; margin: 0 0 1rem; padding: .45rem .7rem .4rem;
    background: var(--encre); color: var(--fond); border: 2px solid var(--encre);
    font-family: var(--titre); font-weight: 700; font-size: 1rem; line-height: 1.1; letter-spacing: .07em; text-transform: uppercase;
}
.etiquette-cadre { background: var(--fond); color: var(--encre); }
.section { margin-top: 2rem; }

/* ---------- Boutons, champs ---------- */
.bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 48px; padding: .5rem 1.1rem; border: 2px solid var(--encre);
    background: var(--encre); color: var(--fond); cursor: pointer; text-decoration: none;
    font-family: var(--titre); font-weight: 700; font-size: 1.0625rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
}
.bouton-clair { background: var(--fond); color: var(--encre); }
.bouton-large { width: 100%; }
input[type="text"], input[type="search"] {
    width: 100%; min-height: 48px; padding: .5rem .75rem; border: 2px solid var(--encre); border-radius: 0;
    background: var(--fond); color: var(--encre); font: inherit; font-size: 1rem;   /* ≥ 16 px : pas de zoom iOS */
    -webkit-appearance: none; appearance: none;
}
input[type="checkbox"] { width: 1.375rem; height: 1.375rem; margin: 0; accent-color: var(--encre); flex: none; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: .2rem .4rem; font-family: var(--texte); font-weight: 700; font-size: .75rem;   /* 12 px */
    line-height: 1.2; letter-spacing: .02em; white-space: nowrap; vertical-align: .1em;
}
.statut {
    display: inline-block; padding: .3rem .55rem .25rem; border: 2px solid var(--encre); color: var(--encre);
    font-family: var(--titre); font-weight: 500; font-size: .9375rem; line-height: 1.1; letter-spacing: .06em; text-transform: uppercase;
}
.statut-encours { background: var(--encours); }
.statut-favorable { background: var(--favorable); }
.statut-definitif { background: var(--encre); color: var(--fond); }

/* Logo de parti : tel quel, dans une case blanche à cadre 2 px encre. */
.logo-parti { display: inline-flex; align-items: center; justify-content: center; background: var(--fond); border: 2px solid var(--encre); flex: none; }
.logo-parti img { display: block; width: auto; object-fit: contain; }
.logo-48 { padding: 4px; }
.logo-48 img { height: 48px; max-width: 160px; }
.logo-24 { padding: 2px; }
.logo-24 img { height: 24px; max-width: 80px; }

/* ---------- Grille et cartes ---------- */
.grille { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); padding: 0 6px 6px 0; }
.carte {
    position: relative; display: flex; flex-direction: column; background: var(--fond);
    border: 3px solid var(--encre); box-shadow: var(--ombre);
}
.carte:hover, .carte:active { box-shadow: var(--ombre-pressee); transform: translate(3px, 3px); }
.carte .couverture { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border-bottom: 3px solid var(--encre); }
.couverture-vide { background: var(--encre); }
.carte-corps { display: flex; flex-direction: column; gap: .6rem; padding: 1rem 1rem 1.1rem; flex: 1; }
.carte-corps > * { margin: 0; }
.carte-date { color: var(--secondaire); font-size: .9375rem; }
.carte-titre { font-size: 1.3125rem; line-height: 1.1; }                 /* 21 px */
.carte-titre a { text-decoration: none; }
.carte-titre a::after { content: ""; position: absolute; inset: -3px; z-index: 1; }  /* toute la carte est cliquable */
.carte-titre a:focus-visible { outline: none; }
.carte-titre a:focus-visible::after { outline: 3px solid var(--encre); outline-offset: 5px; }
.carte-pols { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9375rem; }
.carte-statut { margin-top: auto; padding-top: .25rem; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 2rem; }
.pagination-info { color: var(--secondaire); }
.liste-etat { margin: 1rem 0 0; color: var(--secondaire); min-height: 1.5em; }
.js .pagination [rel="next"].chargement { opacity: .6; }

/* ---------- Liste : barre collante, pastilles, filtres ---------- */
.barre-filtres {
    position: sticky; top: 0; z-index: 10; display: flex; gap: .5rem; align-items: stretch;
    height: 52px; margin: 0 calc(-1 * var(--gouttiere)) 1rem; padding: 4px var(--gouttiere);
    background: var(--fond); border-bottom: 2px solid var(--encre);
}
.barre-recherche { display: flex; flex: 1; min-width: 0; }
.barre-recherche input { min-height: 0; height: 100%; border-right: 0; }
.bouton-loupe {
    flex: none; width: 44px; border: 2px solid var(--encre); background: var(--fond); color: var(--encre);
    font-size: 1.25rem; font-weight: 700; cursor: pointer;
}
.bouton-filtrer { min-height: 0; height: 100%; padding: 0 .9rem; flex: none; }

.pastilles { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.pastille {
    display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .8rem;
    border: 2px solid var(--encre); background: var(--fond); font-weight: 600; text-decoration: none;
}
.pastille span[aria-hidden] { font-size: 1.25rem; line-height: 1; }
.pastille-tout { border-style: dashed; }

/* Sans JavaScript sur mobile : le panneau s'affiche quand on suit le lien « Filtrer » (#filtres). */
.filtres { display: none; }
.filtres:target { display: block; margin-bottom: 1.5rem; }
.filtres-form { border: 3px solid var(--encre); background: var(--fond); }
.filtres-tete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 2px solid var(--encre); }
.filtres-tete .etiquette { margin: 0; }
.filtres-corps { padding: 1rem; }
.filtres-form fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.filtres-form legend, .champ label {
    display: block; padding: 0; margin-bottom: .5rem;
    font-family: var(--titre); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
}
.case { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.cases-annees { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .4rem; }
.case-annee { justify-content: center; border: 2px solid var(--encre); padding: 0 .5rem; }
.case-annee:has(input:checked) { background: var(--encre); color: var(--fond); }
.case-annee input { accent-color: var(--fond); }
.filtres-actions {
    display: flex; gap: .5rem; padding: .75rem 1rem; border-top: 2px solid var(--encre); background: var(--fond);
    position: sticky; bottom: 0;
}
.filtres-actions .bouton { flex: 1; }

/* Panneau plein écran sur mobile (<dialog>, public.js) */
.dialog-filtres {
    width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; inset: 0;
    background: var(--fond); color: var(--encre);
}
.dialog-filtres::backdrop { background: rgba(10, 10, 10, .6); }
.dialog-filtres .filtres-form { border: 0; min-height: 100%; display: flex; flex-direction: column; }
.dialog-filtres .filtres-corps { flex: 1; }
.dialog-filtres .filtres-tete { position: sticky; top: 0; background: var(--fond); z-index: 1; }

/* ---------- Fiche d'une affaire ---------- */
.fiche { padding-top: 1.5rem; }
.fiche-tete h1 { font-size: clamp(2.125rem, 1.6rem + 2vw, 3rem); margin-bottom: 1rem; }   /* 34 px sur mobile */
.fiche-date { font-family: var(--titre); font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--secondaire); margin-bottom: .5rem; }
.fiche-statut { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.fiche section { margin-top: 1.75rem; }
.partis-impliques ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.partis-impliques a { display: inline-flex; min-height: 44px; align-items: center; }
.partis-impliques .badge { font-size: 1rem; padding: .7rem .8rem; }
.fiche-pols { list-style: none; padding: 0; }
.fiche-pols li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 2px solid var(--encre); }
.fiche-pols li:first-child { border-top: 2px solid var(--encre); }
.fiche-pols li > span:last-child { display: flex; flex-direction: column; }
.fiche-pol-nom { font-weight: 700; font-size: 1.0625rem; min-height: 28px; }
.fiche-image { margin: 1.75rem 0 1.25rem; border: 3px solid var(--encre); }
.fiche-image img { display: block; width: 100%; }
.fiche .chapo { font-weight: 600; margin-top: 1.5rem; }

/* Descriptif : 17 px, interligne 1,65 ; rien ne déborde (images, tableaux, URLs). */
.descriptif { font-size: 1.0625rem; line-height: 1.65; max-width: 70ch; }
.descriptif h2 { font-size: 1.375rem; margin-top: 2rem; }
.descriptif h3 { font-size: 1.125rem; margin-top: 1.5rem; }
.descriptif img { display: block; max-width: 100%; height: auto; margin: 1.25rem 0; }
.descriptif blockquote { margin: 1.25rem 0; padding: .25rem 0 .25rem 1rem; border-left: 4px solid var(--encre); }
.descriptif table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.descriptif td, .descriptif th { border: 1px solid var(--encre); padding: .4rem .6rem; }

/* Sources : lignes séparées par un filet de 2 px, flèche ↗ à droite. */
.sources { list-style: none; padding: 0; border-top: 2px solid var(--encre); }
.sources li { padding: .75rem 0; border-bottom: 2px solid var(--encre); }
.sources li p { margin: .2rem 0 0; }
.source-lien { display: flex; justify-content: space-between; gap: 1rem; min-height: 44px; align-items: center; font-weight: 700; }
.source-lien .ext { flex: none; font-size: 1.25rem; }
.documents { list-style: none; padding: 0; display: grid; gap: .75rem; }
.documents a { display: flex; align-items: center; gap: .75rem; min-height: 56px; padding: .5rem; border: 2px solid var(--encre); text-decoration: none; font-weight: 600; }
.documents a > span { display: flex; flex-direction: column; }
.documents img { width: 96px; height: auto; border: 1px solid var(--encre); }
.fiche-pied { margin-top: 2.5rem; }

/* ---------- Pages politicien / parti ---------- */
.page-tete { margin-bottom: 1rem; }
.page-tete .titre-page { margin-top: 0; }
.page-tete:first-child { padding-top: 1.5rem; }
.page-tete-parti { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; padding-top: 1.5rem; }
.liste-partis { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.liste-partis a { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding-right: .5rem; font-weight: 600; }
.lien-fort { font-weight: 700; display: inline-flex; min-height: 44px; align-items: center; }
.legende-statuts { list-style: none; padding: 0 !important; }
.legende-statuts .statut { margin-right: .4rem; }

/* ---------- Pied de page ---------- */
.pied { background: var(--encre); color: var(--fond); padding: 2rem 0 2.5rem; font-size: .9375rem; }
.pied a { color: var(--fond); display: inline-block; padding: .6rem 0; }
.pied-marque { font-family: var(--titre); font-weight: 700; font-size: 1.375rem; letter-spacing: .04em; text-transform: uppercase; }
.pied p { max-width: 70ch; }

/* ---------- Tablette ---------- */
@media (min-width: 600px) {
    .bouton-large { width: auto; }
    .barre-filtres { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}

/* ---------- Ordinateur : navigation en ligne, filtres en barre latérale ---------- */
@media (min-width: 900px) {
    :root { --gouttiere: 2rem; }
    .menu { display: none; }
    .nav-large { display: flex; align-items: stretch; margin-right: 1rem; }
    .nav-large a {
        display: flex; align-items: center; padding: 0 1rem;
        font-family: var(--titre); font-weight: 700; font-size: 1.0625rem; letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
    }
    .nav-large a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
    .barre-filtres { display: none; }
    .mise-en-page-liste { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2rem; align-items: start; }
    .filtres, .filtres:target { display: block; position: sticky; top: 1rem; margin: 0; max-height: calc(100vh - 2rem); overflow-y: auto; }
    .fiche-image { margin-top: 2rem; }
}

@media (min-width: 1200px) {
    .mise-en-page-liste { grid-template-columns: 18rem minmax(0, 1fr); }
}

/* Pas d'action réservée au survol ; pas de décalage pour qui réduit les animations. */
@media (prefers-reduced-motion: reduce) {
    .carte:hover, .carte:active { transform: none; }
    * { scroll-behavior: auto !important; }
}

/* Impression : pas d'ombre, pas de navigation. */
@media print {
    .entete nav, .menu, .barre-filtres, .filtres, .pagination, .pied { display: none !important; }
    .carte { box-shadow: none; }
}
