/* Famille Badin : épuré (arbre, navigation) + album (papier, polaroïds, serif). Mobile d'abord. */
:root {
  --papier: #f6f1e7;
  --papier-2: #efe7d8;
  --carte: #fffdf8;
  --encre: #2b2420;
  --encre-2: #5f544b;
  --discret: #8a7d71;
  --trait: #e3d8c6;
  --accent: #9c4a2c;
  --accent-doux: #f3e3d7;
  --ombre: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .08);
  --ombre-forte: 0 2px 6px rgba(60, 40, 20, .1), 0 18px 40px rgba(60, 40, 20, .16);
  --q0: #2f6f73; --q0-doux: #e1efee;
  --q1: #a8761f; --q1-doux: #f6ecd6;
  --q2: #b4553a; --q2-doux: #f7e4dc;
  --q3: #5f7a35; --q3-doux: #e8efdc;
  --qx: #8a7d71; --qx-doux: #eee8df;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rayon: 16px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #1d1916; --papier-2: #26201c; --carte: #2a2420; --encre: #f1e9de; --encre-2: #cdbfb1;
    --discret: #9d8f82; --trait: #3b332d; --accent: #e08a62; --accent-doux: #3a2a22;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3); --ombre-forte: 0 18px 40px rgba(0, 0, 0, .5);
    --q0: #6db3b5; --q0-doux: #20393a; --q1: #d8a84f; --q1-doux: #3a3020;
    --q2: #e0866b; --q2-doux: #3d2620; --q3: #9dbb6a; --q3-doux: #2b3420; --qx-doux: #332c27;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #1d1916; --papier-2: #26201c; --carte: #2a2420; --encre: #f1e9de; --encre-2: #cdbfb1;
  --discret: #9d8f82; --trait: #3b332d; --accent: #e08a62; --accent-doux: #3a2a22;
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3); --ombre-forte: 0 18px 40px rgba(0, 0, 0, .5);
  --q0: #6db3b5; --q0-doux: #20393a; --q1: #d8a84f; --q1-doux: #3a3020;
  --q2: #e0866b; --q2-doux: #3d2620; --q3: #9dbb6a; --q3-doux: #2b3420; --qx-doux: #332c27;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 16px/1.55 var(--sans); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
body { overflow-x: clip; }
h1, h2, h3 { overflow-wrap: anywhere; hyphens: auto; }
.chiffres, .branches, .galerie, .mur-actes, .famille-grille, .liste-personnes { grid-template-columns: minmax(0, 1fr); }
.chiffres > *, .branches > *, .galerie > *, .mur-actes > * { min-width: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
code { font-size: .88em; background: var(--papier-2); padding: .1em .35em; border-radius: 5px; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.discret { color: var(--discret); }
.surtitre { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 600; color: var(--discret); margin: 0 0 .3rem; }

/* ---------- barre du haut & navigation */
.barre {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--papier) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--trait);
}
.marque { display: flex; align-items: center; gap: 10px; color: var(--encre); font-family: var(--serif); font-size: 1.15rem; margin-right: auto; }
.marque:hover { text-decoration: none; }
.marque em { font-style: italic; color: var(--accent); }
.sceau {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--carte);
  background: var(--accent); font-weight: 600; font-size: 1.05rem; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--carte) 30%, transparent);
}
.nav-haut { display: none; gap: 4px; }
.nav-haut a { color: var(--encre-2); padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.nav-haut a:hover { background: var(--papier-2); text-decoration: none; }
.nav-haut a.actif { background: var(--encre); color: var(--papier); }
.btn-rond { border: 0; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--encre); background: var(--carte); box-shadow: var(--ombre); }
.btn-rond svg { width: 20px; height: 20px; }
.pastille-admin { font-size: .75rem; font-weight: 600; background: var(--encre); color: var(--papier); padding: 4px 10px; border-radius: 999px; }
.nav-bas {
  position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--carte) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--trait);
}
.nav-bas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--discret); font-size: .72rem; font-weight: 500; }
.nav-bas a:hover { text-decoration: none; }
.nav-bas svg { width: 24px; height: 24px; }
.nav-bas a.actif { color: var(--accent); }
.nav-bas a.actif svg { stroke-width: 2.2; }
@media (min-width: 860px) {
  body { padding-bottom: 0; }
  .nav-bas { display: none; }
  .nav-haut { display: flex; }
}

/* ---------- mise en page */
.page { max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px; }
.titre-page { font-size: clamp(1.7rem, 6vw, 2.4rem); margin-top: .2em; }
.chapo-page { color: var(--encre-2); margin-top: -.2em; max-width: 60ch; }
.titre-section { font-size: 1.35rem; margin: 2rem 0 .8rem; }
.titre-ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.titre-ligne .titre-section { margin-bottom: .8rem; }
.pied-note { text-align: center; color: var(--discret); font-size: .82rem; margin: 2.5rem 0 0; }
.btn-principal, .btn-second {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; font-weight: 600; font-size: .95rem; border: 0; cursor: pointer; font-family: inherit;
}
.btn-principal { background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-second { background: var(--carte); color: var(--encre); box-shadow: inset 0 0 0 1.5px var(--trait); }
.btn-principal:hover, .btn-second:hover { text-decoration: none; filter: brightness(1.05); }
.btn-principal svg { width: 18px; height: 18px; }

/* ---------- accueil */
.hero { position: relative; margin: 0 -16px; padding: 34px 16px 30px; overflow: hidden; }
.hero-fond { position: absolute; inset: 0; display: flex; justify-content: flex-end; gap: 10px; opacity: .22; pointer-events: none; }
.hero-fond img {
  width: 46%; max-width: 260px; height: 110%; object-fit: cover; filter: sepia(.7) contrast(.9);
  transform: rotate(4deg) translateY(-4%); border: 8px solid #fff; box-shadow: var(--ombre);
}
.hero-fond img:nth-child(2) { transform: rotate(-6deg) translateY(8%); }
.hero-fond img:nth-child(3) { display: none; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--papier) 35%, color-mix(in srgb, var(--papier) 40%, transparent)); pointer-events: none; }
.hero-texte { position: relative; z-index: 1; max-width: 560px; }
.hero h1 { font-size: clamp(1.8rem, 7.6vw, 3.4rem); margin-bottom: .35em; }
.hero h1 span { display: block; font-style: italic; color: var(--accent); font-weight: 400; }
.chapo { font-size: 1.05rem; color: var(--encre-2); max-width: 44ch; margin: 0 0 1.4rem; }
@media (min-width: 860px) {
  .hero { margin: 0; border-radius: 28px; padding: 64px 48px; background: var(--papier-2); }
  .hero::after { background: linear-gradient(90deg, var(--papier-2) 40%, transparent); }
  .hero-fond img:nth-child(3) { display: block; transform: rotate(-2deg) translateY(-10%); }
  .hero-fond { opacity: .5; padding-right: 30px; }
}
.chiffres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.chiffres div { background: var(--carte); border-radius: var(--rayon); padding: 14px 16px; box-shadow: var(--ombre); }
.chiffres strong { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; }
.chiffres span { color: var(--discret); font-size: .85rem; }
@media (min-width: 640px) { .chiffres { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.branches { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (min-width: 860px) { .branches { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.carte-branche {
  --c: var(--qx); --cd: var(--qx-doux);
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--rayon); min-height: 132px;
  background: var(--cd); color: var(--encre); position: relative; overflow: hidden;
}
.carte-branche::before { content: ""; position: absolute; right: -18px; top: -18px; width: 74px; height: 74px; border-radius: 50%; border: 10px solid var(--c); opacity: .18; }
.carte-branche:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--ombre); }
.branche-nom { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--c); line-height: 1.15; }
.branche-info { font-size: .85rem; font-weight: 600; }
.branche-lieux { font-size: .78rem; color: var(--encre-2); margin-top: auto; }
.q0 { --c: var(--q0); --cd: var(--q0-doux); }
.q1 { --c: var(--q1); --cd: var(--q1-doux); }
.q2 { --c: var(--q2); --cd: var(--q2-doux); }
.q3 { --c: var(--q3); --cd: var(--q3-doux); }

.carte-une {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: start; color: var(--encre);
  background: var(--carte); border-radius: 20px; padding: 16px; box-shadow: var(--ombre);
}
.carte-une:hover { text-decoration: none; box-shadow: var(--ombre-forte); }
.carte-une h3 { font-size: 1.3rem; margin-bottom: .2em; }
.carte-une .dates { margin: 0; font-weight: 500; }
.carte-une .metier { margin: .2em 0; color: var(--encre-2); font-size: .9rem; }
.carte-une .extrait { font-size: .9rem; color: var(--encre-2); font-style: italic; font-family: var(--serif); margin: .6em 0; }
.carte-une .lien { color: var(--accent); font-weight: 600; font-size: .9rem; }
.carte-une .polaroid { transform: rotate(-3deg); }
@media (min-width: 640px) { .carte-une { grid-template-columns: 200px minmax(0, 1fr); padding: 22px; } }

/* polaroïds (images d'actes) */
.polaroid {
  display: block; background: #fff; padding: 7px 7px 0; border-radius: 4px; box-shadow: var(--ombre); color: #4a3f36; margin: 0;
  transition: transform .2s, box-shadow .2s;
}
.polaroid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; background: #eee6da; filter: sepia(.15); }
.polaroid figcaption { font-family: var(--serif); font-size: .78rem; line-height: 1.3; padding: 7px 2px 9px; min-height: 2.6em; }
.polaroid:hover { text-decoration: none; transform: rotate(0) translateY(-3px) !important; box-shadow: var(--ombre-forte); }
.defile { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 16px 18px; margin: 0 -16px; scrollbar-width: none; }
.defile::-webkit-scrollbar { display: none; }
.defile .polaroid { scroll-snap-align: start; }
.defile .polaroid:nth-child(odd) { transform: rotate(-1.6deg); }
.defile .polaroid:nth-child(even) { transform: rotate(1.4deg); }
@media (min-width: 640px) { .defile { grid-auto-columns: 200px; } }

/* ---------- liste des personnes */
.filtres { position: sticky; top: 61px; z-index: 5; background: var(--papier); padding: 6px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.champ-recherche { display: flex; align-items: center; gap: 10px; background: var(--carte); border-radius: 14px; padding: 0 14px; box-shadow: var(--ombre); }
.champ-recherche svg { width: 20px; height: 20px; color: var(--discret); flex: none; }
.champ-recherche input { border: 0; background: none; font: inherit; color: var(--encre); padding: 13px 0; width: 100%; outline: none; }
.puces { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font: 500 .85rem var(--sans);
  background: var(--carte); color: var(--encre-2); border: 1px solid var(--trait); cursor: pointer; white-space: nowrap;
}
.puce small { color: var(--discret); font-weight: 400; }
.puce:hover { text-decoration: none; border-color: var(--discret); }
.puce.active { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.puce.active small { color: inherit; opacity: .7; }
.puce[class*="q"]:not(.active)::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.compte { color: var(--discret); font-size: .85rem; margin: 6px 0; }
.groupe { margin-top: 18px; }
.lettre { font-size: 1.05rem; color: var(--encre-2); border-bottom: 1px solid var(--trait); padding-bottom: 6px; margin-bottom: 6px; }
.lettre small { font-family: var(--sans); font-weight: 400; color: var(--discret); font-size: .8rem; }
.liste-personnes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
@media (min-width: 760px) { .liste-personnes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.ligne-personne { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--carte); color: var(--encre); box-shadow: 0 1px 2px rgba(60, 40, 20, .05); }
.ligne-personne:hover { text-decoration: none; box-shadow: var(--ombre); }
.avatar {
  --c: var(--qx); --cd: var(--qx-doux);
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cd); color: var(--c); font-family: var(--serif); font-weight: 600; font-size: 1rem; letter-spacing: .02em;
}
.avatar.f { border-radius: 50% 50% 50% 14px; }
.avatar.grand { width: 84px; height: 84px; font-size: 1.8rem; box-shadow: 0 0 0 5px var(--carte), var(--ombre); }
.lp-texte { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lp-nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-nom em { font-weight: 400; color: var(--discret); }
.lp-info { font-size: .85rem; color: var(--discret); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vide { text-align: center; color: var(--discret); padding: 30px 0; }

.pastille { display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--qx-doux); color: var(--encre-2); vertical-align: middle; }
.pastille.acte, .pastille.niv-acte { background: var(--q3-doux); color: var(--q3); }
.pastille.niv-temoignage { background: var(--q1-doux); color: var(--q1); }
.pastille.niv-secondaire { background: var(--qx-doux); color: var(--encre-2); }
.pastille.vivant { background: var(--accent-doux); color: var(--accent); }

/* ---------- fiche personne */
.fiche { max-width: 760px; margin: 0 auto; }
.fiche-tete {
  position: relative; text-align: center; padding: 26px 18px 22px; border-radius: 24px; margin-bottom: 14px;
  background: linear-gradient(180deg, var(--cd, var(--qx-doux)), var(--carte) 75%); box-shadow: var(--ombre);
}
.fiche-tete .avatar { margin: 0 auto 14px; }
.fiche-tete h1 { font-size: clamp(1.6rem, 7vw, 2.3rem); margin-bottom: .15em; }
.fiche-tete h1 .nom { display: block; font-variant: small-caps; letter-spacing: .04em; color: var(--c, var(--accent)); }
.fiche-annees { font-family: var(--serif); font-size: 1.2rem; color: var(--encre-2); margin: 0 0 .5em; }
.surnom { font-style: italic; margin: 0 0 .3em; color: var(--encre-2); }
.fiche-metier { color: var(--encre-2); font-size: .92rem; max-width: 46ch; margin: .6em auto 1em; }
.retour { position: absolute; left: 12px; top: 12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--carte); color: var(--encre); font-size: 1.2rem; box-shadow: var(--ombre); }
.retour:hover { text-decoration: none; }
.retour-texte { display: inline-block; margin: 6px 0 4px; font-weight: 500; font-size: .92rem; }
.bloc { background: var(--carte); border-radius: 20px; padding: 18px; margin-bottom: 14px; box-shadow: var(--ombre); }
.bloc h2 { font-size: 1.2rem; }
.bloc h2 small { font-family: var(--sans); font-size: .8rem; font-weight: 400; color: var(--discret); }
.bloc-doute { background: color-mix(in srgb, var(--q1-doux) 70%, var(--carte)); }
.bloc-doute ul { margin: 0; padding-left: 1.1em; }
.bloc-doute li { margin-bottom: .4em; }
.bloc-admin { border: 2px dashed var(--trait); box-shadow: none; margin-top: 30px; }
.famille-grille { display: grid; gap: 14px; }
@media (min-width: 640px) { .famille-grille { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.famille-grille h3 { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--discret); margin: 6px 0 6px; }
.puce-personne { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--papier); color: var(--encre); margin-bottom: 6px; border-left: 3px solid var(--trait); }
.puce-personne:hover { text-decoration: none; background: var(--papier-2); }
.puce-personne .role { font-size: .75rem; color: var(--discret); width: 100%; }
.puce-personne .pp-nom { font-weight: 600; }
.puce-personne .pp-info { font-size: .82rem; color: var(--discret); }
.chrono { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.chrono::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--trait); }
.chrono li { position: relative; padding-bottom: 18px; }
.chrono li:last-child { padding-bottom: 0; }
.chrono li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--carte); border: 3px solid var(--accent); }
.chrono .ev-union::before { border-color: var(--q1); }
.chrono .ev-deces::before { border-color: var(--encre-2); }
.ev-type { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--discret); }
.chrono strong { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.chrono .lieu { display: block; color: var(--encre-2); }
.chrono p { margin: .35em 0; font-size: .92rem; color: var(--encre-2); }
.chrono .doute { color: var(--q1); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.src { font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--papier-2); color: var(--encre-2); }
.src-acte { background: var(--q3-doux); color: var(--q3); }
.src:hover { text-decoration: none; filter: brightness(.96); }
.galerie { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 640px) { .galerie { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.galerie .polaroid:nth-child(3n+1) { transform: rotate(-1.2deg); }
.galerie .polaroid:nth-child(3n+2) { transform: rotate(1deg); }
.notes p { font-family: var(--serif); font-size: 1rem; line-height: 1.6; margin: 0 0 .8em; }
.notes p:last-child { margin-bottom: 0; }
.liste-sources { margin: 0; padding-left: 1.1em; font-size: .92rem; }
.liste-sources li { margin-bottom: .4em; }
.nature { font-size: .75rem; color: var(--discret); }

/* ---------- actes */
.mur-actes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 640px) { .mur-actes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 980px) { .mur-actes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); } }
.siecle { grid-column: 1 / -1; font-size: 1.2rem; margin: 18px 0 2px; color: var(--encre-2); }
.carte-acte { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding: 10px; border-radius: 16px; background: var(--carte); color: var(--encre); box-shadow: var(--ombre); }
.carte-acte:hover { text-decoration: none; box-shadow: var(--ombre-forte); }
.ca-image { position: relative; }
.ca-image img { width: 88px; height: 110px; object-fit: cover; object-position: top; border-radius: 8px; filter: sepia(.2); background: var(--papier-2); }
.ca-nb { position: absolute; bottom: 5px; left: 5px; font-size: .68rem; font-weight: 600; background: rgba(0, 0, 0, .6); color: #fff; padding: 2px 6px; border-radius: 6px; }
.ca-texte { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px; }
.ca-type { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.ca-titre { font-family: var(--serif); font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ca-noms { font-size: .82rem; color: var(--discret); margin-top: auto; }
.page-acte { max-width: 900px; margin: 0 auto; }
.pages-acte { display: grid; gap: 18px; margin: 14px 0 18px; }
.feuillet { margin: 0; background: #fff; padding: 8px; border-radius: 6px; box-shadow: var(--ombre); }
.feuillet button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.feuillet img { width: 100%; height: auto; }
.feuillet figcaption { font-size: .8rem; color: #6b5f55; padding: 8px 4px 2px; }
.pdf { display: flex; align-items: center; gap: 12px; padding: 20px; font-weight: 600; }
.pdf img { width: 48px; }
.reference { font-size: .92rem; color: var(--encre-2); overflow-wrap: anywhere; }
.visionneuse { position: fixed; inset: 0; z-index: 100; background: #111; display: flex; flex-direction: column; }
.v-barre { display: flex; align-items: center; gap: 14px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); color: #bbb; font-size: .8rem; }
.v-barre span { margin-right: auto; }
.v-barre .v-compteur { margin-right: 0; color: #fff; font-weight: 600; white-space: nowrap; }
.v-barre .v-legende { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-barre .v-compteur:empty { display: none; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(40, 40, 40, .75); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.v-prec { left: 10px; } .v-suiv { right: 10px; }
.v-aide { margin: 0; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); text-align: center; color: #888; font-size: .75rem; }
.visionneuse { position: fixed; }
.v-barre a { color: #fff; font-weight: 600; white-space: nowrap; }
.v-barre button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #333; color: #fff; font-size: 1.4rem; cursor: pointer; }
.v-zone { flex: 1; overflow: auto; display: flex; touch-action: pan-x pan-y pinch-zoom; }
.v-zone img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.v-zone img.zoom { max-width: none; max-height: none; width: 260%; cursor: zoom-out; margin: 0; }

/* ---------- arbre (plein écran) */
body.plein-ecran { overflow: hidden; padding-bottom: 0; height: 100dvh; }
.zone-arbre { position: fixed; inset: 0; top: 61px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 860px) { .zone-arbre { bottom: 0; } }
.arbre { position: absolute; inset: 0; touch-action: none; cursor: grab; overflow: hidden;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--trait) 90%, transparent) 1px, transparent 1.3px); background-size: 22px 22px; }
.arbre:active { cursor: grabbing; }
.arbre svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.arbre-outils { position: absolute; z-index: 5; left: 12px; right: 12px; top: 10px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.arbre-outils > * { pointer-events: auto; }
.arbre-titre { background: var(--carte); border-radius: 14px; padding: 7px 12px; box-shadow: var(--ombre); line-height: 1.2; }
.arbre-titre .surtitre { font-size: .62rem; margin: 0; display: block; }
.arbre-titre strong { font-family: var(--serif); font-size: .98rem; }
.arbre-cherche { position: relative; flex: 1; max-width: 340px; margin-left: auto; }
.arbre-cherche input { width: 100%; border: 0; border-radius: 14px; padding: 12px 14px; font: inherit; font-size: .92rem; background: var(--carte); color: var(--encre); box-shadow: var(--ombre); outline: none; }
#suggestions { list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0; background: var(--carte); border-radius: 14px; box-shadow: var(--ombre-forte); max-height: 50vh; overflow: auto; }
#suggestions button { width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 10px; font: inherit; color: var(--encre); cursor: pointer; }
#suggestions button:hover { background: var(--papier); }
#suggestions small { color: var(--discret); }
#suggestions .vide { padding: 10px; }
.arbre-zoom { position: absolute; z-index: 5; right: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.arbre-zoom button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--carte); color: var(--encre); font-size: 1.4rem; box-shadow: var(--ombre); cursor: pointer; display: grid; place-items: center; }
.arbre-zoom svg { width: 22px; height: 22px; }
.legende { position: absolute; z-index: 5; left: 12px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 80px); }
.legende span { font-size: .7rem; font-weight: 600; background: var(--carte); padding: 4px 9px 4px 7px; border-radius: 999px; box-shadow: var(--ombre); display: inline-flex; align-items: center; gap: 5px; color: var(--encre-2); }
.legende span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.legende .leg-acte::before { border-radius: 2px; width: 7px; height: 9px; background: var(--q3); }
.gen-label { font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; fill: var(--discret); stroke: none; }
.lien { stroke: var(--c, var(--trait)); stroke-width: 2; opacity: .45; fill: none; transition: opacity .2s, stroke-width .2s; }
.lien.chemin { opacity: 1; stroke-width: 3.2; }
.carte { cursor: pointer; --c: var(--qx); --cd: var(--qx-doux); }
.carte.q0 { --c: var(--q0); --cd: var(--q0-doux); } .carte.q1 { --c: var(--q1); --cd: var(--q1-doux); }
.carte.q2 { --c: var(--q2); --cd: var(--q2-doux); } .carte.q3 { --c: var(--q3); --cd: var(--q3-doux); }
.carte .fond { fill: var(--carte); stroke: var(--trait); stroke-width: 1; filter: drop-shadow(0 2px 4px rgba(60, 40, 20, .1)); transition: stroke .15s; }
.carte .bande { fill: var(--c); stroke: none; }
.carte text { stroke: none; }
.c-prenom { font: 600 14px var(--sans); fill: var(--encre); }
.c-nom { font: 600 12.5px var(--serif); letter-spacing: .05em; fill: var(--c); }
.c-annees { font: 500 11.5px var(--sans); fill: var(--discret); }
.badge-acte rect { fill: var(--q3-doux); stroke: var(--q3); stroke-width: 1.2; }
.badge-acte path { stroke: var(--q3); stroke-width: 1.4; }
.carte.racine .fond { fill: var(--cd); stroke: var(--accent); stroke-width: 2; }
.carte.masque .fond { fill: var(--papier-2); stroke-dasharray: 4 3; }
.carte.chemin .fond { stroke: var(--c); stroke-width: 2; }
.carte.choisi .fond { stroke: var(--accent); stroke-width: 3; }
.carte:focus { outline: none; }
.carte:focus-visible .fond { stroke: var(--accent); stroke-width: 3; }
.feuille {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; background: var(--carte); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(20px + var(--nav-h) + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(40, 25, 10, .22);
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.feuille.ouverte { transform: none; }
.poignee { width: 44px; height: 5px; border-radius: 3px; background: var(--trait); margin: 0 auto 12px; }
.feuille .fermer { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--papier); color: var(--encre); font-size: 1.3rem; cursor: pointer; }
.feuille h3 { font-size: 1.45rem; margin: 0 0 .2em; padding-right: 36px; }
.feuille h3 .nom { font-variant: small-caps; letter-spacing: .04em; color: var(--accent); }
.feuille .dates { font-weight: 500; margin: 0 0 .3em; }
.feuille .metier { color: var(--encre-2); font-size: .9rem; margin: 0 0 .5em; }
.feuille .actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.feuille .actions a { flex: 1; }
@media (min-width: 860px) {
  .feuille { left: auto; right: 20px; bottom: 20px; width: 380px; border-radius: 22px; padding-bottom: 22px; transform: translateX(120%); }
  .feuille .poignee { display: none; }
}

/* ---------- formulaires & admin */
.carte-form { max-width: 420px; margin: 20px auto; background: var(--carte); border-radius: 22px; padding: 24px; box-shadow: var(--ombre); display: grid; gap: 14px; }
.carte-form.large { max-width: 640px; }
.carte-form label { display: grid; gap: 6px; font-weight: 500; font-size: .9rem; }
.carte-form input:not([type="checkbox"]):not([type="file"]) { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--trait); background: var(--papier); color: var(--encre); }
.carte-form label.case { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.depot { border: 2px dashed var(--trait); border-radius: 16px; padding: 22px; text-align: center; background: var(--papier); }
.depot input { margin: 0 auto 8px; }
.alerte, .succes { border-radius: 14px; padding: 12px 16px; margin: 12px 0; }
.alerte { background: var(--q2-doux); color: var(--q2); }
.succes { background: var(--q3-doux); color: var(--q3); }
.alerte ul, .succes ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--encre-2); }
.tableau { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tableau th, .tableau td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--trait); }
.tableau th { color: var(--discret); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.statut-ok { color: var(--q3); font-weight: 600; }
.statut-erreur { color: var(--q2); font-weight: 600; }
.liste-simple { padding-left: 1.1em; margin: 0; }
.bloc .titre-ligne h2 { margin: 0; }
.bloc .titre-ligne { margin-bottom: 10px; }

/* ---------- transcriptions d'actes */
.tr-type { font-family: var(--sans); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--discret); margin: 1.1rem 0 .4rem; }
.transcription { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; margin: 0 0 .5rem; }
.transcription > summary { cursor: pointer; padding: .7rem .9rem; list-style: none; display: grid; gap: .1rem; }
.transcription > summary::-webkit-details-marker { display: none; }
.transcription .tr-titre::before { content: "▸ "; color: var(--accent); }
.transcription[open] .tr-titre::before { content: "▾ "; }
.tr-titre { font-weight: 600; }
.tr-info { font-size: .85rem; color: var(--discret); }
.tr-corps { padding: 0 .9rem .8rem; font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.tr-page .tr-corps { padding: 0; }
.tr-corps h4 { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--discret); margin: 1rem 0 .3rem; }
.tr-corps h5 { font-size: .95rem; margin: .8rem 0 .2rem; }
.tr-corps p { margin: 0 0 .7rem; }
.tr-corps ul { margin: 0 0 .7rem; padding-left: 1.2em; }
.tr-table { overflow-x: auto; margin: 0 0 .7rem; }
.tr-table table { border-collapse: collapse; font-size: .82rem; }
.tr-table td { border: 1px solid var(--trait); padding: .2rem .45rem; white-space: nowrap; }
.tr-lacune { background: var(--accent-doux); border-radius: 3px; padding: 0 .15em; }
.tr-doute { color: var(--discret); font-style: italic; }
.tr-pied { font-size: .8rem; color: var(--discret); margin: .4rem 0 0; }
