﻿/* -------- Section Avis -------- */
.avis-section {
    background: #f6f8fc; /* léger gris pour faire ressortir les cartes */
    padding: 72px 16px 56px;
    position: relative;
    isolation: isolate;
}

.avis-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Titre "Ce que disent nos clients" ===== */
.avis-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin: 0 auto 40px;
    font-size: clamp(26px, 3.2vw, 40px);
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1.2;
    color: #155e75 !important;
    -webkit-text-fill-color: #155e75 !important;
    background: none !important;
}

/* Conteneur pour centrer horizontalement le titre */
.avis-header,
.avis-section {
    text-align: center; /* centre le bloc inline */
}

/* Lignes fines décoratives à gauche et à droite du titre */
.avis-title::before,
.avis-title::after {
    content: "";
    flex: 1;
    height: 2px;
    background-color: #d9d1c2; /* beige doux */
    max-width: 70px;
    min-width: 30px;
    opacity: 0.9;
}

.avis-title::before {
    left: -76px;
}

.avis-title::after {
    right: -76px;
}

/* Adaptation sur petits écrans */
@media (max-width: 540px) {
    .avis-title {
        font-size: 22px;
        gap: 10px;
    }

        .avis-title::before,
        .avis-title::after {
            max-width: 40px;
            min-width: 20px;
            opacity: 0.6;
        }
}


/* Grille des cartes */
.avis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 992px) {
    .avis-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
}

/* Carte d'avis */
.avis-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 28px 26px;
    box-shadow: 0 8px 22px rgba(15,23,42,0.08);
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

/* Étoiles */
.avis-stars {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

    .avis-stars .star {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        fill: #f5b301; /* or */
        filter: drop-shadow(0 1px 0 rgba(0,0,0,.05));
    }

/* Texte & auteur */
.avis-quote {
    color: #1f2937;
    line-height: 1.6;
    font-size: 16px;
    margin: 0 0 18px;
}

.avis-author {
    color: #0f172a;
    font-weight: 600;
    margin-top: auto;
}

/* Barre dégradée en bas de section (décor) */
.avis-bottom-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 14px;
    background: linear-gradient(90deg,#3b82f6, #7c3aed);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    /* pour que la barre ne couvre pas le contenu si on scrolle vite */
    pointer-events: none;
}
/* -------- Carousel automatique 3 par 3 parfaitement aligné -------- */
.avis-carousel-wrapper {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.avis-carousel {
    display: flex;
    flex-wrap: nowrap;
    width: 300%; /* 3 groupes (9 avis / 3 par groupe) */
    animation: slideAvisGroup 45s infinite ease-in-out;
}

/* Chaque carte occupe exactement 1/9e du total pour 9 avis */
.avis-card {
    flex: 0 0 calc(100% / 9);
    box-sizing: border-box;
}

/* On supprime le gap car il fausse le calcul des translations */
.avis-grid {
    gap: 0;
}

/* Animation : 3 blocs (0 → -33.333% → -66.666%) */
@keyframes slideAvisGroup {
    0%, 20% {
        transform: translateX(0);
    }

    33%, 53% {
        transform: translateX(-33.333%);
    }

    66%, 86% {
        transform: translateX(-66.666%);
    }

    100% {
        transform: translateX(0);
    }
}

/* -------- Responsive : 1 avis à la fois -------- */
@media (max-width: 992px) {
    .avis-carousel {
        width: 900%; /* 9 cartes en ligne */
        animation: slideAvisMobile 36s infinite ease-in-out;
    }

    .avis-card {
        flex: 0 0 calc(100% / 9);
    }

    @keyframes slideAvisMobile {
        0%, 20% {
            transform: translateX(0);
        }

        25%, 45% {
            transform: translateX(-11.111%);
        }

        50%, 70% {
            transform: translateX(-22.222%);
        }

        75%, 95% {
            transform: translateX(-33.333%);
        }

        100% {
            transform: translateX(0);
        }
    }
}
/* -------- Carousel automatique 3 par 3 parfaitement aligné + espacements -------- */
.avis-carousel-wrapper {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.avis-carousel {
    display: flex;
    flex-wrap: nowrap;
    width: 300%; /* 3 groupes (9 avis / 3 par groupe) */
    animation: slideAvisGroup 45s infinite ease-in-out;
    justify-content: space-between;
}

/* Chaque carte occupe exactement 1/9e du total, avec marge interne pour l'espacement */
.avis-card {
    flex: 0 0 calc(100% / 9 - 20px);
    box-sizing: border-box;
    margin: 0 10px; /* espace horizontal entre les cartes */
}

/* Animation par groupes de 3 (affiche toujours 3 entiers) */
@keyframes slideAvisGroup {
    0%, 20% {
        transform: translateX(0);
    }

    33%, 53% {
        transform: translateX(-33.333%);
    }

    66%, 86% {
        transform: translateX(-66.666%);
    }

    100% {
        transform: translateX(0);
    }
}

/* -------- Responsive : 1 avis à la fois -------- */
@media (max-width: 992px) {
    .avis-carousel {
        width: 900%; /* 9 cartes */
        animation: slideAvisMobile 36s infinite ease-in-out;
    }

    .avis-card {
        flex: 0 0 calc(100% / 9 - 12px);
        margin: 0 6px;
    }

    @keyframes slideAvisMobile {
        0%, 20% {
            transform: translateX(0);
        }

        25%, 45% {
            transform: translateX(-11.111%);
        }

        50%, 70% {
            transform: translateX(-22.222%);
        }

        75%, 95% {
            transform: translateX(-33.333%);
        }

        100% {
            transform: translateX(0);
        }
    }
}
/* -------- Carousel infini fluide (sans retour) -------- */
.avis-carousel-wrapper {
    display: flex;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.avis-carousel {
    display: flex;
    flex-shrink: 0;
    width: 100%;
    animation: slideAvisInfinite 60s linear infinite;
}

.avis-card {
    flex: 0 0 calc(33.333% - 28px);
    margin: 0 14px;
    box-sizing: border-box;
}

/* Animation fluide */
@keyframes slideAvisInfinite {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Le clone démarre juste après le premier pour créer la boucle */
.avis-carousel.clone {
    position: absolute;
    top: 0;
    left: 100%;
    animation: slideAvisInfiniteClone 60s linear infinite;
}

@keyframes slideAvisInfiniteClone {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Responsive : 1 carte à la fois sur mobile */
@media (max-width: 992px) {
    .avis-card {
        flex: 0 0 calc(100% - 24px);
        margin: 0 12px;
    }

    .avis-carousel,
    .avis-carousel.clone {
        animation-duration: 40s;
    }
}
