/* Page Historique : fresque verticale 1996–2027 */

/* ---------- Ouverture ---------- */
.hist-hero { padding: clamp(3rem, 7vw, 5.5rem) 0 2.5rem; }
.hist-hero .wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.hist-hero h1 { max-width: 13ch; }
.hist-hero .lede { font-family: var(--font-read); font-size: 1.22rem; line-height: 1.6; color: var(--ink-2); max-width: 36rem; margin: 0; }
.hist-thirty { display: flex; align-items: flex-end; gap: 1rem; justify-content: flex-end; }
.thirty {
  font-weight: 700; letter-spacing: -0.06em; line-height: 0.8;
  font-size: clamp(8rem, 21vw, 17rem);
  color: transparent;
  background: linear-gradient(90deg,
    var(--ax-water) 0 10%, var(--ax-renew) 10% 20%, var(--ax-surface) 20% 30%, var(--ax-electric) 30% 40%,
    var(--ax-waste) 40% 50%, var(--ax-pollutant) 50% 60%, var(--ax-utility) 60% 70%, var(--ax-nonrenew) 70% 80%,
    var(--ax-time) 80% 90%, var(--ax-durability) 90% 100%);
  -webkit-background-clip: text; background-clip: text;
}
.thirty-label { font-size: 1.1rem; font-weight: 600; color: var(--ink-2); line-height: 1.3; padding-bottom: 0.6rem; }
@media (max-width: 820px) {
  .hist-hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hist-thirty { justify-content: flex-start; order: -1; }
}

/* ---------- Vue d'ensemble proportionnelle ---------- */
.ribbon { margin: 1rem 0 3.5rem; padding: 1.25rem 1.25rem 0.75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); }
.ribbon figcaption { font-size: 0.85rem; color: var(--ink-3); margin-bottom: 0.75rem; }
.ribbon-scroll { overflow-x: auto; }
#ribbon-svg { width: 100%; min-width: 760px; height: auto; display: block; }
#ribbon-svg text { font: 500 11px var(--font-ui); fill: var(--ink-3); }
#ribbon-svg .tick { stroke: var(--rule); }
#ribbon-svg .era-label { font-weight: 650; font-size: 12px; fill: var(--ink); }
#ribbon-svg .r-dot { cursor: pointer; stroke: var(--surface); stroke-width: 2; transition: r .15s; }
#ribbon-svg .r-dot:hover, #ribbon-svg .r-dot:focus { r: 7; outline: none; }
#ribbon-svg .r-bar { cursor: pointer; }
#ribbon-svg .r-cursor { stroke: var(--ink); stroke-width: 1.5; }
#ribbon-svg .r-now { fill: var(--ink); font-weight: 650; }
.no-js-hide { display: none; }

/* ---------- Fresque ---------- */
.fresco { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2rem; align-items: start; }

.fresco-now { position: sticky; top: 6rem; }
.now-inner { display: flex; flex-direction: column; gap: 0.3rem; }
.now-year {
  font-size: 4.2rem; font-weight: 700; letter-spacing: -0.05em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--now, var(--ax-water));
  transition: color .5s;
}
.now-era { font-size: 1.15rem; font-weight: 650; }
.now-age { font-size: 0.9rem; color: var(--ink-3); }

.fresco-track { position: relative; padding-bottom: 2rem; }
.spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.spine-fill {
  position: absolute; left: 0; top: 0; width: 100%; height: 0;
  background: linear-gradient(180deg, var(--ax-water), var(--ax-renew) 30%, var(--ax-electric) 55%, var(--ax-time) 85%, var(--ax-utility));
  background-size: 100% var(--track-h, 4000px);
}

.era { position: relative; padding-top: 1rem; }
.era-head { position: relative; z-index: 1; text-align: center; max-width: 30rem; margin: 0 auto 2.5rem; background: var(--paper); padding: 0.5rem 1rem; }
.era-head h2 {
  display: inline-block; margin: 0 0 0.4rem; padding: 0.3rem 1.1rem; border-radius: 999px;
  background: var(--era); color: #fff; font-size: 1.35rem; letter-spacing: -0.01em;
}
.era-head p { margin: 0; color: var(--ink-2); font-size: 0.98rem; }

.events { list-style: none; margin: 0 0 3rem; padding: 0; }
.ev { position: relative; width: 50%; padding-block: 0 2.25rem; padding-inline: 0 2.5rem; }
.ev:nth-child(even) { margin-inline-start: 50%; padding-inline: 2.5rem 0; }
.ev-dot {
  position: absolute; top: 1.35rem; inset-inline-end: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--era); z-index: 1;
  transition: background-color .3s, transform .3s;
}
.ev:nth-child(even) .ev-dot { inset-inline-end: auto; inset-inline-start: -8px; }
.ev.passed .ev-dot { background: var(--era); }
.ev-key .ev-dot { width: 22px; height: 22px; top: 1.15rem; inset-inline-end: -11px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--era) 22%, transparent); }
.ev-key:nth-child(even) .ev-dot { inset-inline-start: -11px; }

/* Trait reliant la carte à la colonne */
.ev::after { content: ""; position: absolute; top: calc(1.35rem + 7px); inset-inline-end: 8px; width: 2rem; height: 2px; background: color-mix(in srgb, var(--era) 45%, var(--rule)); }
.ev:nth-child(even)::after { inset-inline-end: auto; inset-inline-start: 8px; }

.ev-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m);
  padding: 1.1rem 1.25rem 1.2rem; position: relative;
}
.ev-key .ev-card { border-top: 4px solid var(--era); padding-top: 1.25rem; }
.ev-top { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.45rem; }
.ev-icon { width: 22px; height: 22px; fill: none; stroke: var(--era); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ev-year { font-weight: 700; font-size: 0.95rem; color: var(--era); font-variant-numeric: tabular-nums; filter: saturate(1.1) brightness(0.85); }
.ev h3 { font-size: 1.12rem; margin: 0 0 0.35rem; line-height: 1.3; }
.ev-key h3 { font-size: 1.3rem; }
.ev p { margin: 0; color: var(--ink-2); font-size: 0.97rem; line-height: 1.55; }
.ev-link { display: inline-block; margin-top: 0.7rem; font-weight: 600; font-size: 0.92rem; }
.ev-link + .ev-link { margin-inline-start: 1.25rem; }

/* Durée d'une période, proportionnelle */
.ev-span {
  display: flex; align-items: center; gap: 0.6rem; margin-top: 0.85rem;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-3);
}
.ev-span::before { content: ""; height: 6px; border-radius: 3px; width: calc(var(--y) * 1.9rem); max-width: 70%; background: repeating-linear-gradient(90deg, var(--era) 0 calc(1.9rem - 3px), transparent calc(1.9rem - 3px) 1.9rem); }

/* Porte-monnaie 2006 */
.ev-wallet { display: flex; align-items: baseline; gap: 0.4rem; margin-top: 0.8rem; font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ev-wallet i { font-style: normal; color: var(--ink-3); font-weight: 400; }
.ev-wallet b:last-child { color: var(--era); }

/* Nombre de vecteurs */
.ev-bars { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-top: 0.85rem; }
.ev-bars i { width: 9px; border-radius: 2px; background: var(--c); height: var(--h); }
.ev-bars i:nth-child(1) { --c: var(--ax-time); --h: 100%; }
.ev-bars i:nth-child(2) { --c: var(--ax-water); --h: 70%; }
.ev-bars i:nth-child(3) { --c: var(--ax-electric); --h: 85%; }
.ev-bars i:nth-child(4) { --c: var(--ax-fossil); --h: 55%; }
.ev-bars i:nth-child(5) { --c: var(--ax-nonrenew); --h: 75%; }
.ev-bars i:nth-child(6) { --c: var(--ax-renew); --h: 60%; }
.ev-bars i:nth-child(7) { --c: var(--ax-waste); --h: 80%; }
.ev-bars i:nth-child(8) { --c: var(--ax-pollutant); --h: 50%; }
.ev-bars i:nth-child(9) { --c: var(--ax-surface); --h: 90%; }
.ev-bars i:nth-child(10) { --c: var(--ax-durability); --h: 65%; }
.ev-bars i:nth-child(11), .ev-bars i:nth-child(12) { --c: var(--ink-3); --h: 45%; }
.ev-bars-cut i:nth-child(n+11) { opacity: 0.3; background: repeating-linear-gradient(45deg, var(--ink-3) 0 2px, transparent 2px 4px); }

/* Futur : en pointillés */
.era-future .ev-card { border-style: dashed; border-width: 2px; }
.era-future .ev-key .ev-card { border-top-style: solid; }
.era-future .ev-dot { border-style: dashed; }

/* Apparition douce au défilement (si JS et mouvement autorisé) */
@media (prefers-reduced-motion: no-preference) {
  .hist-js .ev-card { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
  .hist-js .ev.in .ev-card { opacity: 1; transform: none; }
}

/* ---------- Écrans moyens : compteur en bandeau ---------- */
@media (max-width: 1100px) {
  .fresco { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fresco-now { top: 4.25rem; z-index: 20; margin: 0 calc(var(--gutter) * -1) 1.5rem; padding: 0.55rem var(--gutter); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
  .now-inner { flex-direction: row; align-items: baseline; gap: 0.9rem; }
  .now-year { font-size: 1.9rem; }
  .now-era { font-size: 1rem; }
}

/* ---------- Mobile : une seule colonne ---------- */
@media (max-width: 760px) {
  .spine { inset-inline-start: 11px; margin-inline-start: 0; }
  .ev, .ev:nth-child(even) { width: auto; margin-inline-start: 0; padding-block: 0 1.5rem; padding-inline: 2.6rem 0; }
  .ev-dot, .ev:nth-child(even) .ev-dot { inset-inline-start: 5px; inset-inline-end: auto; }
  .ev-key .ev-dot, .ev-key:nth-child(even) .ev-dot { inset-inline-start: 2px; }
  .ev::after, .ev:nth-child(even)::after { inset-inline-start: 21px; inset-inline-end: auto; width: 1.3rem; }
  .era-head { text-align: start; margin: 0 0 1.75rem; padding-inline-start: 2.6rem; background: none; }
  .now-age { display: none; }
}

/* Vue d'ensemble : l'axe du temps reste de gauche à droite. */
[dir="rtl"] #ribbon-svg { direction: ltr; }
