/* =====================================================================
   PETITES VIDÉOS (format Instagram, sans le son) : JS/videos.js
   Utilisé par : galerie.html, maquillages.html, tatouageTemporaire.html, bellyPainting.html
   1. le bloc « Marie en action » des pages prestations,
   2. les cartes vidéo (verticales 9:16, bouton lecture, icône « sans son », titre),
   3. la rangée qui défile quand il y a plus de 2 vidéos.
   ===================================================================== */

/* Bloc caché tant qu'il n'y a pas de vidéo (attribut hidden) */
[data-videos][hidden],
[data-videos-lien][hidden] {
  display: none !important;
}

/* ----- 1. Bloc « Marie en action » (pages prestations) ----- */
.vi-action {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 34px;
  align-items: center;
}

.vi-action .vi-texte {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.vi-action .vi-texte p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.65;
}

@media (max-width: 767.98px) {
  .vi-action {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* ----- 2. Les vidéos ----- */
.vi-liste {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* dans la galerie : 4 par ligne sur ordinateur */
.vi-galerie .vi-liste {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

/* la 2e vidéo un peu plus bas (effet « décalé » de la maquette), seulement à côté du texte */
.vi-action .vi-liste:not(.vi-defile) .vi-carte:nth-child(2) {
  margin-top: 46px;
}

.vi-carte {
  position: relative;
  margin: 0;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #140a26;
  border: 2px solid #1e1b2e;
  box-shadow: 5px 4px 1px 0 rgba(83, 10, 96, 0.45);
  cursor: pointer;
}

.vi-carte video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Le rond blanc ▶ au milieu (disparaît pendant la lecture) */
.vi-bouton {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #5a0a96;
  font-size: 2rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.vi-joue .vi-bouton {
  opacity: 0;
}

/* au clavier, on voit quand même le bouton (pour mettre en pause) */
.vi-bouton:focus-visible {
  opacity: 1;
  outline: 3px solid #35b8f5;
  outline-offset: 3px;
}

/* La petite icône « sans son » en haut à droite */
.vi-muet {
  position: absolute;
  right: 10px;
  top: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 3px 9px;
  pointer-events: none;
}

/* Le titre en bas, sur un léger dégradé sombre */
.vi-carte figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  pointer-events: none;
}

/* ----- 3. Plus de 2 vidéos (ou sur téléphone) : une rangée qu'on fait glisser ----- */
.vi-defile {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.vi-defile .vi-carte {
  flex: none;
  width: 220px;
  scroll-snap-align: start;
}

@media (max-width: 575.98px) {
  .vi-liste,
  .vi-galerie .vi-liste {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .vi-liste .vi-carte {
    flex: none;
    width: 68%;
    max-width: 260px;
    scroll-snap-align: start;
  }

  .vi-action .vi-liste:not(.vi-defile) .vi-carte:nth-child(2) {
    margin-top: 0;
  }
}
