/* Empêcher le défilement horizontal */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

/* ========== Animations Hero Fluides et Professionnelles ========== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes smoothFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Animation fluide pour les éléments du texte */
#slide-tag {
    animation: slideInDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#slide-title {
    animation: slideInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
    opacity: 0;
}

#slide-subtitle {
    animation: slideInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
    opacity: 0;
}

#slide-text {
    animation: slideInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
    opacity: 0;
}

#cta-button {
    animation: fadeInScale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
    opacity: 0;
}

/* Transitions fluides lors du changement de contenu */
.fade-out {
    animation: smoothFade 0.4s ease-out forwards;
    opacity: 0;
}

.fade-in {
    animation: smoothFade 0.6s ease-in forwards;
    opacity: 1;
}

/* Image de fond fluide */
#bg-image {
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Indicateurs lisses */
#slide-indicators span {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Boutons de navigation fluides */
#prev-btn,
#next-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#prev-btn:hover,
#next-btn:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1);
}

/* Effets texte gradient */
.gradient-text {
    background: linear-gradient(135deg, #CA161A 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}






/* Effet Ken Burns corrigé */
.animate-ken-burns {
    animation: kenBurns 50s ease-in-out infinite alternate;
    background-position: center;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.15) translate(0, 0);
    }
}



/* Style des liens actifs */
nav ul li a.active-link {
    color: #CA161A !important;
    font-weight: 700;
}



/* --- Styles de la Section Contact --- */
.contact-section {
    /* Reproduction du dégradé (du jaune vers le rouge) */
    background: linear-gradient(to right, #f39c12, #e84d3b);

    /* Hauteur pour donner de l'espace, ajustez selon vos besoins */
    padding: 100px 20px;

    /* Centre le texte horizontalement */
    text-align: center;

    /* Assure que le texte est blanc pour le contraste */
    color: white;
}

.contact-content {
    max-width: 800px;
    margin: 0 auto;
}

/* --- Styles du Titre --- */
.contact-title {
    font-size: 2.2em;
    font-weight: bold;
    color: black;
    margin-bottom: 10px;
}

/* --- Styles de la Description --- */
.contact-subtitle {
    font-size: 1.2em;
    font-weight: 500;
    line-height: 1.5;
    color: white;
}



/* S'assurer que le backdrop-filter fonctionne sur l'élément parent */
#project-modal {
    background-color: rgba(0, 0, 0, 0.4);
    /* Rendre l'arrière-plan semi-transparent pour le flou */
    backdrop-filter: blur(4px);
    /* Application du flou sur l'arrière-plan */
    -webkit-backdrop-filter: blur(4px);
    /* Support pour Safari */
}

/* Pour les navigateurs modernes qui supportent Tailwind */
@media (min-width: 768px) {
    #project-modal {
        @apply backdrop-blur-sm;
        /* Utiliser la classe Tailwind pour le flou */
    }
}





.buttons-container {
    text-align: center;
    padding: 40px 20px;
    /* Espace autour du conteneur */
    background-color: white;
}

/* --- Style général des boutons --- */
.btn {
    display: inline-block;
    padding: 15px 30px;
    /* Espacement interne */
    margin: 0 10px;
    border: none;
    border-radius: 5px;
    /* Bords légèrement arrondis */
    font-size: 1.1em;
    /* Taille de la police */
    font-weight: bold;
    cursor: pointer;
    /* Indique que le bouton est cliquable */
    transition: background-color 0.3s ease;
    /* Transition douce au survol */
    text-decoration: none;
}

/* --- Style du bouton Rouge ("Contact Général") --- */
.btn-red {
    background-color: #d12228;
    color: white;
}

.btn-red:hover {
    background-color: #bb1f24;
    /* Assombrir légèrement au survol */
}

/* --- Style du bouton Gris Clair ("Demande de devis") --- */
.btn-light-grey {
    background-color: #e0e0e0;
    /* Gris clair */
    color: #333;
    /* Texte gris foncé ou noir pour le contraste */
}

.btn-light-grey:hover {
    background-color: #d4d4d4;
    /* Assombrir légèrement au survol */
}

/* --- Ajustement pour l'affichage mobile (Optionnel) --- */
@media (max-width: 600px) {
    .btn {
        display: block;
        margin: 10px auto;
        width: 80%;
        max-width: 300px;
    }
}






/* Ajustement de la section de titre 'Contactez-nous' sur les petits écrans */
.contact-section {
    padding: 60px 20px;
    /* Ajout d'un padding vertical pour l'espace */
    text-align: center;
}

.contact-title {
    font-size: 2.5rem;
    /* Rendre le titre plus compact sur mobile */
}

.contact-subtitle {
    font-size: 1rem;
}


/* Cible les écrans jusqu'à 1023px (petits et moyens écrans, avant 'lg') */
@media (max-width: 1023px) {

    /* Sélectionne la carte d'assistance (ml-[140vh]...) */
    .main-container>div:last-child {
        /* Annule le positionnement absolu/flottant de Tailwind sur mobile */
        position: relative !important;
        margin-left: auto !important;
        margin-right: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;

        /* Assure une bonne largeur et un espacement après la section formulaire */
        width: 90% !important;
        max-width: 400px;
        /* Limite la largeur sur tablette */
        margin-top: 3rem !important;
        margin-bottom: 2rem !important;
    }
}



@media (max-width: 767px) {

    .space-y-6>div>div>.text-white {
        margin-left: 0.5rem !important;
        font-size: 0.9rem;
    }

    .space-y-6>div {
        padding: 15px;
    }

}



@media (max-width: 1023px) {
    .space-y-6>.bg-white {
        /* Conteneur des coordonnées */
        padding: 20px;
    }

    .space-y-6>.rounded-xl iframe {
        width: 100%;
    }
}





.fade-out {
    opacity: 0;
    transition: opacity 0.7s ease-in-out;
    /* Durée de la transition pour le fondu sortant */
}

.fade-in {
    opacity: 1;
    transition: opacity 0.7s ease-in-out;
}

#text-content-container {
    position: relative;
    /* ou z-20 comme déjà fait */
}



#bg-image {
    transition: opacity 1.5s ease-in-out;
}

     
                /* Cache la barre de défilement pour un look plus propre tout en gardant la fonctionnalité */
                .no-scrollbar::-webkit-scrollbar { display: none; }
                .no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }


/* Cache les compteurs immédiatement pour éviter le flash */
.counter {
    opacity: 0;
    display: inline-block;
}

/* Cache la section About par défaut */
#about-section {
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

/* Classe utilitaire pour la visibilité */
.opacity-100 {
    opacity: 1 !important;
}


.fade-slide-enter {
    opacity: 0;
    transform: translateY(15px);
}

.fade-slide-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-slide-leave {
    opacity: 1;
    transform: translateY(0);
}

.fade-slide-leave-active {
    opacity: 0;
    transform: translateY(-15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* --------------------------------------------------
   Styles pour les cartes du portfolio
   -------------------------------------------------- */
.portfolio-item {
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), box-shadow 0.35s ease;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
    display: flex;
    flex-direction: column;
}

.portfolio-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 14px 40px rgba(16, 24, 40, 0.12);
}

.portfolio-item .h-64 {
    position: relative;
    overflow: hidden;
}

.portfolio-item .h-64::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.18) 100%);
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.portfolio-item:hover img {
    transform: scale(1.08) translateZ(0);
}

.portfolio-item .p-4 {
    padding: 1rem;
    display: block;
    flex: 1 1 auto;
}

.portfolio-item .p-4 p:first-child {
    color: #CA161A;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.portfolio-item h3 {
    margin-top: 0.25rem;
    font-size: 1.05rem;
    color: #0f172a;
    line-height: 1.15;
}

.portfolio-item p.line-clamp-3 {
    color: #6b7280;
    margin-top: 0.5rem;
}

.portfolio-item a {
    display: inline-block;
    margin-top: 0.6rem;
    color: #CA161A;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.portfolio-item a:hover {
    color: #eab308;
    /* jaune */
    transform: translateX(3px);
}

/* Petit ajustement responsive pour les cartes */
@media (max-width: 640px) {
    .portfolio-item {
        max-width: 100%;
    }

    .portfolio-item h3 {
        font-size: 1rem;
    }
}

/* Modal sizing: limiter la hauteur pour ne pas dépasser la fenêtre
   et gérer le défilement interne si le contenu est trop grand. */
#project-modal .modal-content {
    width: min(920px, 95%);
    /* largeur maximale raisonnable, s'adapte aux petits écrans */
    max-width: 520px;
    max-height: calc(100vh - 4rem);
    /* laisse une marge au dessus et en dessous */
    overflow: hidden;
    /* masque le débordement externe, on gère le scroll dans le corps */
    display: flex;
    flex-direction: column;
}

#modal-image-container {
    height: clamp(160px, 30vh, 320px);
    /* image adaptée selon la hauteur d'écran */
}

#project-modal .modal-content>.p-6 {
    overflow-y: auto;
    /* contenu scrollable si dépasse max-height */
    padding-right: 1rem;
    /* espace pour le scroll */
}

/* Amélioration : s'assurer que le bouton fermer reste visible */
#project-modal #close-modal {
    z-index: 20;
}


@keyframes slideTag {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    50% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }

    100% {
        opacity: 1;
        transform: translateY(0px) scale(1.02);
    }
}

.animate-slideTag {
    animation: slideTag 1.2s ease-out forwards;
}

/* Animation d'entrée du bouton */
@keyframes ctaButtonAnim {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    50% {
        opacity: 1;
        transform: translateY(0px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
}

.animate-cta {
    animation: ctaButtonAnim 1.2s ease-out forwards;
}

/* Glow subtil au survol */
#cta-button:hover {
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.6), 0 8px 20px rgba(0, 0, 0, 0.2);
}