/* ============================================================
   Scroll-driven exploded view — feuille de style partagée
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg:        #05070b;
  --bg-soft:   #0b1017;
  --ink:       #e9eef6;
  --ink-dim:   #8695a8;
  --ink-faint: #47546634;
  --accent:    #6fd3ff;
  --accent-soft: #6fd3ff22;
  --rule:      #ffffff14;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.theme-brass {
  --bg:      #070604;
  --bg-soft: #14100a;
  --accent:  #f0b45f;
  --accent-soft: #f0b45f22;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

/* ---------- fond ambiant ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 8%, var(--bg-soft) 0%, var(--bg) 62%),
    var(--bg);
}
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--ink-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink-faint) 1px, transparent 1px);
  background-size: 88px 88px, 88px 88px;
  mask-image: radial-gradient(80% 60% at 50% 45%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 45%, #000 0%, transparent 78%);
  opacity: .5;
}
.glow {
  position: fixed; z-index: 0; pointer-events: none;
  left: 50%; top: 50%; width: 120vmax; height: 70vmax;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  opacity: .0;
  transition: opacity .6s ease;
}

/* ---------- HUD fixe ---------- */
.hud {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 22px clamp(18px, 4vw, 48px);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-dim);
  mix-blend-mode: normal;
}
.hud__brand { color: var(--ink); display: flex; align-items: center; gap: 10px; }
.hud__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 14px var(--accent); }
.hud__nav { display: flex; gap: 18px; }
.hud__nav a { text-decoration: none; opacity: .6; transition: opacity .25s, color .25s; }
.hud__nav a:hover, .hud__nav a[aria-current="page"] { opacity: 1; color: var(--accent); }

/* ---------- section scrollytelling ---------- */
.stage { position: relative; z-index: 1; height: 400vh; }
.sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: grid; place-items: center;
}

.scene-wrap {
  position: relative;
  width: min(1500px, 94vw);
  perspective: 1600px;
}
.scene {
  position: relative;
  width: 100%;
  aspect-ratio: 1920 / 856;
  transform-style: preserve-3d;
  will-change: transform;
}

/* couche assemblée */
.layer-assembled {
  position: absolute; inset: 0;
  will-change: transform, opacity, filter;
}
.layer-assembled img { width: 100%; height: 100%; object-fit: contain; }

/* couche éclatée : image intacte (raccord final) */
.layer-full { position: absolute; inset: 0; opacity: 0; will-change: opacity; }
.layer-full img { width: 100%; height: 100%; object-fit: contain; }

/* couche éclatée : bandes */
.layer-parts { position: absolute; inset: 0; will-change: opacity; }
.slice {
  position: absolute; top: 0; height: 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;  mask-size: 100% 100%;
  will-change: transform, filter;
}
.slice > img {
  position: absolute; top: 0; left: 0;
  height: 100%; max-width: none;
}

/* axe technique */
.axis { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.axis line { stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 14 10; opacity: .55; }
.axis circle { fill: var(--accent); }

/* repères numérotés */
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute; transform: translate(-50%, 0);
  display: flex; flex-direction: column; align-items: center;
  opacity: 0; will-change: opacity, transform;
}
.marker__stem { width: 1px; background: linear-gradient(to bottom, transparent, var(--accent)); }
.marker__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  margin-top: -3px;
}
.marker__num {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--accent); margin-bottom: 6px;
  padding: 2px 6px; border: 1px solid var(--accent-soft); border-radius: 3px;
  background: #00000055; backdrop-filter: blur(4px);
}

/* ---------- calques de texte ---------- */
.overlay { position: absolute; inset: 0; pointer-events: none; }

.scrim {
  position: absolute; left: 50%; top: 50%; width: 150%; height: 150%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(3,5,9,.92) 0%, rgba(3,5,9,.72) 45%, transparent 72%);
  will-change: opacity;
}

.title-card {
  position: absolute; left: 50%; top: 44%;
  transform: translate(-50%, -50%);
  width: min(900px, 88vw); text-align: center;
  will-change: opacity, transform;
}
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .34em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 18px;
}
.title-card h1 {
  margin: 0; font-size: clamp(38px, 7.4vw, 104px); line-height: .94;
  font-weight: 600; letter-spacing: -.035em;
}
.title-card h1 em { font-style: normal; color: var(--accent); }
.title-card p {
  margin: 22px auto 0; max-width: 46ch; color: var(--ink-dim);
  font-size: clamp(14px, 1.5vw, 17px); line-height: 1.6;
}

.scroll-cue {
  position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  will-change: opacity;
}
.scroll-cue span { display: block; width: 1px; height: 46px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: cue 1.9s ease-in-out infinite; }
@keyframes cue { 0%,100% { transform: scaleY(.35); transform-origin: top; opacity: .4; }
                 50%      { transform: scaleY(1);   transform-origin: top; opacity: 1; } }

/* étapes à gauche */
.steps {
  position: absolute; left: clamp(18px, 4vw, 48px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 18px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase;
}
.step { display: flex; align-items: center; gap: 12px; color: var(--ink-dim);
  opacity: .35; transition: opacity .4s ease, color .4s ease; }
.step i { font-style: normal; width: 22px; opacity: .6; }
.step b { font-weight: 500; }
.step::before {
  content: ""; width: 26px; height: 1px; background: currentColor;
  transition: width .45s cubic-bezier(.22,1,.36,1), background .4s;
}
.step.is-active { opacity: 1; color: var(--accent); }
.step.is-active::before { width: 52px; }
.step.is-done { opacity: .6; }

/* compteur à droite */
.rail {
  position: absolute; right: clamp(18px, 4vw, 48px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em;
  color: var(--ink-dim);
}
.rail__track { width: 1px; height: 34vh; background: var(--rule); position: relative; }
.rail__fill { position: absolute; top: 0; left: 0; width: 1px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent); height: 0%; }
.rail__pct { color: var(--accent); }

/* légende basse */
.caption {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%);
  text-align: center; width: min(620px, 84vw);
  opacity: 0; will-change: opacity, transform;
}
.caption h2 { margin: 0 0 10px; font-size: clamp(18px, 2.4vw, 28px); font-weight: 600;
  letter-spacing: -.02em; }
.caption p { margin: 0; color: var(--ink-dim); font-size: 14px; line-height: 1.6; }

/* ---------- sections texte ---------- */
.section { position: relative; z-index: 1; padding: clamp(70px, 12vh, 150px) clamp(18px, 4vw, 48px); }
.wrap { max-width: 1100px; margin: 0 auto; }
.lede { font-size: clamp(20px, 3vw, 34px); line-height: 1.35; letter-spacing: -.02em;
  max-width: 22ch; margin: 0 0 28px; font-weight: 500; }
.lede em { font-style: normal; color: var(--accent); }
.grid { display: grid; gap: clamp(24px, 4vw, 56px);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 48px; }
.card { border-top: 1px solid var(--rule); padding-top: 18px; }
.card h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-dim); font-size: 14px; line-height: 1.65; }
.card .num { font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em;
  color: var(--accent); display: block; margin-bottom: 14px; }

.next {
  display: inline-flex; align-items: center; gap: 14px; text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: 14px 26px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  transition: border-color .3s, color .3s, transform .3s;
}
.next:hover { border-color: var(--accent); color: var(--accent); transform: translateX(4px); }

.foot { border-top: 1px solid var(--rule); padding: 28px clamp(18px, 4vw, 48px);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-dim);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .steps, .rail { display: none; }
  .sticky { overflow: hidden; }

  /* l'axe d'assemblage est mis à la verticale : la vue éclatée
     occupe alors toute la hauteur de l'écran */
  .scene-wrap { position: absolute; left: 50%; top: 50%; width: 84vh;
                transform: translate(-50%, -50%) rotate(90deg); }
  .marker__num { transform: rotate(-90deg); margin-bottom: 14px; }
  .title-card { top: 42%; }
  .caption { bottom: 4vh; }
  .caption p { font-size: 13px; }
}

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