/**
 * Section Temoignages Video - PLAYER CENTRÉ + RESPONSIVE
 * wp-content/themes/custom-theme/src/assets/css/agence/temoignages-styles.css
 * VERSION 2.0 - OPTIMISÉ MOBILE (performances téléphone)
 */

/* ====================================
   BLOC TEMOIGNAGES VIDEO - FULL WIDTH
   ==================================== */
.temoignages-section {
    background: var(--coral);
    position: relative;
    overflow: hidden;
    width: 100vw;
    box-sizing: border-box;
    padding: 12em 0;
}

.temoignages-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
}

.temoignages-wrapper {
    display: grid;
    grid-template-columns: 70% 26%;
    gap: var(--space-md);
    align-items: flex-start;
}

/* ====================================
   COLONNE GAUCHE - VIDEOS (70%)
   ==================================== */
.temoignages-videos-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    height: 100%;
    overflow: hidden;
}

/* ====================================
   GRILLE NORMALE - 3 VIDEOS OU MOINS - DESKTOP 1920px
   ==================================== */
.temoignages-videos-list {
    display: grid;
    grid-template-columns: repeat(3, 370px);
    gap: var(--space-sm);
    width: 100%;
    justify-content: start;
}

/* Items en mode grille - TAILLE FIXE 370px */
.temoignages-videos-list:not(.has-carousel) .temoignage-video-item {
    width: 370px !important;
    min-width: 370px !important;
    max-width: 370px !important;
}

.temoignages-videos-list:not(.has-carousel) .temoignage-video-container {
    aspect-ratio: 6/10 !important;
    width: 370px !important;
    max-width: 370px !important;
}

/* ====================================
   CARROUSEL - 4+ VIDEOS (RESTE DANS LA COLONNE)
   ==================================== */
.temoignages-videos-list.has-carousel {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 0;
}

/* Wrapper pour le scroll - SCROLLABLE VISIBLE */
.temoignages-carousel-wrapper {
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(255, 255, 255, 0.1);
    cursor: grab;
    user-select: none;
    width: 100%;
    padding-bottom: var(--space-md);
    -webkit-overflow-scrolling: touch;
}

.temoignages-carousel-wrapper::-webkit-scrollbar {
    height: 10px;
}

.temoignages-carousel-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.temoignages-carousel-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.temoignages-carousel-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.7);
}

.temoignages-carousel-wrapper.grabbing {
    cursor: grabbing;
    scroll-behavior: auto;
}

/* Track du carrousel */
.temoignages-carousel-track {
    display: flex;
    gap: var(--space-sm);
    width: max-content;
    padding-bottom: var(--space-xs);
}

/* Items dans le carrousel - TAILLE FIXE 370px */
.temoignages-videos-list.has-carousel .temoignage-video-item {
    flex: 0 0 370px !important;
    width: 370px !important;
    min-width: 370px !important;
    max-width: 370px !important;
}

/* Container video FIXE en carrousel desktop */
.temoignages-videos-list.has-carousel .temoignage-video-container {
    aspect-ratio: 6/10 !important;
    width: 370px !important;
    max-width: 370px !important;
}

/* ====================================
   ITEM VIDEO - DESIGN BASE
   ==================================== */
.temoignage-video-item {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-normal);
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.temoignage-video-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ====================================
   CONTAINER VIDEO
   ==================================== */
.temoignage-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 6/10;
    background: #000;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    flex-shrink: 0;
}

/* IMAGE POSTER PAR DEFAUT */
.temoignage-video-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    z-index: 2;
    transition: var(--transition-normal);
}

/* SHORTCODE VIDEO MASQUE */
.temoignage-video-shortcode {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Video/Image responsive */
.temoignage-video-container iframe,
.temoignage-video-container video,
.temoignage-video-container img:not(.temoignage-video-poster) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

/* MASQUER LES CONTROLES VIDEO */
.temoignage-video-container video {
    controls: none;
}

.temoignage-video-container video::-webkit-media-controls {
    display: none !important;
}

.temoignage-video-container video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.temoignage-video-container p {
    display: none !important;
}

/* ====================================
   BOUTON PLAY CENTRÉ SUR LA VIDÉO
   ==================================== */
.temoignage-video-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    width: auto;
    height: auto;
}

.temoignage-play-button {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    background: var(--dark);
    border: none;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
    aspect-ratio: 1/1 !important;
    overflow: hidden;
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

/* Icône Play */
.temoignage-play-button::before {
    content: '\25B6';
    font-size: 20px;
    color: var(--white);
    margin-left: 3px;
    display: block;
    line-height: 1;
    width: 100%;
    text-align: center;
}

/* Hover sur le bouton */
.temoignage-play-button:hover {
    background: var(--primary);
    transform: scale(1.15);
}

/* État Playing - MASQUÉ PAR DÉFAUT */
.temoignage-play-button.playing {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Réapparaît au hover sur la vidéo SEULEMENT si en cours de lecture */
.temoignage-video-item:hover .temoignage-play-button.playing {
    opacity: 1;
    visibility: visible;
}

/* Icône Pause */
.temoignage-play-button.playing::before {
    content: '\23F8';
    margin-left: 0;
}

.temoignage-play-button * {
    box-sizing: border-box !important;
}

/* ====================================
   CONTENU VIDEO - SOUS LA VIDEO (100% LARGEUR)
   ==================================== */
.temoignage-video-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    background: transparent;
    position: relative;
    width: 100%;
}

.temoignage-video-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.temoignage-video-title {
    font-family: var(--font-primary);
    font-size: var(--h3-size);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 5px;
    line-height: 1.3;
}

.temoignage-video-description {
    font-family: var(--font-inter);
    font-size: var(--p-size);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
    line-height: var(--p-line-height);
    margin-bottom: 0;
    margin-right: 3px;
}

/* ====================================
   COLONNE DROITE - TITRE (30%) - FIXE
   ==================================== */
.temoignages-title-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-lg);
    position: sticky;
    top: 20vh;
}

.temoignages-title-h2 {
    font-family: var(--font-primary);
    font-size: var(--h2-size);
    font-weight: 900;
    line-height: 55px;
    color: var(--white);
    text-align: left;
    margin-bottom: 0;
    opacity: 0;
    transform: translateY(50px);
}

.temoignages-title-h2.visible {
    opacity: 1;
    transform: translateY(0);
}

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

/* 1440px - Laptop 13/15 pouces */
@media (max-width: 1800px) {
    .temoignages-section {
        padding: 6em 0;
    }

    .temoignages-videos-list {
        grid-template-columns: repeat(3, 200px);
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-item {
        width: 200px !important;
        min-width: 200px !important;
        max-width: 200px !important;
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-container {
        width: 200px !important;
        max-width: 200px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-item {
        flex: 0 0 200px !important;
        width: 200px !important;
        min-width: 200px !important;
        max-width: 200px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-container {
        width: 200px !important;
        max-width: 200px !important;
    }

    .temoignage-play-button {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
    }

    .temoignage-play-button::before {
        font-size: 18px;
    }

    .temoignages-title-h2 {
        font-family: var(--font-primary);
        font-size: var(--h2-size);
        font-weight: 900;
        line-height: 45px;
        color: var(--white);
        text-align: left;
        margin-bottom: 0;
        opacity: 0;
        transform: translateY(50px);
    }
}

/* 1300px - Petit écran desktop */
@media (max-width: 1300px) {
    .temoignages-section {
        padding: 5em 0;
    }

    .temoignages-videos-list {
        grid-template-columns: repeat(3, 180px);
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-item {
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-container {
        width: 180px !important;
        max-width: 180px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-item {
        flex: 0 0 180px !important;
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-container {
        width: 180px !important;
        max-width: 180px !important;
    }

    .temoignage-play-button {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }

    .temoignage-play-button::before {
        font-size: 16px;
    }
}

/* 1024px - Tablettes */
@media (max-width: 1024px) {
    .temoignages-section {
        padding: 4em 0;
    }

    .temoignages-wrapper {
        grid-template-columns: 65% 30%;
        gap: var(--space-sm);
    }

    .temoignages-videos-list {
        grid-template-columns: repeat(3, 250px);
        gap: var(--space-xs);
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-item {
        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;
    }

    .temoignages-videos-list:not(.has-carousel) .temoignage-video-container {
        width: 250px !important;
        max-width: 250px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-item {
        flex: 0 0 250px !important;
        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;
    }

    .temoignages-videos-list.has-carousel .temoignage-video-container {
        width: 250px !important;
        max-width: 250px !important;
    }

    .temoignage-play-button {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }

    .temoignage-play-button::before {
        font-size: 15px;
    }
}

/* ====================================
   📱 MOBILE 968px - SNAP + ZOOM OPTIMISÉ
   ==================================== */
@media (max-width: 968px) {
    .temoignages-section {
        padding: var(--space-sm) 0;
        overflow: hidden;
    }

    .temoignages-wrapper {
        grid-template-columns: 1fr;
        gap: 0;
        display: flex;
        flex-direction: column;
    }

    /* Titre en haut */
    .temoignages-title-content {
        order: 1;
        padding: 0;
        height: auto;
        position: relative;
        top: auto;
        margin-bottom: var(--space-sm);
    }

    .temoignages-title-h2 {
        text-align: center;
        padding: 0 var(--container-padding);
    }

    /* CARROUSEL AVEC SNAP SCROLL ET ZOOM */
    .temoignages-videos-content {
        order: 2;
        overflow: visible;
        gap: 0;
    }

    /* Container du carrousel */
    .temoignages-videos-list {
        margin-top: 25px;
        margin-bottom: 0;
        overflow: hidden;
        position: relative;
        padding: 0;
        display: block;
    }

    /* Wrapper FULL WIDTH */
    .temoignages-carousel-wrapper {
        width: 100vw;
        margin-left: 0;
        position: relative;
        overflow: visible;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .temoignages-carousel-wrapper::-webkit-scrollbar {
        display: none;
    }

    /* Carrousel - SNAP SCROLL */
    .temoignages-carousel {
        display: flex;
        gap: 10px;
        padding: 0;
        padding-left: calc((100vw - 280px) / 2);
        padding-right: calc((100vw - 280px) / 2);
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
        -ms-overflow-style: none;
        cursor: grab;
        scroll-behavior: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-padding-left: calc((100vw - 280px) / 2);
        scroll-padding-right: calc((100vw - 280px) / 2);
    }

    .temoignages-carousel::-webkit-scrollbar {
        display: none;
    }

    .temoignages-carousel.dragging {
        cursor: grabbing;
        scroll-behavior: auto;
    }

    /* Items video - ÉTAT PAR DÉFAUT (scale 0.85) */
    .temoignage-video-item {
        min-width: 280px !important;
        width: 280px !important;
        flex-shrink: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: flex !important;
        flex-direction: column;
        margin: 0 !important;
        scroll-snap-align: center !important;
        scroll-snap-stop: always !important;
        transform-origin: center center !important;

        /* ÉTAT PAR DÉFAUT : PETIT */
        transform: scale(0.85) !important;
        -webkit-transform: scale(0.85) !important;
        opacity: 0.7 !important;

        /* TRANSITION SIMPLE ET PERFORMANTE */
        transition: transform 0.3s ease-out, opacity 0.3s ease-out !important;

        /* GPU optimisation */
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
    }

    /* Carte CENTRALE - scale(1) */
    .temoignage-video-item.center-active {
        transform: scale(1) !important;
        -webkit-transform: scale(1) !important;
        opacity: 1 !important;
        z-index: 10 !important;
    }

    .temoignage-video-container {
        aspect-ratio: 9/11;
    }

    .temoignage-play-button {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
    }

    .temoignage-play-button::before {
        font-size: 18px;
    }

    /* MOBILE - Masquer définitivement le bouton play quand vidéo lancée */
    .temoignage-play-button.playing {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        display: none !important;
    }

    /* Empêcher le hover de réafficher le bouton sur mobile */
    .temoignage-video-item:hover .temoignage-play-button.playing,
    .temoignage-video-item:active .temoignage-play-button.playing,
    .temoignage-video-item:focus .temoignage-play-button.playing {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        display: none !important;
    }
}

/* 768px - Mobile large */
@media (max-width: 768px) {
    .temoignages-section {
        padding: var(--space-lg) 0;
    }

    .temoignage-video-item {
        min-width: 250px !important;
        width: 250px !important;
    }

    .temoignages-carousel {
        gap: 10px;
        padding-left: calc((100vw - 250px) / 2);
        padding-right: calc((100vw - 250px) / 2);
        scroll-padding-left: calc((100vw - 250px) / 2);
        scroll-padding-right: calc((100vw - 250px) / 2);
    }

    .temoignage-video-container {
        aspect-ratio: 3/5;
    }

    .temoignage-play-button {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }

    .temoignage-play-button::before {
        font-size: 16px;
    }
}

/* 480px - Petit mobile */
@media (max-width: 480px) {
    .temoignages-title-h2 {
        font-size: var(--h2-size);
        line-height: 30px;
    }

    .temoignage-video-item {
        min-width: 280px !important;
        width: 280px !important;
    }

    .temoignages-carousel {
        gap: 10px;
        padding-left: calc((100vw - 280px) / 2);
        padding-right: calc((100vw - 280px) / 2);
        scroll-padding-left: calc((100vw - 280px) / 2);
        scroll-padding-right: calc((100vw - 280px) / 2);
    }

    .temoignage-video-title {
        font-size: var(--h4-size);
        line-height: 1.3;
    }

    .temoignage-video-description {
        font-size: var(--mini-size);
        line-height: 1.4;
    }

    .temoignage-play-button {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }

    .temoignage-play-button::before {
        font-size: 15px;
    }
}

/* ====================================
   OPTIMISATION PERFORMANCE
   ==================================== */
.temoignages-title-h2 {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.temoignages-section {
    contain: layout style;
}

.temoignage-video-container iframe,
.temoignage-video-container video,
.temoignage-video-container img {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ====================================
   FALLBACK SANS GSAP
   ==================================== */
.temoignages-section:not(.gsap-ready) .temoignages-title-h2,
.temoignages-section:not(.gsap-ready) .temoignage-video-item {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

@media (max-width: 968px) {
    .temoignages-section:not(.gsap-ready) .temoignage-video-item {
        transform: scale(0.85) !important;
        opacity: 0.7 !important;
    }

    .temoignages-section:not(.gsap-ready) .temoignage-video-item.center-active {
        transform: scale(1) !important;
        opacity: 1 !important;
    }
}

.temoignages-section.animation-complete .temoignages-title-h2,
.temoignages-section.animation-complete .temoignage-video-item {
    opacity: 1 !important;
    visibility: visible !important;
}