/* ==========================================================================
   Où va l'argent public ? — design system inspiré du poster (Le 1 hebdo)
   Fond crème, typographies éditoriales, palette : bleu État / rose Sécu /
   violet Retraites / ocre Collectivités / gris dette ; le cramoisi #8E1B38
   est réservé à l'argent non contributif des retraites.
   ========================================================================== */

:root {
  --bg: #FAF6EF;
  --ink: #1E2430;
  --ink-soft: #4A5265;
  --paper: #FFFFFF;
  --etat: #3D6FB4;
  --secu: #D95970;
  --retraites: #6E5BAE;
  --ct: #D9A441;
  --cram: #8E1B38;
  --dette: #4B4F58;
  --rule: #E4DCCB;
  --accent: #C13B55;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

/* ---------- navigation commune aux pages ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 48px; padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  box-shadow: inset 0 4px 0 0 var(--etat);
  background-image: linear-gradient(90deg, var(--etat) 0 25%, var(--secu) 25% 50%, var(--retraites) 50% 75%, var(--ct) 75% 100%);
  background-size: 100% 4px; background-repeat: no-repeat; background-position: top;
}
.site-brand { font: 700 17px/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.site-links { display: flex; gap: 4px; }
.site-links a {
  font: 700 12px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none; padding: 9px 10px; border-radius: 999px;
}
.site-links a:hover { color: var(--ink); background: var(--paper); }
.site-links a[aria-current="page"] { color: var(--ink); background: linear-gradient(transparent 60%, #F5E663 60%, #F5E663 92%, transparent 92%); }
.site-links a { white-space: nowrap; }@media (max-width: 560px) {
  .site-nav { padding: 0 12px; gap: 8px; }
  .site-brand { font-size: 15px; }
  .site-links a { padding: 9px 7px; letter-spacing: .07em; font-size: 11px; }
  .site-links .art { display: none; }
}@media (max-width: 420px) {
  /* 375 px : la marque + quatre entrées doivent tenir sur une ligne */
  .site-nav { padding: 0 10px; gap: 6px; }
  .site-brand { font-size: 13px; }
  .site-links { gap: 0; }
  .site-links a { padding: 8px 5px; letter-spacing: .04em; font-size: 10px; }
}

/* ---------- page d'accueil (landing) ---------- */
@media (max-width: 760px) {
}

/* ---------- entête éditorial ---------- */
.masthead {
  border-bottom: 2px solid var(--ink);
  background: var(--bg);
  padding: 22px 20px 16px;
}
.masthead-inner { max-width: 1180px; margin: 0 auto; }
.kicker {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
  font-weight: 700;
}
h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.15;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
h1 .hl {
  background: linear-gradient(transparent 58%, #F5E663 58%, #F5E663 94%, transparent 94%);
  padding: 0 4px;
}
.standfirst {
  max-width: 760px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
  font-style: normal;
  font-family: var(--sans);
}

/* bande de totaux — écho de la bande jaune « RECETTES » du poster */
/* ligne de totaux (ex-bandeau jaune) : discrète, sans fond, nombres en gras */
.statband {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.statband b { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.statband .stat { display: inline-block; white-space: nowrap; }
.statband .sep { color: var(--rule); margin: 0 6px; }
.statband .stat-year { display: none; }

/* ---------- section « pensions » (étage permanent) ---------- */

#chart-pensions {
  width: 100%;
  height: 980px;               /* ajusté dynamiquement par app.js */
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(30, 36, 48, .06);
  margin-top: 8px;
}

.panel-retraites {
  display: none;
  margin: 14px 0 0;
  padding: 16px 20px;
  background: #F3F0FA;
  border: 1.5px solid #6E5BAE;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
}
.panel-retraites.open { display: block; }
.panel-retraites h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 18px; }
.panel-retraites .ret-big { font-size: 15px; }
.panel-retraites table { border-collapse: collapse; margin: 8px 0; }
.panel-retraites td { border-bottom: 1px dashed #CFC6E6; padding: 4px 18px 4px 0; }
.panel-retraites td:last-child { font-weight: 700; text-align: right; }
.panel-retraites .ret-src { font-size: 12px; color: var(--ink-soft); margin-bottom: 0; }

/* ---------- breadcrumb ---------- */
.breadcrumb {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 36px;
}
.crumb {
  font: 600 13px/1 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.crumb:hover { border-color: var(--ink); }
.crumb[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  cursor: default;
}
.breadcrumb .sep { color: var(--ink-soft); font-size: 12px; padding: 0 2px; }

/* ---------- graphique ---------- */
main { max-width: 1220px; margin: 0 auto; padding: 6px 12px 8px; }
.cas-legend {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 2px 2px 8px;
}
.cas-legend .swatch {
  display: inline-block;
  width: 22px; height: 11px;
  border-radius: 3px;
  background: #9CA3B0;
  opacity: .7;
  margin-right: 6px;
  vertical-align: -1px;
}
.cas-legend .swatch-est {
  background: repeating-linear-gradient(45deg, #C9CDD6 0 3px, #6E7686 3px 5px);
  margin-left: 10px;
}
.cas-legend .legend-more { color: var(--ink-soft); }

/* ---------- carte « évolution du budget » (au zoom sur un ministère) ---------- */
.histo-card[hidden] { display: none; }   /* l'attribut hidden doit gagner sur le flex */
.histo-card {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 18px;
  margin: 0 0 10px;
  box-shadow: 0 2px 14px rgba(30, 36, 48, .05);
}
.histo-card h3 {
  font-family: var(--serif);
  font-size: 15px;
  margin: 0 0 4px;
}
.histo-card .histo-text { flex: 1 1 320px; min-width: 260px; }
.histo-card .histo-verdict { font-family: var(--serif); font-size: 19px; line-height: 1.25; margin: 0 0 6px; }
.histo-card .histo-verdict b { color: var(--accent); }
.histo-card .histo-punch { font-size: 14px; line-height: 1.45; margin: 0 0 4px; color: var(--ink-soft); }
.histo-card .histo-punch b { color: var(--ink); }
.histo-card .histo-note {
  font-size: 11px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}
.histo-card svg { flex: 0 0 auto; display: block; }
.histo-card .histo-charts {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.histo-card .bar-total { fill: #C5D6EC; }
.histo-card .bar-cas { fill: #9CA3B0; }
.histo-card .bar-neg { fill: #C13B55; }          /* moyens hors retraites en recul */
.histo-card .histo-alert { color: var(--ink); }
.histo-card .histo-alert b { color: var(--accent); }
.histo-card .bar-cas-lbl { font-size: 9px; fill: #FFFFFF; }
.histo-card text { font: 700 10px var(--sans); fill: var(--ink); }
.histo-card .axis-year { font-weight: 400; fill: var(--ink-soft); }
/* rail d'étages (U6) à gauche du canvas + scène */
.stage-wrap { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: start; }
.stage-wrap > #chart-stage { grid-column: 2; }      /* la scène reste en colonne 2 même rail masqué */
.stage-rail { grid-column: 1; position: relative; height: 100%; min-height: 200px; }
.stage-rail[hidden] { display: block; visibility: hidden; }
.stage-lbl {
  position: absolute; right: 0; transform: translateY(-50%);
  width: 96px; text-align: right; padding-right: 10px;
  font: 700 11px/1.25 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft);
  border-right: 2px solid var(--rule);
}
.stage-lbl::after { content: ""; position: absolute; right: -6px; top: 50%; width: 10px; height: 2px; background: var(--rule); }@media (max-width: 900px) {
  .stage-wrap { grid-template-columns: 1fr; gap: 0; }
  .stage-wrap > #chart-stage { grid-column: 1; }
  .stage-rail, .stage-rail[hidden] { display: none; }
}
#chart-stage { position: relative; overflow: hidden; border-radius: 10px; }
/* consigne dans le graphique (U10), en haut à droite */
.chart-hint {
  position: absolute; bottom: 12px; right: 12px; z-index: 4; margin: 0;
  font: 500 12px/1 var(--sans); color: var(--ink-soft);
  background: rgba(255,255,255,.85); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 10px;
  pointer-events: none;
}
.chart-hint kbd { font: 700 10px/1 var(--sans); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 4px; background: var(--paper); }
/* bandeau « thèse » (U5) posé sur le graphique */
.these-banner {
  position: absolute; z-index: 5; left: 12px; right: 12px; top: 10px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--ink); border-left: 6px solid #8E1B38; border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 8px 24px rgba(30,36,48,.12);
}
.these-banner[hidden] { display: none; }
.these-text { margin: 0; flex: 1 1 380px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.these-text b { color: #8E1B38; font-size: 15px; }
.these-banner .crumb { flex: none; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.these-banner .crumb:hover { background: #8E1B38; border-color: #8E1B38; }@media (max-width: 700px) {
  .these-banner { left: 6px; right: 6px; top: 6px; padding: 8px 10px; }
  .these-text { font-size: 13px; }
  .chart-hint { display: none; }
}
#chart {
  width: 100%;
  height: 640px;               /* ajusté dynamiquement par app.js */
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(30, 36, 48, .06);
  will-change: transform, opacity;
}
/* Transition « plongée » : calque fantôme = capture de la vue quittée, animé
   par app.js (diveTransition) — grossit/se résorbe autour du nœud cliqué
   pendant que la nouvelle vue naît de son rectangle. */
.dive-ghost {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 10px;
  pointer-events: none;
  z-index: 3;
  will-change: transform, opacity;
}

.hint {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 10px 0 0;
}
.hint .alt-view {
  display: inline-block;
  margin-left: 10px;
  color: var(--accent);
  font-weight: 600;
}
#treemap {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(30, 36, 48, .06);
}

/* ---------- fil d'Ariane du Mondrian (plongée pilotée, pastilles papier) ---------- */
.tm-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  padding: 8px 6px 10px;
}
.tm-crumb[hidden] { display: none; }
.tm-crumb-item {
  font: 700 12px/1 inherit;
  color: #4A5265;
  background: #FBF7EE;
  border: 1px solid #E4DCCB;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(30, 36, 48, .08);
  transition: background .15s, color .15s, border-color .15s;
}
.tm-crumb-item:hover,
.tm-crumb-item:focus-visible { background: #F5E663; color: #1E2430; border-color: #E2D24A; outline: none; }
.tm-crumb-item.cur {
  color: #1E2430;
  background: #fff;
  border-color: var(--accent);
  cursor: default;
  box-shadow: none;
}
.tm-crumb-sep { color: #B9AE97; font-weight: 700; }

/* ---------- comparateur du treemap ---------- */
.compare-panel[hidden] { display: none; }
.compare-panel {
  background: #FFF5F7;
  border: 1.5px solid var(--accent);
  border-left-width: 6px;
  margin-top: 14px;
}
.compare-panel > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--accent);
}
.compare-panel > summary::-webkit-details-marker { display: none; }
.compare-panel > summary::before { content: "▸"; font-size: 14px; transition: transform .15s; }
.compare-panel[open] > summary::before { transform: rotate(90deg); }
.compare-panel .cmp-hint { font: 400 13px/1.4 var(--sans); color: var(--ink-soft); }
.compare-panel[open] .cmp-hint { display: none; }
.compare-panel .histo-text { margin-top: 10px; }
.report-btn.active { background: var(--accent); color: #fff; }
.cmp-label {
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; min-width: 0; flex: 1 1 240px;
}
.cmp-label select {
  font: 400 13px var(--sans);
  margin-left: 6px;
  flex: 1 1 auto; min-width: 0;
  max-width: min(420px, 100%);
  padding: 5px 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
}
.cmp-squares {
  display: flex;
  gap: 26px;
  align-items: flex-end;
  margin: 12px 0 4px;
  flex-wrap: wrap;
}
.cmp-square { margin: 0 auto 6px; border-radius: 4px; }
.cmp-sentence { font-size: 15px; line-height: 1.5; margin: 10px 0 0; }
.cmp-note { color: var(--ink-soft); font-size: 12px; margin: 4px 0 0; }
.cmp-selects { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* comparateur permanent en tête : SVG + phrase côte à côte (compact) sur desktop */
#compare-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; }
#compare-body .cmp-squares { flex: 0 0 auto; margin: 8px 0 0; }
#compare-body .cmp-sentence { flex: 1 1 320px; margin: 0; }
.cmp-swap {
  border: 1px solid var(--accent); background: var(--paper); color: var(--accent);
  border-radius: 999px; width: 30px; height: 30px; cursor: pointer; font-size: 15px;
  line-height: 1; flex: 0 0 auto;
}
.cmp-swap:hover { background: #FCEDF4; }
.cmp-svg { display: block; margin: 10px auto 0; max-width: 100%; }
.cmp-svg .cmp-ratio { font: 800 17px var(--sans); fill: var(--accent); }
.cmp-svg .cmp-arrow { font: 700 15px var(--sans); fill: var(--ink-soft); }
.cmp-svg .cmp-val { font: 700 12px var(--sans); fill: var(--ink); }

/* ---------- switch de mode (Mondrian) ---------- */
.mode-bar { max-width: 1220px; margin: 8px auto 0; padding: 0 12px; }
/* le libellé INACTIF s'estompe : lève l'ambiguïté quand le switch se replie */

.switch { position: relative; display: inline-block; width: 52px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: #B9738A; transition: background .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(24px); }
/* « Comprendre le calcul » : un bouton en toutes lettres, plus un « ? » de 24 px (U13) */
.mode-info {
  border-radius: 999px; border: 1.5px solid var(--accent);
  background: var(--paper); color: var(--accent); font: 700 13px/1 var(--sans); cursor: pointer;
  padding: 8px 12px; flex: 0 0 auto; white-space: nowrap;
}
.mode-info:hover { background: var(--accent); color: #fff; }
.mode-caption { font-size: 14px; color: var(--ink); margin: 8px 0 0; line-height: 1.5; max-width: 900px; }
.mode-caption strong { color: #8E1B38; }
/* bloc « le calcul des 145 » sous le graphique, visible en lecture ② seulement */
.calc-block { display: none; max-width: 1220px; margin: 14px auto 0; padding: 14px 18px 12px; background: var(--paper);
  border: 1px solid var(--rule); border-left: 6px solid #8E1B38; border-radius: 10px; }
.calc-block .dlg-calc-title { margin-top: 0; }
.calc-block .dlg-calc { max-width: 640px; }
body[data-mode="revele"] .calc-block { display: block; }
.calc-block .phase-link { color: var(--accent); font-weight: 700; cursor: pointer; border-bottom: 1.5px solid rgba(193,59,85,.35); }
.mode-dlg { max-width: 540px; }
.mode-dlg p { font-size: 14px; line-height: 1.55; }
.mode-dlg ul { font-size: 14px; padding-left: 20px; }
.mode-dlg li { margin-bottom: 8px; }
.hint kbd {
  font: 600 11px/1 var(--sans);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--paper);
}

/* ---------- tooltip ECharts (classe injectée) ---------- */
.sankey-tip {
  max-width: 340px;
  white-space: normal !important;
  font-family: var(--sans);
}
.sankey-tip .tip-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.sankey-tip .tip-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.sankey-tip .tip-note {
  font-size: 12px;
  color: var(--ink-soft);
  border-top: 1px dashed var(--rule);
  padding-top: 4px;
  margin-top: 2px;
}

/* ---------- méthodologie / footer ---------- */
.metho {
  max-width: 1180px;
  margin: 26px auto 40px;
  padding: 0 20px;
  color: var(--ink-soft);
  font-size: 13px;
}
.metho details {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 16px;
}
.metho summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
}
.metho ul { margin: 10px 0 4px; padding-left: 20px; }
.metho li { margin-bottom: 6px; }
.metho h4 {
  font-family: var(--serif);
  font-size: 15px;
  margin: 18px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--accent);
}
.metho h4:first-of-type { border-top: 0; padding-top: 4px; margin-top: 8px; }
.metho .src { font-size: 12px; }
.credits { margin-top: 14px; font-size: 12px; }

/* ---------- signalement d'erreur ---------- */
.report-btn {
  font: 600 12px/1 var(--sans);
  color: var(--accent);
  background: var(--paper);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  margin-left: 10px;
  cursor: pointer;
}
.report-btn:hover { background: #FCEDF4; }
.report-dlg {
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 20px 22px;
  max-width: 460px;
  width: calc(100vw - 40px);
  font-family: var(--sans);
  color: var(--ink);
}
.report-dlg::backdrop { background: rgba(30, 36, 48, .45); }
.report-dlg h3 { font-family: var(--serif); margin: 0 0 6px; }
.report-hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
.report-dlg label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.report-dlg textarea, .report-dlg input {
  width: 100%;
  font: 400 14px/1.4 var(--sans);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 4px;
  box-sizing: border-box;
  background: var(--bg);
}
.report-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.report-send { background: var(--accent); color: #fff; border-color: var(--accent); }
.report-status { font-size: 13px; font-weight: 600; color: var(--accent); }@media (max-width: 720px) {
  #chart { height: 560px; }
  .standfirst { font-size: 14px; }
}

/* ============ page Mondrian : en-tête compact (le chart doit se voir
   sans scroller sur un écran de portable) ============ */
.mondrian .masthead { padding: 22px 20px 14px; }
.mondrian h1 { font-size: clamp(26px, 3.2vw, 38px); margin-bottom: 6px; }
.mondrian .standfirst { font-size: 14px; max-width: 940px; }
.mondrian .statband { margin-top: 8px; }@media (max-width: 640px) {
  /* le switch en pile : libellé / interrupteur / libellé, centrés */
  
  .mode-caption { text-align: center; }
}

/* ---------- sélecteur de phase à 3 positions (Mondrian) ---------- */
.mode-steps {
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
  border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden;
  width: fit-content; background: var(--paper);
}
.mode-step {
  font: 600 13px/1.2 var(--sans); color: var(--ink-soft);
  background: transparent; border: 0; cursor: pointer;
  padding: 9px 16px; display: flex; align-items: center; gap: 7px;
  border-right: 1px solid var(--rule); transition: background .15s, color .15s;
}
.mode-step:last-of-type { border-right: 0; }
.mode-step:hover { background: #F5EFE2; color: var(--ink); }
.mode-step.active { background: var(--ink); color: #FAF6EF; }
.mode-step.active .step-n { background: #F5E663; color: var(--ink); }
.step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 999px; flex: 0 0 auto;
  background: var(--rule); color: var(--ink); font-weight: 800; font-size: 11px;
}
.mode-steps .mode-info { margin: 4px 8px 4px 4px; align-self: center; }@media (max-width: 640px) {
  .mode-steps { width: 100%; border-radius: 12px; flex-wrap: nowrap; }
  .mode-step { flex: 1 1 0; padding: 8px 6px; font-size: 11px; line-height: 1.15; justify-content: center; text-align: center; gap: 5px; }
  .mode-step .step-n { width: 16px; height: 16px; font-size: 10px; }
  .mode-steps .mode-info { display: none; }          /* le bloc « calcul » et la légende y mènent */
  .mode-bar { position: relative; }
}

/* ---------- incitation + liens des trois lectures ---------- */
.steps-lead { margin: 0 0 7px; font-size: 13px; color: var(--ink-soft); }
.steps-lead strong { color: var(--ink); }
.mode-caption .phase-link {
  color: var(--accent); font-weight: 700; cursor: pointer;
  border-bottom: 1.5px solid rgba(193, 59, 85, .35); white-space: nowrap;
}
.mode-caption .phase-link:hover { border-bottom-color: var(--accent); }
/* pastille de rappel « il y a trois vues » sur le sélecteur */
@keyframes stepPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(193,59,85,.0); }
  50% { box-shadow: 0 0 0 4px rgba(193,59,85,.16); } }
.mode-steps { animation: stepPulse 2.4s ease-in-out 1.2s 3; }

/* ---------- table du calcul (dialogue « ? ») ---------- */
.dlg-calc-title { font-weight: 700; margin: 14px 0 4px; color: var(--accent); }
.dlg-calc { border-collapse: collapse; width: 100%; font-size: 14px; }
.dlg-calc td { padding: 4px 0; border-bottom: 1px dashed var(--rule); vertical-align: top; }
.dlg-calc td:last-child { text-align: right; font-weight: 700; white-space: nowrap; padding-left: 14px; }
.dlg-calc .dlg-calc-tot td { border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 7px; }
.dlg-note { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; line-height: 1.5; }
/* (ancienne ligne « par habitant » du bandeau : intégrée à la ligne de totaux) */

/* panneau retraites : part au-delà du taux privé, en second dans la même cellule */

.dlg-calc .dlg-calc-tot td:last-child { color: #8E1B38; font-size: 15px; }

/* ==========================================================================
   LE FIL (index.html) — le récit en sept temps
   Une section par temps : texte à gauche (question → réponse), figure à droite
   (le chiffre, la vignette SVG, la légende). Tout en tokens du site.
   ========================================================================== */
.fil .masthead .standfirst.fil-these { max-width: 860px; font: 400 19px/1.55 var(--serif); color: var(--ink); }
.fil .masthead .standfirst.fil-these strong { color: var(--accent); font-weight: 700; }
.fil-main { max-width: 1180px; margin: 0 auto; padding: 8px 20px 20px; }

.temps {
  display: block;
  padding: 40px 0 44px;
  border-bottom: 1px solid var(--rule);
}
.temps:last-of-type { border-bottom: 0; }
.temps-text p.temps-kicker {           /* spécificité ≥ .temps-text p (sinon 16,5 px) */
  font-size: 12px; line-height: 1.4; letter-spacing: .18em; text-transform: uppercase; font-weight: 700;
  color: var(--accent); margin: 0 0 8px;
}
.temps h2 {
  font-family: var(--serif);
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.12;
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.temps h2 .hl {
  background: linear-gradient(transparent 58%, #F5E663 58%, #F5E663 94%, transparent 94%);
  padding: 0 4px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.temps-text p { margin: 0 0 14px; font-size: 17px; line-height: 1.62; color: var(--ink); max-width: 60ch; }
.temps-text p strong { font-weight: 700; font-variant-numeric: tabular-nums; }
/* l'exergue : une phrase courte entre le fait et ce qu'il cache */
.temps-text p.temps-exergue {
  font: 400 21px/1.35 var(--serif); color: var(--ink); margin: 18px 0 18px;
  padding-left: 14px; border-left: 4px solid #8E1B38; max-width: 40ch;
}
.temps-text .cr { color: #8E1B38; }
.temps-cta {
  display: inline-block;
  font: 700 15px/1 var(--sans);
  color: var(--accent);
  background: var(--paper);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 18px;
  text-decoration: none;
  transition: background .15s, color .15s;
  margin: 2px 8px 10px 0;
}
.temps-cta:hover { background: var(--accent); color: #fff; }
.temps-text p.temps-note {
  margin-top: 14px; padding: 12px 14px;
  background: var(--paper); border-left: 4px solid var(--rule);
  font-size: 14px; line-height: 1.55; color: var(--ink-soft);
}
.temps-note b { color: var(--ink); }
.temps-text p.temps-ctas { margin-top: 18px; }

/* ---------- la scène : le vrai graphique, collant, piloté par le temps en cours ---------- */
.fil-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 1.15fr); gap: 0 44px; align-items: start; }
.fil-text { grid-column: 1; grid-row: 1; min-width: 0; }
.fil-stage {
  grid-column: 2; grid-row: 1; position: sticky; top: 60px; height: calc(100vh - 76px); min-height: 460px;
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(30,36,48,.10);
}
.stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 14px; border-bottom: 1px solid var(--rule); background: var(--bg);
}
.stage-title { font: 700 12px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.stage-open { font: 700 13px/1 var(--sans); color: var(--accent); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--accent); border-radius: 999px; padding: 7px 12px; }
.stage-open:hover { background: var(--accent); color: #fff; }
.stage-body { position: relative; flex: 1 1 auto; min-height: 0; background: var(--bg); }
.stage-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
/* masqué mais dimensionné : ECharts s'initialise à la bonne taille dans le cadre caché */
.stage-frame[hidden] { display: block; visibility: hidden; pointer-events: none; }
.stage-svg { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 18px 24px; overflow: auto; }
.stage-svg[hidden] { display: none; }
.stage-panel { display: flex; flex-direction: column; gap: 6px; }
.stage-svg .fil-svg { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; min-height: 0; }
.stage-svg .fil-svg svg { display: block; width: 100%; height: auto; max-height: 230px; margin: 0 auto; }
.stage-cap { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.stage-cap b { color: var(--ink); font-size: 14px; }
.stage-more { font-size: 12px; color: var(--ink-soft); line-height: 1.4; margin: 0; }
.stage-more summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); list-style: none; }
.stage-more summary::before { content: "▸ "; }
.stage-more[open] summary::before { content: "▾ "; }
.stage-more p { margin: 4px 0 0; }
.fil-svg {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 6px;
  min-height: 110px;               /* place réservée avant le chargement de la donnée */
}
.fil-svg svg { display: block; width: 100%; height: auto; }
.fil-caisses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }
.fil-caisses li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: baseline; }
.fil-caisses b { font-family: var(--serif); font-size: 18px; color: #8E1B38; text-align: right; font-variant-numeric: tabular-nums; }

/* temps 7 — la sortie : une seule carte, PLEINE LARGEUR (hors de la grille texte/scène) */
.temps-fin { display: block; padding: 56px 0 30px; }
.fil-exit {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 28px 48px; align-items: start;
  background: var(--paper); border: 1px solid var(--rule); border-top: 4px solid #8E1B38; border-radius: 14px;
  padding: 30px 36px 28px; box-shadow: 0 2px 16px rgba(30,36,48,.07);
}
.fil-exit h2 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.12; margin: 6px 0 16px; max-width: 22ch; }
.fil-exit .fil-these { font: 400 18px/1.55 var(--serif); color: var(--ink); max-width: 64ch; margin: 0 0 16px; }
.fil-exit-nums { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 16px; }
.fil-exit-nums > span { display: flex; flex-direction: column; gap: 2px; }
.fil-exit-nums b { font: 700 24px/1.1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.fil-exit-nums small { font-size: 13px; color: var(--ink-soft); }
.fil-exit-src { font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; }
.fil-exit-links { font-size: 14px; color: var(--ink-soft); margin: 0; }
.fil-exit-links a, .fil-exit-links .linklike { color: var(--accent); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.fil-exit-links a:hover, .fil-exit-links .linklike:hover { text-decoration: underline; }
.fil-toast { color: var(--ink-soft); }
.fil-exit-tools { display: flex; flex-direction: column; gap: 12px; padding-top: 34px; }
.fil-tool {
  display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
  text-decoration: none; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; padding: 10px;
  transition: border-color .15s, transform .15s;
}
.fil-tool:hover { border-color: var(--ink); transform: translateY(-2px); }
.fil-tool img { width: 96px; height: 64px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--rule); }
.fil-tool b { display: block; color: var(--accent); font-size: 15px; }
.fil-tool small { display: block; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }

/* le rail 1-7 : points + titres, collant à droite (desktop), barre en bas (mobile) */
.fil-rail { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 30; display: flex; flex-direction: column; gap: 6px; }
.fil-rail a { display: flex; align-items: center; gap: 8px; flex-direction: row; text-decoration: none; color: var(--ink-soft); font: 700 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.fil-rail a span { opacity: 0; transition: opacity .15s; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 8px; }
.fil-rail a:hover span, .fil-rail a.is-current span { opacity: 1; }
.fil-rail a i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink-soft); background: var(--bg); flex: none; }
.fil-rail a.is-current i { background: #8E1B38; border-color: #8E1B38; }
.fil-rail a.is-current { color: var(--ink); }@media (max-width: 1280px) {
  .fil-rail { top: auto; right: 0; left: 0; bottom: 0; transform: none; flex-direction: row; justify-content: center; gap: 14px;
    padding: 8px 12px; background: rgba(250,246,239,.94); border-top: 1px solid var(--rule); backdrop-filter: blur(4px); }
  .fil-rail a span { display: none; }
  .fil-rail a i { width: 12px; height: 12px; }
  .fil-main { padding-bottom: 60px; }
}@media (max-width: 900px) {
  /* mobile : la scène se colle sous la barre de navigation, le texte défile dessous */
  .fil-layout { grid-template-columns: 1fr; }
  .fil-stage { grid-column: 1; grid-row: 1; }
  .fil-text { grid-column: 1; grid-row: 2; }
  .fil-stage { top: 48px; height: 50vh; min-height: 340px; border-radius: 0 0 12px 12px; z-index: 25; margin: 0 -20px; }
  .stage-head { padding: 7px 12px; }
  .stage-title { font-size: 11px; }
  .stage-svg { padding: 10px 12px; gap: 8px; justify-content: flex-start; }
  .stage-panel { gap: 4px; }
  .stage-cap .cap-more { display: none; }
  .stage-cap b { font-size: 13px; }
  .stage-svg .fil-svg { padding: 4px 6px; }
  .stage-svg .fil-svg svg { max-height: 132px; }
  .stage-more { display: none; }
  .temps { padding: 30px 0 34px; }
  .temps-text p { font-size: 16px; }
  .temps-text p.temps-exergue { font-size: 19px; }
  .fil-exit { grid-template-columns: 1fr; padding: 20px 18px; }
  .fil-exit-tools { padding-top: 0; }
  .temps-fin { padding-top: 30px; }
  .fil .masthead h1 { font-size: 26px; }
  .fil .masthead .standfirst.fil-these { font-size: 17px; }
}

/* ==========================================================================
   LA COUCHE LEXICALE (lexique.js) — termes soulignés pointillés + fiche
   ========================================================================== */
abbr.lex {
  text-decoration: none;
  border-bottom: 1.5px dotted var(--accent);
  cursor: help;
  padding-bottom: 1px;
}
abbr.lex:hover, abbr.lex:focus-visible, abbr.lex[aria-expanded="true"] {
  background: #FBF2A3;
  outline: none;
  border-bottom-style: solid;
}
.lex-pop {
  position: absolute;
  z-index: 60;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(30, 36, 48, .18);
  padding: 12px 14px 10px;
  font: 14px/1.5 var(--sans);
}
.lex-pop::before {
  content: ""; position: absolute; left: calc(50% - 6px); top: -7px;
  width: 12px; height: 12px; background: var(--paper);
  border-left: 1px solid var(--ink); border-top: 1px solid var(--ink);
  transform: rotate(45deg);
}
.lex-pop.above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.lex-pop p { margin: 0 0 6px; }
.lex-pop p:last-child { margin-bottom: 0; }
.lex-pop .lex-t { font-family: var(--serif); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lex-pop .lex-m { font: 700 10px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.lex-pop .lex-d { color: var(--ink); }
.lex-pop .lex-p, .lex-pop .lex-i { color: var(--ink-soft); font-size: 13px; padding-left: 64px; position: relative; }
.lex-pop .lex-p span, .lex-pop .lex-i span {
  position: absolute; left: 0; top: 2px;
  font: 700 10px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}@media (hover: none) { abbr.lex { cursor: pointer; } }

/* ==========================================================================
   MODE EMBED (?embed=1) — l'outil dans la scène du fil : le graphique seul
   ========================================================================== */
body.embed .site-nav, body.embed .masthead, body.embed footer.metho, body.embed .hint,
body.embed #compare-panel, body.embed .mode-bar, body.embed #calc-block, body.embed .these-banner,
body.embed .chart-hint, body.embed #panel-retraites { display: none !important; }body.embed main { padding: 6px 8px 8px; max-width: none; margin: 0; }
body.embed .breadcrumb { margin: 0 0 6px; }
body.embed .breadcrumb:has(.crumb:only-child) { display: none; }   /* « Vue d'ensemble » seul n'apporte rien en scène */
body.embed #chart, body.embed #chart-stage, body.embed #treemap { border-radius: 8px; box-shadow: none; }
body.embed .stage-wrap { gap: 6px; }
/* en scène, la carte historique se fait compacte : l'addition et les deux mini-graphiques, sans la note longue */
body.embed .histo-card { margin: 0 0 8px; padding: 8px 12px; gap: 10px; }
body.embed .histo-card h3 { font-size: 14px; margin: 0 0 2px; }
body.embed .histo-card .histo-verdict { font-size: 16px; margin: 0 0 3px; }
body.embed .histo-card .histo-punch { font-size: 12px; line-height: 1.35; margin: 0 0 2px; }
body.embed .histo-card .histo-note { display: none; }
body.embed .histo-card .histo-charts svg { max-height: 118px; width: auto; }
