/* ── PREVENT HORIZONTAL OVERFLOW (global) ── */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── REDUCED MOTION ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── GRAIN EFFECT (pour la page d'accueil) ── */
.grain-overlay {
    position: fixed;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background-image: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.33;
    background-color: #000000;
    pointer-events: none;
    z-index: 100;
    animation: grain-animation 100s steps(5) infinite;
    will-change: transform;
}

@keyframes grain-animation {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}
.base-header {
    position: relative;
    height: 100vh;
    height: 100svh; /* gere la barre URL mobile (iOS/Android) */
    width: 100%;
    overflow: hidden;
}
.layer-car {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.layer-back {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.layer-orange {
   position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F97316; /* Ton orange */
    z-index: 11;
}
/* --- COUCHE 2 : PRÉNOM --- */
.layer-name {
   position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 12;
}

/* --- COUCHE 3 : TÊTE ENZO --- */
.layer-head {
    position: absolute;
    inset: 0;
    z-index: 13; /* Tout devant */
}
.ligne-blanche-head {
    width: 95%;
    height: 2px;
    background-color: rgba(255, 255, 255, 1);
    margin-left: auto;
    margin-right: auto;
}
.reveal-wrapper {
    position: absolute; 
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.description-head-container {
    position: absolute;
    top: 15vh;
    left: 5vw;
    z-index: 50;
    max-width: clamp(200px, 80vw, 280px);
}
.description-head{
    font-size: clamp(0.85rem, 2.5vw, 1.2rem);
    line-height: 1.5;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    mix-blend-mode: difference;
    font-family: Oswald, sans-serif;
}
.photo-voiture {
    width: 100%;
    height: 100%;
    background-image: url('../images/voiture-montage.webp');
    background-size: cover;
    background-position: center;
    animation: carBreath 20s ease-in-out infinite;
}

@keyframes carBreath {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.photo-enzo {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 85vw;              /* Largeur imposante pour l'effet visuel */
    height: 95vh;             /* Hauteur de l'image (85% de l'écran) */
    background-image: url('../images/enzolum.webp'); 
    background-size: contain;  /* EFFET : L'image n'est jamais déformée */
    background-position: center bottom; /* CAUSE : Aligne la base de l'image source au bas du bloc */
    background-repeat: no-repeat;
}
/* On s'assure que le fond orange est bien en dessous */
.photo-voiture {
    width: 100%;
    height: 100%;
    background-color: #F97316; /* Le orange du site Niko */
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    font-style: italic;
    font-size: 2.25rem;
}
/* Style du prénom du pilote en grand avec contour blanc */
.prenom-pilote {
    font-family: 'Oswald', sans-serif !important;
    color: transparent;
    -webkit-text-stroke: 1.5px rgb(255, 255, 255);
    text-stroke: 2.5px white;
    font-size: clamp(3rem, 12vw, 18vw);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    white-space: nowrap;
    line-height: 1;
    margin-bottom: 0;
    padding-bottom: 0;
    user-select: none;
}

/* Reveal System */
.reveal-wrapper {
    width: 100%;
    height: 100vh;
}
.hero-content-section {
    position: relative;
    z-index: 50; /* Plus haut que le header */
  
    display: flex;
}
.hidden-bg {
   position: absolute;
    inset: 0;
    z-index: 2; /* En dessous */
}
/* Le masque de révélation */
.visible-mask {
   position: absolute;
    inset: 0;
    z-index: 10; /* Au-dessus de l'orange */
    /* Le masque : ce qui est "black" est visible, "transparent" est caché */
    -webkit-mask-image: radial-gradient(circle 280px at var(--x, 50%) var(--y, 50%), black 100%, transparent 99%);
    mask-image: radial-gradient(circle 280px at var(--x, 50%) var(--y, 50%), black 100%, transparent 99%);
   pointer-events: none;
}

/* Fond noir caché derrière le masque */


/* Typographie */
h1 {
    font-family: sans-serif; /* Utilisez une police type 'Inter' ou 'Archive' si possible */
}
#hero-name {
    /* Rend l'intérieur des lettres transparent */
    color: white;
    opacity: 0.33;
    /* Crée le contour blanc fin (effet Niko/Webflow) */
    -webkit-text-stroke: 1px rgba(255, 255, 255, 5.0);
    /* Optionnel : légère lueur pour la lisibilité */
    font-family: Oswald, sans-serif;
    transition: transform 0.1s ease-out;
    z-index: 30;
    transition: transform 0.1s linear;
    font-family: Oswald, sans-serif;
  
}

/* Pour s'assurer que l'image d'Enzo soit bien devant le texte */
.visible-mask {
    position: absolute;
    inset: 0;
    z-index: 20; /* Plus élevé que le nom */
}
/* Fond noir caché derrière le masque */
.hidden-bg {
  position: absolute;
    inset: 0;
    z-index: 10;
}

/* Fond semi-transparent noir : desactive globalement, applique seulement
   en haut du header sur desktop via .base-header::before ci-dessous */
.bg-black\/30 {
    background-color: transparent;
}

/* Voile sombre en haut du header (derriere la nav + nom)
   Uniquement sur desktop pour ameliorer la lisibilite */
@media (min-width: 1025px) {
    .base-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 25%;
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.55) 0%,
            rgba(0, 0, 0, 0.35) 50%,
            rgba(0, 0, 0, 0) 100%
        );
        z-index: 14;
        pointer-events: none;
    }
}


/* On force le curseur standard sur tout le site */
html, body {
    cursor: auto !important;
    overflow-x: hidden;
    background-color: #000000;
}

/* On s'assure que les liens affichent la "main" classique */
a, button {
    cursor: pointer !important;
}

/* Le masque de révélation (toujours actif en arrière-plan) */
.visible-mask {
    position: absolute;
    inset: 0;
    z-index: 20;
    /* On utilise des variables --x et --y pour la position de la souris */
    -webkit-mask-image: radial-gradient(circle 150px at var(--x, 50%) var(--y, 50%), transparent 100%, black 100%);
    mask-image: radial-gradient(circle 150px at var(--x, 50%) var(--y, 50%), transparent 100%, black 100%);
    pointer-events: none; /* Laisse passer les clics si besoin */
}
/* Fond noir caché derrière le masque */
.hero-outline {
    font-family: 'Oswald', sans-serif !important;
    color: transparent; 
    -webkit-text-stroke: 1.5px white; /* Contour blanc pur */
    text-stroke: 1.5px white;
    position: relative;
    z-index: 30;
}

.hero-content-section {
    position: relative;
    z-index: 10;
    min-height: 150vh; /* On donne de la place pour scroller et voir l'effet */
    background-color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Commence en haut */
    padding-top: 20vh; /* Espace avant le premier titre */
}

.content-container {
    max-width: 900px;
    text-align: center;
}

/* Style du titre Pilote */
.pilote {
    font-size: clamp(1.8rem, 6vw, 3rem);
    font-weight: 900;
    color: white;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    margin-bottom: clamp(3rem, 10vw, 8rem);
}
.layer-namerapper {
    background-color: #F97316;
    overflow: hidden;
    padding: 25px 0;
    display: flex;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
/* Style de la description (État initial éteint) */
.description {
    font-size: clamp(1.4rem, 5vw, 2.875rem);
    font-weight: 900;
    font-family: 'Oswald', sans-serif;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.3;
    color: #444; /* Gris foncé par défaut, passera en blanc avec GSAP */
    margin: 25vh auto;
}

/* Optimisation pour les mots générés par SplitType */
.word {
    display: inline-block;
    margin-right: 0.2em;
}

.model-3d-title{
    font-family: 'Oswald', sans-serif !important;
    color: white; 
    font-size: clamp(1.5rem, 5vw, 3rem);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
    background-color: #000000;
    
}

.model-3d-container {
    width: 100%;
    height: 100vh; /* Donne une hauteur visible */
    background-color: #000000;
    position: relative;
    overflow: hidden;
    margin-bottom: clamp(50px, 15vh, 550px);
}

canvas {
    outline: none;
    /* pointer-events: none; */ /* Enlève le commentaire si tu veux scroller à travers la voiture */
}

/* Section globale */
.sponsors-section {
    background-color: #000000;
    position: relative;
    padding: 10px 0; /* Espacement vertical */
}

/* Titre "MES SPONSORS" */
.sponsors-title { 
    text-align: center; 
    color: #ffffff; 
    letter-spacing: 0.5em; 
    text-transform: uppercase; 
    font-size: clamp(1.5rem, 5vw, 3rem);
    margin-bottom: 20px; 
    font-family: 'Oswald', sans-serif;
}

/* Bande Orange */
.marquee-wrapper {
    background-color: #F97316; /* Orange vif conforme au design */
    overflow: hidden;
    padding: 25px 0; /* Hauteur de la bande orange */
    display: flex;
    align-items: center;
}

/* Animation de défilement */
.marquee-content {
    display: flex;
    gap: 100px; /* Espace entre chaque logo */
    animation: scroll 45s linear infinite;
    width: max-content; /* Important pour ne pas tronquer le contenu */
}

/* Logos des marques */
.sponsor-logo { 
    height: 80px; /* Taille uniforme */
    width: auto;
    filter: brightness(1.1); /* Améliore la visibilité si les logos sont sombres */
    flex-shrink: 0; /* Empêche les logos de s'écraser */
}

/* Lignes blanches de séparation */
.ligne-blanche {
    margin-top: 82px;
    margin-bottom: 82px;
    width: 95%;
    height: 3px;
    background-color: #ffffff;
    margin-left: auto;
    margin-right: auto;
}

/* Keyframes : Déplace le contenu de 0 à la moitié (puisqu'on a doublé les logos) */
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Style de la section réseaux */
.social-section {
    padding: 80px 40px;
    text-align: center;
    background-color: #000000;
}

.social-label {
    font-size: 19px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-bottom: 8px;
    font-family: 'Oswald', sans-serif;
}

.social-title {
    font-size: 62px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
    font-family: 'Oswald', sans-serif;
}

.divider {
    width: 32px;
    height: 0.5px;
    background: rgba(255, 255, 255, 0.2);
    margin: 16px auto 40px;
}

.social-grid {
    display: flex;
    justify-content: center;
    gap: 46px;
    flex-wrap: wrap;
}

.social-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 28px 36px;
    border: 0.5px solid rgb(255, 255, 255);
    border-radius: 12px;
    background: transparent;
    text-decoration: none;
    color: rgb(255, 255, 255);
    font-size: 28px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: 'Oswald', sans-serif;
    transition: border-color 0.2s, color 0.2s;
    min-width: 120px;
}


.social-card img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.2s;
}

/* ── RESPONSIVE TABLETTE (reseaux sociaux) ── */
@media (max-width: 1024px) {
    .social-section {
        padding: 60px 20px;
    }
    .social-title {
        font-size: 42px;
    }
    .social-grid {
        gap: 20px;
    }
    .social-card {
        padding: 24px 28px;
        font-size: 22px;
        gap: 24px;
    }
    .social-card img {
        width: 40px;
        height: 40px;
    }
}

/* ── RESPONSIVE MOBILE (reseaux sociaux) ── */
@media (max-width: 600px) {
    .social-section {
        padding: 40px 1rem;
    }
    .social-title {
        font-size: 28px;
    }
    .social-label {
        font-size: 13px;
        letter-spacing: 0.15em;
    }
    .social-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .social-card {
        padding: 20px 12px;
        min-width: 0;
        font-size: 14px;
        gap: 16px;
        letter-spacing: 0.05em;
    }
    .social-card img {
        width: 32px;
        height: 32px;
    }
}
/* La ligne de séparation */

/* Loading Overlay for 3D Model */
#loading-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9); /* Semi-transparent black background */
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    z-index: 100; /* Ensure it's above the canvas */
    transition: opacity 0.5s ease-in-out;
    opacity: 0; /* Start with 0 opacity for transition */
}

#loading-overlay.visible {
    opacity: 1;
    display: flex; /* Show when visible */
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #F97316; /* Orange color for the spinner */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-progress {
    font-size: 1.2rem;
    margin-top: 10px;
}
.footer-divider {
    width: 85%;
    border: none;
    border-top: 1px solid #333;
    margin: 0 auto; /* Centrée */
    background-color: #000000;
}

@media (max-width: 1024px) {
    /* On supprime le masque sur mobile pour que l'image et l'orange soient bien visibles */
    .visible-mask {
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }

    /* Amélioration de la lisibilité du texte d'intro sur mobile */
    .description-head-container {
        top: 130px; /* S'assure qu'il ne rentre pas en collision avec la navigation */
        left: 1rem;
    }
    .description-head {
        font-size: 1rem; /* On force une taille minimum de 16px (1rem) pour le confort de lecture */
        mix-blend-mode: normal; /* On désactive le blend-mode qui peut rendre le texte illisible sur la photo */
        text-shadow: 0px 4px 12px rgba(0, 0, 0, 0.5); /* Ajout d'une ombre forte pour le détacher du fond */
    }

    .grain-overlay {
        opacity: 0; /* Enlève le filtre grain sur mobile et iPad */
    }

    /* Amélioration de la visibilité du prénom Enzo Ragni */
    .layer-name {
        bottom: 45%;
    }
    .prenom-pilote {
        letter-spacing: 0.1em;
        -webkit-text-stroke: 1px white;
    }

    /* Couper les animations lourdes sur tablette/mobile */
    .photo-voiture {
        animation: none !important;
    }
    .description {
        color: #ffffff !important;
    }

    .hero-content-section {
        padding-left: 1rem;
        padding-right: 1rem;
        min-height: auto;
        padding-top: 10vh;
    }
    .model-3d-container {
        height: 50vh; 
        margin-bottom: 40px;
    }
    
    .model-3d-container canvas {
        transform: scale(0.75); /* Dézoomé pour iPad */
        transform-origin: center center;
    }
    .sponsors-title {
        letter-spacing: 0.1em;
    }
    .marquee-content {
        gap: 30px;
    }
    .sponsor-logo {
        height: 65px;
    }
    .social-title {
        font-size: 42px;
    }
    .ligne-blanche {
        margin-top: 30px;
        margin-bottom: 30px;
    }
    .pilote {
        margin-bottom: 2rem;
    }
}

/* ============================================================
   FIX RESPONSIVE MOBILE INDEX — Approche universelle simplifiee
   Compatible iPhone (15/15+/SE), Android, Samsung, etc.
   ============================================================ */

/* Safe-area pour les iPhones avec Dynamic Island / encoche */
@supports (padding-top: env(safe-area-inset-top)) {
    .site-nav {
        padding-top: env(safe-area-inset-top);
    }
    .description-head-container {
        padding-top: env(safe-area-inset-top);
    }
    .footer-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile et petites tablettes (jusqu'a 768px) */
@media (max-width: 768px) {

    /* Header : utilise svh pour eviter le bug barre URL iOS */
    .base-header {
        height: 100svh;
        min-height: 600px;
    }

    /* On annule le grand padding inline entre Enzo et Ragni */
    .prenom-pilote span {
        padding: 0 2vw !important;
    }

    /* === CASQUE : on FORCE la photo a faire exactement 62svh de haut
       Avec background-size: auto 100%, l'image est exactement aussi
       haute que le conteneur. Du coup le haut du casque est TOUJOURS
       au meme endroit (62svh du bas de l'ecran) sur tous les mobiles.
       === */
    .photo-enzo {
        width: 100vw;
        height: 62svh;
        left: 0;
        transform: none;
        bottom: env(safe-area-inset-bottom, 0px);
        background-size: auto 100%;
        background-position: center bottom;
        background-repeat: no-repeat;
    }

    /* === PRENOM : positionne par rapport au bas (comme la photo)
       pour rester pile en haut du casque sur tous les appareils.
       bottom: 56svh = name's bottom edge a 56svh du bas
       Photo top a 62svh du bas, donc le nom chevauche le haut
       du casque sur ~6svh, ce qui donne le style "ecrit dans la photo".
       === */
    .layer-name {
        top: auto;
        bottom: 56svh;
        padding: 0 1rem;
        width: 100%;
    }

    .prenom-pilote {
        font-size: clamp(2.2rem, 13vw, 4.5rem);
        letter-spacing: 0.02em;
        line-height: 1;
        white-space: nowrap;
    }

    #hero-name {
        opacity: 0.88;
        -webkit-text-stroke: 1.5px white;
        text-shadow:
            0 2px 12px rgba(0, 0, 0, 0.25),
            0 0 1px rgba(255, 255, 255, 0.4);
    }

    /* Texte "PASSIONNE..." sous la nav, ne chevauche pas le prenom */
    .description-head-container {
        top: calc(env(safe-area-inset-top, 0px) + 90px);
        left: 1rem;
        max-width: min(78vw, 320px);
    }
    .description-head {
        font-size: 0.95rem;
        line-height: 1.5;
        letter-spacing: 0.01em;
    }
}

/* Petits ecrans (iPhone SE / Mini, Android compact) */
@media (max-width: 380px) {
    .prenom-pilote {
        font-size: clamp(1.8rem, 11vw, 3rem);
    }
    .prenom-pilote span {
        padding: 0 1vw !important;
    }
    /* Sur petits ecrans, on garde la meme logique : nom relatif au bas
       et photo qui remplit la hauteur. On ajuste juste les valeurs. */
    .photo-enzo {
        height: 58svh;
    }
    .layer-name {
        bottom: 52svh;
    }
    .description-head {
        font-size: 0.85rem;
    }
}

/* Mode paysage mobile : layout adapte */
@media (max-height: 500px) and (orientation: landscape) {
    .layer-name {
        top: auto;
        bottom: 8vh;
    }
    .prenom-pilote {
        font-size: clamp(1.8rem, 7vw, 3.5rem);
    }
    .description-head-container {
        top: calc(env(safe-area-inset-top, 0px) + 55px);
        max-width: 45vw;
    }
    .photo-enzo {
        width: 40vw;
        height: 85svh;
        background-size: auto 100%;
    }
}

/* Cap des polices sur tres grand ecran (4K et plus) */
@media (min-width: 1921px) {
    .prenom-pilote {
        font-size: clamp(3rem, 12vw, 18rem);
    }
    .description {
        font-size: clamp(1.4rem, 4vw, 3.5rem);
    }
    .social-title {
        font-size: clamp(2.5rem, 4vw, 5rem);
    }
}