/* Silicéo Carte des réalisations — front */
.scarte {
  --scarte-navy: #094F71;
  --scarte-ink: #0b2a3c;
  --scarte-muted: #5b7282;
  --scarte-bg: transparent;
  --scarte-land: #eaf1f5;
  --scarte-coast: rgba(9, 79, 113, .35);
  --scarte-region: rgba(9, 79, 113, .14);
  --scarte-card: #ffffff;
  --scarte-line: rgba(9, 79, 113, .12);
  --scarte-ring: #ffffff;
  --scarte-max-h: 680px;
  color: var(--scarte-ink);
  background: var(--scarte-bg);
  font: inherit;
  position: relative;
  container-type: inline-size;
  container-name: scarte;
}
.scarte--dark {
  --scarte-ink: #ffffff;
  --scarte-muted: rgba(255, 255, 255, .62);
  --scarte-bg: #094F71;
  --scarte-land: rgba(255, 255, 255, .07);
  --scarte-coast: rgba(255, 255, 255, .35);
  --scarte-region: rgba(255, 255, 255, .10);
  --scarte-card: rgba(255, 255, 255, .06);
  --scarte-line: rgba(255, 255, 255, .14);
  --scarte-ring: #ffffff;
  padding: clamp(24px, 4vw, 56px);
  border-radius: 20px;
}

.scarte__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 20px; }
.scarte__title { margin: 0; font-size: clamp(1.4rem, 2.6vw, 2.1rem); line-height: 1.15; color: inherit; }

.scarte__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: clamp(16px, 3vw, 40px); align-items: center; }
.scarte--nolegend .scarte__body { grid-template-columns: minmax(0, 1fr); }

.scarte__map { position: relative; width: 100%; max-width: calc(var(--scarte-max-h) * 1.037); margin: 0 auto; }
.scarte__stage { position: relative; width: 100%; aspect-ratio: 1000 / 964; }
.scarte__svg, .scarte__canvas, .scarte__sites { position: absolute; inset: 0; width: 100%; height: 100%; }
.scarte__land { fill: var(--scarte-land); }
.scarte__regions { fill: none; stroke: var(--scarte-region); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.scarte__coast { fill: none; stroke: var(--scarte-coast); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.scarte__canvas { pointer-events: none; }
.scarte__sites { pointer-events: none; }

/* Sièges et agences */
.scarte__site {
  position: absolute; width: var(--s, 18px); height: var(--s, 18px); padding: 0; margin: 0;
  transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; pointer-events: auto;
  background: var(--c); border: 3px solid var(--scarte-ring);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: opacity .25s, transform .25s;
  opacity: 0;
}
.scarte.is-ready .scarte__site { opacity: 1; transition-delay: 1.4s; }
.scarte__site--agence { background: var(--scarte-ring); border: 2.5px solid var(--c); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.scarte__site--siege::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--c);
  animation: scarte-pulse 2.6s ease-out infinite; animation-delay: inherit;
}
.scarte__site:hover, .scarte__site:focus-visible { transform: translate(-50%, -50%) scale(1.25); outline: none; z-index: 2; }
.scarte__site:focus-visible { box-shadow: 0 0 0 3px var(--scarte-ring), 0 0 0 5px var(--c); }
.scarte__site.is-dim { opacity: .25 !important; transition-delay: 0s; }
.scarte__site.is-hidden { opacity: 0 !important; pointer-events: none; transition-delay: 0s; }
@keyframes scarte-pulse { 0% { transform: scale(1); opacity: .8; } 80%, 100% { transform: scale(2.4); opacity: 0; } }

/* Infobulle */
.scarte__tip {
  position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none;
  background: #0b2a3c; color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); white-space: nowrap; max-width: 260px;
}
.scarte__tip strong, .scarte__tip span, .scarte__tip em { display: block; }
.scarte__tip span { opacity: .75; }
.scarte__tip em { font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; filter: brightness(1.15); }
.scarte__tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); }

/* Affichage Groupe : sièges cerclés de bleu pour ressortir sur les points jaunes ;
   la ligne de légende unique est masquée quand le compteur global est affiché (doublon). */
.scarte--group .scarte__site--siege { border-color: var(--scarte-navy); box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0, 0, 0, .3); }
.scarte--group .scarte__site--siege::after { border-color: var(--scarte-navy); }
.scarte--dark.scarte--group .scarte__site--siege { border-color: #fff; box-shadow: 0 0 0 2px var(--scarte-navy), 0 2px 8px rgba(0, 0, 0, .3); }
.scarte--dark.scarte--group .scarte__site--siege::after { border-color: #fff; }
.scarte--group:has(.scarte__total) .scarte__legend > li:not(.scarte__key) { display: none; }
.scarte--group .scarte__key-siege { background: #F9B104; border-color: var(--scarte-navy); box-shadow: 0 0 0 1px #fff; }

/* Colonne latérale : légende + compteur global */
.scarte__side { display: flex; flex-direction: column; gap: 14px; }

.scarte__total {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 14px;
  background: var(--scarte-navy); color: #fff;
}
.scarte__total-n { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #F9B104; }
.scarte__total-l { font-weight: 700; line-height: 1.2; }
.scarte__total-l small { display: block; font-weight: 400; font-size: .8em; opacity: .75; margin-top: 2px; }
.scarte--dark .scarte__total { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); }

/* Légende */
.scarte__legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.scarte__item {
  width: 100%; display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--scarte-line); background: var(--scarte-card);
  color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, opacity .2s, transform .2s;
}
.scarte__item:hover { border-color: var(--c); transform: translateX(2px); }
.scarte__item:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.scarte__item[aria-pressed="false"] { opacity: .45; }
.scarte__item[aria-pressed="false"] .scarte__swatch { background: transparent; }
.scarte__swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--c); transition: background .2s; }
.scarte__name { font-weight: 700; line-height: 1.2; }
.scarte__name small { display: block; font-weight: 400; font-size: .8em; color: var(--scarte-muted); margin-top: 2px; }
.scarte__count { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--c); }
.scarte--dark .scarte__count { filter: brightness(1.1); }
.scarte__key { display: flex; align-items: center; gap: 8px; padding: 8px 4px 0; font-size: .85rem; color: var(--scarte-muted); }
.scarte__key-siege, .scarte__key-agence { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--scarte-muted); border: 3px solid var(--scarte-ring); box-shadow: 0 0 0 1px var(--scarte-muted); }
.scarte__key-agence { width: 11px; height: 11px; background: var(--scarte-ring); border: 2px solid var(--scarte-muted); box-shadow: none; margin-left: 10px; }

.scarte--error .scarte__stage::after { content: "Carte momentanément indisponible"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--scarte-muted); }

/* La mise en page suit la largeur du bloc (et non de l'écran) : en colonne étroite, la légende passe sous la carte. */
@container scarte (max-width: 760px) {
  .scarte__body { grid-template-columns: minmax(0, 1fr); }
  .scarte__side { display: grid; grid-template-columns: minmax(0, 1fr); }
  .scarte__legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scarte__item { padding: 10px 12px; }
  .scarte__key { grid-column: 1 / -1; }
}
@container scarte (max-width: 440px) {
  .scarte__legend { grid-template-columns: minmax(0, 1fr); }
  .scarte__total-n { font-size: 1.6rem; }
}
/* Navigateurs sans container queries */
@supports not (container-type: inline-size) {
  @media (max-width: 860px) {
    .scarte__body { grid-template-columns: minmax(0, 1fr); }
    .scarte__legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .scarte__site--siege::after { animation: none; display: none; }
  .scarte.is-ready .scarte__site { transition-delay: 0s; }
}
