/* Foule vivante — rendu des habitants (M2, Tusk).
   Intention : des personnages peints qui posent leurs pieds dans la peinture — ombre elliptique au sol cerclée de la couleur du statut,
   étiquette à l'encre de la peau, teinte de nuit accordée à chaque tableau, balancement de marche à peine perceptible.
   DOM : voir SPEC §6.4 (.foule-calque > .foule-agent > .foule-ombre, .foule-corps > .foule-pose > .foule-sprite, .citylabel, marques).
   Tokens par peau sur .foule-agent / .foule-calque ; chargé après styles.css et royaume.css (neutralise leurs silhouettes sur les sprites ;
   .foule-agent.repli, la silhouette SVG de secours, garde les anciennes règles). */

/* ---------- Tokens (cyber par défaut, une série par peau) ---------- */
.foule-calque, .foule-agent {
  --foule-etiq-fond: rgba(8, 11, 18, 0.94); --foule-etiq-encre: #eaf6ff; --foule-etiq-police: Rajdhani, sans-serif; --foule-etiq-poids: 700;
  --foule-ombre: rgba(0, 0, 0, 0.55); --foule-halo: rgba(246, 240, 224, 0.9);
  --foule-nuit-lum: 0.7; --foule-nuit-sepia: 0; --foule-nuit-sat: 0.95;
  --foule-st-actif: #0aff9d; --foule-st-attente: #fcee0a; --foule-st-bloque: #ff003c; --foule-st-idee: #bd5cff; --foule-st-termine: #5a6a7a;
}
html[data-skin="royaume"] .foule-calque, html[data-skin="royaume"] .foule-agent {
  --foule-etiq-fond: rgba(26, 18, 12, 0.94); --foule-etiq-encre: #f3e6c4; --foule-etiq-police: Cinzel, serif; --foule-etiq-poids: 400;
  --foule-ombre: rgba(30, 18, 6, 0.42); --foule-halo: rgba(240, 207, 106, 0.85);
  --foule-nuit-lum: 0.68; --foule-nuit-sepia: 0.18; --foule-nuit-sat: 1.05;
}
html[data-skin="animus"] .foule-calque, html[data-skin="animus"] .foule-agent {
  --foule-etiq-fond: rgba(255, 255, 255, 0.95); --foule-etiq-encre: #1c2026; --foule-etiq-police: Titillium Web, sans-serif; --foule-etiq-poids: 700;
  --foule-ombre: rgba(40, 24, 10, 0.4); --foule-halo: rgba(127, 208, 255, 0.9);
  --foule-nuit-lum: 0.62; --foule-nuit-sepia: 0.22; --foule-nuit-sat: 0.95;
}
html[data-skin="sparte"] .foule-calque, html[data-skin="sparte"] .foule-agent {
  --foule-etiq-fond: rgba(24, 16, 10, 0.94); --foule-etiq-encre: #f3dcb8; --foule-etiq-police: Marcellus, serif; --foule-etiq-poids: 400;
  --foule-ombre: rgba(30, 18, 8, 0.45); --foule-halo: rgba(240, 190, 120, 0.9);
  --foule-nuit-lum: 0.66; --foule-nuit-sepia: 0.2; --foule-nuit-sat: 1;
}
html[data-skin="mujahid"] .foule-calque, html[data-skin="mujahid"] .foule-agent {
  --foule-etiq-fond: rgba(8, 24, 20, 0.94); --foule-etiq-encre: #f3ead2; --foule-etiq-police: El Messiri, sans-serif; --foule-etiq-poids: 600;
  --foule-ombre: rgba(40, 22, 8, 0.42); --foule-halo: rgba(227, 192, 90, 0.9);
  --foule-nuit-lum: 0.66; --foule-nuit-sepia: 0.2; --foule-nuit-sat: 1.05;
}
html[data-skin="elysee"] .foule-calque, html[data-skin="elysee"] .foule-agent {
  --foule-etiq-fond: rgba(16, 22, 48, 0.92); --foule-etiq-encre: #fffdf8; --foule-etiq-police: Public Sans, sans-serif; --foule-etiq-poids: 700;
  --foule-ombre: rgba(40, 46, 80, 0.32); --foule-halo: rgba(217, 180, 74, 0.9);
  --foule-nuit-lum: 0.68; --foule-nuit-sepia: 0.05; --foule-nuit-sat: 0.88;
}

/* ---------- Neutralisation des anciennes silhouettes sur les sprites (triple classe : passe devant html[data-skin] .cityfig.fig-*) ---------- */
.foule-agent.foule-agent.foule-agent:not(.repli) { filter: none; opacity: 1; cursor: pointer; }
.foule-agent.foule-agent.foule-agent.st-idee { opacity: 1; }
.foule-agent.st-idee:not(.repli) .foule-corps { opacity: 0.8; }
.foule-agent.st-idee.repli .face { opacity: 0.6; }
.foule-agent .citylabel, .foule-agent .qmark, .foule-agent .fbanner, .foule-agent .avtag { opacity: 1; }
.foule-agent.foule-agent.foule-agent.st-termine:not(.repli) { filter: none; }
.foule-agent:not(.repli) .patrol, .foule-agent:not(.repli) .patrol.walk, .foule-agent:not(.repli) .face { animation: none; transform: none; filter: none; }
.foule-agent.foule-agent[data-avatar="1"]:not(.repli) { filter: drop-shadow(0 0 4px var(--foule-halo)); }
.foule-agent:not(.repli):active { opacity: 0.85; }
/* les silhouettes de secours gardent leur ombre portée */
.foule-agent.repli .foule-ombre { display: none; }

/* ---------- Sprite : teinte de jour, statut, nuit ---------- */
.foule-agent:not(.repli) .foule-sprite {
  filter: brightness(var(--foule-lum, 1)) sepia(var(--foule-sepia, 0)) saturate(calc(var(--foule-sat, 1) * var(--foule-sat-st, 1)));
}
.foule-agent.st-idee { --foule-sat-st: 0.45; }
.foule-agent.st-bloque { --foule-sat-st: 0.55; }
.foule-agent.st-attente { --foule-sat-st: 0.9; }
.fresco-panel[data-phase="nuit"] .foule-agent { --foule-lum: var(--foule-nuit-lum); --foule-sepia: var(--foule-nuit-sepia); --foule-sat: var(--foule-nuit-sat); }
.fresco-panel[data-phase="aube"] .foule-agent { --foule-lum: 0.94; }
.fresco-panel[data-phase="crepuscule"] .foule-agent { --foule-lum: 0.86; --foule-sepia: 0.08; }
.fresco-panel[data-phase="nuit"] .foule-agent .foule-ombre { fill-opacity: 0.55; }

/* ---------- Ombre au sol et repère de statut (anneau de la couleur du statut) ---------- */
.foule-agent .foule-ombre {
  fill: var(--foule-ombre); stroke: var(--foule-st-actif); stroke-width: 1.4; stroke-opacity: 0.9; pointer-events: none;
  vector-effect: non-scaling-stroke;
}
.foule-agent .foule-ombre:not([rx]) { rx: 13px; ry: 3.6px; cx: 0; cy: 0; }
.foule-agent.st-attente .foule-ombre { stroke: var(--foule-st-attente); }
.foule-agent.st-bloque .foule-ombre { stroke: var(--foule-st-bloque); stroke-width: 2; }
.foule-agent.st-idee .foule-ombre { stroke: var(--foule-st-idee); stroke-dasharray: 3 2; }
.foule-agent.st-termine .foule-ombre { stroke: var(--foule-st-termine); }
.foule-agent[data-dream] .foule-ombre, .foule-agent[data-avatar="1"] .foule-ombre { stroke: var(--foule-halo); stroke-opacity: 0.8; }
.foule-agent:focus-visible .foule-ombre { stroke-width: 2.6; stroke-opacity: 1; }
.foule-agent[data-mode="fige"] .foule-ombre { stroke-width: 2.2; }

/* ---------- Étiquette % à l'encre de la peau (contraste ≥ 4,5:1) ---------- */
.foule-agent.foule-agent.foule-agent .citylabel rect { fill: var(--foule-etiq-fond); }
.foule-agent.foule-agent.foule-agent .citylabel text { fill: var(--foule-etiq-encre); font-family: var(--foule-etiq-police); font-weight: var(--foule-etiq-poids); paint-order: normal; }

/* ---------- Marques conservées : quête ◆, étendard du focus, ✕ bloqué, laurier livré ---------- */
.foule-agent .qmark { paint-order: stroke; stroke: rgba(8, 11, 18, 0.75); stroke-width: 2.2px; stroke-linejoin: round; }
.foule-agent .fbanner { filter: none; }
.foule-agent .fbanner path, .foule-agent .fbanner line { stroke: rgba(8, 11, 18, 0.55); stroke-width: 0.8px; paint-order: stroke; }
.foule-agent.st-bloque > text { paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 2.6px; stroke-linejoin: round; }
.foule-agent .fig-laurel { pointer-events: none; }
.foule-agent .fig-laurel .spark { animation: sparkle 1.4s ease-in-out infinite; }
.foule-agent .avtag { animation: qbounce 1.1s ease-in-out infinite alternate; }

/* ---------- Marche : balancement ≤ 3°, rebond ≤ 3 % de la hauteur (la pose est à l'échelle 100) ; rien à l'arrêt ---------- */
.foule-agent .foule-pose { transform-box: fill-box; transform-origin: 50% 100%; }
.foule-agent[data-mode="marche"] .foule-pose {
  animation: foule-marche 0.56s ease-in-out infinite alternate;
  animation-play-state: running;
}
.foule-agent[data-mode="marche"].st-attente .foule-pose { animation-duration: 0.8s; }
.foule-agent[data-mode="marche"].st-idee .foule-pose { animation-duration: 0.95s; }
@keyframes foule-marche {
  from { transform: rotate(-2.4deg) translateY(0); }
  to { transform: rotate(2.4deg) translateY(-2.4px); }
}
.foule-agent[data-mode="pause"] .foule-pose, .foule-agent[data-mode="fige"] .foule-pose, .foule-agent.st-bloque .foule-pose { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .foule-agent.foule-agent[data-mode] .foule-pose, .foule-agent.foule-agent .foule-pose, .foule-agent .qmark, .foule-agent .avtag, .foule-agent .fig-laurel .spark { animation: none; }
}

/* ---------- Statut : couleurs exactes de statusColor (la triple classe passe devant toutes les règles de peau de styles.css) ---------- */
.foule-agent.foule-agent.foule-agent.st-actif .citylabel rect { stroke: #0aff9d; }
.foule-agent.foule-agent.foule-agent.st-actif .foule-ombre { stroke: #0aff9d; }
.foule-agent.foule-agent.foule-agent.st-attente .citylabel rect { stroke: #fcee0a; }
.foule-agent.foule-agent.foule-agent.st-attente .foule-ombre { stroke: #fcee0a; }
.foule-agent.foule-agent.foule-agent.st-bloque .citylabel rect { stroke: #ff003c; }
.foule-agent.foule-agent.foule-agent.st-bloque .foule-ombre { stroke: #ff003c; }
.foule-agent.foule-agent.foule-agent.st-termine .citylabel rect { stroke: #5a6a7a; }
.foule-agent.foule-agent.foule-agent.st-termine .foule-ombre { stroke: #5a6a7a; }
.foule-agent.foule-agent.foule-agent.st-idee .citylabel rect { stroke: #bd5cff; }
.foule-agent.foule-agent.foule-agent.st-idee .foule-ombre { stroke: #bd5cff; }
