/* ============================================================
   HERO OSMOSE — refonte style ziben.fr, palette Osmose.
   4 couches empilées (arrière → avant) :
     sky (orbes) → dots → halftone canvas → dispersif canvas → mark
   Le titre h1 est présent dans le DOM en clair mais visuellement
   caché (a11y + SEO conservés, cf. BRIEF §9).
   ============================================================ */

:root {
    --ho-night:    #0b0b1e;      /* fond charte site */
    --ho-cyan:     #38BDF8;
    --ho-cyan-hi:  #a8ecfa;
    --ho-violet:   #8B5CF6;
    --ho-deep:     #1d5f8a;
    --ho-ink:      #ffffff;
}

/* Le fix `overflow-x: clip` sur html/body a été promu dans theme-dark.css
   (chargé partout) pour que TOUS les blocs sticky du site fonctionnent
   (hero home + stack cas d'usage sur /pme/ + tout ce qui viendra). */

.hero-osmose {
    /* Sticky top:0 : le hero reste figé en position pendant qu'on scroll ;
       le bloc suivant (block-plateforme) remonte par-dessus pour le faire
       disparaître (pattern classique parallax cover layer). Hauteur fixe
       100vh pour que sticky se comporte correctement. */
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    background: var(--ho-night);
    color: var(--ho-ink);
    overflow: hidden;
    isolation: isolate;
    z-index: 0;
}

/* ── Titre du hero — texte lisible en Poppins (plus de halftone) ── */
.hero-osmose__title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 1200px);
    margin: 0;
    padding: 0 24px;
    text-align: center;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: clamp(1.8rem, 5vw, 4.6rem);
    font-weight: 500;                       /* medium — classique, lisible */
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #ffffff;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    animation: hero-osmose-title-in 1.0s ease-out 0.4s forwards;
}
.hero-osmose__title-accent {
    display: inline-block;
    background: linear-gradient(135deg, #38BDF8 0%, #a8ecfa 40%, #8B5CF6 100%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}
@keyframes hero-osmose-title-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 20px)); filter: blur(6px); }
    to   { opacity: 1; transform: translate(-50%, -50%);              filter: blur(0);    }
}

/* ── Layer 1 : orbes qui pulsent ── */
.hero-osmose__sky {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.hero-osmose__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    mix-blend-mode: screen;
    animation: hero-osmose-drift 18s ease-in-out infinite alternate;
}
.hero-osmose__glow--g1 {
    width: 65vw;
    height: 65vw;
    left: -12vw;
    top: -18vw;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, transparent 62%);
    opacity: 0.65;
}
.hero-osmose__glow--g2 {
    width: 60vw;
    height: 60vw;
    right: -14vw;
    bottom: -20vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.42) 0%, transparent 62%);
    opacity: 0.6;
    animation-delay: -6s;
}
@keyframes hero-osmose-drift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(3vw, -2vw); }
}

/* ── Layer 2 : motif de points (identique .osm-cta-banner) ── */
.hero-osmose__dots {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(rgba(147, 197, 253, 0.10) 1px, transparent 1px);
    background-size: 14px 14px;
    pointer-events: none;
}

/* Halftone retiré — le titre est maintenant rendu en Poppins classique lisible.
   .hero-osmose__halftone conservé au cas où mais sans effet (canvas plus dans le DOM). */

/* ── Logo Osmose central (rendu Three.js 3D verre gelé, cf. hero-mark-3d.js) ──
   .hero-osmose__mark        = wrapper positionné centré (taille = zone du logo)
     .hero-osmose__mark-canvas   = canvas Three.js (WebGL)
     .hero-osmose__mark-fallback = PNG fallback statique (reduce-motion / no WebGL) */
.hero-osmose__mark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    /* Agrandi : de 260-520px à 340-720px pour occuper davantage l'écran */
    width: clamp(340px, 46vw, 720px);
    z-index: 4;
    pointer-events: none;
    filter: drop-shadow(0 0 24px rgba(56, 189, 248, 0.25))
            drop-shadow(0 0 60px rgba(139, 92, 246, 0.20));
    animation: hero-osmose-mark-float 8s ease-in-out infinite alternate;
}
/* Aspect ratio du logo PNG optimisé, sert au sizing du canvas */
.hero-osmose__mark { aspect-ratio: 1000 / 606; }

.hero-osmose__mark-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* On laisse Three.js gérer le rendu ; opacity 0 tant que la scène est prête */
    opacity: 0;
    transition: opacity .4s ease;
}
.hero-osmose__mark.is-3d-ready .hero-osmose__mark-canvas { opacity: 1; }
.hero-osmose__mark.is-3d-ready .hero-osmose__mark-fallback {
    opacity: 0;
    transition: opacity .4s ease;
}
.hero-osmose__mark-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 40px rgba(56, 189, 248, 0.35));
    /* Visible tant que le rendu 3D n'est pas prêt (progressive enhancement) */
}
@keyframes hero-osmose-mark-float {
    0%   { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-50%, calc(-50% - 8px)) scale(1.015); }
}
/* WebGL absent ou prefers-reduced-motion : garde le fallback PNG statique */
@media (prefers-reduced-motion: reduce) {
    .hero-osmose__mark { animation: none !important; }
    .hero-osmose__mark-canvas { display: none; }
    .hero-osmose__mark-fallback { position: relative; }
}

/* ── Meta bas : eyebrow + CTAs ── */
.hero-osmose__meta {
    position: absolute;
    left: 50%;
    bottom: clamp(40px, 8vh, 80px);
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    max-width: 100%;
    text-align: center;
}
.hero-osmose__eyebrow {
    color: rgba(255, 255, 255, 0.75);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: clamp(11px, 1vw, 13px);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 0;
    max-width: 640px;
    line-height: 1.5;
}
.hero-osmose__ctas {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Bouton outline (secondaire) — cohérent avec la charte site */
.hero-osmose .btn.btn-outline {
    padding: 14px 32px;
    background: transparent;
    color: var(--ho-ink);
    font-family: var(--osm-ff-heading, "Poppins", sans-serif);
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.30);
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: border-color .2s ease, background .2s ease;
}
.hero-osmose .btn.btn-outline:hover {
    border-color: var(--ho-cyan);
    background: rgba(56, 189, 248, 0.08);
}

/* ── Mobile : le halftone occupe tout l'écran mais le logo prend moins de place ── */
@media (max-width: 768px) {
    .hero-osmose__mark { width: clamp(220px, 62vw, 380px); }
    .hero-osmose__title-sr { font-size: clamp(1.5rem, 8vw, 3rem); }
    .hero-osmose__meta { gap: 16px; bottom: 32px; }
    .hero-osmose__ctas { gap: 12px; }
}

/* ── Container sticky : contient le hero + le block-plateforme ──
   Le hero est en sticky INSIDE ce container. Quand on scroll au-delà du
   container, le hero disparaît naturellement — les blocs suivants
   (métiers, sécurité, savoir-faire, faq) sont HORS du sticky context et
   apparaissent normalement en pleine largeur.
   Structure DOM : <div class="home-sticky-area"> hero + plateforme </div>. */
.home-sticky-area {
    position: relative;
}

/* ── Backgrounds opaques sur les sections après le sticky ──
   Sans background défini, ces sections laissent voir le body (qui a un
   dégradé radial cyan/violet aurora), ce qui donne l'illusion que le hero
   réapparaît entre les blocs. Un fond opaque coupe complètement le sticky
   context du hero. */
.block-metiers,
.block-securite,
.propos-savoir,
.faq-feature {
    background: var(--ho-night);
}

/* ── Le block-plateforme recouvre le hero sticky ──
   Fond opaque + z-index 1 obligatoires. Indices visuels (border-radius +
   ombre) pour que l'effet "cover" soit distingué visuellement. */
.block-plateforme {
    position: relative;
    z-index: 1;
    background: var(--ho-night);
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, 0.5);
    padding-top: 40px;
}

/* prefers-reduced-motion : coupe les animations continues */
@media (prefers-reduced-motion: reduce) {
    .hero-osmose__glow,
    .hero-osmose__mark {
        animation: none !important;
    }
}
