/* population-data — récit « La population, en clair » (templates/recit.php)
 *
 * Même identité que le thème expli et que les autres récits : fond bleu encre,
 * une seule famille (Archivo) jouée sur sa chasse, couleur réservée aux données.
 * La couleur du dossier est le violet (--or garde son nom de variable commune). */

:root {
	--fond: #0e1b2c;
	--fond-2: #132439;
	--fond-3: #1a2e48;
	--trame: #233650;
	--texte: #e8eef5;
	--texte-2: #a9b8cc;
	--texte-3: #71849e;
	--or: #b48cf2;        /* couleur du dossier */
	--hommes: #7da7f7;
	--femmes: #f28db2;
	--projection: #71849e;

	--f: "Archivo", "Helvetica Neue", Arial, sans-serif;
	--large: 125;
	--etroit: 72;

	--gouttiere: clamp(16px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }

body {
	margin: 0; background: var(--fond); color: var(--texte);
	font: 400 clamp(16px, 1.05vw, 18px)/1.6 var(--f); font-variation-settings: "wdth" 100;
	-webkit-font-smoothing: antialiased; overflow-x: hidden;
}
strong { font-weight: 700; }
a { color: inherit; text-underline-offset: .18em; }

/* ── Barre du haut ─────────────────────────────────────────────── */
.topbar {
	position: fixed; inset: 0 0 auto; z-index: 50;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; row-gap: 4px;
	padding: 14px var(--gouttiere) 10px; pointer-events: none;
	background: linear-gradient(rgba(14, 27, 44, .9), rgba(14, 27, 44, 0));
}
.topbar a { pointer-events: auto; color: var(--texte); text-decoration: none; }
.topbar__logo { font-size: 21px; font-weight: 800; font-variation-settings: "wdth" var(--large); letter-spacing: -.03em; }
.topbar__logo span { font-weight: 300; }
.topbar__nav { display: none; gap: 20px; font-size: 15px; font-weight: 500; font-variation-settings: "wdth" var(--etroit); }
.topbar__nav a { color: var(--texte-2); }
.topbar__nav a.is-active, .topbar__nav a:hover { color: var(--texte); }
.topbar__fil { flex-basis: 100%; order: 3; }
.topbar__fil ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: 14px; font-variation-settings: "wdth" var(--etroit); }
.topbar__fil li { color: var(--texte-2); }
.topbar__fil li + li::before { content: "/"; margin: 0 8px; color: var(--texte-3); }
.topbar__fil a { color: inherit; }
.topbar__fil a:hover, .topbar__fil [aria-current] { color: var(--texte); }
.topbar__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--trame); }
.topbar__progress span { display: block; height: 100%; width: 100%; background: var(--texte); transform-origin: 0 50%; transform: scaleX(0); }
@media (min-width: 768px) { .topbar__nav { display: flex; } }
.admin-bar .topbar { top: 32px; }
@media (max-width: 782px) { .admin-bar .topbar { top: 46px; } }

/* ── Chapitres ────────────────────────────────────────────────── */
.chapter { position: relative; }
.stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--fond); }

.chapter__head {
	position: absolute; z-index: 3; left: var(--gouttiere); top: clamp(96px, 15vh, 150px);
	max-width: min(30rem, calc(100% - 2 * var(--gouttiere)));
}
.chapter__head h2 {
	margin: 0 0 14px; font-size: clamp(36px, 5vw, 76px); line-height: .95; font-weight: 900;
	font-variation-settings: "wdth" var(--large); letter-spacing: -.035em;
}
.chapter__head p { margin: 0; color: var(--texte-2); }
.chapter__head--static { position: relative; left: auto; top: auto; max-width: 44rem; }

.source {
	position: absolute; z-index: 3; left: var(--gouttiere); bottom: 16px; margin: 0; max-width: calc(100% - 2 * var(--gouttiere));
	font-size: 14px; font-variation-settings: "wdth" var(--etroit); color: var(--texte-3);
}
.source a { color: var(--texte-2); }
.source--statique { position: static; margin-top: 10px; }
.note-bas { margin: 14px 0 0; max-width: 60rem; font-size: 14px; line-height: 1.45; font-variation-settings: "wdth" var(--etroit); color: var(--texte-3); }

/* ── Infobulle ────────────────────────────────────────────────── */
.bulle {
	position: fixed; z-index: 60; pointer-events: none; padding: 7px 10px; border-radius: 4px;
	background: var(--texte); color: var(--fond); font-size: 14px; line-height: 1.35; font-variation-settings: "wdth" var(--etroit); white-space: nowrap;
	transform: translate(-50%, calc(-100% - 14px));
}
.bulle b { font-weight: 800; font-variation-settings: "wdth" 100; }
.bulle i { display: inline-block; width: 10px; height: 3px; margin-right: 6px; vertical-align: middle; font-style: normal; }
.bulle[hidden] { display: none; }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; padding: 0 var(--gouttiere); pointer-events: none; }
.hero__title {
	margin: 0; font-size: clamp(60px, 12vw, 210px); line-height: .82; font-weight: 900;
	font-variation-settings: "wdth" var(--large); letter-spacing: -.05em; text-shadow: 0 4px 60px rgba(14, 27, 44, .55);
}
.hero__lede { margin: 28px 0 0; max-width: 34ch; font-size: clamp(18px, 1.5vw, 23px); text-shadow: 0 2px 20px rgba(14, 27, 44, .9); }
.scroll-cue { position: absolute; left: 50%; bottom: 28px; width: 2px; height: 54px; background: rgba(232, 238, 245, .25); overflow: hidden; }
.scroll-cue span { position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--texte); animation: cue 1.8s cubic-bezier(.6, 0, .3, 1) infinite; }
@keyframes cue { to { top: 100%; } }

/* ── Commandes : bascules, puces, réglages ────────────────────── */
.commandes { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
.bascule { display: inline-flex; padding: 3px; border-radius: 20px; background: var(--fond-3); }
.bascule button { padding: 7px 14px; border: 0; border-radius: 17px; background: none; color: var(--texte-2); font: 600 15px var(--f); font-variation-settings: "wdth" var(--etroit); cursor: pointer; }
.bascule button[aria-pressed="true"] { background: var(--texte); color: var(--fond); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puces[hidden] { display: none; }
.puces button {
	display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--trame); border-radius: 18px;
	background: none; color: var(--texte-3); font: 600 14px var(--f); font-variation-settings: "wdth" var(--etroit); cursor: pointer;
}
.puces button::before { content: ""; width: 14px; height: 3px; border-radius: 2px; background: var(--q, var(--texte-3)); opacity: .35; }
.puces button[aria-pressed="true"] { border-color: var(--texte-3); color: var(--texte); }
.puces button[aria-pressed="true"]::before { opacity: 1; }
.puces button:hover { border-color: var(--texte-2); }
.puces button:focus-visible, .bascule button:focus-visible, .reglage input:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
.reglage { display: flex; align-items: center; gap: 12px; font-size: 16px; font-variation-settings: "wdth" var(--etroit); }
.reglage[hidden] { display: none; }
.reglage input { width: min(320px, 50vw); accent-color: var(--or); }
.reglage output { min-width: 4ch; font-size: 24px; font-weight: 900; font-variation-settings: "wdth" var(--large); color: var(--or); }

/* ── Graphes ──────────────────────────────────────────────────── */
.graphe { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.graphe--grand { height: clamp(320px, 56vh, 620px); margin-top: 20px; }
.graphe text { font: 400 13px var(--f); font-variation-settings: "wdth" var(--etroit); fill: var(--texte-3); }
.graphe .grille line { stroke: var(--trame); }
.graphe .note { font-weight: 600; font-size: 14px; fill: var(--texte); paint-order: stroke; stroke: var(--fond); stroke-width: 4px; }
.graphe .guide { stroke: var(--texte-3); stroke-dasharray: 3 4; }
.bloc { padding: clamp(110px, 16vh, 170px) var(--gouttiere) 80px; }
.bloc--clair { background: var(--fond-2); }
.bloc--clair .graphe .note { stroke: var(--fond-2); }

.sous-titre { margin: 0 0 14px; font-size: clamp(30px, 3.6vw, 52px); line-height: 1; font-weight: 900; font-variation-settings: "wdth" var(--large); letter-spacing: -.03em; }

/* ── Suite ────────────────────────────────────────────────────── */
.outro { padding: 120px var(--gouttiere) 140px; background: var(--fond-2); }
.outro h2 { margin: 0 0 24px; font-size: clamp(44px, 8vw, 128px); line-height: .88; font-weight: 900; font-variation-settings: "wdth" var(--large); letter-spacing: -.045em; }
.outro__updated { margin: 0; max-width: 40rem; font-size: 15px; font-variation-settings: "wdth" var(--etroit); color: var(--texte-3); }

@media (prefers-reduced-motion: reduce) { .scroll-cue span { animation: none; } }

/* ── 1. Les milliards ─────────────────────────────────────────── */
.monde { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.monde text { font: 400 13px var(--f); font-variation-settings: "wdth" var(--etroit); fill: var(--texte-3); }
.monde .grille line { stroke: var(--trame); }
.monde .courbe { fill: none; stroke: var(--or); stroke-width: 3.5; stroke-linejoin: round; }
.monde .aire { fill: var(--or); opacity: .12; }
.monde .projection { fill: none; stroke: var(--or); stroke-width: 2.5; stroke-dasharray: 2 6; stroke-linecap: round; }
.monde .jalon line { stroke: var(--texte-3); stroke-dasharray: 2 4; }
.monde .jalon circle { fill: var(--fond); stroke: var(--or); stroke-width: 3; }
.monde .jalon .jalon__n { font-weight: 900; font-size: 22px; font-variation-settings: "wdth" var(--large); fill: var(--texte); }
.monde .jalon .jalon__a { font-weight: 600; font-size: 14px; fill: var(--or); }
.monde .jalon.is-proj circle { stroke-dasharray: 3 3; }
.monde .jalon.is-proj .jalon__a { fill: var(--texte-2); }
.monde .curseur { fill: var(--texte); }

.readout {
	position: absolute; z-index: 3; left: var(--gouttiere); top: clamp(96px, 15vh, 150px);
	display: flex; flex-direction: column; pointer-events: none; text-shadow: 0 2px 30px rgba(14, 27, 44, .9);
}
.readout__year { font-size: clamp(56px, 9vw, 150px); line-height: .85; font-weight: 900; font-variation-settings: "wdth" var(--large); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.readout__value { margin-top: 10px; font-size: clamp(24px, 2.8vw, 42px); line-height: 1; font-weight: 700; font-variation-settings: "wdth" var(--etroit); font-variant-numeric: tabular-nums; color: var(--or); }
.readout__label { margin-top: 8px; max-width: 26rem; font-size: 15px; line-height: 1.35; font-variation-settings: "wdth" var(--etroit); color: var(--texte-2); }

/* ── Lecteur (lecture / pause, curseur des années) ────────────── */
.lecteur { display: flex; align-items: center; gap: 14px; margin-top: 28px; }
.lecteur__bouton { min-width: 7.5em; padding: 8px 16px; border: 0; border-radius: 18px; background: var(--texte); color: var(--fond); font: 700 15px var(--f); font-variation-settings: "wdth" var(--etroit); cursor: pointer; }
.lecteur__bouton[aria-pressed="false"] { background: var(--or); }
.lecteur__curseur { flex: 1; max-width: 640px; accent-color: var(--or); }
.lecteur__annee { min-width: 5ch; font-size: clamp(30px, 4vw, 54px); line-height: 1; font-weight: 900; font-variation-settings: "wdth" var(--large); letter-spacing: -.03em; color: var(--or); font-variant-numeric: tabular-nums; }
.lecteur__bouton:focus-visible, .lecteur__curseur:focus-visible { outline: 2px solid var(--or); outline-offset: 3px; }

/* ── 2. Le classement ─────────────────────────────────────────── */
.course__monde { margin: 18px 0 0; font-size: 17px; font-variation-settings: "wdth" var(--etroit); color: var(--texte-2); }
.course__monde b { color: var(--texte); font-size: 22px; font-variation-settings: "wdth" var(--large); }
.course { display: grid; grid-template-columns: 1fr; gap: 36px; margin-top: 24px; }
.course__bloc h3 { margin: 0 0 12px; font-size: 18px; font-weight: 700; font-variation-settings: "wdth" var(--etroit); color: var(--texte-2); }
@media (min-width: 900px) { .course { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.classement-anime { position: relative; margin: 0; padding: 0; list-style: none; }
.classement-anime li {
	position: absolute; left: 0; right: 0; top: 0; height: var(--h, 34px);
	display: grid; grid-template-columns: 1.8em minmax(6.5em, 10em) 1fr; align-items: center; gap: 10px;
	font-size: 15px; font-variation-settings: "wdth" var(--etroit); transition: transform .45s cubic-bezier(.3, .7, .2, 1), opacity .3s; cursor: default;
}
.classement-anime .rang { color: var(--texte-3); font-variant-numeric: tabular-nums; text-align: right; }
.classement-anime .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classement-anime .barre { position: relative; height: 70%; }
.classement-anime .barre i { position: absolute; inset: 0 auto 0 0; width: var(--l, 0%); border-radius: 0 3px 3px 0; background: var(--q, var(--or)); transition: width .4s linear; }
.classement-anime .barre b { position: absolute; left: calc(var(--l, 0%) + 8px); top: 50%; transform: translateY(-50%); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; transition: left .4s linear; }
.classement-anime .barre small { margin-left: 6px; font-weight: 400; color: var(--texte-2); }
.classement-anime li:hover .nom, .classement-anime li.is-survol .nom { color: var(--or); }
.classement-anime li.is-hors { opacity: 0; pointer-events: none; }

/* ── 3. La pyramide ───────────────────────────────────────────── */
.pyramide-bloc { display: grid; grid-template-columns: 1fr; gap: 28px; margin-top: 20px; }
@media (min-width: 900px) { .pyramide-bloc { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.pyramide { display: block; width: 100%; height: clamp(420px, 70vh, 760px); overflow: visible; touch-action: pan-y; }
.pyramide text { font: 400 12px var(--f); font-variation-settings: "wdth" var(--etroit); fill: var(--texte-3); }
.pyramide .grille line { stroke: var(--trame); }
.pyramide .h { fill: var(--hommes); }
.pyramide .f { fill: var(--femmes); }
.pyramide .is-proj .h, .pyramide .is-proj .f { opacity: .55; }
.pyramide .is-survol { fill: var(--texte); }
.pyramide .mediane-ligne { stroke: var(--texte); stroke-width: 1.5; stroke-dasharray: 5 4; }
.pyramide .note { font-weight: 600; font-size: 13px; fill: var(--texte); paint-order: stroke; stroke: var(--fond-2); stroke-width: 4px; }
.pyramide .cohorte line { stroke: var(--texte-2); stroke-width: 1.5; }
.pyramide .cohorte text { fill: var(--texte-2); font-size: 12px; }
.mediane__chiffre { margin: 0; line-height: .9; }
.mediane__n { font-size: clamp(56px, 7vw, 110px); font-weight: 900; font-variation-settings: "wdth" var(--large); letter-spacing: -.04em; color: var(--or); font-variant-numeric: tabular-nums; }
.mediane__u { font-size: 22px; font-variation-settings: "wdth" var(--etroit); color: var(--texte-2); }
.mediane__l { margin: 4px 0 0; color: var(--texte-2); }
.graphe--mediane { height: clamp(220px, 30vh, 320px); margin-top: 18px; }

@media (max-width: 767px) {
	.classement-anime li { grid-template-columns: 1.6em minmax(5.5em, 7.5em) 1fr; font-size: 14px; }
	.monde .jalon .jalon__n { font-size: 15px; }
	.monde .jalon .jalon__a { font-size: 12px; }
	.lecteur { flex-wrap: wrap; }
	.lecteur__curseur { flex-basis: 100%; order: 3; }
}
