/* Le vertige des ancêtres
   Papier d'atlas froid, encre bleu-nuit, outremer pour l'interaction, or pour l'implexe.
   L'arbre est le seul élément saturé de la page. */

/* Jetons, remise à zéro et utilitaires communs : voir base.css. */

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon .fill, .icon use { fill: inherit; }
.icon-play, .icon-pause { fill: currentColor; stroke: none; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .45rem .85rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink);
  font-size: .9375rem; line-height: 1.2; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-soft); background: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { border-color: var(--rule-strong); background: var(--sheet); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--accent-wash); border-color: transparent; }

.btn-play { min-width: 7.5rem; }
.btn-play .icon-pause { display: none; }
.btn-play[aria-pressed="true"] .icon-play { display: none; }
.btn-play[aria-pressed="true"] .icon-pause { display: block; }

/* ---------- Structure ---------- */

.app { min-height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; }

.stage-tools { display: flex; align-items: center; gap: .25rem; padding: .25rem 1.25rem; border-bottom: 1px solid var(--rule); }
.stage-title { margin-right: auto; font-size: 1rem; font-weight: 700; }
body.is-presenting .stage-tools, body.is-presenting .step-bar { display: none; }

.view[hidden] { display: none !important; }

.view-explorer {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr) 22.5rem;
  min-height: 0;
}

@media (min-width: 760px) {
  .app { height: 100dvh; }
  main { min-height: 0; overflow: hidden; }
  .view-explorer { height: 100%; }
}

/* ---------- Frise ---------- */

.col-timeline {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--sheet); border-right: 1px solid var(--rule);
}
.tl-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
  padding: .9rem 1rem .75rem; border-bottom: 1px solid var(--rule);
}
.tl-title { font-family: var(--font-display); font-weight: 500; font-size: 1.3125rem; line-height: 1.15; }
.tl-now { font-size: .8125rem; color: var(--ink-soft); margin-top: .15rem; }
.tl-close { display: none; }

.tl-scroll {
  position: relative; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  overflow-x: hidden; /* le calque des traits est mesuré avant l'apparition de la barre verticale */
}
.tl-track { position: relative; cursor: pointer; }

.tl-era { position: absolute; left: 0; right: 0; background: var(--wash); }
.tl-era::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--tone); }
.tl-era-heads { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.tl-era-head {
  position: absolute; left: 82px; right: 10px;
  font-family: var(--font-display); font-size: 1.0625rem; line-height: 1.15;
  color: var(--era-ink);
}
.tl-era-head small { display: block; font-family: var(--font-ui); font-style: normal; font-size: .75rem; margin-top: .1rem; }

.tl-axis { position: absolute; top: 0; bottom: 0; left: 61px; width: 2px; background: rgba(28, 31, 34, .45); }

.tl-tick { position: absolute; left: 56px; width: 5px; height: 1px; background: rgba(28, 31, 34, .35); }
.tl-tick.is-major { left: 50px; width: 11px; background: rgba(28, 31, 34, .6); }
.tl-tick-label {
  position: absolute; right: 16px; top: 0; transform: translateY(-50%);
  font-family: var(--font-display); font-size: .8125rem; line-height: 1.05; text-align: right; white-space: nowrap;
  color: var(--ink-soft); font-variant-numeric: lining-nums;
}
.tl-tick-label b { display: block; color: var(--ink); font-family: var(--font-ui); font-size: .6875rem; }

.tl-marker {
  position: absolute; left: 0; right: 0; top: 0; height: 30px;
  background: rgba(61, 90, 115, .1);
  border-top: 1px solid rgba(61, 90, 115, .5); border-bottom: 1px solid rgba(61, 90, 115, .5);
  transition: transform .45s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none; z-index: 1;
}
.tl-marker-label {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  background: var(--accent); color: #fff; border-radius: 4px;
  padding: .1rem .35rem; font-size: .75rem; font-weight: 700; line-height: 1.3; white-space: nowrap;
}

/* Courbes : positions 2ⁿ face à la population, en log10 de gauche à droite, sous les repères. */

.tl-dots, .tl-leaders { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; }
.tl-leaders path { fill: none; stroke: rgba(28, 31, 34, .45); stroke-width: 1; }
.tl-dot {
  position: absolute; left: 57px; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; border: 2px solid var(--ink); background: var(--sheet);
}
.tl-dot.is-certaine { background: var(--ink); }
.tl-dot.is-traditionnelle { background: linear-gradient(90deg, var(--ink) 50%, var(--sheet) 50%); }
.tl-dot.is-hypothetique { border-style: dotted; }
.tl-range { position: absolute; left: 60px; width: 4px; background: var(--ink); border-radius: 2px; }

.tl-events { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tl-ev { position: absolute; left: 76px; right: 8px; pointer-events: auto; }
.tl-ev-btn {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: .3rem .5rem; border-radius: var(--radius);
  border: 1px solid transparent; background: rgba(251, 251, 251, .82);
}
.tl-ev-btn:hover { background: #fff; border-color: var(--rule-strong); }
.tl-ev-title { display: block; font-weight: 700; font-size: .84375rem; line-height: 1.2; }
.tl-ev-date { display: block; font-family: var(--font-display); font-size: .875rem; line-height: 1.25; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.tl-ev-date::first-letter { text-transform: uppercase; }
.tl-ev.is-near .tl-ev-btn { background: #fff; border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

.tl-hide-events .tl-ev:not(.tl-today), .tl-hide-events .tl-dots, .tl-hide-events .tl-leaders { display: none; }

.tl-foot { padding: .6rem 1rem .75rem; border-top: 1px solid var(--rule); font-size: .75rem; color: var(--ink-soft); }
.tl-foot p { margin-bottom: .4rem; }
.tl-legend-toggle { min-height: 24px; margin: 0 0 .2rem; padding: 0; font-size: .72rem; font-weight: 400; color: var(--ink-faint); gap: .3rem; }
.tl-legend-toggle:hover { background: none; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.tl-legend-toggle::before { content: ""; width: .35em; height: .35em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.tl-legend-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.tl-legend-body { margin-top: .1rem; }
.tl-legend { display: flex; flex-wrap: wrap; gap: .2rem .8rem; list-style: none; margin: 0; padding: 0; }
.tl-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.tl-legend .tl-dot { position: static; margin: 0; }
.tl-legend + .tl-legend { margin-top: .3rem; }

/* « Connu par » : une icône par événement, son libellé au survol (ou au focus du bouton). */
.tl-basis {
  position: relative; display: inline-flex; width: 15px; height: 15px; margin-left: .15rem; vertical-align: -2px;
  color: var(--ink-soft); cursor: help;
}
.tl-basis svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tl-basis.is-ecrits { color: var(--accent); }
.tl-basis.is-archeologie { color: var(--gold-ink); }
.tl-legend .tl-basis { margin: 0; cursor: default; }
/* Infobulle placée par js/timeline.js, en position fixe : elle ne sort jamais de la fenêtre. */
.tl-tip {
  position: fixed; z-index: 950; max-width: min(15rem, calc(100vw - 16px));
  padding: .3rem .5rem; border-radius: 4px; background: var(--ink); color: var(--sheet);
  font: 500 .75rem/1.35 var(--font-ui); pointer-events: none; box-shadow: var(--shadow-float);
}

/* ---------- Scène de l'arbre ---------- */

.col-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage {
  position: relative; flex: 1 1 auto; min-height: 0; margin: 0; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 100%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 70%),
    var(--paper);
}
.stage:focus-visible { outline-offset: -4px; }
.stage-canvas, .stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-svg { overflow: visible; }

.person { cursor: help; }
.person-disc { stroke: rgba(255, 255, 255, .9); stroke-width: .08; }
.person-sil { fill: #fff; }
.person.is-tiny .person-sil { display: none; }
.person-root .person-disc { stroke: var(--paper); stroke-width: .1; }
.person-ring { fill: none; stroke: var(--ink); stroke-width: .06; }
.person-label { font-family: var(--font-ui); font-size: 12px; fill: var(--ink-soft); text-anchor: middle; pointer-events: none; }

.stage-hud { position: absolute; top: 14px; left: 20px; pointer-events: none; }
.hud-gen { display: flex; align-items: baseline; gap: .45rem; }
.hud-gen-word { font-size: .8125rem; color: var(--ink-soft); }
.hud-gen-num {
  font-family: var(--font-display); font-weight: 500; font-size: 2.625rem; line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.hud-year { font-family: var(--font-display); font-size: 1.1875rem; line-height: 1.2; margin-top: .1rem; }
.hud-count { font-family: var(--font-display); font-size: 1rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }

.stage-legend { position: absolute; top: 16px; right: 20px; width: min(19rem, 46%); text-align: right; pointer-events: none; }
.legend-mode { font-weight: 700; font-size: .875rem; }
.legend-text { margin-top: .15rem; font-size: .8125rem; line-height: 1.4; color: var(--ink-soft); }

.stage-hint {
  position: absolute; left: 0; right: 0; bottom: 6px; text-align: center;
  font-size: .8125rem; color: var(--ink-faint); pointer-events: none; transition: opacity .5s;
}
.stage-hint.is-gone { opacity: 0; }
.hint-touch { display: none; }

.stage-error {
  position: absolute; inset: 30% 10% auto; padding: 1rem 1.25rem; text-align: center;
  background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius);
}

.tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  max-width: 17rem; padding: .5rem .7rem;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  font-size: .8125rem; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip strong { display: block; font-size: .875rem; }
.tooltip span { display: block; color: #d4d8dc; }

/* ---------- Commandes ---------- */

.controls {
  display: grid; gap: .55rem;
  padding: .7rem 1.25rem .85rem;
  border-top: 1px solid var(--rule); background: var(--paper);
}
.slider-wrap { display: grid; gap: .15rem; }
.slider-ends { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--font-display); font-size: .9375rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.control-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.btn-timeline { display: none; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: 5px;
  background: var(--track, var(--rule));
  box-shadow: inset 0 0 0 1px rgba(28, 31, 34, .18);
}
input[type="range"]::-moz-range-track {
  height: 10px; border-radius: 5px;
  background: var(--track, var(--rule));
  box-shadow: inset 0 0 0 1px rgba(28, 31, 34, .18);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -6px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(28, 31, 34, .3);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(28, 31, 34, .3);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent); }

/* ---------- Statistiques ---------- */

.col-stats {
  min-height: 0; overflow-y: auto; scrollbar-width: thin;
  padding: 1.1rem 1.5rem 2.5rem;
  background: var(--sheet); border-left: 1px solid var(--rule);
}
.st-head { padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.st-kin { font-family: var(--font-display); font-weight: 500; font-size: 1.75rem; line-height: 1.1; }
.st-kin-hint { font-size: .8125rem; color: var(--ink-soft); margin-top: .15rem; }
.st-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; margin-top: .4rem; }
.st-year { font-family: var(--font-display); font-weight: 600; font-size: 1.3125rem; font-variant-numeric: lining-nums; }
.st-ago { font-family: var(--font-display); font-size: 1.0625rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.st-era {
  display: inline-block; margin-top: .45rem; padding: .1rem .5rem;
  border-radius: 4px; background: var(--era-wash, var(--paper)); color: var(--era-ink, var(--ink));
  font-size: .8125rem; font-weight: 700;
}

.st-section { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.st-section:last-child { border-bottom: 0; }
.st-h { display: flex; align-items: center; gap: .45rem; font-size: .8125rem; font-weight: 700; color: var(--ink-soft); margin-bottom: .35rem; }
.st-h-strong { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.2; margin-bottom: .35rem; }
.st-swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--gen-color); flex: none; }

.st-big {
  font-family: var(--font-display); font-weight: 500;
  font-size: 2.75rem; line-height: 1.02; letter-spacing: -.01em;
  font-variant-numeric: lining-nums; text-wrap: balance;
}
.st-big.is-flash { animation: st-flash .6s ease-out; }
@keyframes st-flash { from { color: var(--accent); } to { color: var(--ink); } }
.st-formula { margin-top: .35rem; font-size: .875rem; color: var(--ink-soft); }
.st-formula sup { font-size: .7em; }
.st-exact {
  margin-top: .6rem; padding: .55rem .7rem;
  border-left: 3px solid var(--gen-color); background: var(--paper);
  font-family: var(--font-display); font-size: 1.0625rem; line-height: 1.4; letter-spacing: .02em;
  font-variant-numeric: lining-nums tabular-nums; overflow-wrap: anywhere; color: var(--ink);
}
.st-mid { font-family: var(--font-display); font-weight: 500; font-size: 1.75rem; line-height: 1.1; font-variant-numeric: lining-nums; }
.st-text { font-size: .9375rem; line-height: 1.55; }
.st-note { font-size: .8125rem; color: var(--ink-soft); margin-top: .3rem; }
.st-range { font-size: .8125rem; color: var(--ink-soft); margin: .6rem 0 .5rem; }
.st-caution { font-size: .8125rem; color: var(--ink-soft); margin-top: .6rem; line-height: 1.45; }
.st-callout {
  margin-top: .7rem; padding: .6rem .75rem;
  border-left: 3px solid var(--gold); background: var(--gold-wash);
  font-size: .9375rem; line-height: 1.5;
}

.vs { display: grid; grid-template-columns: 112px 1fr; gap: .9rem; align-items: end; margin-top: .35rem; }
.vs-svg { width: 112px; height: 112px; display: block; }
.vs-tree { fill: var(--gen-color); }
.vs-world { fill: url(#vs-hatch); stroke: var(--ink); stroke-width: 1; }
.vs-ring { fill: none; stroke: var(--gold); stroke-width: 1.5; }
.vs-legend { margin: 0; display: grid; gap: .5rem; font-size: .8125rem; }
.vs-legend dt { color: var(--ink-soft); line-height: 1.3; }
.vs-legend dd { margin: .1rem 0 0 1.05rem; font-family: var(--font-display); font-size: 1.125rem; line-height: 1.2; font-variant-numeric: lining-nums; }
.sw { display: inline-block; width: 11px; height: 11px; margin-right: .4rem; vertical-align: -1px; }
.sw-tree { background: var(--gen-color); }
.sw-world { background: repeating-linear-gradient(45deg, var(--ink) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1px var(--ink); }

.ev-title { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.2; }
.ev-date { font-family: var(--font-display); font-size: 1rem; color: var(--ink-soft); margin: .1rem 0 .4rem; font-variant-numeric: lining-nums; }
.ev-date::first-letter { text-transform: uppercase; }
.ev-person { margin-top: .5rem; font-size: .8125rem; line-height: 1.45; color: var(--gold-ink); }

.ladder { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: 1px; }
.ladder button {
  display: grid; grid-template-columns: 2.6rem 1fr; align-items: baseline; gap: .5rem;
  width: 100%; padding: .35rem .4rem; text-align: left; cursor: pointer;
  border: 0; border-radius: 4px; background: none;
}
.ladder button:hover:not(:disabled) { background: var(--accent-wash); }
.ladder button:disabled { cursor: default; }
.ladder-gen {
  font-family: var(--font-display); font-size: 1.1875rem; line-height: 1; text-align: right;
  font-variant-numeric: lining-nums tabular-nums; color: var(--ink-faint);
}
.ladder-label { font-size: .875rem; line-height: 1.3; }
.ladder-label small { display: block; font-size: .75rem; color: var(--ink-soft); }
.ladder .is-passed .ladder-gen { color: var(--ink); }
.ladder .is-passed .ladder-label::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.ladder .is-next button { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.ladder .is-next .ladder-gen { color: var(--accent); }
.ladder .is-future .ladder-label { color: var(--ink-soft); }
.ladder .is-crossing .ladder-label { font-weight: 700; }

/* Pastilles des réglages. */
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span {
  display: inline-flex; align-items: center; min-height: 40px; padding: .4rem .9rem;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--sheet); cursor: pointer;
}
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Réglages ---------- */

dialog.settings {
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  padding: 0; border: 0; border-radius: 10px;
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-float);
}
dialog.settings::backdrop { background: rgba(28, 31, 34, .4); }
.settings-head, .settings-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; }
.settings-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.625rem; }
.settings fieldset { border: 0; border-top: 1px solid var(--rule); margin: 0; padding: 1rem 1.25rem; }
.settings legend { float: left; width: 100%; padding: 0; margin-bottom: .6rem; font-weight: 700; }
.settings legend + * { clear: both; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.hint { font-size: .8125rem; color: var(--ink-soft); margin-top: .6rem; }
.range-row { display: flex; align-items: center; gap: .9rem; }
.range-row output { font-family: var(--font-display); font-size: 1.5rem; min-width: 2.5ch; text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.settings-foot { border-top: 1px solid var(--rule); }

/* ---------- Divers ---------- */

.backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(28, 31, 34, .35); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  max-width: min(30rem, calc(100vw - 2rem)); padding: .7rem 1rem;
  background: var(--ink); color: #fff; border-radius: 8px; box-shadow: var(--shadow-float);
  font-size: .9375rem; opacity: 0; pointer-events: none;
  transform: translate(-50%, 12px); transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablette : la frise devient un tiroir ---------- */

@media (max-width: 1179px) {
  .view-explorer { grid-template-columns: minmax(0, 1fr) 21rem; }
  .col-timeline {
    position: fixed; z-index: 850; top: 0; bottom: 0; left: 0;
    width: min(22rem, 88vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .28s ease, visibility 0s linear .28s;
    box-shadow: var(--shadow-float);
  }
  .col-timeline.is-open { transform: none; visibility: visible; transition: transform .28s ease; }
  .tl-close { display: inline-flex; }
  .btn-timeline { display: inline-flex; }
  .label-long { display: none; }
}

/* ---------- Mobile ---------- */

@media (max-width: 759px) {
  .nav-long { display: none; }
  .label-today { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .view-explorer { display: block; }
  .col-stage { display: block; }
  .stage { height: 62svh; min-height: 380px; }
  .stage-hud { top: 10px; left: 12px; }
  .hud-gen-num { font-size: 2.125rem; }
  .stage-legend { top: 12px; right: 12px; width: 45%; }
  .legend-text { display: none; }
  .stage-hint { font-size: .75rem; padding: 0 1rem; }
  .hint-pointer { display: none; }
  .hint-touch { display: inline; }
  .controls { padding: .6rem .75rem .75rem; }
  .control-buttons { gap: .35rem; }
  .control-buttons .btn { padding: .45rem .6rem; }
  .btn-play { min-width: 0; }
  .col-stats { border-left: 0; border-top: 1px solid var(--rule); padding: 1rem 1rem 3rem; }

}

/* ---------- Mode présentation ----------
   L'arbre occupe tout l'écran ; les chiffres clés sont lisibles depuis le fond d'une salle. */

.pres-top, .pres-bottom { display: none; }

body.is-presenting .site-header,
body.is-presenting .col-timeline,
body.is-presenting .col-stats,
body.is-presenting .controls,
body.is-presenting .stage-hud,
body.is-presenting .stage-hint,
body.is-presenting .backdrop { display: none !important; }

body.is-presenting .app { height: 100dvh; min-height: 0; grid-template-rows: minmax(0, 1fr); }
body.is-presenting main { min-height: 0; overflow: hidden; }
body.is-presenting .view-explorer,
body.is-presenting .col-stage { display: block; height: 100%; }
body.is-presenting .stage { height: 100dvh; min-height: 0; }

body.is-presenting .pres-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start; gap: 2rem;
  padding: clamp(1rem, 3vh, 2.25rem) clamp(1.25rem, 3.5vw, 3.5rem) 0;
  pointer-events: none;
}
.pres-label { font-size: clamp(.9rem, 1.8vh, 1.25rem); color: var(--ink-soft); }
.pres-gen-num {
  font-family: var(--font-display); font-weight: 500; line-height: .88; letter-spacing: -.02em;
  font-size: clamp(4rem, 13vh, 9.5rem); font-variant-numeric: lining-nums tabular-nums;
}
.pres-year { font-family: var(--font-display); font-size: clamp(1.4rem, 3.8vh, 2.75rem); line-height: 1.1; margin-top: .2rem; font-variant-numeric: lining-nums; }

.pres-numbers { text-align: center; }
.pres-positions {
  font-family: var(--font-display); font-weight: 500; line-height: 1; letter-spacing: -.01em;
  font-size: clamp(2.6rem, 9vh, 7rem); font-variant-numeric: lining-nums; text-wrap: balance;
}
.pres-positions-label { font-size: clamp(1rem, 2.2vh, 1.5rem); color: var(--ink-soft); margin-top: .25rem; }
.pres-positions-label::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .4em; border-radius: 50%; background: var(--gen-color); vertical-align: -.05em; }
.pres-pop { font-family: var(--font-display); font-size: clamp(1.15rem, 2.8vh, 2rem); margin-top: .6rem; font-variant-numeric: lining-nums; }

.pres-event { text-align: right; justify-self: end; max-width: 26rem; }
.pres-era {
  display: inline-block; padding: .15rem .6rem; border-radius: 4px;
  background: var(--era-wash, var(--sheet)); color: var(--era-ink, var(--ink));
  font-size: clamp(.85rem, 1.7vh, 1.1rem); font-weight: 700;
}
.pres-event-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.45rem, 3.6vh, 2.6rem); line-height: 1.08; margin-top: .45rem; text-wrap: balance; }
.pres-event-date { font-family: var(--font-display); font-size: clamp(1.05rem, 2.3vh, 1.6rem); color: var(--ink-soft); margin-top: .2rem; font-variant-numeric: lining-nums; }
.pres-event-date::first-letter { text-transform: uppercase; }
.pres-event-note { font-size: clamp(.85rem, 1.6vh, 1.05rem); color: var(--gold-ink); margin-top: .35rem; }

body.is-presenting .pres-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(.6rem, 1.6vh, 1.1rem);
  padding: 0 clamp(1rem, 3.5vw, 3.5rem) clamp(.9rem, 2.4vh, 1.75rem);
}
.pres-message {
  justify-self: center; max-width: min(44ch, 100%); text-align: center; text-wrap: balance;
  font-family: var(--font-display); font-size: clamp(1.25rem, 3.1vh, 2.2rem); line-height: 1.25;
}
.pres-controls { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pres-nav { display: flex; gap: .5rem; }
.pres-btn { min-height: 52px; min-width: 52px; font-size: 1.125rem; }
.pres-btn .icon { width: 24px; height: 24px; }
.pres-play { min-width: 9rem; }
.pres-tour { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.pres-stop {
  display: inline-flex; align-items: baseline; gap: .35rem; min-height: 44px; padding: .4rem .8rem;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--sheet); cursor: pointer;
  font-size: .9375rem; white-space: nowrap;
}
.pres-stop small { font-family: var(--font-display); font-size: .9375rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.pres-stop:hover:not(:disabled) { border-color: var(--ink-soft); background: #fff; }
.pres-stop:disabled { opacity: .45; cursor: default; }
.pres-stop[aria-current="step"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pres-stop[aria-current="step"] small { color: #d4d8dc; }

body.is-presenting .stage-legend { top: auto; bottom: calc(var(--pres-band, 120px) + .5rem); right: clamp(1.25rem, 3.5vw, 3.5rem); }
body.is-presenting .legend-text { display: block; }

@media (max-width: 900px) {
  body.is-presenting .pres-top { grid-template-columns: auto minmax(0, 1fr); gap: .75rem 1.25rem; }
  body.is-presenting .pres-numbers { text-align: right; }
  body.is-presenting .pres-event { grid-column: 1 / -1; justify-self: start; text-align: left; max-width: none; }
  .pres-controls { flex-wrap: wrap; justify-content: center; }
  .pres-tour { order: 3; width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: .2rem; }
  .pres-stop { flex: none; }
  .pres-exit span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.is-presenting .stage-legend { display: none; }
  .pres-gen-num { font-size: clamp(3.5rem, 11vh, 6rem); }
  .pres-positions { font-size: clamp(2.2rem, 7vh, 4rem); }
  .pres-pop { font-size: 1.0625rem; }
  .pres-event-title { font-size: 1.5rem; margin-top: .25rem; }
  .pres-message { font-size: 1.1875rem; }
  .pres-btn { min-height: 48px; min-width: 48px; }
  .pres-play { min-width: 7.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Sélecteur de langue (rempli par js/lang.js) ----------
   À droite des actions. La police actuelle est plus large que l'ancienne : sous 1360 px, les rubriques
   perdent leur complément (« l'implexe », « et méthode ») pour que l'en-tête tienne sur une ligne.
   Sur mobile, le sélecteur suit les actions et les rubriques gardent leur ligne entière. */

/* Avertissement : dates et populations sont des estimations (frise). */
.tl-note { margin: .35rem 0 0; font-size: .75rem; color: var(--ink-faint); }

/* ---------- Des arbres qui se rejoignent (second explorateur) ---------- */

.vg { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr) 22.5rem; min-height: 0; }
@media (min-width: 760px) { .vg { height: 100%; } }
.vg-side, .vg-panel { min-height: 0; overflow-y: auto; scrollbar-width: thin; background: var(--sheet); }
.vg-side { display: flex; flex-direction: column; gap: .8rem; padding: 1.1rem 1rem 2rem; border-right: 1px solid var(--rule); }
.vg-panel { padding: 1.1rem 1.5rem 2.5rem; border-left: 1px solid var(--rule); }
.vg-side-title { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; }
.vg-intro { font-size: .875rem; line-height: 1.5; color: var(--ink-soft); }
.vg-fine { font-size: .8125rem; line-height: 1.45; color: var(--ink-soft); }
.vg-h { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; line-height: 1.25; }

.vg-seg { display: flex; }
.vg-seg-btn {
  flex: 1; min-height: 44px; padding: 0 .6rem; font: inherit; font-size: .875rem; font-weight: 500;
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); cursor: pointer;
}
.vg-seg-btn + .vg-seg-btn { border-left: 0; }
.vg-seg-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.vg-seg-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.vg-seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.vg-seg-btn:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; position: relative; }

.vg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.vg-step { padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); color: var(--ink-faint); font-size: .8125rem; line-height: 1.45; }
.vg-step.is-done { border-color: var(--distinct); background: color-mix(in srgb, var(--distinct) 9%, var(--sheet)); color: var(--ink); }
.vg-step-title { font-weight: 700; font-size: .875rem; margin-bottom: .15rem; }
.vg-howto { margin: 0; padding: .5rem 1.25rem 0; max-width: 46rem; font-size: .875rem; line-height: 1.45; color: var(--ink-soft); }
.vg-legend { list-style: none; margin: 0; padding: .6rem 0 0; border-top: 1px solid var(--rule); display: grid; gap: .3rem; font-size: .8125rem; color: var(--ink-soft); }
.vg-legend li { display: flex; align-items: center; gap: .5rem; }
.vg-legend svg { width: 16px; height: 16px; flex: none; }

.vg-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.vg-hud { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding: 1rem 1.25rem 0; }
.vg-headline { font-family: var(--font-display); font-size: 1rem; color: var(--ink-soft); }
.vg-grid { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: .75rem 1.25rem; }
.vg-svg { display: block; width: 100%; height: 100%; max-height: 34rem; }
.vg-row-label { font-family: var(--font-ui); fill: var(--ink-faint); text-anchor: end; }
.vg-row-label.is-badge { fill: var(--distinct); font-weight: 700; }
.vg-badges { list-style: none; margin: 0; padding: 0 1.25rem .5rem; display: grid; gap: .2rem; font-size: .875rem; font-weight: 500; color: var(--distinct); }
.vg-row-label.is-current { fill: var(--ink); font-weight: 700; }
.vg-badges li { display: flex; align-items: center; gap: .45rem; }
.vg-mark circle { fill: var(--distinct); }
.vg-badge-num { flex: none; background: var(--distinct); display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; color: var(--sheet); font-size: .75rem; font-weight: 700; }
.vg-mark { display: none; }
.vg-mark.is-on { display: inline; }
.vg-mark text { font-family: var(--font-ui); font-weight: 700; fill: var(--sheet); text-anchor: middle; }
.vg-foot { display: none; font-family: var(--font-ui); font-weight: 700; text-anchor: middle; }
.vg-foot.is-on { display: inline; }
.vg-foot-a { fill: var(--accent); }
.vg-foot-b { fill: var(--gold-ink); }
/* Liens de parenté, sous les pastilles. Mêmes couleurs et mêmes épaisseurs relatives que la présentation
   (js/presentation.js) : bleu = A, orange = B, vert = ancêtre commun ; trait fin = lien, trait épais = chemin. */
.vg-l { fill: none; stroke-linecap: round; }
.vg-l-faint { stroke: #656b72; stroke-width: calc(1px * var(--fin, 1)); stroke-opacity: .35; }
.vg-l-a { stroke: var(--accent); stroke-width: calc(1.8px * var(--fin, 1)); stroke-opacity: .5; }
.vg-l-b { stroke: var(--gold); stroke-width: calc(1.8px * var(--fin, 1)); stroke-opacity: .5; }
.vg-l-all { stroke: var(--distinct); stroke-width: calc(1.5px * var(--fin, 1)); stroke-opacity: .45; }
.vg-l-a-main { stroke: var(--accent); stroke-width: calc(4.2px * var(--fin, 1)); }
.vg-l-b-main { stroke: var(--gold); stroke-width: calc(4.2px * var(--fin, 1)); }
.vg-l-ink { stroke: var(--ink); stroke-width: calc(4.2px * var(--fin, 1)); }
.vg-svg.is-tracing .vg-base { opacity: .12; }
.vg-hover { min-height: 1.4em; margin: 0; padding: 0 1.25rem .25rem; font-size: .875rem; font-weight: 500; color: var(--ink); }
.vg-svg .vg-c.is-parent { stroke: var(--ink); stroke-width: 2.5; }
.vg-c { transition: opacity .15s; }
.vg-svg.is-tracing .vg-c:not(.is-focus):not(.is-parent), .vg-svg.is-tracing .vg-n:not(.is-focus):not(.is-parent) { opacity: .18; }
/* Nombre de descendants dans la pastille : blanc sur les pastilles foncées, encre sur les claires. */
.vg-n { font-family: var(--font-ui); font-weight: 700; text-anchor: middle; fill: var(--ink); pointer-events: none; transition: opacity .15s; }
.vg-n-a, .vg-n-common { fill: #fff; }
@media (prefers-reduced-motion: reduce) { .vg-c, .vg-n { transition: none; } }
.vg-svg .vg-c.is-focus { stroke: var(--ink); stroke-width: 3.5; }

.vg-c { stroke: #656b72; stroke-width: 1; }
.vg-c-hid { fill: #f1f2f2; stroke: #dcdfe0; }
.vg-c-off { fill: #e4e7e8; }
.vg-c-none { fill: #fff; }
.vg-c-a { fill: var(--accent); }
.vg-c-b { fill: var(--gold); }
.vg-c-common { fill: var(--distinct); }
.vg-c-path { fill: #a9d6c4; }
.vg-c-today { fill: #1c1f22; }

.vg-conclusion { display: grid; gap: .45rem; margin-bottom: .5rem; padding: .9rem 1rem; border: 2px solid var(--distinct); border-radius: var(--radius); background: color-mix(in srgb, var(--distinct) 9%, var(--sheet)); font-size: .9375rem; line-height: 1.5; }
.vg-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--distinct); }
.vg-stats { display: grid; gap: .35rem; margin: 0; }
.vg-stats div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9375rem; }
.vg-stats dt { color: var(--ink-soft); }
.vg-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.vg-real { display: grid; gap: .6rem; }
.vg-real-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.vg-tag { flex: none; padding: .15rem .45rem; border-radius: 4px; background: var(--gold-wash); color: var(--gold-ink); font-size: .75rem; font-weight: 500; }
.vg-chang { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.vg-chang > div { padding: .6rem .7rem; border: 1px solid var(--rule); border-radius: var(--radius); }
.vg-big { font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; margin: .1rem 0; }
.vg-warn { padding: .55rem .7rem; border-radius: var(--radius); background: var(--gold-wash); color: var(--gold-ink); font-size: .9375rem; font-weight: 500; line-height: 1.45; }

@media (max-width: 1179px) {
  main.vg { overflow-y: auto; }
  .vg { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; height: auto; }
  .vg-stage { grid-column: 1; grid-row: 1 / span 2; }
  .vg-side { grid-column: 2; grid-row: 1; border-right: 0; border-left: 1px solid var(--rule); overflow: visible; }
  .vg-panel { grid-column: 2; grid-row: 2; overflow: visible; }
}
@media (max-width: 759px) {
  .vg { display: flex; flex-direction: column; }
  .vg-stage { order: 1; }
  .vg-side { order: 2; border-left: 0; border-top: 1px solid var(--rule); }
  .vg-panel { order: 3; border-left: 0; border-top: 1px solid var(--rule); }
  .vg-grid { padding: .5rem .5rem; }
  .vg-svg { height: auto; }
}

/* Invitation vers la seconde expérience, dans le panneau de l'explorateur */
.st-invite { margin: .5rem 0; padding: 1rem 1.1rem; border: 2px solid var(--accent); border-bottom-width: 2px; border-radius: 8px; background: var(--accent-wash); display: grid; gap: .5rem; }
.st-invite-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.st-invite .st-h-strong { margin: 0; }
.st-invite-link { justify-self: start; min-height: 44px; text-decoration: none; }

/* ---------- L'absurde : carte au franchissement, bandeau permanent au-delà ---------- */

.absurd-banner {
  display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem;
  padding: .6rem 1.25rem; background: var(--gold-wash); border-top: 3px solid var(--gold); color: var(--gold-ink); font-weight: 700;
}
.absurd-banner a, .absurd-card a { text-decoration: none; }
.absurd-card {
  position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(30rem, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  display: grid; gap: .6rem; padding: 1.25rem 1.5rem;
  background: var(--gold-wash); border: 3px solid var(--gold); border-radius: 10px; box-shadow: var(--shadow-float);
}
.absurd-card h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); line-height: 1.1; color: var(--gold-ink); text-wrap: balance; }
.absurd-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.absurd-banner .btn { flex: none; }
.absurd-actions .btn, .absurd-banner .btn { min-height: 44px; }
body.is-presenting .absurd-banner, body.is-presenting .absurd-card { display: none; }

/* ---------- Repères d'échelle et jauge d'absurdité ---------- */

.scale-note {
  position: absolute; z-index: 4; left: 16px; bottom: 16px; width: min(21rem, calc(100% - 32px));
  padding: .8rem 3rem .8rem 1rem; background: var(--sheet); border: 2px solid var(--accent); border-radius: 8px;
  box-shadow: var(--shadow-float); animation: scale-in .25s ease-out;
}
@keyframes scale-in { from { opacity: 0; transform: translateY(12px); } }
.scale-kicker { font-size: .875rem; color: var(--ink-soft); }
.scale-text { font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.scale-slots { font-size: .875rem; }
.scale-close { position: absolute; top: 4px; right: 4px; padding: .5rem; }
.gauge { display: grid; gap: .3rem; padding: .55rem 1.25rem; border-top: 1px solid var(--rule); background: var(--paper); font-size: .875rem; }
.gauge-bar { position: relative; height: 10px; border: 1px solid var(--rule-strong); border-radius: 5px; overflow: hidden; background: var(--sheet); }
.gauge-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.gauge-bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.gauge[data-level="1"] .gauge-bar span, .gauge[data-level="2"] .gauge-bar span { background: #c98a1b; }
.gauge[data-level="3"] .gauge-bar span, .gauge[data-level="4"] .gauge-bar span { background: var(--gold); }
.gauge[data-level="3"] strong, .gauge[data-level="4"] strong { color: var(--gold-ink); }
.gauge-marks { color: var(--ink-soft); }
body.is-presenting .scale-note, body.is-presenting .gauge { display: none; }
@media (prefers-reduced-motion: reduce) { .scale-note { animation: none; } .gauge-bar span { transition: none; } }

/* Commandes sur une ligne, pour laisser la place à l'arbre. */
@media (max-width: 1499px) { .label-long { display: none; } }
@media (max-width: 559px) {
  .stage-tools { padding-inline: 12px; }
  .stage-tools .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* Frise : l'entrée « Aujourd'hui », point de départ. */
.tl-ev.tl-today .tl-ev-btn, .tl-ev.tl-today .tl-ev-btn:hover { background: var(--ink); border-color: var(--ink); }
.tl-today .tl-ev-title, .tl-today .tl-ev-date { color: #fff; }
.backdrop { z-index: 840; } /* tiroir de la frise : au-dessus de l'en-tête et de la barre du bas */

/* Invitation à la présentation, à l'ouverture de l'explorateur. */
.welcome {
  position: absolute; z-index: 5; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(30rem, calc(100% - 24px)); display: grid; gap: .6rem; padding: 1.25rem 1.5rem;
  background: var(--sheet); border: 2px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow-float);
}
.welcome h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); line-height: 1.15; text-wrap: balance; }
.welcome a { text-decoration: none; }
body.is-presenting .welcome { display: none; }
