/* ═══════════════════════════════════════════════
   GENÈSE — feuille de style
   ═══════════════════════════════════════════════ */
:root {
  --ink: #f4f0e8;
  --ink-dim: #b9b2c6;
  --accent: #8df0cf;
  --accent-2: #ffc387;
  --bg: #04060d;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --chapter-w: min(560px, calc(100vw - 2.5rem));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(125, 227, 195, .25); }

/* ── canvas 3D ─────────────────────────────── */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ── overlays d'ambiance ───────────────────── */
#vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,5,.55) 100%);
}
#grain {
  position: fixed; inset: -50%; z-index: 3; pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-2%,3%); }
  40% { transform: translate(3%,-2%); }
  60% { transform: translate(-3%,-3%); }
  80% { transform: translate(2%,2%); }
}

/* ── loader ────────────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: #03050a;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.1s ease, visibility 1.1s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; }
.loader-kicker {
  font-size: .65rem; letter-spacing: .45em; color: var(--ink-dim);
  margin-bottom: 1.2rem;
}
.loader-title {
  font-family: var(--serif); font-weight: 300; font-size: clamp(3rem, 9vw, 5.5rem);
  letter-spacing: .22em; margin-right: -.22em;
  background: linear-gradient(120deg, #f5f2ea, #7de3c3 60%, #4aa9ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.loader-bar {
  width: 180px; height: 1px; background: rgba(255,255,255,.12);
  margin: 2rem auto 0; overflow: hidden;
}
.loader-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loadslide 1.1s ease-in-out infinite;
}
@keyframes loadslide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* ── barre du haut ─────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.6rem;
  font-size: .68rem; letter-spacing: .3em;
  mix-blend-mode: screen;
}
#topbar .brand { font-weight: 500; color: var(--ink); text-shadow: 0 1px 4px rgba(0,0,0,.9); }
#topbar .brand span { color: var(--ink-dim); font-weight: 300; letter-spacing: .2em; }
#topbar .epoch { color: var(--accent); font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px rgba(0,0,0,.9); }

#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 11;
  background: rgba(255,255,255,.05);
}
#progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .1s linear;
}

/* ── frise latérale ────────────────────────── */
#timeline {
  position: fixed; left: 1.6rem; top: 50%; transform: translateY(-50%);
  z-index: 10; display: flex; flex-direction: column; gap: 1.15rem;
}
#timeline button {
  all: unset; cursor: pointer; display: flex; align-items: center; gap: .7rem;
  color: var(--ink-dim); font-size: .6rem; letter-spacing: .14em;
  transition: color .4s;
}
#timeline button::before {
  content: ""; width: 22px; height: 1px; background: currentColor;
  opacity: .45; transition: all .4s;
}
#timeline button.on { color: var(--accent); }
#timeline button.on::before { width: 34px; opacity: 1; }
#timeline button:hover { color: var(--ink); }
@media (max-width: 900px) { #timeline { display: none; } }

/* ── héro ──────────────────────────────────── */
main { position: relative; z-index: 5; }

.hero {
  height: 100vh; height: 100svh;
  display: grid; place-items: center;
  text-align: center;
  padding: 0 1.5rem;
}
.hero .kicker {
  font-size: .62rem; letter-spacing: .5em; margin-right: -.5em;
  color: var(--ink-dim); margin-bottom: 1.6rem;
}
.hero h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(3.4rem, 13vw, 8.5rem);
  letter-spacing: .24em; margin-right: -.24em; line-height: 1;
  background: linear-gradient(115deg, #f7f4ec 20%, #8ee8cb 55%, #58aaff 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 28px rgba(125,227,195,.18));
}
.hero .sub {
  margin-top: 1.8rem;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: #e6e0ee;
  text-shadow: 0 1px 8px rgba(0,0,0,.85);
}
.hero .cta {
  margin-top: 3.2rem;
  font-size: .62rem; letter-spacing: .35em; color: var(--ink-dim);
}
.hero .chevron {
  display: inline-block; margin-left: .5rem;
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ── chapitres ─────────────────────────────── */
.chapter {
  min-height: 185vh;
  display: grid; align-items: center;
  padding: 10vh 1.5rem;
}
.chapter-inner {
  width: var(--chapter-w);
  opacity: 0; transform: translateY(46px);
  transition: opacity 1s ease, transform 1s ease;
  will-change: opacity, transform;
  /* panneau lisible par-dessus la 3D */
  background: linear-gradient(180deg, rgba(4,6,13,.72), rgba(4,6,13,.58));
  border: 1px solid rgba(232,228,218,.09);
  border-radius: 6px;
  padding: clamp(1.5rem, 3.5vw, 2.4rem) clamp(1.4rem, 3.2vw, 2.3rem);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.chapter-inner.center { margin: 0 auto; text-align: center; }
.chapter-inner.right { margin-left: auto; }
@media (min-width: 901px) {
  .chapter-inner.left { margin-left: max(7vw, 4rem); }
  .chapter-inner.right { margin-right: max(7vw, 4rem); }
}
.chapter-inner.visible { opacity: 1; transform: none; }

.kicker {
  font-size: .6rem; letter-spacing: .32em; color: var(--accent);
  margin-bottom: 1.1rem; text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
}
.chapter h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.08; letter-spacing: .015em;
  margin-bottom: 1.6rem;
  text-wrap: balance;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(0,0,0,.85);
}
.chapter p {
  font-size: 1rem; font-weight: 400; color: #eae5f2;
  margin-bottom: 1.15rem;
  text-wrap: pretty;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.chapter p strong { color: #ffffff; font-weight: 600; }
.chapter p em { color: var(--accent-2); font-style: italic; }

.facts {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: .7rem;
  margin-top: 1.9rem;
}
.facts li {
  border: 1px solid rgba(232,228,218,.18);
  border-radius: 2px;
  padding: .55rem .9rem;
  display: flex; flex-direction: column;
  background: rgba(4,6,13,.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.facts li strong {
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
  color: var(--accent); line-height: 1.2;
}
.facts li span { font-size: .6rem; letter-spacing: .12em; color: var(--ink-dim); }

/* ── épilogue ──────────────────────────────── */
.epilogue { min-height: 160vh; }
blockquote {
  margin: 2.2rem auto 0;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  color: #f0eaf6; max-width: 34ch;
}
blockquote cite {
  display: block; margin-top: .9rem;
  font-family: var(--sans); font-style: normal; font-size: .62rem;
  letter-spacing: .28em; color: var(--ink-dim);
}
.recap {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem;
  margin-top: 2.6rem;
}
.recap div {
  border-top: 1px solid rgba(141,240,207,.45);
  padding: .6rem .8rem 0; text-align: left;
}
.recap strong {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 1.05rem; color: var(--accent);
}
.recap span { font-size: .58rem; letter-spacing: .14em; color: var(--ink-dim); text-transform: uppercase; }
footer {
  margin-top: 4rem;
  font-size: .6rem; letter-spacing: .2em; color: #8a8496;
}

/* ── réduction de mouvement ────────────────── */
@media (prefers-reduced-motion: reduce) {
  #grain { animation: none; }
  .hero .chevron { animation: none; }
  .chapter-inner { transition: opacity .6s ease; transform: none; }
}
