/* SPDX-License-Identifier: EUPL-1.2 — © 2026 Donatien Roche */
/* Carte des Monuments Historiques de France : feuille de style (mobile d'abord). */

@font-face {
  font-family: "Fraunces"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/fraunces-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(../fonts/fraunces-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(../fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url(../fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2) format("woff2-variations");
}

/* ---------------------------------------------------------------- jetons */
:root {
  color-scheme: light;
  --papier: #F3EFE6;
  --surface: #FBF9F4;
  --surface-2: #F1ECE2;
  --encre: #1F2328;
  --encre-douce: #5E574C;
  --trait: #DCD3C4;
  --trait-fort: #B9AE9C;
  --accent: #8C2F1C;
  --sur-accent: #FFFFFF;
  --ombre: 0 1px 2px rgb(60 45 20 / .08), 0 8px 24px rgb(60 45 20 / .12);
  --grappe-fond: #EAE1CE;
  --grappe-texte: #2B2620;
  --grappe-bord: #C4B497;
  --rayon: 14px;
  --police-titre: "Fraunces", Georgia, "Times New Roman", serif;
  --police: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pouce: 24px;
  --duree: 200ms;
}
:root[data-theme="sombre"] {
  color-scheme: dark;
  --papier: #1A1D23;
  --surface: #23272F;
  --surface-2: #2B3039;
  --encre: #ECE7DC;
  --encre-douce: #ABA497;
  --trait: #3A3F48;
  --trait-fort: #5A606B;
  --accent: #F0A48C;
  --sur-accent: #1A1D23;
  --ombre: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px rgb(0 0 0 / .45);
  --grappe-fond: #23272F;
  --grappe-texte: #ECE7DC;
  --grappe-bord: #5A606B;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --papier: #1A1D23; --surface: #23272F; --surface-2: #2B3039; --encre: #ECE7DC; --encre-douce: #ABA497;
    --trait: #3A3F48; --trait-fort: #5A606B; --accent: #F0A48C; --sur-accent: #1A1D23;
    --grappe-fond: #23272F; --grappe-texte: #ECE7DC; --grappe-bord: #5A606B;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 400 16px/1.45 var(--police); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3 { font-family: var(--police-titre); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.005em; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.vh, .vh-mobile { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.icone { display: block; flex: none; }
[data-icone] { display: inline-flex; }
[hidden] { display: none !important; }

.evitement { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--encre); color: var(--papier); padding: 10px 14px; border-radius: 8px; }
.evitement:focus { top: 8px; }

/* ---------------------------------------------------------------- boutons */
.btn, .btn-icone {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border: 1px solid var(--trait); background: var(--surface); color: var(--encre);
  border-radius: 999px; padding: 0 16px; font-weight: 600; font-size: .95rem; white-space: nowrap;
  transition: background var(--duree), border-color var(--duree), transform var(--duree);
}
.btn:hover, .btn-icone:hover { border-color: var(--trait-fort); background: var(--surface-2); }
.btn:active, .btn-icone:active { transform: scale(.97); }
.btn-icone { width: 44px; padding: 0; }
.btn-petit { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-icone.btn-petit { width: 36px; padding: 0; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.btn-accent:hover { background: var(--accent); border-color: var(--encre); }
.btn-discret { background: transparent; border-color: transparent; color: var(--encre-douce); }
.btn-large { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------- structure */
.appli { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; }
.entete {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--papier); border-bottom: 1px solid var(--trait); z-index: 20;
}
.marque { display: flex; align-items: center; gap: 8px; color: var(--encre); text-decoration: none; flex: none; }
.marque-logo { width: 32px; height: 32px; flex: none; }
.marque-texte { display: none; font-family: var(--police-titre); font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; }
.marque-texte em { font-style: normal; color: var(--accent); }
/* Nom complet sur grand écran, « Monuments Historiques » seul sur écran moyen */
.marque-long { display: none; }
@media (min-width: 1000px) { .marque-long { display: inline; } }
.outils { display: flex; gap: 4px; }
.outils .btn-icone { border-color: transparent; background: transparent; }
.outils .btn-icone:hover { background: var(--surface-2); }

.recherche { position: relative; flex: 1; min-width: 0; }
.recherche input {
  width: 100%; height: 44px; border: 1px solid var(--trait); border-radius: 999px;
  background: var(--surface); padding: 0 14px 0 40px; font-size: 1rem;
}
.recherche input::placeholder { color: var(--encre-douce); opacity: 1; }
.recherche input:focus-visible { outline-offset: 0; }
.recherche-loupe { position: absolute; left: 12px; top: 10px; color: var(--encre-douce); pointer-events: none; }
.recherche-resultats {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre);
  max-height: min(60vh, 420px); overflow: auto;
}
.recherche-resultats li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.recherche-resultats li[aria-selected="true"], .recherche-resultats li:hover { background: var(--surface-2); }
.recherche-resultats .r-nom { font-weight: 600; }
.recherche-resultats .r-info { color: var(--encre-douce); font-size: .85rem; white-space: nowrap; }
/* Résultat « monument » : pastille de période, titre sur deux lignes au plus, commune dessous */
.recherche-resultats li.r-monument { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 1px; align-items: start; }
.recherche-resultats .r-pastille { grid-row: span 2; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px var(--trait-fort); }
.recherche-resultats li.r-monument .r-nom { font-weight: 550; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recherche-resultats li.r-monument .r-info { white-space: normal; }
.recherche-resultats .r-vide { color: var(--encre-douce); cursor: default; }

.scene { position: relative; overflow: hidden; min-height: 0; }
.carte { position: absolute; inset: 0; background: var(--papier); }
.carte:focus-visible { outline-offset: -3px; }

/* ---------------------------------------------------------------- panneau des options (feuille sur mobile, fenêtre flottante sur grand écran) */
.panneau {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--ombre);
  transform: translateY(105%); visibility: hidden;
  transition: transform 260ms cubic-bezier(.2, .8, .2, 1), visibility 0s 260ms;
}
.panneau.ouvert { transform: none; visibility: visible; transition: transform 260ms cubic-bezier(.2, .8, .2, 1); }
.panneau-tete { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.panneau-tete h2 { font-size: 1.35rem; }
.panneau-corps { overflow: auto; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.voile { position: fixed; inset: 0; z-index: 45; background: rgb(20 18 14 / .35); opacity: 0; pointer-events: none; transition: opacity var(--duree); }
.voile.actif { opacity: 1; pointer-events: auto; }

.bloc { padding: 14px 0; border-bottom: 1px solid var(--trait); }
.bloc:last-of-type { border-bottom: 0; }
.bloc h3 { font-size: 1.05rem; margin-bottom: 8px; }
.aide { margin: -4px 0 10px; color: var(--encre-douce); font-size: .85rem; }

.pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.pastille {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 10px 2px 3px; white-space: nowrap;
  border: 1px solid var(--trait); border-radius: 999px; background: var(--surface); font-size: .84rem; line-height: 1.1;
  transition: background var(--duree), border-color var(--duree), color var(--duree);
}
.pastille:hover { border-color: var(--trait-fort); }
.pastille .p-icone {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--encre); flex: none;
}
.pastille .p-icone .icone { width: 17px; height: 17px; }
.pastille .p-nb { color: var(--encre-douce); font-size: .74rem; font-variant-numeric: tabular-nums; }
.pastille[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--papier); }
.pastille[aria-pressed="true"] .p-icone { background: var(--papier); color: var(--encre); }
.pastille[aria-pressed="true"] .p-nb { color: inherit; opacity: .8; }
.pastille.vide:not([aria-pressed="true"]) { opacity: .55; }
.pastille-texte { padding-left: 10px; }

.territoires { display: flex; flex-wrap: wrap; gap: 6px; }
.territoires .btn { min-height: 38px; font-weight: 500; font-size: .875rem; }

/* fond de carte : vignettes cliquables (groupe radio) */
.fonds { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fond-choix {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 2px; padding: 4px 4px 6px; text-align: left;
  min-width: 0; overflow-wrap: break-word; hyphens: auto;
  border: 1.5px solid var(--trait); border-radius: 10px; background: var(--surface); color: var(--encre);
  transition: border-color var(--duree), background var(--duree);
}
.fond-choix:hover { border-color: var(--trait-fort); background: var(--surface-2); }
.fond-choix[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fond-vignette { display: block; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.fond-vignette img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Le plan vectoriel n'a pas de tuile image : vignette dessinée (terre, rivière, routes). */
.fond-vignette-plan {
  --v-terre: #F3EFE6; --v-eau: #C6D6DC; --v-route: #FFFFFF; --v-bord: #DCD2C1;
  background:
    linear-gradient(28deg, transparent 46%, var(--v-eau) 46% 58%, transparent 58%),
    linear-gradient(-62deg, transparent 47%, var(--v-bord) 47%, var(--v-route) 48.5% 51.5%, var(--v-bord) 53%, transparent 53%),
    linear-gradient(8deg, transparent 70%, var(--v-bord) 70%, var(--v-route) 71% 73%, var(--v-bord) 74%, transparent 74%),
    var(--v-terre);
}
:root[data-theme="sombre"] .fond-vignette-plan { --v-terre: #1A1D23; --v-eau: #122029; --v-route: #323842; --v-bord: #1A1D23; }
.fond-nom { font-weight: 650; font-size: .86rem; margin-top: 3px; }
.fond-detail { font-size: .74rem; line-height: 1.25; color: var(--encre-douce); }

.legende-ligne { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .9rem; }
.legende-degrade { display: flex; height: 12px; border-radius: 6px; overflow: hidden; flex: 1; max-width: 180px; }
.legende-degrade span { flex: 1; }
.legende .exemple { width: 34px; height: 34px; flex: none; }
.interrupteur {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--trait); border-radius: 12px; background: var(--surface); font-weight: 600; font-size: .92rem; line-height: 1.3;
}
.interrupteur:hover { border-color: var(--trait-fort); }
.interrupteur-piste { width: 40px; height: 24px; flex: none; border-radius: 12px; background: var(--trait-fort); position: relative; transition: background var(--duree); }
.interrupteur-piste span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform var(--duree); box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.interrupteur[aria-pressed="true"] .interrupteur-piste { background: var(--encre); }
.interrupteur[aria-pressed="true"] .interrupteur-piste span { transform: translateX(16px); }
.aide-inline { display: block; font-weight: 400; font-size: .82rem; color: var(--encre-douce); }

/* ---------------------------------------------------------------- dock : boutons + cadre des filtres */
.dock {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.dock > * { pointer-events: auto; }

.filtres {
  background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 4px 8px 8px;
  max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain;
}
.filtres { transition: padding-bottom 280ms cubic-bezier(.2,.75,.25,1); }
.filtres.plie { padding-bottom: 4px; }
.filtres:focus { outline: none; }
.filtres-tete { display: flex; align-items: center; gap: 6px; }
.filtres-plier {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px;
  border: 0; border-radius: 10px; background: none; text-align: left;
}
.filtres-plier:hover { background: var(--surface-2); }
.filtres-nom { font-family: var(--police-titre); font-weight: 650; font-size: 1.05rem; }
.filtres-resume { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--encre-douce); font-size: .84rem; }
.filtres-chevron { transform: rotate(90deg); transition: transform var(--duree); color: var(--encre-douce); }
.filtres.plie .filtres-chevron { transform: rotate(-90deg); }
.compteur { margin: 0; font-size: .84rem; color: var(--encre-douce); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compteur strong { color: var(--encre); font-family: var(--police-titre); font-size: 1.12rem; font-weight: 650; margin-right: 2px; }

.filtres-corps { display: grid; gap: 8px; margin-top: 2px; padding: 8px 4px 0; border-top: 1px solid var(--trait); }
.filtre-ligne { display: grid; grid-template-columns: 1fr; gap: 4px; min-width: 0; }
.filtre-titre { margin: 0; font-family: var(--police); font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--encre-douce); }
/* Natures : pastilles empilées sur plusieurs lignes, sans défilement horizontal */
.pastilles-nature { gap: 4px; }
/* Natures secondaires masquées tant que « + autres natures » n'est pas activé (sauf si l'une est sélectionnée) */
.pastilles-nature:not(.tout) .pastille.secondaire:not([aria-pressed="true"]) { display: none; }
.pastille-plus { padding: 2px 12px; border-style: dashed; color: var(--encre-douce); font-weight: 600; }
.pastille-plus:hover { color: var(--encre); border-color: var(--trait-fort); }
@media (max-width: 559px) {
  /* Petit écran : pastilles de nature plus serrées, effectif masqué (il reste dans le nom accessible et l'infobulle) */
  .pastilles-nature .pastille { min-height: 30px; padding: 1px 8px 1px 2px; gap: 4px; font-size: .78rem; }
  .pastilles-nature .pastille .p-icone { width: 24px; height: 24px; }
  .pastilles-nature .pastille .p-nb { display: none; }
}
#f-prop { gap: 4px; }
.frise-corps { display: flex; align-items: stretch; gap: 8px; }
.frise-piste { position: relative; flex: 1; height: 56px; }
.frise-histo { position: absolute; left: 0; right: 0; top: 0; height: 30px; display: flex; align-items: flex-end; gap: 2px; }
.frise-histo span { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; background: var(--c); opacity: .35; transition: height 300ms, opacity var(--duree); }
.frise-histo span.dans { opacity: .9; }
.frise-segments { position: absolute; left: 0; right: 0; top: 32px; height: 12px; display: flex; gap: 2px; }
.frise-segment { flex: 1; border: 0; padding: 0; border-radius: 3px; background: var(--c); opacity: .28; transition: opacity var(--duree); }
.frise-segment.dans { opacity: 1; }
.frise-cliquable { cursor: pointer; }
.frise-histo span { position: relative; }
/* zone cliquable étendue à toute la hauteur de la colonne, même au-dessus d'une barre basse */
.frise-histo span::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; }
.frise-segment.survol, .frise-histo span.survol { opacity: .8; }
.frise-segment.dans.survol, .frise-histo span.dans.survol { opacity: 1; filter: brightness(1.12); }
.frise-etiquettes span.survol { color: var(--encre); text-decoration: underline; text-underline-offset: 2px; }
.frise-curseur {
  position: absolute; top: 26px; height: 24px; margin: 0; background: none; pointer-events: none;
  left: calc(100% / 18 - var(--pouce) / 2); width: calc(100% * 8 / 9 + var(--pouce));
  -webkit-appearance: none; appearance: none;
}
.frise-curseur::-webkit-slider-runnable-track { background: none; height: 24px; }
.frise-curseur::-moz-range-track { background: none; }
.frise-curseur::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: var(--pouce); height: var(--pouce); border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--encre); box-shadow: 0 1px 4px rgb(0 0 0 / .25); cursor: grab;
}
.frise-curseur::-moz-range-thumb {
  pointer-events: auto; width: calc(var(--pouce) - 5px); height: calc(var(--pouce) - 5px); border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--encre); box-shadow: 0 1px 4px rgb(0 0 0 / .25); cursor: grab;
}
.frise-curseur:focus-visible { outline: none; }
.frise-curseur:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.frise-curseur:focus-visible::-moz-range-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.frise-etiquettes { display: flex; gap: 2px; margin-right: 58px; font-size: .68rem; color: var(--encre-douce); user-select: none; }
.frise-etiquettes span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.frise-etiquettes span.dans { color: var(--encre); font-weight: 700; }

.frise-nd {
  width: 50px; flex: none; border: 1px solid transparent; background: none; padding: 0; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; font-size: .66rem; line-height: 1.05;
  color: var(--encre-douce);
}
.frise-nd-barre { width: 26px; height: 26px; display: flex; align-items: flex-end; }
.frise-nd-barre span { width: 100%; background: var(--per-9); opacity: .3; border-radius: 3px 3px 0 0; min-height: 2px; }
.frise-nd[aria-pressed="true"] { color: var(--encre); font-weight: 700; }
.frise-nd[aria-pressed="true"] .frise-nd-barre span { opacity: .9; }
.frise-nd:hover { border-color: var(--trait); }

.barre { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.barre .btn { box-shadow: var(--ombre); }
.barre .btn-discret { box-shadow: none; background: color-mix(in srgb, var(--surface) 90%, transparent); border-color: var(--trait); }

/* ---------------------------------------------------------------- fiche et liste (feuilles flottantes) */
.flottant {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 72%;
  display: flex; flex-direction: column; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: var(--ombre); border: 1px solid var(--trait); border-bottom: 0;
  animation: monter 240ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes monter { from { transform: translateY(24px); opacity: 0; } }
.flottant-tete { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 8px; }
.flottant-tete h2 { flex: 1; font-size: 1.3rem; }
.flottant > .defile { overflow: auto; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

.fiche-pastille { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--c); color: var(--sc, #fff); box-shadow: 0 0 0 2px var(--anneau); position: relative; }
.fiche-pastille .icone { width: 28px; height: 28px; }
.fiche-tete-texte { flex: 1; min-width: 0; }
.fiche-sur { margin: 0 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-douce); }
.fiche h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
.fiche h2:focus { outline: none; }
.fiche-lieu { margin: 4px 0 0; color: var(--encre-douce); }
.fiche-photo { margin: 2px 0 6px; }
.fiche-photo[aria-busy="true"] { height: 220px; border-radius: 12px; background: linear-gradient(100deg, var(--surface-2) 40%, var(--trait) 50%, var(--surface-2) 60%) 0 0 / 200% 100%; animation: reflet 1.4s linear infinite; }
@keyframes reflet { to { background-position: -200% 0; } }
.fiche-photo-cadre {
  position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); cursor: zoom-in;
}
.fiche-photo img { position: relative; display: block; width: 100%; height: 220px; object-fit: cover; opacity: 0; transition: opacity 300ms; }
.fiche-photo.chargee img { opacity: 1; }
/* Vue verticale ou carrée : photo entière ; le cadre (et le crédit) prennent la largeur de la photo, centrés */
.fiche-photo.verticale { display: grid; grid-template-columns: min-content; justify-content: center; }
.fiche-photo.verticale img { width: auto; height: min(340px, 42vh); max-width: none; object-fit: contain; }
.fiche-photo-loupe {
  position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(20 18 14 / .55); color: #fff; opacity: .85; transition: opacity var(--duree);
}
.fiche-photo-cadre:hover .fiche-photo-loupe, .fiche-photo-cadre:focus-visible .fiche-photo-loupe { opacity: 1; }
.fiche-photo-cadre:focus-visible { outline-offset: 2px; }

.visionneuse { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(12 12 14 / .94); color: #F3EFE6; }
.visionneuse::backdrop { background: rgb(12 12 14 / .6); }
.visionneuse[open] { display: grid; place-items: center; animation: fondu 180ms ease-out; }
@keyframes fondu { from { opacity: 0; } }
.visionneuse-fermer { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2; }
.visionneuse-fermer .btn-icone { background: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .25); color: #fff; }
.visionneuse-figure { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 56px 16px 16px; width: 100%; height: 100%; }
.visionneuse-figure img { flex: none; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); object-fit: contain; border-radius: 6px; }
.visionneuse-figure figcaption { max-width: 760px; text-align: center; font-size: .85rem; line-height: 1.4; color: #D8D2C6; }
.visionneuse-figure figcaption strong { font-family: var(--police-titre); font-size: 1.05rem; color: #F3EFE6; }
.visionneuse-figure figcaption a { color: #F3EFE6; }
.fiche-photo figcaption { margin-top: 5px; font-size: .75rem; color: var(--encre-douce); line-height: 1.35; }
.fiche-photo figcaption a { color: var(--encre-douce); }
.fiche-infos { margin: 8px 0 0; display: grid; gap: 0; }
.fiche-infos > div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-top: 1px solid var(--trait); }
.fiche-infos dt { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-douce); }
.fiche-infos dd { margin: 0; }
.fiche-infos .detail { display: block; color: var(--encre-douce); font-size: .9rem; }
.puce-periode { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }
.puce-periode::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.inconnu { color: var(--encre-douce); font-style: italic; }
.meme-lieu h3 { font-family: var(--police); font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-douce); margin-bottom: 4px; }
.notice-bloc .detail-inline { text-transform: none; letter-spacing: 0; font-weight: 400; }
.meme-lieu ul { list-style: none; margin: 0; padding: 0; }
.meme-lieu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 600; }
.meme-lieu button:hover { background: var(--surface-2); }
.meme-lieu .l-pastille { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--c); color: var(--sc, #fff); box-shadow: 0 0 0 1.5px var(--anneau); }
/* Notice : cote, chronologie, textes, renvois */
.siecle { font-variant-caps: normal; letter-spacing: .01em; }
.siecle sup { font-size: .68em; line-height: 0; vertical-align: .55em; margin-left: .03em; }
.fiche-cote { margin: 3px 0 0; font-size: .8rem; color: var(--encre-douce); letter-spacing: .04em; }
.fiche-cote span { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--encre); letter-spacing: .06em; }
.notice-bloc { padding: 10px 0 4px; border-top: 1px solid var(--trait); }
.notice-bloc > h3 { margin: 0 0 6px; font-family: var(--police); font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-douce); }
.notice-resume { margin: 0 0 4px; font-weight: 600; }
.chrono { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--trait); }
.chrono li { position: relative; display: grid; grid-template-columns: minmax(0, auto); padding: 2px 0 8px 8px; }
.chrono li::before { content: ""; position: absolute; left: -21px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--encre-douce); }
.chrono-quand { font-weight: 700; font-variant-numeric: oldstyle-nums proportional-nums; }
.chrono-quoi { color: var(--encre-douce); font-size: .9rem; }
.texte-long { margin: 4px 0 6px; font-size: .92rem; line-height: 1.55; }
.texte-long p { margin: 0 0 .6em; }
.texte-long p:last-child { margin-bottom: 0; }
.texte-titre { font-size: .82rem; font-weight: 700; color: var(--encre-douce); margin-bottom: 2px !important; }
details.texte-long > summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style-position: outside; margin: 2px 0 6px; }
details.texte-long > summary:hover { text-decoration: underline; text-underline-offset: 3px; }
details.texte-long[open] > summary { color: var(--encre-douce); }
.renvois { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .92rem; }
.renvois li { padding-left: 16px; position: relative; line-height: 1.35; }
.renvois li::before { content: "→"; position: absolute; left: 0; color: var(--encre-douce); }
.renvois a { color: var(--encre); text-decoration-color: var(--trait-fort); }
.renvois a:hover { text-decoration-color: var(--accent); }
.detail-inline { color: var(--encre-douce); font-size: .85em; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.fiche-actions a.btn { text-decoration: none; color: var(--sur-accent); }
.fiche-source { margin: 0; padding-top: 10px; border-top: 1px solid var(--trait); font-size: .8rem; color: var(--encre-douce); }

.liste-info { margin: 0 16px 8px; color: var(--encre-douce); font-size: .9rem; }
.liste-items { list-style: none; margin: 0; padding: 0 8px calc(14px + env(safe-area-inset-bottom)); overflow: auto; }
.liste-items button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px; border: 0; border-radius: 12px; background: none;
}
.liste-items button:hover { background: var(--surface-2); }
.liste-items .l-pastille { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--c); color: var(--sc, #fff); box-shadow: 0 0 0 1.5px var(--anneau); }
.liste-items .l-texte { min-width: 0; }
.liste-items .l-titre { display: block; font-weight: 600; line-height: 1.25; }
.liste-items .l-info { display: block; color: var(--encre-douce); font-size: .85rem; }

/* ---------------------------------------------------------------- surcouches de la carte */
.chargement {
  position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--papier); color: var(--encre-douce); font-family: var(--police-titre); font-size: 1.1rem;
  transition: opacity 400ms;
}
.chargement.fini { opacity: 0; pointer-events: none; }
.chargement.erreur { color: var(--encre); padding: 24px; text-align: center; font-family: var(--police); }
.chargement-roue { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--trait); border-top-color: var(--accent); animation: tourner 900ms linear infinite; }
@keyframes tourner { to { transform: rotate(360deg); } }



/* pluie de monuments au chargement : calques temporaires au-dessus de la carte, sous les contrôles */
.pluie { position: absolute; inset: 0; pointer-events: none; z-index: 1; transition: opacity .3s ease; }
.pluie.efface { opacity: 0; }

/* grappes (regroupements) : disque beige cerclé d'un filet, effectif au centre */
.grappe {
  display: grid; place-items: center; cursor: pointer; border-radius: 50%;
  background: var(--grappe-fond); border: 1.5px solid var(--grappe-bord); box-shadow: 0 1px 3px rgb(40 30 15 / .22);
  transition: background var(--duree), border-color var(--duree);
}
.grappe span { font-weight: 700; font-size: .78rem; color: var(--grappe-texte); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.grappe:hover { background: var(--accent); border-color: var(--accent); }
.grappe:hover span { color: var(--sur-accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h, 150px) + 8px); z-index: 60; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--encre); color: var(--papier); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  max-width: calc(100% - 32px); text-align: center; transition: opacity var(--duree), transform var(--duree);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- à propos */
.apropos {
  width: min(680px, calc(100% - 24px)); max-height: calc(100% - 48px); padding: 0; border: 1px solid var(--trait);
  border-radius: 18px; background: var(--surface); color: var(--encre); box-shadow: var(--ombre);
}
.apropos::backdrop { background: rgb(20 18 14 / .45); }
.apropos[open] { display: flex; flex-direction: column; animation: monter 220ms ease-out; }
.apropos-tete { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.apropos-tete h2 { font-size: 1.5rem; }
.apropos-corps { overflow: auto; padding: 0 18px 22px; }
.apropos-corps h3 { font-size: 1.1rem; margin: 18px 0 6px; }
.apropos-corps p, .apropos-corps li { font-size: .95rem; }
.apropos-corps ul { padding-left: 1.2em; }
.apropos-corps table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.apropos-corps td, .apropos-corps th { border-top: 1px solid var(--trait); padding: 6px 4px; text-align: left; vertical-align: top; }
.apropos-corps td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.sans-js { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--papier); }

/* MapLibre : contrôles harmonisés */
.maplibregl-ctrl-group { background: var(--surface); border: 1px solid var(--trait); border-radius: 12px !important; box-shadow: var(--ombre) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--trait); }
.ctrl-regrouper { display: grid !important; place-items: center; color: var(--encre-douce); }
.ctrl-regrouper[aria-pressed="true"] { color: var(--accent); background: var(--surface-2) !important; }
.ctrl-regrouper:hover { color: var(--encre); }
:root[data-theme="sombre"] .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--encre-douce); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--encre); }
:root[data-theme="sombre"] .maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: var(--dock-h, 150px); }
.maplibregl-canvas-container.maplibregl-interactive { cursor: grab; }

.mobile-seul { }
@media (max-width: 419px) {
  .txt-etroit { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #btn-liste { width: 44px; padding: 0; flex: none; }
  .barre .btn { padding: 0 12px; gap: 6px; font-size: .88rem; }
  .filtres-nom { font-size: .98rem; }
  #btn-hasard { flex: none; }
  .frise-etiquettes { font-size: .64rem; }
}

/* ---------------------------------------------------------------- écrans moyens */
@media (min-width: 560px) {
  .marque-texte { display: inline; }
    .frise-etiquettes { font-size: .75rem; }
  .vh-mobile { position: static !important; width: auto; height: auto; clip: auto; clip-path: none; }
}

/* ---------------------------------------------------------------- grand écran */
@media (min-width: 960px) {
  .entete { padding: 10px 16px; gap: 16px; }
  .recherche { max-width: 460px; }
  .outils { margin-left: auto; }
  .panneau {
    left: auto; right: 12px; bottom: auto; top: 70px; width: 380px; max-height: calc(100vh - 90px);
    border-radius: 16px; border: 1px solid var(--trait); transform: translateY(-8px); opacity: 0;
    transition: transform 200ms, opacity 200ms, visibility 0s 200ms;
  }
  .panneau.ouvert { transform: none; opacity: 1; transition: transform 200ms, opacity 200ms; }
  .dock { left: 50%; right: auto; transform: translateX(-50%); width: min(940px, calc(100% - 32px)); bottom: 16px; }
  .filtre-ligne { grid-template-columns: 78px 1fr; align-items: center; gap: 10px; }
  .filtre-ligne .filtre-titre { align-self: start; padding-top: 8px; }
  .flottant { left: auto; right: 16px; top: 16px; bottom: auto; width: 400px; max-height: calc(100% - 32px - var(--dock-h, 150px)); border-radius: 18px; border-bottom: 1px solid var(--trait); }
  .voile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .chargement-roue { animation: none; border-top-color: var(--trait); }
}
@media (forced-colors: active) {
  .pastille[aria-pressed="true"] { outline: 2px solid CanvasText; }
  .frise-segment.dans { outline: 2px solid CanvasText; }
}

/* lien vers les mentions légales, en pied de la fenêtre « À propos » */
.apropos-mentions { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--trait); font-size: .92rem; color: var(--encre-douce); }
.apropos-mentions a { font-weight: 600; }
.apropos-independant { padding: 8px 12px; border-left: 3px solid var(--trait-fort); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .92rem; color: var(--encre-douce); }
