/* AcqHome Tools — habillage Leaflet commun (v2, 28/09/2026). Servi sur /blocs/carte.css.
   À charger après /leaflet.css et /apihome.css. Les cartes sont en rendu SVG
   (L.svg()) : la couleur des points vient des classes .ah-niv-* posées par
   `className`, elle suit le thème sans redessin. Aucun rayon au-delà de 6 px. */

/* ── Conteneur ───────────────────────────────────────────────────────────── */
.leaflet-container{font-family:var(--sans);font-size:14px;background:var(--brume);color:var(--encre);
  -webkit-tap-highlight-color:transparent}
.leaflet-container a{color:var(--action)}
.leaflet-container:focus-visible{outline:2px solid var(--focus);outline-offset:-2px}

/* ── Zoom : deux cibles de 44 px, encadré au rayon 6 ─────────────────────── */
.leaflet-bar{border:1px solid var(--trait-2);border-radius:var(--r-2);box-shadow:var(--ombre-flottant);overflow:hidden;background:var(--surface)}
.leaflet-bar a,.leaflet-bar a:hover,.leaflet-bar a:focus{width:var(--cible);height:var(--cible);line-height:var(--cible);
  background:var(--surface);color:var(--encre);border-bottom:1px solid var(--trait);font:500 22px/44px var(--sans);
  text-indent:0;text-decoration:none;display:block;text-align:center;transition:background var(--duree)}
.leaflet-bar a:last-child{border-bottom:0}
.leaflet-bar a:first-child,.leaflet-bar a:last-child{border-radius:0}
.leaflet-bar a:active{background:var(--brume)}
.leaflet-bar a.leaflet-disabled{color:var(--encre-3);background:var(--brume);cursor:not-allowed}
.leaflet-bar a:focus-visible{outline:2px solid var(--focus);outline-offset:-3px}
@media(hover:hover){.leaflet-bar a:hover{background:var(--brume)}}
.leaflet-touch .leaflet-bar a{width:var(--cible);height:var(--cible);line-height:var(--cible)}
.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:1px solid var(--trait-2)}
.leaflet-control-zoom-in,.leaflet-control-zoom-out{font-family:var(--sans)!important}
.leaflet-top,.leaflet-bottom{z-index:800}
.leaflet-top .leaflet-control{margin-top:var(--e-3)}
.leaflet-left .leaflet-control{margin-left:var(--e-3)}
.leaflet-right .leaflet-control{margin-right:var(--e-3)}
.leaflet-bottom .leaflet-control{margin-bottom:var(--e-3)}

/* ── Attribution : lisible, discrète, jamais tronquée ────────────────────── */
.leaflet-control-attribution{background:rgba(255,255,255,.82);color:var(--encre-2);font-size:11px;line-height:1.3;
  padding:2px 6px;border-radius:var(--r-1) 0 0 0;max-width:calc(100vw - 32px);white-space:normal}
.leaflet-control-attribution a{color:var(--encre-2);text-decoration:underline;text-underline-offset:1px}
.leaflet-control-attribution .leaflet-attribution-flag{display:none!important}
:root[data-theme="dark"] .leaflet-control-attribution{background:rgba(19,20,28,.82)}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]) .leaflet-control-attribution{background:rgba(19,20,28,.82)}}

/* ── Bulle (popup) et infobulle ──────────────────────────────────────────── */
.leaflet-popup-content-wrapper{background:var(--surface);color:var(--encre);border:1px solid var(--trait-2);
  border-radius:var(--r-2);box-shadow:var(--ombre-flottant);padding:0}
.leaflet-popup-content{margin:var(--e-3) var(--e-4);font:14px/1.45 var(--sans);min-width:200px}
.leaflet-popup-content p{margin:0 0 var(--e-2)}
.leaflet-popup-content b,.leaflet-popup-content strong{font-weight:700}
.leaflet-popup-tip{background:var(--surface);border:1px solid var(--trait-2);border-top:0;border-left:0;box-shadow:none}
.leaflet-container a.leaflet-popup-close-button{width:var(--cible);height:var(--cible);font:400 22px/44px var(--sans);
  color:var(--encre-2);top:0;right:0;padding:0;text-align:center;border-radius:0 var(--r-2) 0 var(--r-1)}
.leaflet-container a.leaflet-popup-close-button:active{background:var(--brume)}
@media(hover:hover){.leaflet-container a.leaflet-popup-close-button:hover{background:var(--brume);color:var(--encre)}}
.leaflet-tooltip{background:var(--encre);color:var(--papier);border:0;border-radius:var(--r-1);box-shadow:var(--ombre-flottant);
  font:500 12px/1.3 var(--sans);padding:4px 8px}
.leaflet-tooltip-top::before{border-top-color:var(--encre)}
.leaflet-tooltip-bottom::before{border-bottom-color:var(--encre)}
.leaflet-tooltip-left::before{border-left-color:var(--encre)}
.leaflet-tooltip-right::before{border-right-color:var(--encre)}

/* ── Niveaux d'adresse sur les points (rendu SVG : className) ────────────── */
/* Contour blanc de surface pour décoller le point du fond de carte ; la
   couleur porte le niveau, la forme (marqueur .ah-marque-*) le redouble. */
.ah-niv-certaine{stroke:var(--certaine);fill:var(--certaine);fill-opacity:.9;stroke-opacity:1}
.ah-niv-probable{stroke:var(--probable);fill:var(--probable);fill-opacity:.9;stroke-opacity:1}
.ah-niv-verifier{stroke:var(--verifier);fill:var(--verifier);fill-opacity:.9;stroke-opacity:1}
.ah-niv-non-trouvee{stroke:var(--non-trouvee);fill:var(--non-trouvee);fill-opacity:.7;stroke-opacity:1}
.ah-niv-veille{stroke:var(--veille);fill:var(--veille);fill-opacity:.9;stroke-opacity:1}
.ah-niv-choisi{stroke:var(--action);stroke-width:3;fill-opacity:1}      /* le point sélectionné */
.ah-niv-attenue{fill-opacity:.35;stroke-opacity:.5}                       /* hors filtre, toujours compté */
.ah-niv-halo{stroke:var(--surface);stroke-width:2;fill:none}              /* anneau blanc sous le point */
.leaflet-interactive{cursor:pointer}
.leaflet-interactive:focus-visible{outline:2px solid var(--focus)}

/* ── Marqueurs HTML (L.divIcon) : forme par masque, couleur par jeton ─────── */
.ah-marque{width:28px;height:28px;display:grid;place-items:center;margin:-14px 0 0 -14px!important;
  border-radius:50%;background:var(--surface);border:2px solid var(--niv,var(--encre-3));box-shadow:0 1px 2px rgba(0,0,0,.25)}
.ah-marque::before{content:"";width:14px;height:14px;background:var(--niv,var(--encre-3));
  -webkit-mask:var(--forme) center/14px 14px no-repeat;mask:var(--forme) center/14px 14px no-repeat}
.ah-marque--certaine{--niv:var(--certaine);
  --forme:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.2l2.4 2.4 4.8-4.8-1.1-1.1-3.7 3.7-1.3-1.3z'/%3E%3C/svg%3E")}
.ah-marque--probable{--niv:var(--probable);
  --forme:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M6 1.2a4.8 4.8 0 1 0 0 9.6 4.8 4.8 0 0 0 0-9.6Zm0 1.6a3.2 3.2 0 1 1 0 6.4 3.2 3.2 0 0 1 0-6.4Z'/%3E%3C/svg%3E")}
.ah-marque--verifier{--niv:var(--verifier);
  --forme:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M5.2 1.5h1.6v5.4H5.2zM5.2 8.4h1.6V10H5.2z'/%3E%3C/svg%3E")}
.ah-marque--non-trouvee{--niv:var(--non-trouvee);
  --forme:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 5.2h7.2v1.6H2.4z'/%3E%3C/svg%3E")}
.ah-marque--veille{--niv:var(--veille);border-radius:var(--r-1);transform:rotate(45deg)}
.ah-marque--veille::before{transform:rotate(-45deg);
  --forme:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M5.2 2h1.6v5H5.2zM5.2 8.4h1.6V10H5.2z'/%3E%3C/svg%3E")}
.ah-marque--choisi{border-color:var(--action);box-shadow:0 0 0 3px var(--action-f),0 1px 2px rgba(0,0,0,.25)}

/* ── Zone tactile : 48 px au doigt (charte §5) ; à la souris, le dessin suffit
      et une zone élargie volerait le clic aux cercles voisins ── */
@media(pointer:coarse){
.leaflet-marker-icon.pt-croix::after,.leaflet-marker-icon.pt-eq::after,.leaflet-marker-icon.pt-num::after,.leaflet-marker-icon.ah-marque::after,
.leaflet-marker-icon.pt-mandat::after,.leaflet-marker-icon.pt-vendu::after,.leaflet-marker-icon.pt-contact::before{
  content:"";position:absolute;left:50%;top:50%;width:var(--cible-carte);height:var(--cible-carte);transform:translate(-50%,-50%)}
}

/* ── Position corrigée à la main : un anneau, la couleur du niveau reste ─── */
.ah-niv-corrigee{stroke-dasharray:3 2}
.ah-marque--corrigee{border-style:dashed}

/* ── Fond de carte en sombre : un voile, pas un filtre sur chaque tuile ────── */
:root[data-theme="dark"] .leaflet-tile-pane{filter:brightness(.78) saturate(.85)}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]) .leaflet-tile-pane{filter:brightness(.78) saturate(.85)}}

/* ── Légende des niveaux, posée sur la carte ─────────────────────────────── */
.ah-legende{position:absolute;left:var(--e-3);bottom:var(--e-3);z-index:800;display:flex;flex-wrap:wrap;gap:var(--e-2) var(--e-3);
  padding:var(--e-2) var(--e-3);background:var(--surface);border:1px solid var(--trait-2);border-radius:var(--r-2);
  box-shadow:var(--ombre-flottant);font-size:12px;max-width:calc(100% - 2*var(--e-3))}
.ah-legende .ah-niveau{font-weight:500}

@media(prefers-reduced-motion:reduce){.leaflet-zoom-anim .leaflet-zoom-animated{transition:none}}
