/* ==========================================================
   OPTIX — BASCULE DE FOND « ATTERRISSAGE »
   Le hero cockpit vole dans l'espace (canvas #starfield +
   nébuleuse). Dès que le zoom sur l'écran Optix révèle le
   panneau Windows 10/11, la page se « pose » : on repasse au
   fond de l'ancienne version — wallpaper flouté, orbes,
   triangles de vitesse, grille cyber, particules — et on y
   reste jusqu'au footer.

   Chargé après index-rework.css (il en écrase l'overlay bleu).
   Tout est scopé body.ship : les autres pages sont intactes.

   ‼ Les couches d'effets restent À PLAT dans le DOM (pas de
   wrapper) : elles ont chacune leur z-index dans
   design-system.css (0 pour les fonds, 2 pour le warp de
   scroll qui doit passer AU-DESSUS du contenu). Un conteneur
   opacifié créerait un contexte d'empilement et écraserait
   cette hiérarchie.
   ========================================================== */

/* ----------------------------------------------------------
   1. CROSS-FADE DE L'IMAGE DE FOND
   Un background-image ne se cross-fade pas : on empile une
   seconde couche au-dessus de la nébuleuse et on échange les
   opacités.
   ---------------------------------------------------------- */
body.ship .page-background__image--legacy {
    position: absolute;
    inset: 0;
    background-image: url('../img/blury background/wallpaperflare.com_wallpaper (5).webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
}

body.ship .page-background__image {
}

body.ship.grounded .page-background__image--legacy {
    /* fallback sans GSAP */
    opacity: 0.4;
}

body.ship.grounded .page-background__image {
    /* fallback sans GSAP */
    opacity: 0;
}

/* L'overlay reste harmonieux avec le fond flouté sans flash sombre instantané */
body.ship .page-background__overlay {
    transition: opacity 0.8s ease;
}

body.ship.grounded .page-background__overlay {
    background: linear-gradient(180deg,
            rgba(13, 16, 27, 0.45) 0%,
            rgba(10, 12, 22, 0.6) 50%,
            rgba(8, 10, 18, 0.75) 100%);
}

/* ----------------------------------------------------------
   2. LE STARFIELD S'EFFACE
   ---------------------------------------------------------- */
body.ship.grounded #starfield {
    visibility: hidden;
    pointer-events: none;
}

/* ----------------------------------------------------------
   3. LES COUCHES D'EFFETS DE L'ANCIENNE VERSION
   Neutres pendant le vol, elles s'allument à l'atterrissage.
   ---------------------------------------------------------- */
body.ship:not(.grounded) .speed-lines,
body.ship:not(.grounded) .speed-lines *,
body.ship:not(.grounded) .cyber-grid,
body.ship:not(.grounded) .floating-shapes,
body.ship:not(.grounded) .floating-shapes *,
body.ship:not(.grounded) .particle-field,
body.ship:not(.grounded) .particle-field * {
    animation-play-state: paused !important;
}

body.ship .speed-lines,
body.ship .cyber-grid,
body.ship .floating-shapes,
body.ship .particle-field {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease, visibility 1s;
}

body.ship.grounded .speed-lines,
body.ship.grounded .cyber-grid,
body.ship.grounded .floating-shapes,
body.ship.grounded .particle-field {
    opacity: 1;
    visibility: visible;
}

body.ship.grounded .speed-lines *,
body.ship.grounded .floating-shapes *,
body.ship.grounded .particle-field * {
    animation-play-state: running;
}

/* Le warp de scroll garde son propre pilotage (.active posé par
   index.js selon la vélocité) : on se contente de le neutraliser
   tant que le vaisseau n'est pas posé. */
body.ship:not(.grounded) .scroll-speed-lines {
    visibility: hidden;
}


