/* TéléPAC Analyser — feuille de style commune */

@font-face { font-family: "Familjen Grotesk"; src: url("../fonts/familjen-grotesk-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; src: url("../fonts/familjen-grotesk-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Familjen Grotesk"; src: url("../fonts/familjen-grotesk-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --terre: #f1e8e4;          /* fond de plan */
  --terre-fonce: #e2d6d0;
  --blanc: #ffffff;
  --encre: #1d2b20;          /* vert de haie très sombre */
  --encre-douce: #4a584d;
  --haie: #36c047;           /* contour de parcelle */
  --haie-texte: #1c7a2b;     /* vert lisible sur blanc */
  --selection: #d92d25;      /* contour de sélection */
  --paille: #f4e1aa;
  --lavande: #8f87ba;
  --eau: #a9e8d6;
  --ocre: #c08c1c;
  --ocre-clair: #e2b65c;

  --titre: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --texte: "Atkinson Hyperlegible", Verdana, sans-serif;

  --r-petit: 4px;
  --r-moyen: 10px;
  --ombre-carte: 0 1px 2px rgba(29, 43, 32, .18), 0 6px 22px rgba(29, 43, 32, .14);
  --barre-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--texte);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--encre);
  background: var(--terre);
}
h1, h2, h3 { font-family: var(--titre); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.01em; }
a { color: var(--haie-texte); text-underline-offset: .18em; }
a:hover { color: var(--encre); }
:focus-visible { outline: 3px solid var(--selection); outline-offset: 2px; border-radius: 2px; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lien-evitement { position: absolute; left: 12px; top: -60px; z-index: 2000; background: var(--blanc); padding: 8px 14px; border-radius: var(--r-petit); }
.lien-evitement:focus { top: 8px; }

/* ---------- Barre de navigation ---------- */
.barre {
  position: relative;
  z-index: 1000;
  height: var(--barre-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--blanc);
  border-bottom: 1px solid var(--terre-fonce);
}
.marque {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--titre); font-weight: 700; font-size: 1.08rem;
  color: var(--encre); text-decoration: none; white-space: nowrap;
}
.marque svg { width: 28px; height: 28px; flex: none; }

@media (max-width: 760px) {
  .barre { padding: 0 16px; }
}

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px;
  font-family: var(--titre); font-weight: 600; font-size: .98rem;
  border-radius: var(--r-petit); border: 2px solid var(--encre);
  background: var(--encre); color: var(--blanc); cursor: pointer; text-decoration: none;
}
.bouton:hover { background: #2d4232; color: var(--blanc); }
.bouton[disabled] { opacity: .45; cursor: not-allowed; }
.bouton.secondaire { background: var(--blanc); color: var(--encre); }
.bouton.secondaire:hover { background: var(--terre); }
.bouton svg { width: 18px; height: 18px; }
.bouton.danger { background: #b3261e; border-color: #b3261e; color: var(--blanc); }
.bouton.danger:hover { background: #8c1d17; border-color: #8c1d17; }
.bouton.danger.secondaire { background: var(--blanc); color: #b3261e; }
.bouton.danger.secondaire:hover { background: #fbeceb; }

/* ================= ACCUEIL ================= */
.page-accueil { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.page-accueil .barre { background: rgba(255, 255, 255, .94); }
.plan {
  position: fixed; inset: 0; z-index: 0;
  background: var(--terre) url("../img/fond-parcellaire.svg") center / cover no-repeat;
}
.plan::after { /* voile pour la lisibilité */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(241,232,228,.0) 30%, rgba(241,232,228,.35) 100%);
}
.accueil {
  position: relative; z-index: 1; flex: 1;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 5vh, 56px) clamp(16px, 5vw, 64px) clamp(20px, 6vh, 64px);
  min-height: 0;
}
.etiquette-titre {
  justify-self: start;
  max-width: 34rem;
  background: var(--blanc);
  padding: 22px 26px 24px;
  border-radius: var(--r-moyen);
  border-left: 6px solid var(--haie);
  box-shadow: var(--ombre-carte);
}
.etiquette-titre h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: .35em;
}
.etiquette-titre p { margin: 0; color: var(--encre-douce); max-width: 30rem; }

/* Zone de dépôt : une parcelle à poser sur le plan */
.depot {
  grid-row: 3; justify-self: center;
  position: relative;
  width: min(560px, 100%);
  min-height: 190px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 34px 48px;
  cursor: pointer;
  isolation: isolate;
}
.depot-forme { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; filter: drop-shadow(0 8px 18px rgba(29,43,32,.22)); }
.depot-forme polygon {
  fill: rgba(255, 255, 255, .96);
  stroke: var(--haie); stroke-width: 3.5; stroke-dasharray: 12 8; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill .18s ease, stroke .18s ease;
}
.depot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.depot:focus-within .depot-forme polygon { stroke: var(--encre); stroke-dasharray: none; }
.depot:hover .depot-forme polygon { stroke-dasharray: none; }
.depot.survol .depot-forme polygon { fill: var(--ocre-clair); stroke: var(--selection); stroke-dasharray: none; stroke-width: 4.5; }
.depot.erreur .depot-forme polygon { stroke: var(--selection); }
.depot-icone { width: 40px; height: 40px; margin-bottom: 6px; color: var(--haie-texte); }
.depot.survol .depot-icone { color: var(--encre); }
.depot-titre { font-family: var(--titre); font-weight: 700; font-size: 1.3rem; margin: 0; }
.depot-aide { margin: 4px 0 0; color: var(--encre-douce); font-size: .95rem; }
.depot-aide u { text-decoration-color: var(--haie); text-decoration-thickness: 2px; }
.depot-message { margin: 10px 0 0; font-weight: 700; color: var(--selection); max-width: 26rem; }
.depot-message:empty { display: none; }
.depot.chargement .depot-titre::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: 10px; vertical-align: -0.1em; border: 3px solid var(--haie); border-right-color: transparent; border-radius: 50%; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.accueil-pied { position: relative; z-index: 1; text-align: center; font-size: .82rem; padding: 0 16px 10px; color: var(--encre-douce); }
.accueil-pied a { color: var(--encre-douce); }

@media (max-width: 600px) {
  .etiquette-titre { padding: 18px 18px 20px; }
  .depot { min-height: 170px; padding: 28px 34px; }
}
@media (max-height: 560px) {
  .page-accueil { height: auto; overflow: auto; }
  .accueil { gap: 24px; }
}

/* ================= ANALYSE ================= */
.page-analyse { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.outils {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px;
  padding: 10px 20px; background: var(--blanc); border-bottom: 1px solid var(--terre-fonce);
}
.outils h1 { font-size: 1.25rem; margin: 0; }
.fichier-nom { color: var(--encre-douce); font-size: .92rem; overflow-wrap: anywhere; }
.outils .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.compteur { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 .35em; border-radius: 99px; background: var(--selection); color: var(--blanc); font-size: .8rem; }

.espace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; }
.volet { overflow-y: auto; background: var(--blanc); border-right: 1px solid var(--terre-fonce); }
.volet section { padding: 18px 20px; border-bottom: 1px solid var(--terre); }
.volet h2 { font-size: 1.05rem; margin-bottom: 12px; }

.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.chiffres div { background: var(--terre); border-radius: var(--r-petit); padding: 10px 12px; }
.chiffres dt { font-size: .8rem; color: var(--encre-douce); }
.chiffres dd { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.exploitation { margin: 12px 0 0; font-size: .9rem; color: var(--encre-douce); }
.exploitation strong { color: var(--encre); }

.categories { display: flex; height: 12px; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; background: var(--terre); }
.categories span { display: block; height: 100%; }
.categories-legende { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.categories-legende button {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  background: none; border: 0; padding: 5px 6px; border-radius: var(--r-petit); cursor: pointer; font: inherit; color: inherit;
}
.categories-legende button:hover, .categories-legende button[aria-pressed="true"] { background: var(--terre); }
.categories-legende b { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bio-resume { margin: 0 0 8px; font-size: .92rem; }
.aide-volet { margin: 8px 0 0; font-size: .82rem; color: var(--encre-douce); }
.badge-bio {
  display: inline-block; font-family: var(--titre); font-weight: 700; font-size: .72rem; line-height: 1;
  padding: 3px 6px; border-radius: 99px; background: #dff2d6; color: var(--haie-texte); vertical-align: 1px;
}

.repartition { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.repartition button {
  width: 100%; display: grid; grid-template-columns: 18px 1fr auto; gap: 4px 10px; align-items: center;
  text-align: left; background: none; border: 0; padding: 7px 6px; border-radius: var(--r-petit); cursor: pointer;
}
.repartition button:hover, .repartition button[aria-pressed="true"] { background: var(--terre); }
.repartition .barre-part { grid-column: 2 / 4; height: 4px; background: var(--terre); border-radius: 99px; overflow: hidden; }
.repartition .barre-part i { display: block; height: 100%; background: var(--encre-douce); }
.repartition .surf { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--encre-douce); }
.pastille { width: 16px; height: 16px; border-radius: 3px; border: 2px solid var(--haie); flex: none; }

.recherche { width: 100%; padding: 9px 12px; border: 1px solid var(--terre-fonce); border-radius: var(--r-petit); background: var(--blanc); margin-bottom: 10px; }
.liste-ilots { list-style: none; margin: 0; padding: 0; }
.liste-ilots > li + li { margin-top: 12px; }
.ilot-tete { display: flex; justify-content: space-between; gap: 8px; font-family: var(--titre); font-weight: 600; font-size: .92rem; color: var(--encre-douce); padding: 0 6px 4px; border-bottom: 1px solid var(--terre); }
.liste-parcelles { list-style: none; margin: 4px 0 0; padding: 0; }
.parcelle-ligne {
  width: 100%; display: grid; grid-template-columns: 16px 2.6em 1fr auto; gap: 10px; align-items: center;
  text-align: left; background: none; border: 0; border-radius: var(--r-petit); padding: 8px 6px; cursor: pointer;
}
.parcelle-ligne:hover { background: var(--terre); }
.parcelle-ligne[aria-current="true"] { background: #fbe9e7; box-shadow: inset 3px 0 0 var(--selection); }
.parcelle-ligne .num { font-family: var(--titre); font-weight: 700; }
.parcelle-ligne .cult { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parcelle-ligne .cult small { color: var(--encre-douce); }
.parcelle-ligne .surf { font-variant-numeric: tabular-nums; font-size: .9rem; }
.modifie-marque { color: var(--selection); font-weight: 700; }

.carte-zone { position: relative; min-height: 0; }
#carte { position: absolute; inset: 0; background: var(--terre); }
.leaflet-container { font-family: var(--texte); }
.etiquette-parcelle { background: none; border: 0; box-shadow: none; font-family: var(--titre); font-weight: 700; font-size: 12px; color: var(--encre); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; padding: 0; }
.etiquette-parcelle::before { display: none; }

.fiche {
  position: absolute; z-index: 800; top: 14px; right: 14px; width: min(360px, calc(100% - 28px));
  max-height: calc(100% - 28px); overflow-y: auto;
  background: var(--blanc); border-radius: var(--r-moyen); box-shadow: var(--ombre-carte);
  border-top: 5px solid var(--selection);
  padding: 16px 18px 18px;
}
.fiche[hidden] { display: none; }
.fiche-tete { display: flex; align-items: start; gap: 10px; }
.fiche-tete h2 { font-size: 1.2rem; margin: 0; }
.fiche-tete p { margin: 2px 0 0; font-size: .9rem; color: var(--encre-douce); }
.fermer { margin-left: auto; background: none; border: 0; padding: 4px; cursor: pointer; border-radius: var(--r-petit); line-height: 0; }
.fermer:hover { background: var(--terre); }
.fiche dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0; font-size: .93rem; }
.fiche dt { color: var(--encre-douce); }
.fiche dd { margin: 0; font-weight: 700; }
.champ { display: grid; gap: 4px; margin-bottom: 12px; }
.champ label { font-weight: 700; font-size: .93rem; }
.champ select { width: 100%; padding: 9px 10px; border: 1px solid #b9aca6; border-radius: var(--r-petit); background: var(--blanc); }
.champ select:disabled { background: var(--terre); color: var(--encre-douce); }
.champ .aide { font-size: .85rem; color: var(--encre-douce); }
.fiche-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fiche-origine { margin: 10px 0 0; font-size: .86rem; color: var(--encre-douce); }
.fiche-suppression { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--terre); }
.fiche-suppression .bouton { min-height: 38px; padding: 6px 12px; font-size: .92rem; }

.ilot-tete { align-items: center; }
.ilot-tete .commune { margin-left: auto; font-weight: 400; }
.ilot-supprimer { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--r-petit); background: none; color: var(--encre-douce); cursor: pointer; }
.ilot-supprimer svg { width: 17px; height: 17px; }
.ilot-supprimer:hover { background: #fbeceb; color: #b3261e; }
.ilot-vide { margin: 6px 6px 0; font-size: .88rem; font-style: italic; color: var(--encre-douce); }

.confirmation { width: min(28rem, calc(100% - 32px)); border: 0; border-radius: var(--r-moyen); border-top: 5px solid #b3261e; padding: 22px 24px; box-shadow: var(--ombre-carte); color: var(--encre); }
.confirmation::backdrop { background: rgba(29, 43, 32, .45); }
.confirmation h2 { font-size: 1.25rem; }
.confirmation p { margin: 0 0 18px; color: var(--encre-douce); }
.confirmation .fiche-actions { justify-content: flex-end; }

.vide-analyse { position: absolute; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(241,232,228,.9); }
.vide-analyse[hidden] { display: none; }
.vide-carte { max-width: 30rem; background: var(--blanc); padding: 28px; border-radius: var(--r-moyen); box-shadow: var(--ombre-carte); text-align: center; }
.vide-carte p { color: var(--encre-douce); }
.vide-carte .depot { margin-top: 10px; min-height: 150px; }
.vide-carte .depot-forme { filter: none; }

.annonce {
  position: fixed; z-index: 1500; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--encre); color: var(--blanc); padding: 10px 18px; border-radius: var(--r-petit);
  box-shadow: var(--ombre-carte); font-weight: 700;
}
.annonce[hidden] { display: none; }
.annonce:not([hidden]) { display: flex; align-items: center; gap: 14px; }
.annonce-annuler { background: none; border: 0; padding: 4px 2px; color: var(--paille); font-family: var(--titre); font-weight: 700; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.annonce-annuler[hidden] { display: none; }
.annonce-annuler:hover { color: var(--blanc); }

@media (max-width: 860px) {
  .page-analyse { height: auto; overflow: visible; }
  .espace { grid-template-columns: 1fr; }
  .carte-zone { height: 62vh; order: -1; }
  .volet { border-right: 0; overflow: visible; }
  .fiche { position: fixed; top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-height: 70vh; border-radius: var(--r-moyen) var(--r-moyen) 0 0; }
}

/* ================= PAGES DE TEXTE ================= */
.page-texte main { max-width: 46rem; margin: 0 auto; padding: 48px 20px 72px; }
.page-texte h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: .4em; }
.chapo { font-size: 1.12rem; color: var(--encre-douce); margin: 0 0 40px; max-width: 38rem; }
.article-legal { display: grid; grid-template-columns: 3.2rem 1fr; gap: 0 18px; padding: 26px 0; border-top: 1px solid var(--terre-fonce); }
.article-legal .n { font-family: var(--titre); font-weight: 700; font-size: 1.6rem; color: var(--haie-texte); line-height: 1.1; }
.article-legal h2 { font-size: 1.3rem; }
.article-legal p, .article-legal address { margin: 0 0 .7em; font-style: normal; }
.article-legal p:last-child { margin-bottom: 0; }
.mis-a-jour { margin-top: 32px; font-size: .9rem; color: var(--encre-douce); }
.a-completer { background: #fff3c4; padding: 0 .25em; border-radius: 2px; }

.version { position: relative; background: var(--blanc); border-radius: var(--r-moyen); padding: 26px 28px; box-shadow: var(--ombre-carte); border-left: 6px solid var(--haie); }
.version-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 14px; }
.version-tete h2 { font-size: 1.7rem; margin: 0; }
.version-tete time { color: var(--encre-douce); }
.badge { display: inline-block; font-family: var(--titre); font-weight: 700; font-size: .85rem; padding: 2px 10px; border-radius: 99px; background: var(--eau); color: var(--encre); }
.version h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.version ul { margin: 0; padding-left: 1.2em; }
.version li + li { margin-top: 4px; }

.pied { border-top: 1px solid var(--terre-fonce); background: var(--blanc); padding: 18px 20px; font-size: .9rem; color: var(--encre-douce); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; }
.pied a { color: var(--encre-douce); }

@media (max-width: 560px) {
  .article-legal { grid-template-columns: 1fr; }
  .article-legal .n { font-size: 1.1rem; margin-bottom: 4px; }
  .version { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Chiffres : Familjen Grotesk (zéro non barré, chiffres tabulaires) */
.surf, .categories-legende b, .fiche dd, .exploitation, .ilot-tete, .fichier-nom, .parcelle-ligne .num { font-family: var(--titre); font-variant-numeric: tabular-nums; }
.compteur[hidden] { display: none; }
.accueil-pied span { display: inline-block; background: rgba(255, 255, 255, .92); padding: 4px 12px; border-radius: 99px; }
.bouton[hidden] { display: none; }
