/* =========================================
    STYLES GLOBAUX (Pour la prévisualisation)
    ========================================= */
:root {
    --bg-color: #111111; /* Couleur de fond sombre pour les projets */
}
body, html {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: white;
}

/* =========================================
    CORRECTION DU HOME.CSS
    ========================================= */

/* Conteneur principal pour encadrer la vidéo absolue */
.home-main {
    position: relative; 
}

/* =========================================
    VIDEO D'ARRIÈRE-PLAN
    ========================================= */
.home-background-video {
    display: block;
    position: absolute; /* Modifié de fixed à absolute pour rester en haut mais défiler */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* Couvre le premier écran */
    object-fit: cover;
    mask-image: linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 20%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 20%);
    z-index: 0;
}

/* =========================================
    SECTION HERO
    ========================================= */
.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Centre le contenu verticalement */
    min-height: 100vh; /* Prend 100% de la hauteur de l'écran pour repousser la section suivante */
    width: 100%;
    text-align: center;
    position: relative; /* Modifié de absolute à relative */
    z-index: 1; /* S'assure d'être au-dessus de la vidéo */
    padding: 0;
    margin: 0;
}

.home-hero__title {
    font-size: 3rem;
    margin-bottom: 20px;
    line-height: 50px;
}

.home-hero__btn {
    margin-top: 20px; /* Plus besoin de marge négative */
    padding: 12px 24px;
    background: white;
    color: black;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

/* =========================================
    SECTION PROJETS
    ========================================= */
.home-projects {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 0;
    gap: 20px; 
    background-color: var(--bg-color);
    overflow: hidden;
    position: relative;
    z-index: 2; /* S'assure d'être au-dessus de la vidéo lors du scroll */
}

.home-projects__row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 5vw;
    flex-wrap: wrap;
}

.home-projects__title-img {
    max-width: 25vw;
    min-width: 200px;
    height: auto;
    object-fit: contain;
}

.home-projects__all-btn {
    z-index: 10;
    margin-top: 40px; 
    padding: 12px 24px;
    background: transparent;
    color: white;
    border: 2px solid white;
    text-decoration: none;
    border-radius: 5px;
    transition: 0.3s;
}

.home-projects__all-btn:hover {
    background: white;
    color: black;
}

/* =========================================
    CARROUSEL 3D
    ========================================= */
.home-carousel {
    position: relative;
    width: 60vw;
    height: 50vh;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-carousel__viewport {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1500px;
    transform-style: preserve-3d;
    -webkit-mask-image: linear-gradient(to right, transparent 5%, black 25%, black 75%, transparent 95%);
    mask-image: linear-gradient(to right, transparent 5%, black 25%, black 75%, transparent 95%);
    pointer-events: none; 
}

.home-carousel__nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    position: absolute;
    top: 50%;
    transform: translateY(-50%); 
    z-index: 100;
}

.home-carousel__nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.home-carousel__nav-btn--prev { left: -20px; }
.home-carousel__nav-btn--next { right: -20px; }

.home-carousel__icon {
    width: 20px;
    height: 20px;
    fill: white;
}

/* =========================================
    CARTES DU CARROUSEL
    ========================================= */
.home-carousel__card {
    --base-w: 570;
    --base-h: 320;
    --ratio: calc(var(--base-h) / var(--base-w));
    --ratio-inv: calc(var(--base-w) / var(--base-h));
    --card-width: min(30vw, calc(90vh * var(--ratio-inv)));
    --card-height: calc(var(--card-width) * var(--ratio));

    pointer-events: auto; 
    position: absolute;
    width: var(--card-width);
    min-width: 280px; /* Sécurité pour petits écrans */
    height: var(--card-height);
    min-height: 160px;
    
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Centrage plus propre que les margins négatives */
    
    border: solid 2px #ffffff;
    border-radius: 15px;
    overflow: hidden; 
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    backface-visibility: hidden;
}

.home-carousel__card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 1;
    /* Ajout d'une couleur de fond grise pour l'aperçu si l'image ne charge pas */
    background-color: #333; 
}

/* =========================================
    ÉTATS DYNAMIQUES DU CARROUSEL (Pilotés par JS)
   ========================================= */

/* État par défaut (caché pour éviter les bugs visuels au chargement) */
.home-carousel__card {
    opacity: 0;
    z-index: 0;
    transform: translate(-50%, -50%) scale(0.8); /* Position centrale réduite */
    pointer-events: none; /* On ne peut pas cliquer sur les cartes cachées */
}

/* 1. La carte ACTIVE (au centre) */
.home-carousel__card--active {
    opacity: 1;
    z-index: 10;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto; /* On peut cliquer/sélectionner */
}

/* 2. La carte PRÉCÉDENTE (à gauche) */
.home-carousel__card--prev {
    opacity: 0.6;
    z-index: 5;
    /* On décale vers la gauche (-120%) et on applique une rotation pour l'effet 3D */
    transform: translate(-120%, -50%) scale(0.85) perspective(1000px) rotateY(-15deg);
}

/* 3. La carte SUIVANTE (à droite) */
.home-carousel__card--next {
    opacity: 0.6;
    z-index: 5;
    /* On décale vers la droite (20%) */
    transform: translate(20%, -50%) scale(0.85) perspective(1000px) rotateY(15deg);
}

/* 4. Les cartes CACHÉES (derrière) */
.home-carousel__card--hidden {
    opacity: 0;
    z-index: 0;
    transform: translate(-50%, -50%) scale(0.5);
}


/* =========================================
    OVERLAY ET ANIMATIONS DU CARROUSEL
   ========================================= */

/* 1. Préparation de l'image pour l'effet de zoom */
.home-carousel__card-img {
    transition: transform 1s ease; /* Ajout de la transition fluide */
}

/* 2. Structure de l'overlay (invisible par défaut) */
.home-carousel__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(0, 0, 0, 0); 
    transition: background 0.4s ease;
    padding: 20px;
    box-sizing: border-box;
    z-index: 2; /* S'assure d'être au-dessus de l'image */
}

/* 3. Conteneur des détails (Date et Bouton - caché par défaut) */
.home-carousel__details {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    height: 0;
    overflow: hidden;
    padding: 10px;
}

/* 4. Typographie de la date (identique à projets.css) */
.home-carousel__date {
    font-size: 1.5rem;
    font-family: var(--font-tertiary, "lft-etica-compressed", sans-serif);
    color: var(--txt-color, #ffffff);
    margin-bottom: 15px;
    margin-top: 5px;
}

/* 5. Style du bouton (hérite de ta classe .btn globale) */
.home-carousel__btn {
    padding: 8px 20px;
    width: 100px;
    height: 20px;
    font-size: 20px;
    transition: background-color 0.2s;
}

/* =========================================
   ANIMATIONS AU SURVOL (CARTE ACTIVE UNIQUEMENT)
   ========================================= */

/* Effet de zoom sur l'image */
.home-carousel__card--active:hover .home-carousel__card-img {
    transform: scale(1.05);
}

/* Assombrissement de l'overlay */
.home-carousel__card--active:hover .home-carousel__overlay {
    background: rgba(0, 0, 0, 0.85);
}

/* Apparition du texte et du bouton */
.home-carousel__card--active:hover .home-carousel__details {
    opacity: 1;
    transform: translateY(0);
    height: auto;
    margin-top: 20px;
}

/* =========================================
    RESPONSIVE MOBILE
   ========================================= */
@media (max-width: 1200px) {
    .home-projects__row {
        flex-direction: column;
    }

    .home-projects__title-img {
        max-width: 40vw; /* Ajuste la taille du titre sur mobile */
        margin-bottom: -50px;
    }

    .home-carousel {
        width: 80vw; /* Élargit le carrousel pour mieux utiliser l'espace sur mobile */
        min-height: 250px; /* Optionnel : réduit un peu la hauteur minimum sur mobile */
    }
}

@media (hover: none) and (pointer: coarse) {
    
    /* 1. On annule les animations visuelles (zoom et fond sombre) */
    .home-carousel__card--active:hover .home-carousel__card-img,
    .home-carousel__card--active:active .home-carousel__card-img {
        transform: none !important;
    }

    .home-carousel__card--active:hover .home-carousel__overlay,
    .home-carousel__card--active:active .home-carousel__overlay {
        background: transparent !important;
    }

    /* 2. On masque la date pour garder l'image propre */
    .home-carousel__date {
        display: none !important; 
    }

    /* 3. On force le conteneur des détails à prendre toute la place */
    .home-carousel__details {
        height: 100% !important;
        width: 100% !important;
        overflow: visible !important;
        transform: none !important;
        opacity: 1 !important;
        margin: 0 !important;
    }

    /* 4. On étend le bouton sur toute la carte et on le rend transparent */
    .home-carousel__btn {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 10 !important;
        opacity: 0 !important; /* Le bouton est là, et cliquable, mais invisible */
        margin: 0 !important;
        padding: 0 !important;
    }
}