/*
 * reviews.css
 * Module Reviews : carrousel scroll-snap, cartes d'avis, hero agrégat, badges source.
 * Réutilise au maximum les design tokens de design_variables.css
 * et les composants de shared_components.css (btn, badge, grid, container, etc.)
 */

/* ==========================================================================
   CARROUSEL (home / section intégrée)
   ========================================================================== */

.reviews-carousel {
    margin-top: 0;
    position: relative;
}

.reviews-carousel__header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.reviews-carousel__summary {
    margin-top: var(--space-3);
    color: var(--gray-600);
    font-size: 0.95rem;
}

.reviews-carousel__summary a {
    color: var(--ocean-primary);
    text-decoration: none;
    font-weight: 500;
}

.reviews-carousel__summary a:hover {
    text-decoration: underline;
}

.reviews-carousel__viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-3);
}

.reviews-carousel__viewport::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   TRACK + SLIDES : 1 slide = 1 page de 2 avis (50/50)
   --------------------------------------------------------------------------
   - Un slide occupe EXACTEMENT 100% du viewport : plus de peek, donc le
     padding horizontal vit sur la row (sinon flex-basis:100% se calcule sur la
     boîte de contenu du track et chaque slide déborde de quelques px).
   - `.reviews-carousel__row` = grille 2 colonnes : 2 avis par slide.
   - Un slide orphelin (nombre impair d'avis) ne contient qu'une carte : la règle
     :only-child l'étire sur toute la largeur, sans classe en plus.
   - scroll-snap-align: start + scroll-snap-type: mandatory → 1 clic prev/next
     = 1 slide = 2 avis, et le scroll manuel retombe toujours sur une page.
   - En dessous de 768px : 1 colonne (2 cartes de 50% sur un téléphone = ~170px,
     illisible).
   ========================================================================== */
.reviews-carousel__track {
    display: flex;
    gap: 0;
    padding: var(--space-3) 0;
    list-style: none;
    margin: 0;
}

.reviews-carousel__slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
}

.reviews-carousel__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    padding: 0 var(--space-2);
}

/* Nombre impair d'avis : le dernier avis occupe seul toute la largeur. */
.reviews-carousel__row > :only-child {
    grid-column: 1 / -1;
}

.reviews-carousel__controls {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.reviews-carousel__btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--ocean-primary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-base);
}

.reviews-carousel__btn:hover:not(:disabled) {
    background: var(--ocean-primary);
    color: var(--white);
    border-color: var(--ocean-primary);
}

.reviews-carousel__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.reviews-carousel__empty {
    text-align: center;
    color: var(--gray-500);
    padding: var(--space-8);
}

/* ==========================================================================
   CARTE D'AVIS
   ========================================================================== */

.review-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
}

.review-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--ocean-primary);
}

.review-card--compact {
    padding: var(--space-4);
}

.review-card__quote {
    margin: 0 0 var(--space-4) 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--gray-700);
    font-style: italic;
    position: relative;
    padding-left: var(--space-4);
    border-left: 3px solid var(--ocean-light);
    flex-grow: 1;
}

.review-card__quote--truncated {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.review-card__author {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.review-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--ocean-mist);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.review-card--compact .review-card__avatar {
    width: 40px;
    height: 40px;
}

.review-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.review-card__avatar-initial {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ocean-primary);
    font-size: 1.2rem;
}

.review-card__author-meta {
    min-width: 0;
    flex: 1;
}

.review-card__author-name {
    margin: 0 0 var(--space-1) 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-card__rating {
    margin-bottom: var(--space-1);
    color: var(--warning);
}

/* ==========================================================================
   RECOMMANDATION (plateformes qui ne notent pas — Facebook)
   ========================================================================== */

/* La recommandation occupe la place des étoiles : même emplacement, même
   hauteur, pour que la carte ne change pas de hauteur selon la plateforme. Le
   pouce est décoratif (`aria-hidden` dans le partial) et le texte porte seul le
   sens, y compris pour un lecteur d'écran. */
.review-recommendation {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

.review-card--compact .review-recommendation {
    font-size: 0.8rem;
}

.review-recommendation__icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1;
}

.review-recommendation--yes {
    color: var(--success);
}

/* Un refus n'est pas masqué ni atténué au point de disparaître : c'est un avis
   publié, et l'aligner sur le vert des autres ferait croire à un bug de mise en
   forme plutôt qu'à un avis négatif. */
.review-recommendation--no {
    color: var(--error);
}

.review-card__date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.review-card__footer {
    display: flex;
    align-items: center;
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-200);
}

/* ==========================================================================
   BADGES SOURCE
   ========================================================================== */

.reviews-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-base);
}

.reviews-source--google {
    background: var(--white);
    color: #4285F4;
    border: 1px solid var(--gray-200);
}

.reviews-source--google:hover {
    background: #4285F4;
    color: var(--white);
}

.reviews-source--manual {
    background: var(--ocean-mist);
    color: var(--ocean-dark);
    border: 1px solid var(--ocean-light);
}

.reviews-source--tripadvisor {
    background: var(--white);
    color: #00aa6c;
    border: 1px solid #00aa6c;
}

.reviews-source--tripadvisor:hover {
    background: #00aa6c;
    color: var(--white);
}

.reviews-source--getyourguide {
    background: var(--white);
    color: #ff5d55;
    border: 1px solid #ff5d55;
}

.reviews-source--getyourguide:hover {
    background: #ff5d55;
    color: var(--white);
}

.reviews-source--facebook {
    background: var(--white);
    color: #1877F2;
    border: 1px solid #1877F2;
}

.reviews-source--facebook:hover {
    background: #1877F2;
    color: var(--white);
}

.reviews-source__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    background: currentColor;
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
}

.reviews-source--google .reviews-source__icon {
    background: linear-gradient(135deg, #4285F4, #34A853, #FBBC05, #EA4335);
}

.reviews-source--tripadvisor .reviews-source__icon {
    background: #00aa6c;
}

.reviews-source--getyourguide .reviews-source__icon {
    background: #ff5d55;
}

.reviews-source--facebook .reviews-source__icon {
    background: #1877F2;
}

.reviews-source__external {
    font-size: 0.7rem;
    margin-left: 2px;
}

/* ==========================================================================
   ÉTOILES (SVG)
   ========================================================================== */

.reviews-stars {
    display: inline-block;
    color: var(--warning);
    line-height: 1;
}

.reviews-stars--sm svg { width: 70px; height: 14px; }
.reviews-stars--md svg { width: 90px; height: 18px; }
.reviews-stars--lg svg { width: 110px; height: 22px; }

/* ==========================================================================
   LIGNE DE CRÉDIBILITÉ (page /reviews)
   ========================================================================== */

/* Un dégradé ocean de quelques rem, en pleine largeur : c'est une signature de
   confiance, pas une section. Le bandeau d'origine en prenait six, pour deux
   nombres et un badge. */
.reviews-credibility {
    background: linear-gradient(135deg, var(--ocean-deep), var(--ocean-primary));
    color: var(--white);
    padding: var(--space-4) 0;
}

/* Le blanc est reecrit ici, et non herite de la section : `base_reset.css`
   donne `color: var(--gray-700)` a tous les `p`, specificity (0,0,1), qui bat
   l'heritage de `.reviews-credibility`. Sans cette ligne, seul le texte nu —
   « 4,9/5 sur », « % recommandent sur » — tombait en gris sur le degrade
   bleu, les liens restant blancs. */
.reviews-credibility__text {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-4);
    margin: 0;
    color: var(--white);
    font-size: 1rem;
    line-height: 1.5;
}

/* Séparateur en CSS, pas dans le Twig : un `·` écrit en dur dans la boucle
   traînerait un deux-points orphelin en fin de ligne selon la largeur. */
.reviews-credibility__item + .reviews-credibility__item::before {
    content: '\00b7';
    margin-right: var(--space-4);
    opacity: 0.7;
}

.reviews-credibility__item a {
    color: var(--white);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: opacity var(--transition-base);
}

.reviews-credibility__item a:hover,
.reviews-credibility__item a:focus-visible {
    opacity: 0.85;
}

.reviews-credibility__item a::after {
    content: ' \2197';
    font-size: 0.8em;
}


.badge {
    display: inline-block;
    padding: 2px var(--space-2);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
}

.btn--danger {
    color: var(--error);
}

.btn--danger:hover {
    background: var(--error);
    color: var(--white);
}

/* ==========================================================================
   LIEN « AFFICHER TOUS LES AVIS » (accueil)
   ========================================================================== */

.reviews-carousel__more {
    margin-top: var(--space-6);
    text-align: center;
}

/* ==========================================================================
   FILTRES PAR PLATEFORME (/reviews)
   ========================================================================== */

/* Le bandeau ne porte QUE le fond et le padding vertical. Le padding lateral
   vient du `.container` qu'il contient : sur le meme element, cette regle
   ecrascript celle du conteneur (reviews.css est charge apres
   shared_components.css) et les pastilles se retrouvaient collees au bord.
   Le fond, lui, doit couvrir toute la largeur comme `.reviews-page-grid`. */
.reviews-filter {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-5) 0;
}

/* Un intitulé : sans lui, une rangée de pastilles ne dit pas à quoi elle sert.
   C'est un <span> et non un <h2> — ce n'est pas un titre de section, et le
   placer dans la hiérarchie des titres polluerait le plan de la page. */
.reviews-filter__label {
    display: block;
    margin-bottom: var(--space-3);
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.reviews-filter__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    list-style: none;
    margin: 0;
    padding: 0;
}

.reviews-filter__chip {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.5;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.reviews-filter__chip:hover {
    border-color: var(--ocean-primary);
    color: var(--ocean-dark);
}

/* Anneau de focus explicite : un changement de bordure ne se voit pas au
   clavier, et la navigation au clavier est le seul moyen d'atteindre ces
   filtres sans souris. */
.reviews-filter__chip:focus-visible {
    outline: 2px solid var(--ocean-primary);
    outline-offset: 2px;
}

/* Le chip actif reprend la couleur d'accent du site : blanc sur
   `--ocean-primary` = 4,58:1, au-dessus du seuil AA. Un noir plein faisait
   passer le texte gris voisin pour du texte secondaire. */
.reviews-filter__chip--active,
.reviews-filter__chip--active:hover {
    background: var(--ocean-primary);
    border-color: var(--ocean-primary);
    color: var(--white);
    font-weight: 600;
}

.reviews-filter__chip--active .reviews-filter__count {
    color: var(--white);
    opacity: 0.85;
}

/* Couleur propre au lieu d'un `opacity` : sur le chip actif, un compteur
   estompé à 65% passait sous le seuil de contraste alors même que le texte
   voisin était plein. */
.reviews-filter__count {
    color: var(--gray-500);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   GRILLE PAGE /reviews
   ========================================================================== */

.reviews-page-grid {
    padding: var(--space-10) 0;
    background: var(--gray-50);
}

.reviews-page-grid__list {
    margin-bottom: var(--space-6);
}

.reviews-page-grid__item {
    height: 100%;
}

.reviews-page-grid__more {
    text-align: center;
    margin-top: var(--space-6);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    /* 1 avis par slide sur mobile : 2 colonnes de 50% seraient illisibles */
    .reviews-carousel__row {
        grid-template-columns: minmax(0, 1fr);
    }

    .reviews-carousel__btn {
        width: 38px;
        height: 38px;
    }

    .reviews-credibility__text {
        font-size: 0.95rem;
    }

    /* Défilement horizontal plutot qu'un retour a la ligne : sur mobile, un chip
       par ligne repoussait la grille de trois lignes plus bas que l'ecran. */
    .reviews-filter__list {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-2);
    }

    .reviews-filter__chip {
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reviews-carousel__viewport {
        scroll-behavior: auto;
    }

    .review-card,
    .reviews-source,
    .reviews-carousel__btn {
        transition: none;
    }
}

/* Boutons désactivés (visuellement grisés, mais JS gère le toggle) */
.reviews-carousel__btn.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Override pour la section reviews intégrée à la home
   ========================================================================== */
.reviews {
    padding: var(--space-6) 0;
}

.reviews .section-subtitle {
    margin-bottom: var(--space-4);
}
