/* =========================================================
   Sēkoia — Chapitre « L'INVISIBLE »
   Bascule gooey (noir) + 3 parties : Automatisation · Logiciel · Agentique
   Thème : near-black warm + cuivre-signal. On entre dans la machine.
   ========================================================= */

#inv-root {
  background: var(--void);
  border-block: 1px solid var(--hair-soft);
  /* Tokens Sēkoia */
  --os: #f2efe7;
  --bone-light: #f2efe7;
  --copper: #a25d31;
  --copper-soft: #b97442;
  --copper-bright: #b97442;
  --copper-deep: #7a4a32;
  --green: #4e5a46;
  --green-soft: #4e5a46;

  /* Thème CLAIR (re-thémé) — aligné sur la DA crème du site */
  --void: #ece6db;
  --void-2: #e4ddcf;
  --panel: #ffffff;
  --panel-2: #faf7f1;
  --hair: rgba(27, 22, 17, 0.12);
  --hair-soft: rgba(27, 22, 17, 0.06);
  --ink: #1b1611;
  --dim: rgba(27, 22, 17, 0.62);
  --faint: rgba(27, 22, 17, 0.40);

  /* Amorce claire */
  --cream: #f5f1e9; /* aligné sur --bg du site de Dino → raccord beige invisible */
  --cream-2: #e8e2d6;
  --cream-ink: #1b1611;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.1, 1);
  --ease-inout: cubic-bezier(0.76, 0, 0.24, 1);

  --pad: clamp(1.25rem, 5vw, 5.5rem);
  --maxw: 1560px;
  --r: 4px;
  --r-lg: 14px;
  --r-pill: 100px;

  --font-display: "Zodiak", "Clash Display", Georgia, serif;
  --font-sans: "Satoshi", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  /* Tweakables (overridden by JS) */
  --tw-copper: #a25d31;
  --tw-grain: 0.055;
  --tw-speed: 0.5;
  --tw-glow: 0;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  overflow-x: clip;
  scroll-behavior: auto;
}

::selection { background: var(--tw-copper); color: var(--void); }
:focus-visible { outline: 2px solid var(--tw-copper); outline-offset: 3px; border-radius: var(--r); }
:focus:not(:focus-visible) { outline: none; }
/* ===================================================================
   LA BASCULE — VISIBLE → INVISIBLE
   #switch : section haute, stage sticky, progression --p (0→1)
   =================================================================== */
.switch { position: relative; height: 220vh; padding-inline: 0; }

/* ===== INTÉGRATION site — neutralise le `section{padding-inline:var(--pad)}` global
   de Dino pour que la bascule + le shader-band soient full-bleed (zéro bande crème). ===== */
#inv-root .switch,
#inv-root .shaderband { padding-inline: 0; }

/* Texte clair par défaut sur les zones SOMBRES du chapitre. Les blocs globaux du
   handoff (body/h/p) ont été neutralisés à l'intégration ; sans ça, les éléments
   sans couleur explicite (titres de cartes Versus, punchline…) héritaient du texte
   sombre du body de Dino → illisible sur fond noir. On NE touche pas .switch (crème). */
#inv-root .chapter-dark,
#inv-root .shaderband { color: var(--ink); }

/* Équilibrage typographique des titres du chapitre sombre (pas de veuves/orphelines) */
#inv-root h2, #inv-root h3, .part__title, .versus__punch, .shaderband__title, .automate__headline { text-wrap: balance; }
#inv-root p, .part__lead { text-wrap: pretty; }

/* Sortie du chapitre : fondu noir → crème (#f5f1e9 = --bg de Dino) pour rejoindre
   la section Méthode en douceur — symétrie avec l'entrée beige→noir. */
.inv-outro {
  height: clamp(22vh, 30vh, 38vh);
  background: linear-gradient(to bottom, var(--void) 0%, var(--void) 6%, #f5f1e9 100%);
  margin-top: -1px; /* évite tout filet entre le shader noir et le fondu */
}
.switch__stage {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: grid; place-items: center;
  background: var(--cream);
}
/* fond qui vire au noir, piloté par --p */
.switch__bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 78% 110%, rgba(205,145,99,0.18), transparent 55%),
    radial-gradient(90% 70% at 12% -10%, rgba(93,107,84,0.12), transparent 60%),
    var(--cream);
}
.switch__bg::after {
  content: ""; position: absolute; inset: 0; background: var(--void);
  opacity: clamp(0, calc((var(--p) - 0.05) / 0.22), 1);
}

/* Amorce claire */
.amorce {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: clamp(5rem, 12vh, 8rem) var(--pad) 0;
  opacity: clamp(0, calc(1 - var(--p) / 0.16), 1);
  transform: translateY(calc(var(--p) * -40px)) scale(calc(1 - var(--p) * 0.04));
  color: var(--cream-ink);
}
.amorce__eyebrow {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--copper-deep); margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
}
.amorce__line { font-family: var(--font-display); font-weight: 500; line-height: 1.02; letter-spacing: -.02em;
  font-size: clamp(2.4rem, 7vw, 6rem); }
.amorce__line em { font-style: italic; color: var(--copper-deep); }
.amorce__hint {
  margin-top: clamp(2rem, 5vw, 3.4rem); font-family: var(--font-mono); font-size: .7rem;
  letter-spacing: .18em; text-transform: uppercase; color: rgba(27,22,17,.5);
  display: inline-flex; align-items: center; gap: .8rem;
}
.amorce__hint i { display: block; width: 1px; height: 34px; background: linear-gradient(var(--copper-deep), transparent);
  animation: hintLine 2.2s var(--ease-soft) infinite; transform-origin: top; }
@keyframes hintLine { 0%{transform:scaleY(0)}40%{transform:scaleY(1);transform-origin:top}
  60%{transform:scaleY(1);transform-origin:bottom}100%{transform:scaleY(0);transform-origin:bottom} }

/* Couche noire + gooey */
.bascule {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center;
  padding: 0 var(--pad); pointer-events: none;
  opacity: clamp(0, calc((var(--p) - 0.08) / 0.10), 1);
}
/* grille technique cuivre, monte en intensité */
.bascule__grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(205,145,99,0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205,145,99,0.5) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 50%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 90% at 50% 50%, #000 0%, transparent 72%);
  opacity: calc(var(--p) * 0.10);
}
.gooey {
  position: relative; z-index: 1;
  filter: url(#gooey-threshold);
}
.gooey__word {
  grid-area: 1 / 1; position: relative;
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.035em; line-height: .86;
  font-size: clamp(2.1rem, 10.2vw, 12rem);
  white-space: nowrap;
  color: var(--tw-copper);
}
.gooey { display: grid; grid-area: 1 / 1; }
.gooey__layer { grid-area: 1 / 1; }
.gooey__layer--b { color: var(--copper-bright); }

.bascule__stack {
  position: relative; z-index: 2;
  display: grid; place-items: center;
}
.bascule__morph { position: relative; display: grid; place-items: center; }

/* ===================================================================
   STRUCTURE COMMUNE DES PARTIES
   =================================================================== */
.chapter-dark { position: relative; background: transparent; z-index: 5; }
.part { position: relative; padding: clamp(1.6rem, 4vw, 3rem) var(--pad); max-width: var(--maxw); margin-inline: auto; }
.part__head { max-width: 980px; margin: 0 auto clamp(1.4rem, 3.2vw, 2.6rem); text-align: center; }

/* Bloc 2 colonnes : texte + visuel côte à côte (compaction du chapitre) */
.part--split { display: grid; grid-template-columns: minmax(260px, 0.82fr) 1.18fr; gap: clamp(1.8rem, 4vw, 4rem); align-items: center; }
.part--split .part__head { text-align: left; margin: 0; max-width: none; }
.part--split .part__lead { margin-left: 0; margin-right: 0; max-width: 46ch; }
.part--split .eyebrow::before { display: none; }
@media (max-width: 920px) {
  .part--split { grid-template-columns: 1fr; gap: clamp(1.4rem, 5vw, 2.4rem); }
  .part--split .part__head { text-align: center; margin: 0 auto; }
  .part--split .part__lead { margin-left: auto; margin-right: auto; }
  .part--split .eyebrow::before { display: inline-block; }
}
.eyebrow {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--tw-copper); display: inline-flex; align-items: center; gap: .7rem;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--tw-copper); opacity: .6; }
.eyebrow::after  { content: ""; width: 26px; height: 1px; background: var(--tw-copper); opacity: .6; }
.part__num {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .2em; color: var(--faint);
  margin-bottom: 1.4rem;
}
.part__title {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -.04em; line-height: .96;
  font-size: clamp(2.8rem, 7.2vw, 6rem); margin: 1.4rem 0 0;
}
.part__title em { font-style: normal; color: var(--tw-copper); }
.part__lead { margin: clamp(1.4rem,3vw,2.2rem) auto 0; max-width: 56ch; color: var(--dim);
  font-size: clamp(1.05rem, 2vw, 1.35rem); }

/* reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
body.cap .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
body.cap .module, body.cap .drow, body.cap .cap-card { opacity: 1 !important; transform: none !important; transition: none !important; }
body.cap .switch__bg { background: #050507 !important; }

/* divider hairline between parts */
.part-rule { width: 100%; max-width: var(--maxw); margin: 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hair), transparent); }

/* tabs (shared) */
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: clamp(2.4rem,5vw,3.6rem); }
.tab {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); padding: .7rem 1.2rem; border: 1px solid var(--hair); border-radius: var(--r-pill);
  background: transparent; cursor: pointer; transition: all .4s var(--ease); white-space: nowrap;
}
.tab:hover { color: var(--ink); border-color: rgba(242,239,231,.25); }
.tab.is-active { color: var(--void); background: var(--tw-copper); border-color: var(--tw-copper); }

/* CTA buttons */
.btn {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: .7rem; padding: 1rem 1.7rem; border-radius: var(--r-pill);
  cursor: pointer; transition: all .4s var(--ease); border: 1px solid transparent;
}
.btn--primary {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--copper-bright) 0%, var(--tw-copper) 50%, #b1764a 100%);
  color: #2a1a0e;
  border: 1px solid rgba(0,0,0,0.34);
  border-top-color: rgba(255,255,255,0.45);
  text-shadow: 0 1px 0 rgba(255,255,255,0.28);
  box-shadow:
    inset 0 1px 0.5px rgba(255,255,255,0.6),
    inset 0 -2px 3px rgba(80,40,15,0.45),
    inset 0 0 0 1px rgba(255,255,255,0.06),
    0 8px 22px -10px rgba(205,145,99,0.7),
    0 2px 5px rgba(0,0,0,0.35);
}
.btn--primary::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0) 46%);
  opacity: .75;
}
.btn--primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 50%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-18deg); opacity: 0;
}
.btn--primary:hover { filter: brightness(1.07); transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0.5px rgba(255,255,255,0.7),
    inset 0 -2px 3px rgba(80,40,15,0.45),
    0 16px 38px -12px rgba(205,145,99,0.8),
    0 3px 7px rgba(0,0,0,0.4); }
.btn--primary:hover::after { animation: btnSweep .8s var(--ease) forwards; }
@keyframes btnSweep { from { left: -60%; opacity: .9; } to { left: 120%; opacity: 0; } }
.btn--primary:active { transform: translateY(1px) scale(.99); filter: brightness(.96);
  box-shadow: inset 0 2px 4px rgba(40,20,8,0.5), inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 6px rgba(0,0,0,0.35); }
.btn--primary > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .btn--primary:hover::after { animation: none; } }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--hair); }
.btn--ghost:hover { border-color: var(--tw-copper); gap: 1rem; }

@media (max-width: 760px) {
  .part { padding: clamp(1.6rem, 6vw, 2.6rem) var(--pad); }
}
