/**
 * Hero : boucle vidéo de fond (26/11/2026)
 * Film émeraude du Studio, v4 du 27/11/2026 : une génération Kling 4.0 en 1080p natif, 24 i/s, même image au début
 * et à la fin (boucle sans raccord). Fichiers en cache immuable 1 an : changer de nom à chaque nouvelle version.
 * Ordinateur : 1920 px en AV1 ou H.264 ; écrans jusqu'à 1100 px : 1280 px. En portrait, le film entier passe en bandeau
 * au-dessus du texte. Image fixe en attendant le film, et à sa place si l'utilisateur réduit les animations ou économise
 * ses données (hero-film.js).
 */

.hero__film {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #040a08 url("/assets/hero-film/hero-kaalytics-v4-1920.jpg") center / cover no-repeat;
}

.hero__film-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.2s ease-out;
}

.hero__film.is-playing .hero__film-video {
    opacity: 1;
}

/* Voile : centre assombri derrière le texte, haut sous la barre de navigation, bas fondu dans la page */
.hero__film-voile {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 46% 42% at 50% 50%, rgba(4, 10, 8, 0.64) 0%, rgba(4, 10, 8, 0.32) 60%, rgba(4, 10, 8, 0) 100%),
        linear-gradient(180deg, rgba(4, 10, 8, 0.82) 0%, rgba(4, 10, 8, 0.45) 9%, rgba(4, 10, 8, 0) 22%, rgba(4, 10, 8, 0) 74%, var(--bg-void, #040a08) 100%);
}

/* Le film remplace les décors animés du hero (orbes, grille, particules) */
.hero:has(.hero__film) .hero__bg,
.hero:has(.hero__film) .hero__grid,
.hero:has(.hero__film) .hero__orb,
.hero:has(.hero__film) .hero__particles {
    display: none;
}

.hero:has(.hero__film) .hero__content {
    position: relative;
    z-index: 2;
}

.hero:has(.hero__film) .hero__title,
.hero:has(.hero__film) .hero__subtitle {
    text-shadow: 0 2px 24px rgba(4, 10, 8, 0.65);
}

/* Écran en portrait (téléphone, tablette) : le film entier en bandeau sous la barre de navigation, le texte dessous.
   Rempli en hauteur, le film ne montrait plus que son centre vide (27/11/2026). */
@media (orientation: portrait) and (max-width: 1100px) {
    .hero:has(.hero__film) {
        align-items: flex-start;
        min-height: 0;
        padding-bottom: var(--space-3xl, 4rem);
    }

    .hero__film {
        inset: var(--navbar-height, 72px) 0 auto 0;
        aspect-ratio: 16 / 9;
    }

    .hero__film-voile {
        background: linear-gradient(180deg, rgba(4, 10, 8, 0.5) 0%, rgba(4, 10, 8, 0) 16%, rgba(4, 10, 8, 0) 58%, rgba(4, 10, 8, 0.7) 86%, var(--bg-void, #040a08) 100%);
    }

    .hero:has(.hero__film) .hero__content {
        margin-top: calc(100vw * 9 / 16 - 0.75rem);
    }
}

/* Téléphone : bandeau un peu plus haut (bords du film légèrement rognés) */
@media (orientation: portrait) and (max-width: 600px) {
    .hero__film {
        aspect-ratio: 3 / 2;
    }

    .hero:has(.hero__film) .hero__content {
        margin-top: calc(100vw * 2 / 3 - 0.5rem);
    }
}

/* Téléphone en portrait (28/11/2026) : image verticale du Studio (hv8-02 diagonale) en plein écran derrière le titre,
   lente dérive en attendant la vidéo verticale. Le film 16:9 n'est pas chargé (hero-film.js). */
@media (orientation: portrait) and (max-width: 600px) {
    .hero:has(.hero__film) {
        align-items: center;
        min-height: 100svh;
    }

    .hero__film {
        inset: 0;
        aspect-ratio: auto;
        background: #040a08;
    }

    .hero__film::before {
        content: "";
        position: absolute;
        inset: -4%;
        background: url("/assets/hero-film/hero-vertical-02-720.webp") center / cover no-repeat;
        animation: hero-derive 26s ease-in-out infinite alternate;
        will-change: transform;
    }

    .hero.hors-ecran .hero__film::before {
        animation-play-state: paused;
    }

    .hero__film-video {
        display: none;
    }

    .hero__film-voile {
        background:
            radial-gradient(ellipse 70% 30% at 50% 50%, rgba(4, 10, 8, 0.55) 0%, rgba(4, 10, 8, 0) 100%),
            linear-gradient(180deg, rgba(4, 10, 8, 0.7) 0%, rgba(4, 10, 8, 0) 14%, rgba(4, 10, 8, 0) 80%, var(--bg-void, #040a08) 100%);
    }

    .hero:has(.hero__film) .hero__content {
        margin-top: 0;
    }
}

@keyframes hero-derive {
    from { transform: scale(1) translate3d(0, 0, 0); }
    to { transform: scale(1.06) translate3d(-1.5%, 1.5%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .hero__film-video {
        display: none;
    }

    .hero__film::before {
        animation: none;
    }
}

@media print {
    .hero__film {
        display: none;
    }
}
