/* ==================================================================
   Portfolio Juditech3D — noir, or et bordeaux (même identité que le site)
   Organisation :
     1. Base            4. Slide d'accueil     7. Fenêtre de détail
     2. Navigation      5. Chapitres & cartes  8. Motion (scroll)
     3. Boutons/tags    6. Possible & contact  9. Accessibilité
   ================================================================== */

/* ───────── 1. Base ───────── */
:root {
  --bg: #09070a;
  --bg-2: #0f0b0c;
  --card: #140f0b;
  --line: #2c2010;
  --line-soft: #1d150b;
  --text: #d8c9a8;
  --text-hi: #f3e8c8;
  --muted: #a28b66;
  --gold: #c9a227;
  --gold-lt: #e8c84a;
  --maroon: #5c1020;
  --maroon-lt: #8e2038;
  --accent: var(--gold-lt);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --topbar-h: 68px;
  --gutter: clamp(18px, 4vw, 56px);
  --font: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: var(--topbar-h);
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--gold-lt); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--gold-lt); color: #1a1205; padding: 10px 16px; border-radius: 8px; font-weight: 700;
  transition: top .2s;
}
.skip:focus { top: 12px; }

.eyebrow {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
.big-title {
  font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: 1.04; font-weight: 800;
  color: var(--text-hi); letter-spacing: -.02em; text-wrap: balance;
}
.big-title em { font-style: normal; color: var(--gold-lt); }
.noscript { padding: 24px; text-align: center; color: var(--text-hi); }

/* ───────── 2. Navigation ───────── */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120;
  background: linear-gradient(90deg, var(--maroon-lt), var(--gold), var(--gold-lt));
  transform: scaleX(0); transform-origin: 0 50%;
  box-shadow: 0 0 12px rgba(232, 200, 74, .5);
}

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(9, 7, 10, .92), rgba(9, 7, 10, .55));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(44, 32, 16, .7);
}
.brand img { height: 40px; width: auto; filter: drop-shadow(0 0 10px rgba(201, 162, 39, .35)); }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  position: relative; padding: 8px 14px; border-radius: 999px;
  font-size: .86rem; text-decoration: none; color: var(--muted);
  transition: color .25s, background .25s;
}
.topnav a:hover { color: var(--text-hi); }
.topnav a[aria-current="true"] { color: var(--text-hi); background: rgba(201, 162, 39, .14); }
.topcta {
  padding: 9px 18px; border-radius: 999px; text-decoration: none; font-size: .86rem; font-weight: 700;
  color: #1a1205; background: linear-gradient(135deg, var(--gold-lt), var(--gold));
  transition: transform .25s var(--ease), box-shadow .25s;
  white-space: nowrap;
}
.topcta:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(201, 162, 39, .35); }

/* Points de navigation sur le côté */
.dots {
  position: fixed; right: clamp(10px, 1.6vw, 24px); top: 50%; translate: 0 -50%; z-index: 90;
  display: flex; flex-direction: column; gap: 14px;
}
.dots a {
  position: relative; display: block; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--muted); transition: all .3s var(--ease);
}
.dots a::after {
  content: attr(data-label); position: absolute; right: 22px; top: 50%; translate: 8px -50%;
  white-space: nowrap; font-size: .75rem; letter-spacing: .06em; color: var(--text-hi);
  background: rgba(9, 7, 10, .85); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s var(--ease);
}
.dots a:hover::after, .dots a:focus-visible::after { opacity: 1; translate: 0 -50%; }
.dots a[aria-current="true"] { background: var(--gold-lt); border-color: var(--gold-lt); scale: 1.4; box-shadow: 0 0 12px rgba(232, 200, 74, .7); }

/* ───────── 3. Boutons & étiquettes ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 24px; border-radius: 12px;
  font: inherit; font-size: .95rem; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .3s var(--ease), box-shadow .3s, background .3s, border-color .3s;
}
.btn.primary { color: #1a1205; background: linear-gradient(135deg, var(--gold-lt), var(--gold)); }
.btn.primary:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(201, 162, 39, .35); }
.btn.ghost { color: var(--gold-lt); background: rgba(201, 162, 39, .08); border-color: rgba(201, 162, 39, .35); }
.btn.ghost:hover { transform: translateY(-3px); background: rgba(201, 162, 39, .16); }
.btn.big { padding: 16px 30px; font-size: 1.05rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: .72rem; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px;
  color: var(--muted); border: 1px solid var(--line); background: rgba(255, 255, 255, .02);
}

.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: .7rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; padding: 4px 11px; border-radius: 999px;
  border: 1px solid; backdrop-filter: blur(6px);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok   { color: #8fe0a6; border-color: rgba(143, 224, 166, .4); background: rgba(20, 60, 32, .55); }
.badge.warn { color: #f3c969; border-color: rgba(243, 201, 105, .4); background: rgba(70, 48, 8, .55); }
.badge.mute { color: #c9bda4; border-color: rgba(201, 189, 164, .3); background: rgba(40, 32, 22, .6); }

/* ───────── 4. Slide d'accueil ───────── */
.slide { scroll-snap-align: start; position: relative; }

.hero {
  min-height: 100svh; display: grid; place-items: center;
  padding: calc(var(--topbar-h) + 40px) var(--gutter) 90px; overflow: clip;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-grid {
  position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 75%);
}
.hero-halo {
  position: absolute; left: 50%; top: 45%; width: min(900px, 120vw); aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(circle, rgba(201, 162, 39, .17) 0%, rgba(92, 16, 32, .1) 40%, transparent 70%);
  animation: halo 5s ease-in-out infinite;
}
@keyframes halo { 50% { scale: 1.12; opacity: .75; } }
.particles { position: absolute; inset: 0; }
.particle {
  position: absolute; bottom: 0; border-radius: 50%; background: var(--gold); opacity: 0;
  animation: float linear infinite;
}
@keyframes float {
  0% { transform: translateY(0) scale(0); opacity: 0; }
  12% { opacity: .55; }
  90% { opacity: .25; }
  100% { transform: translateY(-105vh) scale(1); opacity: 0; }
}

.hero-content { position: relative; z-index: 1; max-width: 1040px; text-align: center; display: grid; gap: 26px; justify-items: center; }
.hero-title {
  font-size: clamp(2.4rem, 7.2vw, 5.6rem); line-height: 1.02; font-weight: 800; letter-spacing: -.03em;
  color: var(--text-hi); text-wrap: balance;
}
.hero-title .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.hero-title .w > span { display: inline-block; }
.hero-lead { font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--text); max-width: 46ch; text-wrap: balance; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 44px; margin-top: 18px; padding-top: 26px; border-top: 1px solid var(--line); width: min(680px, 100%); }
.hero-stats div { display: grid; justify-items: center; gap: 2px; }
.hero-stats dt { order: 2; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.hero-stats dd { order: 1; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; color: var(--gold-lt); font-variant-numeric: tabular-nums; line-height: 1.1; }

.scroll-cue {
  position: absolute; bottom: 26px; left: 50%; translate: -50% 0; z-index: 1;
  display: grid; justify-items: center; gap: 8px; text-decoration: none;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.mouse { width: 24px; height: 38px; border: 1.5px solid var(--gold); border-radius: 14px; position: relative; }
.mouse i { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--gold-lt); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { translate: 0 0; opacity: 1; } 70% { translate: 0 12px; opacity: 0; } 100% { translate: 0 0; opacity: 0; } }

/* Bandeaux défilants */
.band { overflow: clip; padding: 22px 0; border-block: 1px solid var(--line-soft); background: var(--bg-2); }
.band-track { display: flex; width: max-content; will-change: transform; }
.band-track span {
  font-size: clamp(2.2rem, 6vw, 4.4rem); font-weight: 900; letter-spacing: -.02em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(201, 162, 39, .55);
}
.band-rev .band-track span { -webkit-text-stroke-color: rgba(142, 32, 56, .9); }

/* ───────── 5. Chapitres & cartes ───────── */
.chapter { position: relative; padding: clamp(72px, 12vh, 140px) var(--gutter); }
.chapter::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 15% 20%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
}
.chapter-inner { max-width: 1320px; margin: 0 auto; display: grid; gap: 48px; grid-template-columns: minmax(260px, 31%) 1fr; align-items: start; }

.chapter-head { position: sticky; top: calc(var(--topbar-h) + 28px); display: grid; gap: 14px; }
.chapter-num {
  font-size: clamp(6rem, 13vw, 11.5rem); font-weight: 900; line-height: .8; letter-spacing: -.05em;
  color: transparent; -webkit-text-stroke: 1.5px color-mix(in srgb, var(--accent) 55%, transparent);
  user-select: none;
}
.chapter-head h2 { font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1.06; font-weight: 800; color: var(--text-hi); letter-spacing: -.02em; }
.chapter-head h2 .line { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.chapter-head h2 .line > span { display: block; }
.chapter-head h2 .line:last-child > span { color: var(--accent); }
.chapter-intro { color: var(--text); max-width: 38ch; }
.chapter-meter { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: .8rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.chapter-meter .rail { position: relative; width: 4px; height: 92px; border-radius: 4px; background: var(--line); overflow: hidden; }
.chapter-meter .rail i { position: absolute; inset: 0; background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent)); transform: scaleY(0); transform-origin: 50% 0; }
.chapter-meter b { color: var(--accent); font-size: 1.6rem; font-weight: 800; margin-right: 6px; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 24px; }
.cards .card:nth-child(even) { margin-top: 56px; }
.cards .card:nth-child(odd):last-child { grid-column: 1 / -1; }

.card { position: relative; perspective: 1000px; }
.card-surface {
  position: relative; display: grid; grid-template-rows: auto 1fr; height: 100%;
  background: linear-gradient(160deg, #181109, var(--card)); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  transition: transform .5s var(--ease), border-color .35s, box-shadow .35s;
  transform-style: preserve-3d;
}
.card-surface::before { /* halo qui suit le pointeur */
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
}
.card:hover .card-surface, .card:focus-within .card-surface { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: 0 20px 50px rgba(0, 0, 0, .5), 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.card:hover .card-surface::before { opacity: 1; }

.cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0b0809; border-bottom: 1px solid var(--line); }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; scale: 1.14; transition: scale .8s var(--ease); }
.card:hover .cover img { scale: 1.2; }
.cover .badge { position: absolute; left: 14px; top: 14px; z-index: 3; }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(20, 15, 11, .65), transparent 45%); pointer-events: none; }

/* Visuel dessiné (quand il n'y a pas de capture) */
.art {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(142, 32, 56, .35), transparent 55%),
    linear-gradient(145deg, #1a1209, #0d090a);
}
.art::before {
  content: ''; position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(circle at center, #000 25%, transparent 75%);
}
.art svg { position: relative; width: 38%; max-width: 150px; color: var(--accent); filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 55%, transparent)); animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -7px; } }

.card-body { display: grid; gap: 10px; padding: 20px 22px 22px; align-content: start; }
.card-body h3 { font-size: 1.28rem; line-height: 1.2; font-weight: 750; color: var(--text-hi); letter-spacing: -.01em; }
.card-body p { font-size: .92rem; color: var(--text); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.card-open {
  all: unset; cursor: pointer; font-size: .85rem; font-weight: 700; color: var(--accent);
  display: inline-flex; align-items: center; gap: 8px;
}
.card-open::after { content: ''; position: absolute; inset: 0; z-index: 4; border-radius: 20px; } /* toute la carte est cliquable */
.card-open:focus-visible { outline: none; }
.card:has(.card-open:focus-visible) .card-surface { outline: 2px solid var(--gold-lt); outline-offset: 3px; }
.card-open span { transition: translate .3s var(--ease); }
.card:hover .card-open span { translate: 5px 0; }
.card-live {
  position: relative; z-index: 5; font-size: .8rem; font-weight: 600; text-decoration: none; color: var(--muted);
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; transition: color .25s, border-color .25s, background .25s;
}
.card-live:hover { color: #1a1205; background: var(--accent); border-color: var(--accent); }

/* ───────── 6. Possible & contact ───────── */
.possible, .contact { padding: clamp(80px, 14vh, 160px) var(--gutter); }
.possible-inner, .contact-inner { max-width: 1240px; margin: 0 auto; display: grid; gap: 22px; }
.possible-lead { max-width: 62ch; font-size: 1.1rem; color: var(--text); }
.caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; margin-top: 26px; }
.cap {
  display: grid; gap: 12px; align-content: start; padding: 26px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(201, 162, 39, .07), rgba(92, 16, 32, .1)); border: 1px solid var(--line);
  transition: border-color .3s, transform .4s var(--ease);
}
.cap:hover { border-color: rgba(201, 162, 39, .5); transform: translateY(-4px); }
.cap svg { width: 40px; height: 40px; color: var(--gold-lt); }
.cap h3 { font-size: 1.15rem; color: var(--text-hi); font-weight: 750; }
.cap p { font-size: .94rem; }
.cap .eg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: .78rem; color: var(--muted); }
.cap .eg button {
  font: inherit; font-size: .78rem; color: var(--gold-lt); background: rgba(201, 162, 39, .08); border: 1px solid rgba(201, 162, 39, .3);
  padding: 3px 11px; border-radius: 999px; cursor: pointer; transition: background .25s;
}
.cap .eg button:hover { background: rgba(201, 162, 39, .22); }

.contact { min-height: 100svh; display: grid; grid-template-rows: 1fr auto; padding-bottom: 24px; background: radial-gradient(ellipse 70% 55% at 50% 35%, rgba(92, 16, 32, .28), transparent 70%); }
.contact-inner { align-content: center; text-align: center; justify-items: center; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 12px; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; max-width: 1240px; width: 100%; margin: 0 auto; padding-top: 22px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.foot a { text-decoration: none; color: var(--gold); }

/* ───────── 7. Fenêtre de détail ───────── */
dialog#detail {
  width: min(1120px, 94vw); max-height: min(88dvh, 820px); margin: auto; padding: 0; overflow: hidden;
  color: var(--text); background: #100c0d; border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), 0 0 0 1px rgba(201, 162, 39, .12);
  opacity: 0; translate: 0 44px; scale: .95;
  transition: opacity .35s ease-out, translate .5s var(--ease), scale .5s var(--ease), overlay .5s allow-discrete, display .5s allow-discrete;
}
dialog#detail[open] { opacity: 1; translate: 0 0; scale: 1; }
@starting-style { dialog#detail[open] { opacity: 0; translate: 0 44px; scale: .95; } }
dialog#detail::backdrop {
  background: rgba(6, 4, 7, 0); backdrop-filter: blur(0);
  transition: background .4s, backdrop-filter .4s, overlay .5s allow-discrete, display .5s allow-discrete;
}
dialog#detail[open]::backdrop { background: rgba(6, 4, 7, .78); backdrop-filter: blur(8px); }
@starting-style { dialog#detail[open]::backdrop { background: rgba(6, 4, 7, 0); backdrop-filter: blur(0); } }
html:has(dialog[open]) { overflow: hidden; }

.d-shell { display: grid; grid-template-columns: minmax(0, 54%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; max-height: min(88dvh, 820px); }
.d-close {
  position: absolute; top: 14px; right: 14px; z-index: 5; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  color: var(--text-hi); background: rgba(9, 7, 10, .7); border: 1px solid var(--line); border-radius: 50%; transition: background .25s, rotate .4s var(--ease);
}
.d-close:hover { background: var(--maroon); rotate: 90deg; }
.d-media {
  position: relative; grid-row: 1 / 2; overflow: hidden; display: grid; place-items: center; padding: 30px; min-height: 400px;
  background: radial-gradient(ellipse at 30% 20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%), #0b0809;
  border-right: 1px solid var(--line);
}
.d-media img {
  width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top;
  border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.d-media .art svg { width: 30%; max-width: 170px; }
.d-body { grid-row: 1 / 2; overflow-y: auto; padding: 38px 36px 26px; display: grid; gap: 14px; align-content: start; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.d-cat { font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); font-weight: 700; padding-right: 48px; }
.d-body h3 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1; color: var(--text-hi); font-weight: 800; letter-spacing: -.02em; }
.d-about { font-size: 1rem; }
.d-body h4 { font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 8px; font-weight: 700; }
.d-features { display: grid; gap: 9px; }
.d-features li { position: relative; padding-left: 26px; font-size: .95rem; }
.d-features li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 10px; height: 2px; background: var(--accent); border-radius: 2px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.d-nav {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 22px;
  border-top: 1px solid var(--line); background: rgba(9, 7, 10, .6); font-size: .82rem; color: var(--muted);
}
.d-nav button { font: inherit; color: var(--text-hi); background: none; border: 0; cursor: pointer; display: inline-flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; transition: background .25s, color .25s; }
.d-nav button:hover { background: rgba(201, 162, 39, .14); color: var(--gold-lt); }

/* ───────── 8. Motion piloté par la molette ─────────
   Les animations ci-dessous sont liées à la position de défilement
   (animation-timeline). Aucune boucle JavaScript : la molette pilote tout. */
@media (prefers-reduced-motion: no-preference) {

  /* Arrivée de la page : titre mot par mot */
  .js .hero-title .w > span { translate: 0 110%; animation: word-in 1s var(--ease) forwards; animation-delay: calc(.15s + var(--i) * 70ms); }
  @keyframes word-in { to { translate: 0 0; } }
  .js .hero-eyebrow, .js .hero-lead, .js .hero-actions, .js .hero-stats, .js .scroll-cue { opacity: 0; translate: 0 22px; animation: fade-up .9s var(--ease) forwards; }
  .js .hero-eyebrow { animation-delay: .05s; }
  .js .hero-lead { animation-delay: .75s; }
  .js .hero-actions { animation-delay: .95s; }
  .js .hero-stats { animation-delay: 1.1s; }
  .js .scroll-cue { animation-delay: 1.4s; }
  @keyframes fade-up { to { opacity: 1; translate: 0 0; } }

  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    /* Barre de progression de la page */
    .scroll-progress { animation: grow linear both; animation-timeline: scroll(root); }
    @keyframes grow { to { transform: scaleX(1); } }

    /* Accueil : le contenu s'éloigne et s'efface quand on défile */
    .hero-content { animation: hero-out linear both; animation-timeline: view(); animation-range: exit 0% exit 80%; }
    @keyframes hero-out { to { opacity: 0; translate: 0 -90px; scale: .93; filter: blur(4px); } }
    .hero-grid { animation: grid-drift linear both; animation-timeline: view(); animation-range: exit; }
    @keyframes grid-drift { to { translate: 0 -120px; } }
    .hero-halo { animation: halo 5s ease-in-out infinite, halo-out linear both; animation-timeline: auto, view(); animation-range: normal, exit; }
    @keyframes halo-out { to { opacity: 0; } }
    .scroll-cue { animation: fade-up .9s 1.4s var(--ease) forwards, cue-out linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0px 200px; }
    @keyframes cue-out { to { opacity: 0; } }

    /* Bandeaux : le texte défile latéralement avec la molette */
    .band-track { animation: band-slide linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
    @keyframes band-slide { from { translate: 4% 0; } to { translate: -46% 0; } }
    .band-rev .band-track { animation-name: band-slide-rev; }
    @keyframes band-slide-rev { from { translate: -46% 0; } to { translate: 4% 0; } }

    /* Chapitres : chaque section est une « scène » suivie par un chronomètre nommé */
    .chapter { view-timeline: --chap block; }
    .chapter-num { animation: num-par linear both; animation-timeline: --chap; animation-range: cover 0% cover 100%; }
    @keyframes num-par { from { translate: -6% 70px; opacity: 0; } 25% { opacity: 1; } to { translate: 0 -90px; opacity: .55; } }
    .chapter-head h2 .line > span { animation: line-up linear both; animation-timeline: --chap; animation-range: entry 8% entry 55%; }
    .chapter-head h2 .line:nth-child(2) > span { animation-range: entry 14% entry 62%; }
    @keyframes line-up { from { translate: 0 115%; } to { translate: 0 0; } }
    .chapter-intro, .chapter-meter { animation: fade-slide linear both; animation-timeline: --chap; animation-range: entry 25% entry 70%; }
    @keyframes fade-slide { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }
    .chapter-meter .rail i { animation: fill linear both; animation-timeline: --chap; animation-range: entry 40% exit 40%; }
    @keyframes fill { to { transform: scaleY(1); } }

    /* Cartes : arrivée depuis le bas, couverture dévoilée, image en parallaxe */
    .card { animation: card-in linear both; animation-timeline: view(); animation-range: entry 0% entry 75%; }
    @keyframes card-in { from { opacity: 0; translate: 0 90px; scale: .9; } to { opacity: 1; translate: 0 0; scale: 1; } }
    .cover { animation: cover-wipe linear both; animation-timeline: view(); animation-range: entry 5% entry 85%; }
    @keyframes cover-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
    .cover img { animation: parallax linear both; animation-timeline: view(); animation-range: cover; }
    @keyframes parallax { from { translate: 0 -6%; } to { translate: 0 6%; } }
    .art svg { animation: bob 5s ease-in-out infinite, art-rot linear both; animation-timeline: auto, view(); animation-range: normal, cover; }
    @keyframes art-rot { from { rotate: -9deg; scale: .85; } 50% { rotate: 0deg; scale: 1; } to { rotate: 9deg; scale: .85; } }

    /* Autres blocs qui apparaissent */
    [data-reveal] { animation: fade-slide linear both; animation-timeline: view(); animation-range: entry 5% entry 60%; }
    .cap { animation: card-in linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }

  /* Repli pour les navigateurs sans animation liée au scroll (ex. Firefox) :
     app.js ajoute .fb sur <html> et la classe .in via IntersectionObserver. */
  .fb .card, .fb .cap, .fb [data-reveal], .fb .chapter-intro, .fb .chapter-meter { opacity: 0; translate: 0 50px; transition: opacity .8s var(--ease), translate .8s var(--ease); }
  .fb .in { opacity: 1 !important; translate: 0 0 !important; }
  .fb .chapter-head h2 .line > span { translate: 0 115%; transition: translate .9s var(--ease); }
  .fb .chapter.in .chapter-head h2 .line > span { translate: 0 0; }
  .fb .band-track { translate: var(--bx, 0) 0; }
  .fb .scroll-progress { transform: scaleX(var(--p, 0)); }
}

/* ───────── 9. Responsive & accessibilité ───────── */
@media (max-width: 1100px) {
  .topnav a { padding: 8px 10px; font-size: .8rem; }
}
@media (max-width: 960px) {
  :root { --topbar-h: 60px; }
  .topnav { display: none; }
  .topcta { margin-left: auto; }
  .dots { display: none; }
  .chapter-inner { grid-template-columns: 1fr; gap: 34px; }
  .chapter-head { position: relative; top: 0; }
  .chapter-num { font-size: clamp(5rem, 24vw, 8rem); }
  .chapter-meter .rail { height: 4px; width: 92px; }
  .chapter-meter .rail i { transform: scaleX(0); transform-origin: 0 50%; }
  @media (prefers-reduced-motion: no-preference) { @supports (animation-timeline: view()) { @keyframes fill { to { transform: scaleX(1); } } } }
  dialog#detail { max-height: 92dvh; }
  .d-shell { display: flex; flex-direction: column; height: min(92dvh, 900px); max-height: none; }
  .d-media { flex: none; height: 200px; min-height: 0; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .d-media img { width: auto; height: 100%; }
  .d-body { flex: 1; min-height: 0; padding: 24px 22px; }
  .d-nav { flex: none; }
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .cards .card:nth-child(even) { margin-top: 0; }
  .hero-stats { gap: 14px 28px; }
  .d-nav button span { display: none; }
  .brand img { height: 34px; }
}

@media (hover: none), (prefers-reduced-motion: reduce) { .card-surface::before { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .particles { display: none; }
}
@media (prefers-contrast: more) { .tags li, .card-surface { border-color: var(--muted); } }
