/* ============================================================
   MBEZORA — Témoignages : ruban défilant
   ------------------------------------------------------------
   Préfixe .tm-  •  chargé par index.php ($page_css)

   Remplace l'ancien bloc « TÉMOIGNAGES » de assets/css/main.css
   (les règles .hm-testi*). Vous pouvez supprimer ce bloc : plus
   aucune page ne s'en sert.

   Le défilement est entièrement en CSS : il fonctionne sans
   JavaScript, se met en pause au survol, et une case à cocher
   accessible au clavier permet de l'arrêter (exigence WCAG 2.2.2
   pour tout contenu qui bouge plus de cinq secondes).

   Plan :
     1. Section et fond en dégradé animé
     2. Titre
     3. Ruban et défilement cyclique
     4. Carte : liseré dégradé tournant
     5. Contenu de la carte
     6. Bouton pause
     7. Écrans étroits, impression, mouvement réduit
============================================================ */

/* ============================================================
   1. Section et fond
============================================================ */
.tm-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 104px 0 112px;
  background: linear-gradient(168deg, #050D22 0%, #0A1A42 48%, #06102C 100%);
  color: #fff;
}

/* Liseré lumineux en haut et en bas de la section */
.tm-section::before,
.tm-section::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,194,255,.55) 20%, rgba(124,58,237,.55) 80%, transparent);
  z-index: 2;
}
.tm-section::before { top: 0; }
.tm-section::after  { bottom: 0; }

/* Deux voiles de couleur qui se déplacent lentement : c'est ce qui
   donne au fond sa profondeur sans alourdir le rendu (aucune image). */
.tm-aurore {
  position: absolute;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  filter: blur(70px);
  opacity: .62;
}
.tm-aurore::before,
.tm-aurore::after {
  content: '';
  position: absolute;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 50%;
  will-change: transform;
}
.tm-aurore::before {
  top: 4%; left: 2%;
  background: radial-gradient(circle, rgba(0,102,255,.85), transparent 68%);
  animation: tm-flotte-a 19s ease-in-out infinite alternate;
}
.tm-aurore::after {
  bottom: 0; right: 4%;
  background: radial-gradient(circle, rgba(124,58,237,.78), transparent 68%);
  animation: tm-flotte-b 23s ease-in-out infinite alternate;
}

@keyframes tm-flotte-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(22%, 16%, 0) scale(1.18); }
}
@keyframes tm-flotte-b {
  from { transform: translate3d(0, 0, 0) scale(1.12); }
  to   { transform: translate3d(-20%, -14%, 0) scale(1); }
}

/* Fine trame de points, comme sur le hero */
.tm-section .container { position: relative; z-index: 2; }

/* ============================================================
   2. Titre
============================================================ */
.tm-tete { text-align: center; max-width: 680px; margin: 0 auto; }

.tm-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .38rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(0,194,255,.35);
  background: rgba(0,194,255,.10);
  color: #8FD8FF;
  font-size: .76rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
}
.tm-kicker::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent, #00C2FF);
  box-shadow: 0 0 0 4px rgba(0,194,255,.22);
}

.tm-tete h2 {
  margin: 1.1rem 0 .85rem;
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: clamp(1.9rem, 4vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  /* Dégradé appliqué au texte lui-même */
  background: linear-gradient(100deg, #FFFFFF 0%, #BFD9FF 42%, #7FE4FF 70%, #C4B5FD 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tm-tete p { color: rgba(214, 226, 255, .74); font-size: 1.02rem; }

/* ============================================================
   3. Ruban et défilement cyclique
============================================================ */
.tm-ruban {
  position: relative;
  margin-top: 3.2rem;
  /* Les cartes apparaissent et disparaissent en fondu sur les bords */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.tm-piste {
  display: flex;
  width: max-content;
  padding: 1.4rem 0;          /* laisse respirer l'ombre des cartes */
  animation: tm-defile var(--tm-duree, 60s) linear infinite;
  will-change: transform;
}

/* Le ruban contient deux fois la même suite de cartes.
   Chaque carte porte sa marge à droite : la largeur totale est donc
   exactement le double d'une moitié, et translateX(-50%) reboucle
   sans le moindre saut. (Avec « gap », il resterait un demi-écart.) */
@keyframes tm-defile {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* Pause au survol et lorsqu'un élément du ruban reçoit le focus */
.tm-ruban:hover .tm-piste,
.tm-ruban:focus-within .tm-piste { animation-play-state: paused; }

/* Moins de quatre témoignages : rien ne défile. Les cartes sont
   simplement centrées, sans fondu sur les bords ni bouton de pause.
   Un même témoignage n'est jamais affiché deux fois pour « remplir ». */
.tm-ruban--fixe {
  padding: 0 24px;                       /* .tm-ruban est hors du .container */
  -webkit-mask-image: none;
  mask-image: none;
}
.tm-ruban--fixe .tm-piste {
  animation: none;
  width: auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}
.tm-ruban--fixe .tm-carte { margin-right: 0; }

/* ============================================================
   4. Carte : liseré dégradé tournant
============================================================ */
.tm-carte {
  position: relative;
  flex: 0 0 auto;
  width: min(390px, 80vw);
  margin: 0 1.5rem 0 0;
  padding: 1.5px;               /* épaisseur du liseré */
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(0,194,255,0);
  transition: transform .45s cubic-bezier(.22,.61,.36,1), box-shadow .45s ease;
}
.tm-carte:hover { box-shadow: 0 0 44px -6px rgba(0,194,255,.35); }

/* Le dégradé conique tourne derrière la carte ; seul le liseré est
   visible, le contenu étant posé sur un fond opaque par-dessus. */
.tm-halo {
  position: absolute;
  top: 50%; left: 50%;
  width: 190%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: conic-gradient(
          from 0deg,
          rgba(0,194,255,.95) 0deg,
          rgba(124,58,237,.90) 110deg,
          rgba(0,102,255,.95) 210deg,
          rgba(0,194,255,.35) 300deg,
          rgba(0,194,255,.95) 360deg);
  animation: tm-tourne 11s linear infinite;
  opacity: .8;
}
@keyframes tm-tourne {
  to { transform: translate(-50%, -50%) rotate(1turn); }
}

.tm-corps {
  position: relative;
  height: 100%;
  display: flex; flex-direction: column;
  padding: 1.9rem 1.8rem 1.6rem;
  border-radius: 21px;
  background:
          linear-gradient(160deg, rgba(14,28,64,.96) 0%, rgba(8,18,44,.98) 100%);
  box-shadow: 0 24px 48px -28px rgba(0,0,0,.9);
  overflow: hidden;
}

/* Guillemet ouvrant en filigrane */
.tm-corps::before {
  content: '\201C';
  position: absolute; top: -.6rem; right: 1.2rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 6rem; line-height: 1;
  color: rgba(143, 216, 255, .13);
  pointer-events: none;
}

/* Reflet qui traverse la carte au survol */
.tm-corps::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.10) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .9s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
}
.tm-carte:hover { transform: translateY(-8px); }
.tm-carte:hover .tm-corps::after { transform: translateX(120%); }
.tm-carte:hover .tm-halo { opacity: 1; }

/* Première carte : accent plus marqué */
.tm-carte--phare .tm-corps {
  background: linear-gradient(158deg, rgba(0,71,204,.94) 0%, rgba(10,26,66,.98) 78%);
}
.tm-carte--phare .tm-halo { opacity: 1; }

/* ============================================================
   5. Contenu de la carte
============================================================ */
.tm-etoiles {
  display: flex; gap: .22rem;
  margin-bottom: 1rem;
  font-size: .86rem;
  color: #FFC94D;
}
.tm-etoiles .tm-vide { color: rgba(255,255,255,.22); }

.tm-texte {
  flex: 1;
  margin: 0 0 1.5rem;
  color: rgba(233, 240, 255, .92);
  font-size: .98rem;
  line-height: 1.78;
}
.tm-texte p { color: inherit; margin: 0; }

.tm-pied {
  display: flex; align-items: center; gap: .9rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255,255,255,.12);
}

/* Anneau dégradé autour de la photo */
.tm-avatar {
  position: relative;
  width: 52px; height: 52px; flex-shrink: 0;
  padding: 2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #00C2FF), var(--accent2, #7C3AED));
  display: grid; place-items: center;
}
.tm-avatar img,
.tm-avatar .tm-initiale {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.tm-avatar .tm-initiale {
  display: grid; place-items: center;
  background: #0A1A42;
  color: #fff;
  font-weight: 800; font-size: 1.05rem;
}

.tm-identite { min-width: 0; }
.tm-identite strong {
  display: block;
  color: #fff;
  font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm-identite small {
  display: block;
  color: rgba(208, 222, 255, .82);
  font-size: .82rem;
  line-height: 1.45;
}

/* ============================================================
   6. Bouton pause (sans JavaScript)
============================================================ */
.tm-pause-etat { position: absolute; opacity: 0; width: 1px; height: 1px; }

.tm-barre {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: .6rem .9rem;
  margin-top: 1.6rem;
  padding: 0 16px;              /* .tm-barre est hors du .container */
  text-align: center;
}

.tm-pause {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  /* Fond opaque : la lisibilité du libellé ne dépend pas de la
     position de l'aurore, qui se déplace derrière la section. */
  background: rgba(7, 16, 40, .78);
  color: #EAF1FF;
  font-size: .82rem; font-weight: 600;
  cursor: pointer;
  transition: background .25s, border-color .25s, color .25s;
  -webkit-user-select: none; user-select: none;
}
.tm-pause:hover { background: rgba(12, 28, 68, .92); border-color: rgba(0,194,255,.55); color: #fff; }
.tm-pause-etat:focus-visible ~ .tm-barre .tm-pause {
  outline: 2px solid var(--accent, #00C2FF);
  outline-offset: 3px;
}

/* Deux libellés : un seul est visible selon l'état de la case */
.tm-pause .tm-reprendre { display: none; }
.tm-pause-etat:checked ~ .tm-barre .tm-pause .tm-arreter   { display: none; }
.tm-pause-etat:checked ~ .tm-barre .tm-pause .tm-reprendre { display: inline; }

/* Arrêt de toutes les animations de la section */
.tm-pause-etat:checked ~ .tm-ruban .tm-piste,
.tm-pause-etat:checked ~ .tm-ruban .tm-halo { animation-play-state: paused; }

.tm-compteur { color: rgba(214, 226, 255, .80); font-size: .82rem; }

/* ============================================================
   7. Écrans étroits, impression, mouvement réduit
============================================================ */
@media (max-width: 768px) {
  .tm-section { padding: 74px 0 82px; }
  .tm-ruban {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  }
  .tm-carte { width: min(320px, 84vw); margin-right: 1rem; }
  .tm-barre { margin-top: 1.2rem; }
  .tm-corps { padding: 1.5rem 1.4rem 1.3rem; }
  .tm-texte { font-size: .93rem; }
}

/* Mouvement réduit : le ruban devient une grille immobile.
   Les copies servant au bouclage sont retirées pour éviter
   d'afficher deux fois le même témoignage. */
@media (prefers-reduced-motion: reduce) {
  .tm-piste {
    animation: none;
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
  }
  .tm-piste > [data-copie] { display: none; }
  .tm-carte { margin-right: 0; transition: none; }
  .tm-halo,
  .tm-aurore::before,
  .tm-aurore::after { animation: none; }
  .tm-ruban { -webkit-mask-image: none; mask-image: none; }
  .tm-barre { display: none; }
}

@media print {
  .tm-section { background: #fff; color: #000; padding: 20px 0; }
  .tm-aurore, .tm-halo, .tm-barre { display: none; }
  .tm-ruban { -webkit-mask-image: none; mask-image: none; }
  .tm-piste { animation: none; width: auto; flex-wrap: wrap; }
  .tm-piste > [data-copie] { display: none; }
  .tm-corps { background: #fff; border: 1px solid #ccc; box-shadow: none; }
  .tm-texte, .tm-identite strong { color: #000; }
  .tm-tete h2 { color: #000; -webkit-text-fill-color: #000; }
}