/* Fabrique de Niches — feuille COMMUNE aux sites du réseau (S3, refondue en S3b).
   Elle porte la structure, l'accessibilité et le mobile, sur le balisage commun des gabarits.
   Les couleurs (jetons --fond, --encre…, en clair et en sombre), les polices et la mise en
   forme propre à chaque site viennent de /static/identite.css, généré depuis
   moteur/identites/<nom>/ par moteur/identite.py. Rien ici ne fixe une couleur. */

:root {
  --police-texte: system-ui, sans-serif;
  --police-titres: var(--police-texte);
  --graisse-titres: 700;
  --t-corps: 1.0625rem;
  --t-h1: clamp(2rem, 1.3rem + 3vw, 3.25rem);
  --t-h2: 1.5rem;
  --t-chiffre: clamp(2.5rem, 1.8rem + 3vw, 4rem);
  --lien-epaisseur: 1.5px;
  --rayon: 0;
  --filet: 1px;
  --cadre: 74rem;
  --lecture: 42rem;
  --gouttiere: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
/* `hidden` doit TOUJOURS cacher, même un élément dont la classe fixe un display
   (le bouton de carte restait affiché « Chargement… », vu à la vérification visuelle de S3). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: var(--t-corps)/1.6 var(--police-texte); font-kerning: normal;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-texte); text-decoration-thickness: var(--lien-epaisseur); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: calc(var(--lien-epaisseur) + 1.5px); }
:focus-visible { outline: 3px solid var(--accent-texte); outline-offset: 2px; }
/* Sur un bandeau coloré, l'accent peut être la couleur même du fond (Court central, Littoral) :
   le contour prend alors la couleur du texte, qui y est lisible par construction (audit S3b). */
.entete :focus-visible, .ouverture :focus-visible, .motif :focus-visible, .appel :focus-visible { outline-color: currentColor; }
h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; font-family: var(--police-titres); font-weight: var(--graisse-titres); }
p { margin: 0 0 1rem; max-width: var(--lecture); }
mark { background: var(--vif); color: var(--sur-vif); padding: 0 .15em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.evitement { position: absolute; left: -999px; top: 0; z-index: 10; background: var(--fond); color: var(--encre); padding: .5rem .75rem; }
.evitement:focus { left: 1rem; }

.cadre { width: 100%; max-width: var(--cadre); margin-inline: auto; padding-inline: var(--gouttiere); }

/* En-tête */
.entete .cadre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1rem; min-height: 4.25rem; }
/* Plusieurs liens depuis S4 (rubriques + méthode) : espacés, et repliés sous la marque sur mobile. */
.entete-nav { display: flex; flex-wrap: wrap; column-gap: 1.25rem; }
.marque { display: inline-flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; min-width: 0; }
.marque-signe { flex: none; width: 1.75rem; height: 1.75rem; background: center / contain no-repeat; }
.marque-nom { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 1.3rem; line-height: 1.1; }
.entete-nav a { color: inherit; font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }

/* Ouverture : fil, titre, accroche, chiffres */
.ouverture { padding-block: 1rem 2.5rem; }
.fil ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin: 0 0 1.5rem; padding: 0; font-size: .875rem; }
.fil li + li::before { content: "/"; margin-right: .5rem; opacity: .6; }
.fil a { color: inherit; }
.titre { display: grid; gap: .75rem; margin-top: 2rem; }
.fil + .titre { margin-top: 0; }
h1 { font-size: var(--t-h1); }
.titre-sous { display: block; margin-top: .4em; font-size: .45em; line-height: 1.25; }
.maj { margin: 0; font-size: .875rem; }
.accroche { margin: 1.5rem 0 0; font-size: 1.25rem; line-height: 1.5; max-width: 34em; }
.resume { margin: 1.25rem 0 0; font-weight: 600; }
.chiffres { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chiffres li { min-width: 0; }
.chiffres strong { display: block; font-family: var(--police-titres); font-weight: var(--graisse-titres);
  font-size: var(--t-chiffre); line-height: .9; font-variant-numeric: tabular-nums; }
.chiffres span { display: block; margin-top: .4rem; font-size: .9375rem; }

/* Corps */
.corps { padding-block: 3rem 4.5rem; }
.bloc + .bloc { margin-top: 3.5rem; }
.bloc-titre { font-size: var(--t-h2); margin-bottom: 1.25rem; }
.bloc-intro { color: var(--encre-2); }
.note, .sources { font-size: .9375rem; color: var(--encre-2); margin-top: 1.5rem; }

/* Classement des départements (grands annuaires) */
.classement { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.classement li { display: grid; grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 5.5rem; align-items: center; gap: 1rem; }
.classement .barre { display: block; height: 1.25rem; background: var(--accent-doux); }
.classement .barre span { display: block; height: 100%; background: var(--accent); }
.classement .nb { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Tuiles : départements, communes */
.tuiles { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.tuiles a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem .5rem; height: 100%;
  padding: .7rem .8rem .8rem; background: var(--fond-2); color: var(--encre); text-decoration: none; border-radius: var(--rayon); }
.tuile-code { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 1.75rem; line-height: 1; }
.tuile-nb { font-size: .875rem; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.tuile-nom { flex-basis: 100%; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; overflow-wrap: anywhere; }
.tuiles-communes .tuile-nom { flex-basis: auto; font-weight: 600; }

/* Cartes de lieux (petits annuaires) */
.cartes { list-style: none; margin: 0; padding: 0; display: grid; gap: .875rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.carte-lieu a { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: .875rem; height: 100%; padding: 1.1rem 1.1rem 1.25rem;
  background: var(--fond-2); color: var(--encre); text-decoration: none; border-radius: var(--rayon); }
.carte-code { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 2.25rem; line-height: .95; }
.carte-texte { display: grid; gap: .25rem; min-width: 0; }
.carte-dep { font-size: .875rem; font-weight: 700; color: var(--encre-2); }
.carte-nom { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 1.35rem; line-height: 1.2;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; overflow-wrap: anywhere; }
.carte-detail { font-size: .9375rem; color: var(--encre-2); }
.en-ligne { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* Annuaire vide : état et règle de publication */
.etat-chiffre { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.etat-chiffre strong { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 5rem; line-height: .9; color: var(--vif); }
.etat-chiffre span { font-weight: 600; font-size: 1.125rem; }
.etapes { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); counter-reset: etape; }
.etapes li { counter-increment: etape; display: grid; gap: .25rem; align-content: start; }
.etapes li::before { content: counter(etape); font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 2.5rem; line-height: 1; color: var(--accent-texte); }
.etapes span { color: var(--encre-2); font-size: 1rem; }

/* Liste des lieux d'une commune */
.lieux { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: .75rem; }
.lieu { display: flex; gap: 1rem; padding: 1rem 1.1rem; background: var(--fond-2); border-radius: var(--rayon); }
.lieu-rang { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 2rem; line-height: 1; color: var(--accent-texte); min-width: 1.5ch; }
.lieu-texte { min-width: 0; }
.lieu h2 { font-size: 1.25rem; margin-bottom: .25rem; }
.lieu h2 a { color: var(--encre); }
.lieu p { margin: 0 0 .5rem; color: var(--encre-2); font-size: .9375rem; }
.etiquette { display: inline-block; font-size: .8125rem; font-weight: 700; padding: .1rem .55rem; border-radius: var(--rayon);
  background: var(--accent-doux); color: var(--accent-texte); }

/* Fiche d'un lieu */
.fiche { margin: 0; display: grid; max-width: var(--lecture); border-top: var(--filet) solid var(--trait-fort); }
.fiche > div { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: .25rem 1rem; padding: .85rem 0; border-bottom: 1px solid var(--trait); }
.fiche dt { font-weight: 700; color: var(--encre-2); font-size: .9375rem; }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
.motif { margin-top: 2rem; max-width: var(--lecture); padding: 1.25rem 1.4rem; background: var(--accent-doux); border-radius: var(--rayon); }
.motif h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.motif p { margin: 0; }

/* Carte : chargée sur demande (R13) ; la liste reste la vérité (R14). */
.carte { margin: 0 0 1.5rem; }
.corps > .carte:first-child, .fiche + .carte { margin-top: 0; }
.fiche + .carte { margin-top: 1.5rem; }
.carte-bouton { font: 700 1rem var(--police-texte); display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .75rem 1.25rem; border: 0; border-radius: var(--rayon); cursor: pointer;
  background: var(--accent-texte); color: var(--sur-accent); }
.carte-bouton:hover { filter: brightness(1.1); }
.carte-zone { height: min(60vh, 26rem); border: 1px solid var(--trait); margin-top: .75rem; border-radius: var(--rayon); }
.carte-note { font-size: .8125rem; color: var(--encre-2); margin: .5rem 0 0; }

/* Méthode */
.texte { max-width: var(--lecture); }
.texte h2 { font-size: var(--t-h2); margin: 2.5rem 0 1rem; }
.auteur { font-size: .9375rem; color: var(--encre-2); }
.auteur:empty { display: none; }
.sources-liste { padding-left: 1.25rem; }
.sources-liste li { margin-bottom: .5rem; }

/* Articles (S4) : le corps vient du Markdown restreint de moteur/contenu.py. */
.redaction { font-size: .9375rem; color: var(--encre-2); margin-top: 0; }
.corps-article h3 { font-size: 1.1875rem; margin: 1.75rem 0 .5rem; }
.corps-article li { margin-bottom: .35rem; }
.tableau { overflow-x: auto; margin: 1.25rem 0; }
.tableau table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.tableau th, .tableau td { text-align: left; vertical-align: top; padding: .55rem .75rem; border-bottom: var(--filet) solid var(--trait); }
.tableau th { border-bottom: 2px solid var(--trait-fort); }
.lexique dt { font-weight: 700; margin-top: 1.1rem; }
.lexique dd { margin: .2rem 0 0; }
.sources-article, .voisins { margin-top: 3rem; }
.voisins ul { padding-left: 1.25rem; }
.guides { list-style: none; margin: 0; padding: 0; display: grid; gap: .875rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.guide a { display: grid; gap: .35rem; height: 100%; padding: 1.1rem 1.1rem 1.25rem; background: var(--fond-2); color: var(--encre);
  text-decoration: none; border-radius: var(--rayon); }
.guide a:hover .guide-titre { text-decoration: underline; }
.guide-titre { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 1.25rem; line-height: 1.2; color: var(--accent-texte); }
.guide-resume { color: var(--encre-2); font-size: .9375rem; }
.bloc-titre a { color: inherit; }

/* S4b : « L'essentiel », le sommaire, le schéma du terrain (couleurs de l'identité, en clair et en sombre). */
.essentiel { margin: 1.5rem 0 2rem; padding: 1.1rem 1.25rem 1.2rem; background: var(--accent-doux); border-left: 4px solid var(--accent-texte); border-radius: var(--rayon); }
/* Plus spécifique que « .texte h2 » des identités (filets, majuscules), chargées après cette feuille. */
.article .essentiel h2, .article .sommaire h2 { font-size: 1rem; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .06em; border: 0; padding: 0; }
.essentiel ul { margin: 0; padding-left: 1.2rem; }
.essentiel li { margin-bottom: .3rem; }
.sommaire { margin: 0 0 2rem; }
.sommaire ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.sommaire li { margin-bottom: .25rem; break-inside: avoid; }
.schema { margin: 1.75rem 0; }
.schema-terrain { display: block; width: 100%; height: auto; font-family: var(--police-texte); }
.schema figcaption { font-size: .875rem; color: var(--encre-2); margin-top: .5rem; }
.schema-sol { fill: var(--bandeau); }
.schema-zone { fill: var(--sur-bandeau); fill-opacity: .22; }
.schema-trait { stroke: var(--sur-bandeau); stroke-width: 3; fill: none; }
.schema-simple { stroke-dasharray: 10 8; }
.schema-zone-libre { fill-opacity: .12; }
.schema-pointille { stroke: var(--sur-bandeau); stroke-width: 2; stroke-dasharray: 6 6; }
.schema-filet { stroke: var(--encre); stroke-width: 6; }
.schema-cote { stroke: var(--encre-2); stroke-width: 1.5; }
.schema-texte { fill: var(--encre); font-size: 44px; font-weight: 600; }
.schema-petit { font-size: 38px; font-weight: 400; }

/* Appel vers la méthode */
.appel-lien { font-weight: 700; }

/* S5 — Les mécaniques du lancement : réclamer sa fiche, la lettre d'information,
   la mention d'affiliation. Toutes reprennent les jetons de l'identité : aucune
   couleur en dur, elles suivent donc les trois thèmes, en clair comme en sombre. */
.reclamer { margin-top: 2.5rem; max-width: var(--lecture); padding: 1.35rem 1.4rem 1.5rem;
  border: var(--filet) solid var(--trait-fort); border-radius: var(--rayon); }
.reclamer h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
.reclamer p { margin: 0 0 .9rem; }
.reclamer-note { font-size: .875rem; color: var(--encre-2); margin-bottom: 0; }
.newsletter-form { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin: 1rem 0 .75rem; }
.newsletter-form label { display: block; font-weight: 700; font-size: .9375rem; margin-bottom: .35rem; }
.newsletter-form input { font: 1rem var(--police-texte); min-height: 48px; width: min(100%, 20rem);
  padding: .6rem .8rem; color: var(--encre); background: var(--fond);
  border: var(--filet) solid var(--trait-fort); border-radius: var(--rayon); }
.newsletter-form button { font: 700 1rem var(--police-texte); min-height: 48px; padding: .75rem 1.25rem;
  border: 0; border-radius: var(--rayon); cursor: pointer; background: var(--accent-texte); color: var(--sur-accent); }
.newsletter-form button:hover { filter: brightness(1.1); }
.newsletter-note { font-size: .8125rem; color: var(--encre-2); margin: 0; }
.affiliation { font-size: .9375rem; color: var(--encre-2); padding: .6rem .8rem;
  background: var(--accent-doux); border-radius: var(--rayon); }
.preferee { font-size: .875rem; }

/* S5c : les pages locales — où jouer d'autre autour, et le guide pour débuter. */
.proches { margin-top: 2.5rem; max-width: var(--lecture); }
.proches h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
.proches ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--trait); }
.proches li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .15rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--trait); }
.proches-detail { color: var(--encre-2); font-size: .9375rem; }
.proches-note, .debutant { font-size: .9375rem; color: var(--encre-2); }
.proches-note { margin: .6rem 0 0; }
.debutant { margin-top: 1.75rem; max-width: var(--lecture); }

/* Pied de page */
.pied { background: var(--pied); color: var(--sur-pied); font-size: .9375rem; }
.pied .cadre { padding-block: 2.25rem 2.75rem; display: grid; gap: .75rem; }
.pied a { color: inherit; }
.pied p { margin: 0; }
.pied nav { display: flex; flex-wrap: wrap; gap: 1rem; }

@media (max-width: 40rem) {
  :root { --gouttiere: 1rem; }
  .chiffres { grid-template-columns: 1fr 1fr; row-gap: 1.25rem; }
  .classement li { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .classement .barre { grid-column: 1 / -1; grid-row: 2; }
  .fiche > div { grid-template-columns: 1fr; }
  .marque-nom { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
