/* Palette « archives » : gris-bleu des boîtes d'archives, encre, mauve du demi-deuil */
:root {
  --papier: #f3f5f6;
  --carton: #e3e8eb;
  --blanc: #fbfcfc;
  --encre: #1c2731;
  --ardoise: #4a5e6d;
  --filet: #cbd4da;
  --mauve: #6e4a8e;
  --mauve-fonce: #4d2f6e;
  --mauve-pale: #ece4f3;
  --serie-f: #6e4a8e; --serie-m: #1f8a70;
  --seq-1: #ece4f3; --seq-2: #d3c1e4; --seq-3: #b297cf; --seq-4: #8e6bb2; --seq-5: #6e4a8e; --seq-6: #4d2f6e; --hors: #a3afb8;
  --affiche: "Libre Caslon Display", "Times New Roman", serif;
  --texte: "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papier); color: var(--encre); font: 17px/1.5 var(--texte); }
a { color: var(--mauve-fonce); text-underline-offset: 0.18em; }
a:hover { color: var(--mauve); }
:focus-visible { outline: 3px solid var(--mauve); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 0.86em; letter-spacing: -0.01em; }

.bandeau-demo { background: var(--encre); color: #dfe6ea; font-size: 0.82rem; padding: 0.45rem 1rem; text-align: center; }
.bandeau-demo strong { color: #fff; }

.entete { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: 1320px; margin: 0 auto; padding: 1.1rem 1.5rem 0.9rem; border-bottom: 1px solid var(--filet); }
.marque { font-family: var(--affiche); font-size: 1.45rem; color: var(--encre); text-decoration: none; letter-spacing: 0.01em; }
.marque span { font-family: var(--mono); font-size: 0.62em; color: var(--mauve); margin-left: 0.1em; }
.entete nav { display: flex; gap: 1.4rem; font-size: 0.95rem; }
.entete nav a { color: var(--ardoise); text-decoration: none; padding-bottom: 0.2rem; }
.entete nav a[aria-current] { color: var(--encre); border-bottom: 2px solid var(--mauve); }

/* --- outil --- */
.accroche { max-width: 1320px; margin: 0 auto; padding: 2.4rem 1.5rem 1.2rem; }
.accroche h1 { font-family: var(--affiche); font-weight: 400; font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1.05; margin: 0 0 0.6rem; letter-spacing: -0.01em; max-width: 18ch; }
.accroche p { margin: 0; color: var(--ardoise); }
.accroche strong { color: var(--encre); font-family: var(--mono); font-weight: 500; }

.recherche { max-width: 1320px; margin: 0 auto 1.4rem; padding: 0 1.5rem; }
.ligne-principale { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 0.75rem; align-items: end;
  background: var(--carton); padding: 1rem; border-radius: 6px; }
.champ { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.champ > span { font-size: 0.8rem; font-weight: 700; color: var(--ardoise); }
.champ input, .champ select { font: inherit; color: var(--encre); background: var(--blanc); border: 1px solid var(--filet);
  border-radius: 4px; padding: 0.62rem 0.75rem; width: 100%; }
.champ-nom input { font-family: var(--mono); font-size: 1.12rem; letter-spacing: 0.04em; text-transform: uppercase; }
.champ-nom input::placeholder { text-transform: none; letter-spacing: 0; }
.champ input:focus, .champ select:focus { border-color: var(--mauve); outline: none; box-shadow: 0 0 0 3px var(--mauve-pale); }
.bouton { font: 700 1rem var(--texte); background: var(--encre); color: #fff; border: 0; border-radius: 4px; padding: 0.72rem 1.4rem; cursor: pointer; }
.bouton:hover { background: var(--mauve-fonce); }

.modes { border: 0; margin: 0.8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; align-items: center; }
.modes legend { float: left; font-size: 0.85rem; color: var(--ardoise); margin-right: 0.4rem; padding: 0; }
.modes label { cursor: pointer; }
.modes input { position: absolute; opacity: 0; }
.modes span { display: inline-block; font-size: 0.88rem; padding: 0.28rem 0.75rem; border: 1px solid var(--filet); border-radius: 999px; background: var(--blanc); }
.modes input:checked + span { background: var(--mauve-pale); border-color: var(--mauve); color: var(--mauve-fonce); font-weight: 700; }
.modes input:focus-visible + span { outline: 3px solid var(--mauve); outline-offset: 2px; }

.criteres { margin-top: 0.7rem; }
.criteres summary { cursor: pointer; font-size: 0.92rem; color: var(--mauve-fonce); width: max-content; }
.grille-criteres { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr 1fr 1fr 1fr; gap: 0.75rem; margin-top: 0.7rem; }

.onglets { display: none; }

.espace { max-width: 1320px; margin: 0 auto; padding: 0 1.5rem 1rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 1.5rem; align-items: start; }
.etat { min-height: 3rem; }
.etat p { margin: 0 0 0.6rem; }
.invite { color: var(--ardoise); }
.exemples { font-size: 0.92rem; color: var(--ardoise); }
.compte strong { font-family: var(--mono); font-weight: 500; }

.liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--filet); }
.liste li { border-bottom: 1px solid var(--filet); }
.resultat { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; width: 100%; padding: 0.75rem 0.5rem; cursor: pointer; }
.resultat:hover { background: var(--blanc); }
.resultat:focus-visible { outline: 3px solid var(--mauve); outline-offset: -3px; }
.qui { font-size: 1.02rem; }
.nom { font-family: var(--mono); font-weight: 500; letter-spacing: 0.03em; }
.quand { color: var(--ardoise); font-size: 0.9rem; text-align: right; white-space: nowrap; }
.ou { grid-column: 1 / -1; color: var(--ardoise); font-size: 0.88rem; }
.etiquette { display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--mauve-fonce); background: var(--mauve-pale); border-radius: 3px; padding: 0.05rem 0.4rem; margin-left: 0.35rem; vertical-align: 0.12em; }
.bouton-secondaire { font: inherit; font-size: 0.95rem; margin: 1rem 0; background: none; border: 1px solid var(--encre); border-radius: 4px; padding: 0.5rem 1rem; cursor: pointer; }

.cartographie { position: sticky; top: 1rem; }
.barre-carte { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.bascule { display: inline-flex; border: 1px solid var(--filet); border-radius: 4px; overflow: hidden; }
.bascule button { font: inherit; font-size: 0.86rem; background: var(--blanc); color: var(--ardoise); border: 0; padding: 0.4rem 0.75rem; cursor: pointer; }
.bascule button[aria-pressed="true"] { background: var(--encre); color: #fff; }
.bouton-lasso { font: 700 0.9rem var(--texte); color: var(--mauve-fonce); background: var(--blanc); border: 1.5px solid var(--mauve); border-radius: 4px; padding: 0.4rem 0.9rem; cursor: pointer; }
.bouton-lasso::before { content: ""; display: inline-block; width: 0.85em; height: 0.85em; margin-right: 0.45em; border: 1.5px dashed currentColor; border-radius: 50%; vertical-align: -0.1em; }
.bouton-lasso:disabled { opacity: 0.45; cursor: not-allowed; }
.mode-lasso .bouton-lasso { background: var(--mauve); color: #fff; }
.carte { height: min(72vh, 680px); border-radius: 6px; border: 1px solid var(--filet); background: var(--carton); }
.mode-lasso .carte { cursor: crosshair; outline: 2px solid var(--mauve); outline-offset: 2px; }
.mode-lasso .leaflet-interactive { pointer-events: none; }
.zone { margin: 0.6rem 0 0; font-size: 0.92rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
.zone[hidden] { display: none; }
.zone strong { font-family: var(--mono); font-weight: 500; color: var(--mauve-fonce); }
.zone button { font: inherit; background: none; border: 0; padding: 0; color: var(--mauve-fonce); text-decoration: underline; cursor: pointer; }

/* signature : la zone, un cercle à poignées */
.zone-crayon { stroke: var(--mauve); stroke-width: 2.5; stroke-dasharray: 6 5; fill: var(--mauve); fill-opacity: 0.08; }
.poignee { border-radius: 50%; background: var(--blanc); border: 3px solid var(--mauve); box-shadow: 0 1px 4px rgb(28 39 49 / 0.35); }
.poignee-centre { cursor: move; }
.poignee-centre::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--mauve); }
.poignee-bord { cursor: ew-resize; }
.poignee-bord::after { content: "↔"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px/1 var(--texte); color: var(--mauve-fonce); }
.poignee:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
.rayon { display: inline-flex; align-items: center; gap: 0.5rem; margin-right: 0.6rem; }
.rayon span { font-size: 0.8rem; font-weight: 700; color: var(--ardoise); }
.rayon input { accent-color: var(--mauve); width: 9rem; }
.rayon output { font-family: var(--mono); font-size: 0.85rem; min-width: 4.2em; }

.technique { max-width: 1320px; margin: 0 auto; padding: 0 1.5rem 1.5rem; font: 0.78rem var(--mono); color: var(--ardoise); }

.fiche { border: 0; border-radius: 6px; padding: 2rem 2rem 1.5rem; max-width: 34rem; width: calc(100% - 2rem); color: var(--encre); background: var(--blanc); box-shadow: 0 20px 60px rgb(28 39 49 / 0.28); }
.fiche::backdrop { background: rgb(28 39 49 / 0.45); }
.fermer { position: absolute; top: 0.6rem; right: 0.8rem; font-size: 1.7rem; line-height: 1; background: none; border: 0; color: var(--ardoise); cursor: pointer; }
.surtitre { margin: 0 0 0.3rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mauve); }
.fiche h2 { font-family: var(--affiche); font-weight: 400; font-size: 2rem; line-height: 1.1; margin: 0 0 1.2rem; }
.fiche h2 .nom { font-size: 0.72em; letter-spacing: 0.06em; }
.etat-civil { display: grid; grid-template-columns: 6rem 1fr; gap: 0.7rem 1rem; margin: 0 0 1.3rem; padding: 1rem 0; border-top: 1px solid var(--filet); border-bottom: 1px solid var(--filet); }
.etat-civil dt { font-size: 0.8rem; font-weight: 700; color: var(--ardoise); padding-top: 0.15rem; }
.etat-civil dd { margin: 0; }
.liens-fiche { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.2rem; }
.mention { font-size: 0.8rem; color: var(--ardoise); margin: 0; }

.pied { max-width: 1320px; margin: 1rem auto 0; padding: 1.2rem 1.5rem 2rem; border-top: 1px solid var(--filet); font-size: 0.85rem; color: var(--ardoise); }
.pied p { margin: 0 0 0.3rem; }

/* --- page commune (indexable) --- */
.commune { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1.5rem 2rem; }
.ariane { font-size: 0.85rem; color: var(--ardoise); margin-bottom: 1.4rem; }
.commune h1 { font-family: var(--affiche); font-weight: 400; font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1; margin: 0 0 0.8rem; }
.chapeau { max-width: 62ch; color: var(--ardoise); margin: 0 0 1.8rem; }
.chiffres { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 2.4rem; border-top: 2px solid var(--encre); }
.chiffres div { flex: 1 1 12rem; padding: 0.8rem 1.2rem 0.8rem 0; }
.chiffres dt { font-size: 0.82rem; color: var(--ardoise); }
.chiffres dd { margin: 0.1rem 0 0; font: 500 1.9rem var(--mono); letter-spacing: -0.03em; }
.commune section { margin-bottom: 2.6rem; }
.commune h2 { font-family: var(--affiche); font-weight: 400; font-size: 1.7rem; margin: 0 0 0.6rem; }
.note { font-size: 0.85rem; color: var(--ardoise); margin: 0.4rem 0 0.8rem; }
.histo { width: 100%; max-width: 760px; height: auto; display: block; }
.histo rect { fill: var(--ardoise); }
.histo rect.incomplet { fill: var(--filet); }
.histo rect:hover { fill: var(--mauve); }
.histo text { font: 9px var(--mono); fill: var(--ardoise); }
.noms-frequents { list-style: none; padding: 0; margin: 0; columns: 4 11rem; column-gap: 1.5rem; }
.noms-frequents li { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--filet); padding: 0.25rem 0; break-inside: avoid; }
.noms-frequents a { font-family: var(--mono); font-size: 0.92rem; text-decoration: none; }
.noms-frequents span { font: 0.85rem var(--mono); color: var(--ardoise); }
.table-defile { overflow-x: auto; border: 1px solid var(--filet); border-radius: 6px; background: var(--blanc); }
.registre { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.registre th, .registre td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--carton); vertical-align: top; }
.registre thead th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ardoise); background: var(--carton); white-space: nowrap; }
.registre tbody th { font-weight: 400; min-width: 14rem; }
.registre td.mono { white-space: nowrap; }
.pagination { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; font-size: 0.92rem; }
.pagination a, .pagination span { padding: 0.3rem 0.65rem; border: 1px solid var(--filet); border-radius: 4px; text-decoration: none; }
.pagination [aria-current] { background: var(--encre); color: #fff; border-color: var(--encre); }

@media (max-width: 900px) {
  .ligne-principale { grid-template-columns: 1fr; }
  .grille-criteres { grid-template-columns: 1fr 1fr; }
  .grille-criteres .champ:not(.court) { grid-column: 1 / -1; }
  .onglets { display: flex; max-width: 1320px; margin: 0 1rem 0.8rem; border: 1px solid var(--filet); border-radius: 4px; overflow: hidden; }
  .onglets button { flex: 1; font: inherit; background: var(--blanc); border: 0; padding: 0.55rem; color: var(--ardoise); }
  .onglets button[aria-selected="true"] { background: var(--encre); color: #fff; }
  .espace { grid-template-columns: 1fr; padding: 0 1rem 1rem; }
  .espace[data-vue="liste"] .cartographie { display: none; }
  .espace[data-vue="carte"] .resultats { display: none; }
  .cartographie { position: static; }
  .carte { height: 68vh; }
  .accroche, .recherche, .technique, .entete, .pied, .commune { padding-left: 1rem; padding-right: 1rem; }
  .bandeau-demo { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* --- fiche (vraie page) --- */
a.resultat { color: inherit; text-decoration: none; }
.fiche-page { max-width: 1320px; margin: 0 auto; padding: 1.2rem 1.5rem 2rem; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; align-items: start; }
.fiche-contenu { max-width: 780px; }
.colonne-pub { position: sticky; top: 1rem; }
.pub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; border: 1.5px dashed var(--filet); border-radius: 4px; color: var(--ardoise); font: 0.8rem var(--mono); background: repeating-linear-gradient(135deg, transparent 0 10px, rgb(203 212 218 / 0.25) 10px 11px); }
.pub span { font: 700 0.68rem var(--texte); letter-spacing: 0.08em; text-transform: uppercase; }
.pub-haute { height: 600px; }
.pub-bandeau { height: 90px; margin: 1.6rem 0; }
.pub-pave { height: 280px; max-width: 336px; margin: 2rem 0; }
.titre-fiche { font-family: var(--affiche); font-weight: 400; font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.05; margin: 0 0 0.4rem; }
.titre-fiche .nom { font-size: 0.7em; letter-spacing: 0.06em; display: block; margin-bottom: 0.15rem; }
.resume { margin: 0; color: var(--ardoise); font-size: 1.05rem; }
.bloc { padding: 1.4rem 0; border-top: 1px solid var(--filet); }
.bloc h2 { font-family: var(--affiche); font-weight: 400; font-size: 1.65rem; margin: 0 0 0.8rem; }
.bloc h3 { font-size: 1rem; margin: 1.2rem 0 0.3rem; }
.bloc > p { max-width: 64ch; }
.page-fiche .etat-civil { grid-template-columns: 9rem 1fr; border: 0; padding: 0; margin: 0; }
.code { display: block; font: 0.78rem var(--mono); color: var(--ardoise); margin-top: 0.15rem; }
.mairies { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.mairie { background: var(--blanc); border: 1px solid var(--filet); border-left: 3px solid var(--mauve); border-radius: 4px; padding: 0.9rem 1rem; font-size: 0.92rem; }
.mairie p { margin: 0 0 0.45rem; }
.mairie-role { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mauve); }
.mairie-nom { font-weight: 700; font-size: 1rem; }
.mairie-horaires { color: var(--ardoise); font-size: 0.85rem; }
.mairie-liens { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0 !important; }
.lettre { margin-top: 1rem; background: var(--carton); border-radius: 6px; padding: 1rem; }
.lettre-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.lettre-champs .champ:first-child { grid-column: 1 / -1; }
.lettre-champs textarea { font: inherit; color: var(--encre); background: var(--blanc); border: 1px solid var(--filet); border-radius: 4px; padding: 0.62rem 0.75rem; resize: vertical; }
.lettre-texte { white-space: pre-wrap; font: 0.9rem/1.55 var(--texte); background: var(--blanc); border: 1px solid var(--filet); border-radius: 4px; padding: 1.2rem 1.4rem; margin: 1rem 0; max-height: 26rem; overflow: auto; }
.lettre-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.lettre-actions .bouton { text-decoration: none; }
.lettre-actions .bouton-secondaire { margin: 0; }
.carte-fiche { height: 320px; }
.etiquette-carte { font: 0.8rem var(--texte); }
.proches { list-style: none; padding: 0; margin: 0.3rem 0 0; columns: 2 16rem; column-gap: 1.5rem; }
.proches li { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--filet); break-inside: avoid; font-size: 0.92rem; }
.proches .mono { color: var(--ardoise); white-space: nowrap; }
.page-fiche .liens-fiche { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.page-fiche .mention { margin-top: 1rem; }
.registre tbody th a { color: inherit; text-decoration: none; }
.registre tbody th a:hover .nom { color: var(--mauve); text-decoration: underline; }
@media (max-width: 1000px) {
  .fiche-page { grid-template-columns: 1fr; padding: 1rem; }
  .colonne-pub { display: none; }
  .lettre-champs { grid-template-columns: 1fr; }
  .page-fiche .etat-civil { grid-template-columns: 7rem 1fr; }
}
@media print {
  .impression-lettre * { visibility: hidden; }
  .impression-lettre .lettre-texte, .impression-lettre .lettre-texte * { visibility: visible; }
  .impression-lettre .lettre-texte { position: absolute; inset: 0; border: 0; max-height: none; font-size: 12pt; }
}

/* --- critères avancés --- */
.nb-criteres:not(:empty) { display: inline-block; min-width: 1.4em; margin-left: 0.3rem; padding: 0 0.35em; border-radius: 999px; background: var(--mauve); color: #fff; font: 700 0.75rem/1.4 var(--texte); text-align: center; }
.groupes-criteres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 0.8rem; }
.groupe { border: 1px solid var(--filet); border-radius: 6px; background: var(--blanc); margin: 0; padding: 0.4rem 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.groupe legend { font-family: var(--affiche); font-size: 1.15rem; padding: 0 0.3rem; }
.groupe .champ input, .groupe .champ select { background: var(--papier); }
.case { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; cursor: pointer; }
.case input { accent-color: var(--mauve); margin-top: 0.25rem; }
.intervalle { display: flex; align-items: center; gap: 0.4rem; }
.intervalle input { width: 4.5rem !important; }
.intervalle span { font-size: 0.88rem; color: var(--ardoise); }
.lieu { position: relative; }
.suggestions { position: absolute; z-index: 1000; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 0.25rem 0; list-style: none; background: var(--blanc); border: 1px solid var(--filet); border-radius: 4px; box-shadow: 0 8px 24px rgb(28 39 49 / 0.15); }
.suggestions li { padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.92rem; }
.suggestions li small { display: block; color: var(--ardoise); font-size: 0.78rem; }
.suggestions li:hover, .suggestions li[aria-selected="true"] { background: var(--mauve-pale); }
.actions-criteres { display: flex; gap: 0.6rem; margin-top: 0.9rem; }
.actions-criteres .bouton-secondaire { margin: 0; }
.filtres-actifs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.filtres-actifs:empty { display: none; }
.filtre { font: inherit; font-size: 0.84rem; background: var(--mauve-pale); color: var(--mauve-fonce); border: 1px solid var(--mauve); border-radius: 999px; padding: 0.2rem 0.7rem; cursor: pointer; }
.filtre span:first-child { font-weight: 700; }
.filtre:hover { background: #fff; }
@media (max-width: 900px) { .groupes-criteres { grid-template-columns: 1fr; } }

/* --- alertes et carnet --- */
.alerte { margin: 0.4rem 0 1rem; background: var(--mauve-pale); border-radius: 6px; padding: 0.8rem 1rem; }
.alerte-titre { margin: 0 0 0.6rem; font-weight: 700; }
.alerte-ligne { display: grid; grid-template-columns: minmax(11rem, 1.2fr) minmax(12rem, 1.4fr) auto; gap: 0.6rem; align-items: end; }
.alerte .note { margin: 0.5rem 0 0; }
.alerte .note.erreur { color: #8a1f2b; font-weight: 700; }
.alerte-ok { margin: 0; }
.actions-fiche { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.2rem 0 0.4rem; }
.actions-fiche .bouton-secondaire { margin: 0; }
.bouton[aria-pressed="true"] { background: var(--mauve-fonce); }
.carnet { max-width: 900px; margin: 0 auto; padding: 1.6rem 1.5rem 2rem; }
.entete-bloc { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.entete-bloc .bouton-secondaire { margin: 0; }
.liste-carnet { list-style: none; padding: 0; margin: 0; }
.liste-carnet li { display: grid; gap: 0.5rem; padding: 0.9rem 0; border-bottom: 1px solid var(--filet); }
.liste-carnet .note { margin: 0; }
.carnet-qui a { font-size: 1.05rem; }
.ligne-alerte { grid-template-columns: 1fr auto; align-items: center; }
.lien-retirer { justify-self: start; font: inherit; font-size: 0.85rem; background: none; border: 0; padding: 0; color: var(--ardoise); text-decoration: underline; cursor: pointer; }
.liste-carnet textarea { font: inherit; font-size: 0.92rem; background: var(--blanc); border: 1px solid var(--filet); border-radius: 4px; padding: 0.5rem 0.7rem; resize: vertical; }
.avantages { padding-left: 1.1rem; margin: 0 0 0.6rem; }
.avantages li { margin-bottom: 0.4rem; }
@media (max-width: 700px) { .alerte-ligne { grid-template-columns: 1fr; } }

/* --- page chiffres --- */
.chiffres-page { max-width: 980px; margin: 0 auto; padding: 2rem 1.5rem 2rem; }
.accroche-chiffre { font-family: var(--affiche); font-weight: 400; font-size: clamp(2rem, 4.8vw, 3.4rem); line-height: 1.08; margin: 0.3rem 0 0.8rem; max-width: 22ch; }
.accroche-chiffre strong { font-family: var(--mono); font-weight: 500; color: var(--mauve-fonce); letter-spacing: -0.03em; }
.sous-accroche { font-size: 1.1rem; color: var(--ardoise); max-width: 60ch; margin: 0 0 1.8rem; }
.sous-accroche strong { color: var(--encre); }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); border-top: 2px solid var(--encre); margin-bottom: 2.4rem; }
.tuile { padding: 0.9rem 1.2rem 0.9rem 0; display: flex; flex-direction: column; gap: 0.2rem; }
.tuile-v { font: 500 1.6rem var(--mono); letter-spacing: -0.03em; }
.tuile-t { font-size: 0.85rem; color: var(--ardoise); }
.bloc-chiffre { padding: 1.6rem 0; border-top: 1px solid var(--filet); }
.bloc-chiffre h2 { font-family: var(--affiche); font-weight: 400; font-size: 1.75rem; margin: 0 0 0.4rem; }
.bloc-chiffre h3 { font-size: 0.95rem; margin: 0 0 0.6rem; }
.lecture { max-width: 66ch; margin: 0 0 1rem; color: var(--ardoise); }
.lecture:empty { display: none; }
.graphe { width: 100%; height: auto; display: block; overflow: visible; }
.graphe .grille { stroke: var(--carton); stroke-width: 1; }
.graphe .axe { font: 11px var(--mono); fill: var(--ardoise); }
.graphe .barre { fill: var(--mauve); }
.graphe .barre.incomplete { fill: var(--filet); }
.graphe .barre.fort { fill: var(--mauve-fonce); }
.graphe .barre.survol { fill: var(--encre); }
.graphe .cible { fill: transparent; cursor: crosshair; }
.graphe .cible:focus { outline: none; }
.graphe .courbe { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphe .point { stroke: var(--papier); stroke-width: 2; }
.graphe .etiquette { font: 12px var(--texte); fill: var(--encre); }
.graphe .repere { stroke: var(--ardoise); stroke-width: 1; }
.bulle { position: fixed; z-index: 2000; pointer-events: none; background: var(--encre); color: #fff; font-size: 0.82rem; line-height: 1.45; padding: 0.45rem 0.65rem; border-radius: 4px; max-width: 18rem; }
.bulle span { color: #c9d3d8; }
.bulle i { display: inline-block; width: 0.65em; height: 0.65em; border-radius: 2px; margin-right: 0.35em; }
.classement { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.classement li { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr auto; gap: 0.8rem; align-items: center; font-size: 0.92rem; }
.classement-barre { height: 12px; }
.classement-barre span { display: block; height: 100%; background: var(--mauve); border-radius: 0 4px 4px 0; }
.classement-v { font-family: var(--mono); font-size: 0.85rem; min-width: 5.5rem; text-align: right; }
.legende { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.82rem; color: var(--ardoise); margin-bottom: 0.8rem; }
.legende i { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px; margin-right: 0.35em; vertical-align: -0.05em; }
.empile-ligne { display: grid; grid-template-columns: 11rem 1fr; gap: 0.8rem; align-items: center; margin-bottom: 0.45rem; font-size: 0.9rem; }
.empile { display: flex; gap: 2px; height: 22px; }
.empile span { display: block; height: 100%; min-width: 0; }
.empile span:first-child { border-radius: 4px 0 0 4px; }
.empile span:last-child { border-radius: 0 4px 4px 0; }
.voir-tableau { margin-top: 0.8rem; font-size: 0.9rem; }
.voir-tableau summary { cursor: pointer; color: var(--mauve-fonce); }
.voir-tableau .table-defile { max-height: 22rem; overflow: auto; margin-top: 0.6rem; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.source-chiffres { margin-top: 2rem; }
@media (max-width: 700px) {
  .deux-colonnes { grid-template-columns: 1fr; }
  .empile-ligne { grid-template-columns: 1fr; gap: 0.2rem; }
  .classement li { grid-template-columns: 7.5rem 1fr auto; }
  .chiffres-page { padding: 1.4rem 1rem; }
}
.alerte-pliable { padding: 0.55rem 0.9rem; }
.alerte-ouvrir { all: unset; cursor: pointer; font-size: 0.92rem; color: var(--mauve-fonce); }
.alerte-ouvrir::before { content: "＋ "; font-weight: 700; }
.alerte-ouvrir[aria-expanded="true"]::before { content: "− "; }
.alerte-ouvrir:focus-visible { outline: 3px solid var(--mauve); outline-offset: 2px; }
.alerte-pliable .form-alerte { margin-top: 0.7rem; }
.variantes { font-size: 0.88rem; color: var(--ardoise); margin: 0 0 0.6rem; }
.variantes span { font-family: var(--mono); font-size: 0.8rem; }
.lien-mode { font: inherit; font-weight: 700; background: none; border: 0; padding: 0; margin-left: 0.4rem; color: var(--mauve-fonce); text-decoration: underline; cursor: pointer; }


/* --- fiche : la vie en deux dates --- */
.vie { display: grid; grid-template-columns: 1fr minmax(8rem, 0.7fr) 1fr; align-items: stretch; background: var(--blanc); border: 1px solid var(--filet); border-radius: 6px; margin: 0.4rem 0 1.2rem; }
.vie-evt { padding: 1.1rem 1.3rem; }
.vie-evt p { margin: 0; }
.vie-lib { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mauve); margin-bottom: 0.35rem !important; }
.vie-date { font-family: var(--affiche); font-size: 1.55rem; line-height: 1.15; margin-bottom: 0.35rem !important; }
.vie-date::first-letter { text-transform: uppercase; }
.vie-lieu { font-size: 0.98rem; }
.vie-duree { position: relative; display: grid; place-items: center; padding: 0 0.6rem; }
.vie-duree::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--filet); }
.vie-duree::after { content: ""; position: absolute; right: 0; top: calc(50% - 5px); border: 6px solid transparent; border-left-color: var(--filet); border-right: 0; }
.vie-duree span { position: relative; background: var(--mauve-pale); color: var(--mauve-fonce); font-size: 0.82rem; font-weight: 700; text-align: center; padding: 0.3rem 0.6rem; border-radius: 999px; max-width: 12rem; }
.vie-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.6rem 1.2rem; margin: 0 0 0.8rem; }
.vie-details dt { font-size: 0.75rem; font-weight: 700; color: var(--ardoise); }
.vie-details dd { margin: 0.1rem 0 0; }
.ligne-insee { margin-top: 0.6rem; font-size: 0.9rem; }
.ligne-insee summary { cursor: pointer; color: var(--mauve-fonce); }
.ligne-insee pre { white-space: pre; overflow-x: auto; font-size: 0.72rem; line-height: 1.6; background: var(--encre); color: #dfe6ea; padding: 0.7rem 0.9rem; border-radius: 4px; margin: 0.6rem 0; }
.ligne-insee .z1 { background: rgb(255 255 255 / 0.1); }
.ligne-insee span:hover { background: var(--mauve); color: #fff; }
.demarches { padding-left: 1.1rem; margin: 0 0 0.6rem; }
.demarches li { margin-bottom: 0.6rem; max-width: 66ch; }
.demarches a { white-space: nowrap; }
.leaflet-overlay-pane .trajet { stroke-linecap: round; }
@media (max-width: 700px) {
  .vie { grid-template-columns: 1fr; }
  .vie-duree { padding: 0.5rem 1.3rem; justify-items: start; }
  .vie-duree::before, .vie-duree::after { display: none; }
}

/* --- familles probables --- */
.familles { background: var(--blanc); border: 1px solid var(--filet); border-left: 3px solid var(--mauve); border-radius: 4px; padding: 0.9rem 1.1rem; margin: 0.6rem 0 1.2rem; }
.familles-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.familles-tete h3 { margin: 0; font-family: var(--affiche); font-weight: 400; font-size: 1.3rem; }
.fiabilite { font-size: 0.75rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; }
.fiabilite-forte { background: var(--mauve); color: #fff; }
.fiabilite-moyenne { background: var(--mauve-pale); color: var(--mauve-fonce); }
.fiabilite-faible, .fiabilite-inconnue { background: var(--carton); color: var(--ardoise); }
.groupe-famille { font-weight: 700; font-size: 0.92rem; margin: 0.9rem 0 0.1rem; }
.groupe-famille span { font-weight: 400; color: var(--ardoise); }
.exports { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.exports .bouton-secondaire { margin: 0; }

/* --- le nom à travers le temps --- */
.nom-page { max-width: 1000px; margin: 0 auto; padding: 1.4rem 1.5rem 2rem; }
.titre-nom { font-family: var(--mono); font-weight: 500; font-size: clamp(2.4rem, 7vw, 4.6rem); letter-spacing: 0.04em; line-height: 1; margin: 0.2rem 0 0.8rem; }
.temps { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 0.8rem; }
.temps-curseur { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; min-width: 14rem; font-size: 0.95rem; }
.temps-curseur strong { font-family: var(--mono); font-weight: 500; color: var(--mauve-fonce); }
.temps-curseur input { accent-color: var(--mauve); width: 100%; }
.carte-nom { height: min(64vh, 560px); }
.decennies { list-style: none; padding: 0; margin: 0; display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; }
.decennies li { flex: 1 0 2.6rem; }
.decennies button { all: unset; box-sizing: border-box; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; cursor: pointer; padding: 0.2rem 0; border-radius: 4px; }
.decennies button:focus-visible { outline: 3px solid var(--mauve); }
.dec-barre { height: 120px; width: 70%; max-width: 24px; display: flex; align-items: flex-end; }
.dec-barre span { display: block; width: 100%; background: var(--filet); border-radius: 4px 4px 0 0; min-height: 2px; }
.decennies button:hover .dec-barre span, .decennies button[aria-pressed="true"] .dec-barre span { background: var(--mauve); }
.dec-nb { font-size: 0.72rem; color: var(--ardoise); }
.dec-an { font-size: 0.72rem; }
.liste-simple { padding-left: 1.2rem; margin: 0; }
.liste-simple li { padding: 0.15rem 0; }
.liste-simple .mono { color: var(--ardoise); margin-left: 0.3rem; }
.variantes-nom a { font-family: var(--mono); }
.variantes-nom .mono { font-size: 0.8rem; color: var(--ardoise); }
