/* Accueil · les passages d'un écran à l'autre (avec accueil.js). Storyboard : un film en sept plans.
   Ordre : portail → les 1001 nues → sélection → cavalier → séries → l'artiste → actualités → pied de page.
   P1 Delphine s'éloigne dans la nuit des nues · P2 la salle se rallume, la mosaïque se range en tête du rail
   P3 le cavalier arrive de la profondeur (cavalier.css) · P4 la toile du cavalier rentre dans l'index
   P5-P6 portrait et actualités arrivent de la profondeur · P7 le pied de page monte comme une feuille de nuit.
   Tout est fonction du défilement (rien n'est détourné) ; sans JS ou en mouvement réduit : une page calme et complète. */

/* ---------------------------------------------------------------- P2 · la sélection glisse comme une feuille sur la salle des nues */
.home .ouverture { position: relative; z-index: 1; margin-top: -28px; padding-top: calc(28px + clamp(32px, 5vw, 72px));
  border-radius: 28px 28px 0 0; background: var(--paper);
  box-shadow: 0 -1px 0 color-mix(in oklab, var(--ink) 6%, transparent), 0 -28px 56px -40px rgb(0 0 0 / .22); }
/* La mosaïque des nues, rangée en tête du rail : une petite salle noire, « Composer la mosaïque » (ajoutée par accueil.js) */
.rail .rail-mosaique .frame { display: grid; place-items: center; width: min(calc(var(--rail-h) * .62 * 2.4), calc(100vw - 2 * var(--gutter) - 32px)); aspect-ratio: 2.4; background: var(--night); }
.rail .rail-mosaique canvas { display: block; width: 88%; height: auto; aspect-ratio: 76.33 / 35.8; }
.rail .rail-mosaique .t { transition: color var(--d-court) var(--courbe-sortie); }
.rail .rail-mosaique .t::after { content: " →"; }
.rail .rail-mosaique a:hover .t { color: var(--accent); }
.rail .rail-mosaique.en-vol .frame { background: color-mix(in oklab, var(--night) calc(var(--fond, 0) * 100%), transparent); }
.rail .rail-mosaique.en-vol canvas { visibility: hidden; }
/* Les toiles viennent de la profondeur, en cascade (--arrivee : 0 → 1, posé par accueil.js) */
.ouverture.ac-vol .rail figure:not(.rail-mosaique) {
  --i: clamp(0, calc(var(--arrivee, 1) * 1.84 - var(--k, 0) * .14), 1);
  opacity: calc(.12 + .88 * var(--i)); translate: calc((1 - var(--i)) * 96px) 0; scale: calc(.88 + .12 * var(--i)); transform-origin: 0 100%; }
@media (min-width: 760px) { .ouverture.ac-vol .rail figure:not(.rail-mosaique) { filter: blur(calc((1 - var(--i)) * 6px)); } }

/* Les copies qui voyagent (P1, P2, P4) : fixes, déplacées en transform seulement */
.ac-fantome { position: fixed; left: 0; top: 0; z-index: 35; margin: 0; pointer-events: none; transform-origin: 0 0; will-change: transform; display: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 18px 48px -18px rgb(0 0 0 / .28); }
.ac-fantome.on { display: block; }
.ac-fantome img, .ac-fantome canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.ac-fantome-mosaique { box-shadow: none; }
.cavalier.ac-envolee canvas { opacity: 0; }
.ac-cache { visibility: hidden; }

/* ---------------------------------------------------------------- Le fil des chapitres (ordinateur) */
.chapitres { display: none; }
@media (min-width: 760px) {
  .chapitres { position: fixed; left: 50%; bottom: 14px; z-index: 30; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 5px 0 20px;
    border-radius: 999px; background: color-mix(in oklab, var(--paper) 74%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid color-mix(in oklab, var(--ink) 9%, transparent);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .55), 0 10px 32px -8px rgb(0 0 0 / .18), 0 2px 6px rgb(0 0 0 / .06);
    translate: -50% 0; opacity: 0; transform: translateY(12px); filter: blur(4px); visibility: hidden; pointer-events: none;
    transition: opacity var(--d-moyen) var(--courbe-sortie), transform var(--d-moyen) var(--courbe-sortie), filter var(--d-moyen) var(--courbe-sortie), visibility 0s var(--d-moyen); }
  .chapitres.on { opacity: 1; transform: none; filter: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .chapitres { background: var(--paper); } }
  .ch-l { min-width: 15ch; margin: 0; font: 500 var(--t-etiquette)/1 var(--mono, ui-monospace, Menlo, Consolas, monospace); letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; transition: opacity 140ms var(--courbe-sortie), filter 140ms var(--courbe-sortie); }
  .ch-l.change { opacity: 0; filter: blur(4px); }
  .ch-l b { font-weight: 500; color: var(--ink-soft); margin-right: .7em; }
  .ch-points { position: relative; display: flex; margin: 0; padding: 0; list-style: none; }
  .ch-points a { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 44px; border-radius: 22px; }
  .ch-points a::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: color-mix(in oklab, var(--ink) 30%, transparent);
    transition: background var(--d-court) var(--courbe-sortie), transform var(--d-court) var(--courbe-sortie); }
  .ch-points a:hover::before { background: var(--ink); transform: scale(1.3); }
  .ch-points a[aria-current="true"]::before { background: var(--ink); }
  .ch-points a:focus-visible { outline: 2px solid var(--vif); outline-offset: -4px; }
  /* la pastille glisse sous le chapitre courant */
  .ch-pastille { position: absolute; left: 0; top: 7px; width: 36px; height: 30px; border-radius: 15px; background: color-mix(in oklab, var(--ink) 9%, transparent);
    transform: translateX(calc(var(--c, 0) * 36px)); transition: transform 380ms var(--courbe-tiroir); }
}

/* ---------------------------------------------------------------- P3-P6 · l'arrivée en profondeur (CSS, liée au défilement) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* P4 : les filets de l'index se tracent, les noms font leur mise au point */
    .js .home .index li { border-bottom-color: transparent; background: linear-gradient(var(--line), var(--line)) 0 100% / 100% 1px no-repeat;
      animation: ac-filet linear both; animation-timeline: view(); animation-range: entry 5% cover 32%; }
    .js .home .index .n { animation: ac-net linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
    /* P5 : le portrait sort de la pénombre, puis recule en sortant */
    .js .home .artiste-bloc figure { animation: ac-profondeur linear both, ac-recul linear forwards; animation-timeline: view(), view(); animation-range: entry 0% cover 40%, exit 10% exit 100%; }
    /* P6 : les actualités approchent une à une, la vignette se met au point juste après */
    .js .home .actus li { animation: ac-approche linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
    .js .home .actus img { animation: ac-net linear both; animation-timeline: view(); animation-range: entry 15% cover 38%; }
    /* P3 : la sélection recule pendant que la scène du cavalier arrive */
    .js .home .ouverture { view-timeline: --ouverture block; }
    .js .home .ouverture > * { animation: ac-recul-feuille linear forwards; animation-timeline: --ouverture; animation-range: exit 5% exit 100%; }
  }
}
@keyframes ac-filet { from { background-size: 0% 1px; } }
@keyframes ac-net { from { opacity: .12; filter: blur(7px); translate: 0 8px; } }
@keyframes ac-profondeur { from { opacity: .15; scale: .88; filter: blur(10px); } }
@keyframes ac-recul { to { opacity: .55; scale: .96; } }
@keyframes ac-approche { from { opacity: 0; translate: 0 28px; scale: .96; } }
@keyframes ac-recul-feuille { to { opacity: .4; scale: .97; translate: 0 6vh; } }
@media (max-width: 759px) {
  /* téléphone : pas de flou animé (coût), l'échelle et l'opacité suffisent */
  @keyframes ac-net { from { opacity: .12; translate: 0 8px; } }
  @keyframes ac-profondeur { from { opacity: .15; scale: .9; } }
}

/* Le fil de droite (instruments) suit la lumière de la salle (cavalier, nues) : --accueil-nuit posé par accueil.js */
@media (min-width: 901px) {
  body.home .instr-fil.on:not(.sur-nuit) { color: color-mix(in oklab, var(--on-night-soft) calc(var(--accueil-nuit, 0) * 100%), var(--ink-soft)); }
}

/* ---------------------------------------------------------------- Les 1001 nues (P1 à l'entrée, P2 à la sortie)
   Sans JS ou en mouvement réduit : une salle noire, le titre, le chapô, une frise (ou la mosaïque immobile), les deux liens. */
.nues-espace { position: relative; background: var(--night); color: var(--on-night); color-scheme: dark; }
.ne-scene { position: relative; display: grid; gap: clamp(28px, 4vw, 48px); padding: clamp(56px, 8vw, 112px) 0 clamp(48px, 6vw, 80px); }
.nues-espace canvas { display: none; }
.ne-texte { position: relative; }
.ne-surtitre { margin: 0 0 1rem; color: var(--on-night-soft); }
.ne-titre { margin: 0 0 .35em; color: inherit; font-size: var(--t-titre); transform-origin: 0 0; }
.ne-chapo { max-width: 46ch; margin: 0; font-size: var(--t-texte); color: var(--on-night); }
.ne-frise { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0 var(--gutter); }
.ne-frise img { width: clamp(84px, 11vw, 172px); height: auto; box-shadow: 0 6px 18px rgb(0 0 0 / .35); }
/* Le bouton : le même verre sombre que la barre de la page Mosaïque */
.ne-actions { display: flex; align-items: center; gap: 4px; width: fit-content; max-width: calc(100% - 20px); margin: 0 auto; padding: 4px; border-radius: 27px;
  background: color-mix(in oklab, var(--night) 58%, transparent); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid color-mix(in oklab, var(--on-night) 12%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--on-night) 22%, transparent), 0 8px 32px rgb(0 0 0 / .32), 0 2px 6px rgb(0 0 0 / .18); }
.ne-actions a { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 46px; padding: 0 20px; border-radius: 23px; white-space: nowrap;
  font: 500 .875rem/1 var(--sans); text-decoration: none; transition: background var(--d-court) var(--courbe-sortie), color var(--d-court) var(--courbe-sortie), transform var(--d-instant) var(--courbe-sortie); }
.ne-cta { background: var(--on-night); color: var(--night); }
.ne-cta:hover { background: #fff; color: var(--night); }
.ne-projet { color: var(--on-night-soft); }
.ne-projet:hover { color: var(--on-night); background: color-mix(in oklab, var(--on-night) 9%, transparent); }
.ne-actions a:active { transform: scale(.97); }
.ne-actions a:focus-visible { outline: 2px solid var(--accent-night); outline-offset: 2px; }
@media (max-width: 479px) { .ne-actions a { padding: 0 15px; font-size: .8125rem; } .ne-actions .ne-projet { padding: 0 12px; } }

/* Mouvement réduit (avec JS) : la mosaïque assemblée, immobile */
.ne-calme canvas { display: block; width: calc(100% - 2 * var(--gutter)); max-width: var(--max); margin: 0 auto; aspect-ratio: 76.33 / 35.8; height: auto; }
.ne-calme .ne-frise { display: none; }
.ne-calme .ne-texte { order: -1; }
.ne-calme .ne-scene { padding-bottom: clamp(72px, 9vw, 120px); }

/* Vivant : une scène épinglée de 300 svh (200 sur téléphone), le canvas en fond, le texte au-dessus */
.nues-espace.ne-vivant { height: 300svh; background: var(--night); }
.ne-vivant .ne-scene { position: sticky; top: var(--header); display: block; height: calc(100svh - var(--header)); padding: 0; overflow: hidden;
  background: color-mix(in oklab, var(--night) calc(var(--ne-nuit, 1) * 100%), var(--paper)); }
.ne-vivant canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.ne-vivant .ne-frise { display: none; }
.ne-vivant .ne-texte { position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; pointer-events: none;
  color: var(--ink); transition: color var(--d-court) linear; }
.ne-vivant .ne-texte > * { position: relative; pointer-events: auto; will-change: transform, opacity; }
.ne-vivant .ne-surtitre { color: inherit; opacity: .78; transform-origin: 0 0; }
.ne-vivant .ne-chapo { color: inherit; }
.ne-vivant.ne-sombre .ne-texte { color: var(--on-night); }
/* un voile de nuit derrière le texte pendant le voyage (les planches proches passent dessous) */
.ne-vivant .ne-scene::before { content: ""; position: absolute; inset: 0 auto 0 0; z-index: 1; width: min(66%, 820px); pointer-events: none;
  background: linear-gradient(90deg, color-mix(in oklab, var(--night) 86%, transparent) 35%, transparent); opacity: var(--ne-voile, 0); }
.ne-vivant .ne-texte, .ne-vivant .ne-actions { z-index: 2; }
.ne-vivant .ne-actions { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); translate: -50% 0; margin: 0;
  opacity: 0; transform: translateY(10px); filter: blur(4px); visibility: hidden;
  transition: opacity var(--d-moyen) var(--courbe-sortie), transform var(--d-moyen) var(--courbe-sortie), filter var(--d-moyen) var(--courbe-sortie), visibility 0s var(--d-moyen); }
.ne-vivant.ne-fin .ne-actions { opacity: 1; transform: none; filter: none; visibility: visible; transition-delay: 0s; }
@media (max-width: 759px) {
  .nues-espace.ne-vivant { height: 200svh; }
  .ne-vivant .ne-texte { justify-content: flex-start; padding-top: 36px; }
  .ne-vivant .ne-scene::before { inset: 0 0 auto 0; width: auto; height: 62%; background: linear-gradient(180deg, color-mix(in oklab, var(--night) 86%, transparent) 45%, transparent); }
  .ne-titre { font-size: clamp(2.25rem, 10vw, 2.75rem); }
}
@media (max-width: 479px) { .ne-actions .ne-long { display: none; } }
/* le haut de la salle, tant qu'elle n'est pas éteinte : un fondu vers le papier (pas de bord dur pendant l'entrée) */
.ne-vivant .ne-scene::after { content: ""; position: absolute; inset: 0 0 auto; z-index: 1; height: 55%; pointer-events: none;
  background: linear-gradient(var(--paper), color-mix(in oklab, var(--paper) 0%, transparent)); opacity: calc(1 - var(--ne-nuit, 1)); }

/* ---------------------------------------------------------------- P7 · actualités → pied de page
   Le pied de page monte comme une feuille de nuit sur le papier : coins arrondis, ombre douce (même geste que la sélection). */
body.home .site-footer { position: relative; z-index: 1; margin-top: -28px; border-radius: 28px 28px 0 0;
  box-shadow: 0 -28px 56px -40px rgb(0 0 0 / .3); }
