/* =====================================================================
   V2 · La traversée : la séquence d'ouverture pilotée par le défilement,
   et la sonde d'échographie. Chargé après style.css.
   ===================================================================== */

/* ---------- La traversée ---------- */
.flight { position: relative; background: var(--night); color: var(--night-ink); }
.flight .sc-stage,
.flight [data-sc-stage] {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: clip;
  background: var(--night);
}
.flight :is(video[data-sc-scrub], .sc-stage__poster) {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}
.flight video[data-sc-scrub] { opacity: 0; transition: opacity .38s var(--ease-out); }
.flight video[data-sc-scrub].sc-has-clip { opacity: 1; }
.flight .sc-stage__poster { transition: opacity .38s var(--ease-out); }
.flight.sc-has-clip .sc-stage__poster { opacity: 0; }

/* Ouverture : le film démarre resserré sur les deux vitres violettes, puis le cadre
   s’ouvre pendant que la caméra avance. L’angle de l’immeuble, qui n’existe pas en
   vrai, reste hors champ (il sort de l’image vers 3 s du film). Le zoom suit l’image
   réellement affichée (--zoom-open, réglé par v2.js), pas le défilement : la vidéo
   rattrape le défilement en douceur et serait sinon en retard sur le zoom.
   Le bord gauche reste calé : seul le côté droit, avec l’angle, est coupé.
   Sortie : la caméra continue d’avancer doucement pendant que la scène s’efface. */
.flight :is(video[data-sc-scrub], .sc-stage__poster) {
  --zoom: var(--zoom-open, 1.28);
  transform: translateX(calc((var(--zoom) - 1) * 50%)) scale(calc(var(--zoom) * (1 + var(--exit, 0) * .09)));
  transform-origin: 50% 46%;
}
/* Sur téléphone, le cadrage suit déjà la fenêtre éclairée : l’angle n’est pas dans le champ */
@media (max-aspect-ratio: 4/5) { .flight :is(video[data-sc-scrub], .sc-stage__poster) { --zoom: 1; } }

/* Voile : assombrit seulement là où le texte se pose */
.flight__veil {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(to top, rgba(21, 14, 28, 1) 0%, rgba(21, 14, 28, .9) 7%, rgba(21, 14, 28, .62) 28%, rgba(21, 14, 28, 0) 56%),
    linear-gradient(to bottom, rgba(21, 14, 28, .55) 0%, rgba(21, 14, 28, 0) 22%);
}

.flight__copy,
.flight__line {
  position: absolute; z-index: 2;
  left: var(--gutter); right: var(--gutter);
  bottom: clamp(88px, 13vh, 150px);
  max-width: 46rem;
  margin: 0 auto 0 max(0px, calc((100vw - var(--wrap)) / 2));
  will-change: opacity, transform;
  opacity: 0;
}
.flight__eyebrow {
  margin: 0 0 14px;
  font-size: var(--t-small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--night-soft);
}
.flight__title {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--t-hero); line-height: 1.04; letter-spacing: -.02em;
  color: var(--night-ink); text-wrap: balance;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .35);
}
.flight__title em { font-style: italic; font-weight: 300; color: var(--hi); }
.flight__title--sm { font-size: var(--t-h2); }
.flight__line {
  font-family: var(--font-display); font-weight: 300; font-style: italic;
  font-size: var(--t-h3); line-height: 1.15; letter-spacing: -.01em;
  text-wrap: balance; text-shadow: 0 2px 26px rgba(0, 0, 0, .45);
}
.flight__finale p:not(.flight__title) { margin: 14px 0 0; max-width: 36rem; font-size: var(--t-lead); color: var(--night-soft); }
.flight__ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.flight .btn--ghost { color: var(--night-ink); box-shadow: inset 0 0 0 1.5px rgba(246, 238, 242, .45); }
@media (hover: hover) and (pointer: fine) { .flight .btn--ghost:hover { background: rgba(255, 255, 255, .08); } }

/* La nuit se lève : fondu vers la suite de la page */
.flight + .hero { margin-top: 0; }
.flight + .hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: clamp(160px, 22vw, 300px);
  background: linear-gradient(to bottom, var(--night) 0%, var(--dusk-6) 22%, var(--dusk-4) 52%, var(--dusk-2) 80%, var(--canvas) 100%);
  pointer-events: none; z-index: 0;
}
.flight + .hero { padding-top: clamp(200px, 26vw, 340px); }
.flight + .hero .hero__glow { inset: clamp(160px, 22vw, 300px) -10% auto auto; }

/* Sans animation : les affiches suffisent, le texte reste lisible */
/* Sans animation : trois images fixes se relaient (façade, salle d'écho, bébé) */
.flight__still { display: none; }
@media (prefers-reduced-motion: reduce) {
  .flight video[data-sc-scrub] { display: none; }
  .flight__still { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); }
  .flight__still--mid { opacity: clamp(0, calc((var(--sc-p, 0) - .34) * 8), 1); }
  .flight__still--end { opacity: clamp(0, calc((var(--sc-p, 0) - .72) * 8), 1); }
}

/* L'accueil « Bienvenue » arrive après la traversée : son entrée attend qu'il soit à l'écran */
.is-ready .hero:not(.is-in) .hero__title .w > span { opacity: 0; transform: translateY(.38em); transition: none; }
.is-ready .hero:not(.is-in) [data-hero-in] { opacity: 0; transform: translateY(14px); transition: none; }
.is-ready .hero:not(.is-in) .hero__art .arch-in { opacity: 0; transform: scale(.96); transition: none; }
.is-ready .hero:not(.is-in) .hero__art .plane--line span,
.is-ready .hero:not(.is-in) .hero__art .blob { opacity: 0; transition: none; }
.is-ready .hero:not(.is-in) .hero__art .float-card,
.is-ready .hero:not(.is-in) .hero__art .plane--sprig use { opacity: 0; transform: translateY(16px); transition: none; }
@media (prefers-reduced-motion: reduce) {
  .is-ready .hero:not(.is-in) :is(.hero__title .w > span, [data-hero-in], .hero__art .arch-in, .hero__art .float-card, .hero__art .plane--sprig use) { transform: none; }
}

/* Sur téléphone, le cadrage suit le sujet : la fenêtre éclairée au départ, puis le centre */
@media (max-aspect-ratio: 4/5) {
  .flight { --focus: clamp(50%, calc(66% - var(--sc-p, 0) * 160%), 66%) 50%; }
  .flight__copy, .flight__line { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Le texte final se pose sur l'écran lumineux : un halo sombre rien que derrière lui */
.flight__finale { isolation: isolate; }
.flight__finale::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -55% -45% -40% -30%;
  background: radial-gradient(closest-side, rgba(21, 14, 28, .9) 0%, rgba(21, 14, 28, .78) 45%, rgba(21, 14, 28, 0) 100%);
}

/* En-tête au-dessus du film, avant tout défilement : texte clair */
body.is-night .site-header .header-phone,
body.is-night .site-header .brand__name { color: var(--night-ink); }

/* Sur téléphone, l'éventail remplit l'écran : voile plus large et plus dense derrière le texte final */
@media (max-aspect-ratio: 4/5) {
  .flight__finale::before {
    inset: -45% -30% -35% -30%;
    background: radial-gradient(closest-side, rgba(21, 14, 28, .95) 0%, rgba(21, 14, 28, .88) 58%, rgba(21, 14, 28, 0) 100%);
  }
}

/* ---------- Neuf mois : l'écran reste, bébé grandit ---------- */
.months { position: relative; z-index: 1; margin-bottom: clamp(48px, 7vw, 96px); }
.months [data-sc-stage] {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: grid; align-items: center;
  padding-top: calc(var(--header-h) + 64px);
  padding-bottom: 24px;
}
.months__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: center; }

.months__monitor {
  position: relative; aspect-ratio: 3 / 2; width: 100%;
  border-radius: 22px; overflow: hidden;
  background: #050407;
  box-shadow: 0 0 0 10px #17111d, 0 0 0 11px rgba(255, 255, 255, .08), 0 50px 110px -30px rgba(0, 0, 0, .85), 0 0 120px -20px rgba(170, 200, 230, .18);
  transform: scale(calc(.97 + var(--sc-p, 0) * .03));
}
.months__scan { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.months__monitor::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .55));
}
.months__week {
  position: absolute; top: 14px; right: 18px; margin: 0;
  display: grid; justify-items: end;
  font: 600 .85rem/1 var(--font-text); letter-spacing: .08em; color: rgba(222, 236, 245, .85);
  font-variant-numeric: tabular-nums;
}
.months__week span { grid-area: 1 / 1; opacity: 0; }

.months__track { position: relative; height: 2px; margin: 28px 6px 0; background: var(--night-line); border-radius: 2px; }
.months__fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--sc-p, 0) * 100%); background: linear-gradient(90deg, var(--hi), var(--hi)); border-radius: 2px; }
.months__track i {
  position: absolute; top: 50%; left: calc(var(--at) * 100%);
  width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--night-2); box-shadow: inset 0 0 0 2px var(--night-line);
}
.months__track i { background: color-mix(in oklab, var(--hi) calc(clamp(0, (var(--sc-p, 0) - var(--at) + .02) * 4000, 100) * 1%), var(--night-2)); }

.months__title { margin: 0 0 clamp(20px, 3vw, 36px); font: 300 clamp(1.7rem, 1.2rem + 1.6vw, 2.6rem)/1.12 var(--font-display); letter-spacing: -.02em; color: var(--night-ink); text-wrap: balance; }
.months__title em { color: var(--hi); }
.months__steps { position: relative; display: grid; margin: 0; padding: 0; list-style: none; }
.months__steps li { grid-area: 1 / 1; display: grid; gap: 8px; align-content: start; opacity: 0; }
.months__steps strong { font: 400 clamp(1.4rem, 1.2rem + .6vw, 1.8rem)/1.2 var(--font-display); color: var(--night-ink); }
.months__steps li > span:last-child { color: var(--night-soft); font-size: var(--t-body); line-height: 1.6; max-width: 40ch; }

@media (max-width: 900px) {
  .months [data-sc-stage] { align-items: start; padding-top: calc(var(--header-h) + 74px); padding-bottom: 110px; }
  .months__grid { grid-template-columns: 1fr; gap: 22px; }
  .months__monitor { box-shadow: 0 0 0 6px #17111d, 0 0 0 7px rgba(255, 255, 255, .08), 0 30px 60px -24px rgba(0, 0, 0, .85); }
  .months__track { margin-top: 18px; }
  .months__title { font-size: 1.45rem; margin-bottom: 12px; }
  .months__steps strong { font-size: 1.3rem; }
  .months__steps li > span:last-child { font-size: var(--t-small); }
}
@media (prefers-reduced-motion: reduce) {
  .months__monitor { transform: none; }
}
