/* Politiques.ch — variante D′ de la maquette. Couleurs des figures : scrutin/charte.py. */
:root {
  --fond: #fcfcfb; --panneau: #ffffff; --bord: #e1e0d9;
  --encre: #1f1f1c; --gris: #5f5e58;
  --oui: #2a78d6; --oui-clair: #86b6ef; --non: #c9352b; --neutre: #ecebe6;
  --fleche: #9d9c96; --rouge-pale: #f1d5d2; --bleu-pale: #d3e2f6;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--fond); color: var(--encre); font: 16px/1.5 var(--sans); }
body { margin: 0 auto; max-width: 1280px; padding: 0 22px 44px; }

/* ── En-tête ── */
header { display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap; padding: 20px 0 14px; }
.marque { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.2rem;
  letter-spacing: .01em; color: inherit; text-decoration: none; }
.marque .mot span { color: var(--oui); }
.logo { height: 48px; width: auto; display: block; }
.logo .pays { fill: var(--gris); opacity: .72; }
.logo .barres rect, .logo .points circle { fill: var(--oui); }
.contexte { margin: 0; font-size: .78rem; font-weight: 400; line-height: 1.5; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gris); }

/* ── Avancement du dépouillement ── */
.point { width: 9px; height: 9px; border-radius: 50%; background: var(--non);
  box-shadow: 0 0 0 0 rgba(201,53,43,.5); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(201,53,43,0); } 100% { box-shadow: 0 0 0 0 rgba(201,53,43,0); } }
@media (prefers-reduced-motion: reduce) { .point { animation: none; } }

.avancement { background: var(--panneau); border: 1px solid var(--bord); border-radius: 12px;
  padding: 16px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avancement .l { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gris); }
.avancement .v { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.avancement .rail { flex: 1 1 220px; min-width: 160px; height: 10px;
  background: var(--neutre); border-radius: 5px; overflow: hidden; }
.avancement .rail i { display: block; height: 100%; background: linear-gradient(90deg, var(--oui-clair), var(--oui)); }
.avancement .note { display: flex; align-items: center; gap: 9px; font-size: .84rem; color: var(--gris); }

/* ── Le mur : un panneau par objet ── */
/* min(300px, 100%) : sinon les panneaux débordent sous 344 px. */
.mur { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 18px; margin-top: 18px; }
.panneau { background: var(--panneau); border: 1px solid var(--bord); border-radius: 14px;
  padding: 22px 22px 20px; display: flex; flex-direction: column; container-type: inline-size; }
.panneau .nom { margin: 0; font-size: .95rem; font-weight: 400; line-height: 1.5; color: var(--gris); min-height: 3em; }

/* Tailles en cqi (largeur du panneau) ; la première déclaration sert de repli. */
.panneau .attente { margin: 0; padding: 18px 0; font-size: .9rem; color: var(--gris); }
.valeurs { display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; row-gap: 8px;
  grid-template-areas: "ext ext dep" "lib-ext fourchette lib-dep"; align-items: center; margin: 10px 0 14px; }
.panneau .chiffre { grid-area: ext; justify-self: start; align-self: end;
  font-size: clamp(2.8rem, 6vw, 4.2rem); font-size: clamp(2.2rem, 16cqi, 4.2rem);
  font-weight: 800; line-height: .95; letter-spacing: -.035em; }
.panneau .chiffre-connu { grid-area: dep; justify-self: center; align-self: end;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem); font-size: clamp(1rem, 6.7cqi, 1.75rem);
  font-weight: 700; line-height: 1; letter-spacing: -.02em; color: var(--gris); }
.panneau .libelle { justify-self: start; font-size: .66rem; font-size: clamp(.6rem, 3.8cqi, .7rem);
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px;
  color: var(--gris); background: rgba(95,94,88,.1); white-space: nowrap; }
.panneau .libelle-ext { grid-area: lib-ext; }
.panneau .libelle-connu { grid-area: lib-dep; justify-self: center; }
.panneau .libelle.oui { color: var(--oui); background: rgba(42,120,214,.12); }
.panneau .libelle.non { color: var(--non); background: rgba(201,53,43,.12); }
.panneau .fourchette { grid-area: fourchette; justify-self: start; line-height: 1.3;
  font-size: .7rem; font-size: clamp(.62rem, 4.2cqi, .74rem); }
.panneau .fourchette .bornes { display: block; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.oui { color: var(--oui); } .non { color: var(--non); }

/* ── La barre : rail teinté à 50 %, moustache de l'intervalle, dépouillé en gris ── */
.barre { position: relative; height: 25px; margin: 0 0 4px; }
.barre.oui { --c: var(--oui); } .barre.non { --c: var(--non); }
.barre .rail { position: absolute; left: 0; right: 0; top: 8px; height: 9px; border-radius: 5px;
  background: linear-gradient(90deg, var(--rouge-pale) 50%, var(--bleu-pale) 50%); }
.barre .moustache { position: absolute; top: 11px; height: 3px; background: var(--c); }
.barre .moustache::before, .barre .moustache::after { content: ""; position: absolute; top: -6px; width: 2px; height: 15px; background: var(--c); }
.barre .moustache::before { left: 0; } .barre .moustache::after { right: 0; }
.barre .connu { position: absolute; top: 0; height: 25px; width: 2px; margin-left: -1px; background: var(--fleche); box-shadow: 0 0 0 1.5px #fff; }
.barre .trajet { position: absolute; top: 11.5px; height: 2px; background: var(--fleche); }
.barre .fleche { position: absolute; top: 8.5px; width: 0; height: 0; color: var(--fleche); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.barre .fleche.droite { margin-left: -7px; border-left: 7px solid; }
.barre .fleche.gauche { border-right: 7px solid; }

/* Proportions de la Suisse ; Plotly prend la hauteur du conteneur. */
.carte { margin-top: 12px; aspect-ratio: 1.55; }
.carte .figure { height: 100%; }

/* ── Pages de texte et de carte ── */
.page { background: var(--panneau); border: 1px solid var(--bord); border-radius: 14px;
  padding: 26px 28px; max-width: 760px; margin: 18px auto 0; line-height: 1.6; }
.page h1 { margin: 0 0 14px; font-size: 1.5rem; line-height: 1.25; letter-spacing: -.01em; }
.page a { color: var(--oui); }
.page-carte { max-width: 900px; }

/* ── Pied de page : le menu ── */
footer { margin-top: 26px; border-top: 1px solid var(--bord); padding-top: 6px; }
footer nav { display: flex; justify-content: center; flex-wrap: wrap; column-gap: 32px; }
footer a { color: var(--gris); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; padding: 13px 4px; }
footer a:hover, footer a:focus-visible { color: var(--oui); }
footer a[aria-current] { color: var(--encre); font-weight: 600; }

/* ── Téléphone (en fin de feuille, sinon les règles de base l'écrasent) ── */
@media (max-width: 600px) {
  .marque .mot { display: none; }
  header { flex-wrap: nowrap; }
  .contexte { text-align: right; }
  .contexte .quand { display: block; }
  .avancement { padding: 12px 14px; gap: 8px 12px; }
  .avancement > div:first-child { display: contents; }
  .avancement .l { display: none; }
  .avancement .note { order: 1; flex-basis: 100%; font-size: .78rem; white-space: nowrap; }
  .avancement .rail { order: 2; flex: 1 1 0; min-width: 0; height: 8px; }
  .avancement .v { order: 3; font-size: 1.1rem; }
  .page { padding: 20px 18px; }
}
/* 320 px : marges resserrées pour que les valeurs tiennent dans le panneau. */
@media (max-width: 359px) {
  body { padding-left: 14px; padding-right: 14px; }
  .panneau { padding-left: 16px; padding-right: 16px; }
  footer nav { column-gap: 18px; }
}
