/* Carte du Tribunal — bloc de cartes.
   Hérite de la police du thème et reprend ses couleurs (variables WordPress),
   avec des valeurs de secours identiques à celles de letribunal.com. */
.carte-tribunal {
  --ct-ink: var(--wp--preset--color--contrast, #000);
  --ct-paper: var(--wp--preset--color--base, #fff);
  --ct-link: var(--wp--preset--color--secondary, #345C00);
  --ct-open: var(--wp--preset--color--secondary, #345C00);  /* vert du site : adresses ouvertes */
  --ct-closed: #9a9a9a;                                      /* gris : adresses fermées */
  --ct-soft: var(--wp--preset--color--tertiary, #F6F6F6);
  --ct-muted: #595959;
  --ct-line: #d9d9d9;
  font-family: inherit; color: var(--ct-ink); display: grid; gap: 1.5rem;
}
.carte-tribunal * { box-sizing: border-box; }
.carte-tribunal [hidden] { display: none !important; } /* un seul territoire affiché à la fois */

/* onglets, sous la carte : boutons carrés du thème (plein = sélectionné, contour = disponible) */
.ct-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.ct-tabs:empty { display: none; }
.ct-tabs button {
  font: inherit; font-size: .875rem; line-height: 1.2; color: var(--ct-ink); background: transparent;
  border: 1px solid var(--ct-ink); border-radius: 0; padding: .55em 1em; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5em;
}
.ct-tabs button span { font-variant-numeric: tabular-nums; opacity: .6; }
.ct-tabs button[aria-selected="true"] { background: var(--ct-ink); color: var(--ct-paper); }
.ct-tabs button:hover:not([aria-selected="true"]) { background: var(--ct-soft); }
.carte-tribunal button:focus-visible, .carte-tribunal a:focus-visible { outline: 2px solid var(--ct-link); outline-offset: 2px; }

.ct-panel { display: grid; gap: 2.5rem; }
.ct-block { display: grid; gap: .9rem; min-width: 0; }
.ct-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.ct-head h2 { margin: 0; font-size: clamp(1.75rem, 1.6rem + .6vw, 2.25rem); font-weight: 400; line-height: 1.2; text-wrap: balance; }
.ct-count { color: var(--ct-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

/* légende */
.ct-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.25rem; margin: 0; font-size: .875rem; }
.ct-legend .item { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.ct-dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; flex: none; }
.ct-dot.open { background: var(--ct-open); }
.ct-dot.closed { background: var(--ct-closed); }
.ct-note { margin: 0; font-size: .875rem; color: var(--ct-muted); }
.ct-note strong { color: var(--ct-ink); font-weight: 600; }

/* recherche d'une adresse, avec suggestions pendant la saisie */
.ct-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ct-search { display: flex; gap: .5rem; flex-wrap: nowrap; margin: .25rem 0 0; }
.ct-combo { position: relative; flex: 1 1 auto; min-width: 0; }
.ct-search input { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; font: inherit; font-size: 16px; /* 16 px : pas de zoom automatique sur iPhone */
  line-height: 1.3; padding: .5em .75em; border: 1px solid var(--ct-ink); border-radius: 0; background: var(--ct-paper); color: var(--ct-ink); }
.ct-search input::placeholder { color: var(--ct-muted); opacity: 1; }
.ct-search input:focus { outline: 2px solid var(--ct-link); outline-offset: 0; }
.ct-search button { flex: none; font: inherit; font-size: .875rem; line-height: 1.2; padding: .55em 1em; border: 1px solid var(--ct-ink); border-radius: 0; cursor: pointer;
  background: var(--ct-ink); color: var(--ct-paper); }
.ct-suggest { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% - 1px); margin: 0; padding: 0; list-style: none;
  background: var(--ct-paper); border: 1px solid var(--ct-ink); box-shadow: 0 8px 22px rgba(0,0,0,.16); max-height: 19rem; overflow-y: auto; }
.ct-suggest li { display: grid; gap: .1rem; padding: .5rem .75rem; cursor: pointer; border-bottom: 1px solid var(--ct-soft); line-height: 1.3; }
.ct-suggest li:last-child { border-bottom: 0; }
.ct-suggest li:hover, .ct-suggest li[aria-selected="true"] { background: var(--ct-soft); }
.ct-suggest li[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--ct-ink); }
.ct-suggest .m { font-size: .92rem; color: var(--ct-ink); }
.ct-suggest .p { font-size: .8rem; color: var(--ct-muted); }
.ct-search-msg { margin: 0; font-size: .85rem; color: var(--ct-muted); }
.ct-search-msg:empty { display: none; }

.ct-map { height: min(65vh, 520px); min-height: 340px; border: 1px solid var(--ct-line); background: var(--ct-soft); isolation: isolate; scroll-margin: 12px 0; }
/* fond vectoriel net (texte en haute résolution) ; en secours, tuiles OpenStreetMap passées en gris d'un seul bloc */
.ct-map.ct-raster .leaflet-tile-pane { filter: grayscale(1) contrast(.95) brightness(1.04); }
.ct-map.leaflet-container { font: inherit; background: var(--ct-soft); }
.ct-map .leaflet-control-attribution { font-size: .68rem; background: rgba(255,255,255,.85); color: var(--ct-muted); }
.ct-map .leaflet-control-attribution a { color: var(--ct-muted); }
.ct-map .leaflet-bar { border: 1px solid var(--ct-ink); border-radius: 0; box-shadow: none; }
.ct-map .leaflet-bar a { border-radius: 0 !important; color: var(--ct-ink); background: var(--ct-paper); border-bottom-color: var(--ct-line); }
.ct-map .ct-filter { display: flex; background: var(--ct-paper); border: 1px solid var(--ct-ink); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.ct-map .ct-filter button { font: inherit; font-size: .8rem; line-height: 1.2; color: var(--ct-ink); background: var(--ct-paper); border: 0; border-radius: 0;
  padding: .5em .8em; cursor: pointer; display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
.ct-map .ct-filter button + button { border-left: 1px solid var(--ct-ink); }
.ct-map .ct-filter button:hover:not([aria-pressed="true"]) { background: var(--ct-soft); }
.ct-map .ct-filter button[aria-pressed="true"] { background: var(--ct-ink); color: var(--ct-paper); }
.ct-map .ct-home a { display: grid; place-items: center; }
.ct-here { width: 22px; height: 22px; border-radius: 50%; background: var(--ct-paper); border: 6px solid var(--ct-ink); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 1px 4px rgba(0,0,0,.4); }
.ct-empty { margin: 0; font-size: .875rem; color: var(--ct-muted); }

/* repères */
.ct-pin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.ct-pin.open { background: var(--ct-open); }
.ct-pin.closed { background: var(--ct-closed); }
.ct-cluster { display: grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: .8rem; line-height: 1; font-variant-numeric: tabular-nums; }
.ct-cluster.open { color: #fff; background: var(--ct-open); box-shadow: 0 0 0 5px rgba(52, 92, 0, .22); }
.ct-cluster.closed { color: #3d3d3d; background: #e3e3e3; border: 1.5px solid var(--ct-closed); box-shadow: 0 0 0 4px rgba(0, 0, 0, .06); }

/* fiche (popup) */
.ct-map .leaflet-popup-content-wrapper { background: var(--ct-paper); color: var(--ct-ink); border-radius: 0; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.ct-map .leaflet-popup-tip { background: var(--ct-paper); }
.ct-map .leaflet-popup-content { margin: 1rem 1.1rem; width: min(300px, 72vw) !important; font-size: .9rem; line-height: 1.45; }
.ct-map a.leaflet-popup-close-button { color: var(--ct-muted); }
.ct-pop { display: grid; gap: .3rem; }
.ct-map .leaflet-popup-content .ct-pop p { margin: 0; }
.ct-pop .name { font-size: 1.3rem; font-weight: 400; line-height: 1.2; padding-right: 1rem; }
.ct-pop .lieu { font-size: .85rem; color: var(--ct-muted); font-style: italic; }
.ct-pop .addr { font-size: .88rem; }
.ct-pop .meta { display: flex; gap: .5rem; align-items: center; font-size: .8rem; color: var(--ct-muted); }
.ct-pop .badge { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; padding: .1rem .4rem; border: 1px solid var(--ct-ink); color: var(--ct-ink); }
.ct-list { position: relative; margin-top: .35rem; border-top: 1px solid var(--ct-line); }
.ct-pop ol { list-style: none; margin: 0; padding: .35rem 0 0; max-height: 210px; overflow-y: auto; overscroll-behavior: contain; display: grid; }
/* liste plus longue que l'encart : fondu et flèche du côté où il reste des tests */
.ct-list::before, .ct-list::after { content: ""; position: absolute; left: 0; right: 0; height: 2.6rem; pointer-events: none; opacity: 0; transition: opacity .15s; }
.ct-list::before { top: 0; background: linear-gradient(var(--ct-paper) 15%, rgba(255,255,255,0)); }
.ct-list::after { bottom: 0; background: linear-gradient(rgba(255,255,255,0), var(--ct-paper) 85%); }
.ct-list.can-up::before, .ct-list.can-down::after { opacity: 1; }
.ct-map .ct-scroll { position: absolute; z-index: 1; left: 50%; transform: translateX(-50%); width: 2.1rem; height: 1.45rem; padding: 0; display: grid; place-items: center;
  color: var(--ct-ink); background: var(--ct-paper); border: 1px solid var(--ct-ink); border-radius: 0; cursor: pointer; opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s; }
.ct-map .ct-scroll.up { top: .3rem; }
.ct-map .ct-scroll.down { bottom: .15rem; }
.ct-list.can-up .ct-scroll.up, .ct-list.can-down .ct-scroll.down { opacity: 1; visibility: visible; }
.ct-map .ct-scroll:hover { color: var(--ct-paper); background: var(--ct-ink); }
.ct-pop li { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px solid var(--ct-soft); }
.ct-pop li:last-child { border-bottom: 0; }
.ct-pop a { color: var(--ct-link); text-decoration: underline; text-underline-offset: .15em; min-width: 0; }
.ct-pop a:hover { text-decoration-thickness: 2px; }
.ct-pop time { font-size: .76rem; color: var(--ct-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ct-pop.is-closed .name { color: var(--ct-muted); }
.ct-panels, .ct-panel { min-width: 0; }
@media (max-width: 560px) {
  .ct-map { height: 62vh; }
  .ct-map .ct-filter button { padding: .5em .6em; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { .ct-map .leaflet-marker-icon, .ct-list::before, .ct-list::after, .ct-map .ct-scroll { transition: none !important; } }
