/* Bodic TV (pages/tv.php, pages/tv-single.php) — charte « Bodic v2 ».
   Tout est sous .hv2-tv (classe du <main>) ; les composants communs viennent de charte.css. */

.hv2-tv .tv-moment { background: var(--hv2-sand); }
.hv2-tv .tv-moment-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.hv2-tv .tv-moment-tete .hv2-h2,
.hv2-tv .hv2-news-tools .hv2-h2 { margin: 0; }

/* ---------- Carrousel « Les vidéos du moment » ----------
   Défilement horizontal à cran, natif : doigt, molette, clavier. Boutons : public/js/tv.js. */
.hv2-tv .tv-carousel {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 4px 4px 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 4px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.hv2-tv .tv-carousel:focus-visible { outline: 3px solid var(--hv2-ink); outline-offset: 4px; border-radius: 16px; }
.hv2-tv .tv-carousel-item { flex: 0 0 calc((100% - 24px) / 2); min-width: 0; scroll-snap-align: start; }
.hv2-tv .tv-carousel-controls { display: flex; gap: 12px; }
.hv2-tv .tv-carousel-controls[hidden] { display: none; }
.hv2-tv .tv-carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--hv2-ink);
  border-radius: 50%;
  background: var(--hv2-white);
  color: var(--hv2-ink);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.hv2-tv .tv-carousel-btn:hover:not(:disabled) { background: var(--hv2-ink); color: var(--hv2-white); }
.hv2-tv .tv-carousel-btn:disabled { opacity: .35; cursor: default; }

/* ---------- Cartes ---------- */
.hv2-tv .tv-grille {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hv2-tv .tv-card { padding: 0; gap: 0; overflow: hidden; height: 100%; color: var(--hv2-ink); }
.hv2-tv .tv-card-media { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--hv2-ink); overflow: hidden; }
.hv2-tv .tv-card-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hv2-tv .tv-card-apercu {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 500% 100%;
  background-position: 0 0;
  opacity: 0;
}
.hv2-tv .tv-card-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--hv2-yellow);
  color: var(--hv2-ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  transition: opacity .2s ease;
}
.hv2-tv .tv-card-play svg { margin-left: 2px; }
.hv2-tv .tv-card-duree {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(14, 27, 61, .9);
  color: var(--hv2-white);
  font-family: var(--hv2-mono);
  font-size: 12px;
  line-height: 1.5;
}
.hv2-tv .tv-card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.hv2-tv .tv-card-date { font-size: 13px; color: var(--hv2-muted); }
.hv2-tv .tv-card-title { font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: break-word; }
.hv2-tv .tv-card-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--hv2-muted-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hv2-tv .tv-card-more { margin-top: auto; padding-top: 4px; font-size: 14px; font-weight: 600; color: var(--hv2-ink); }
.hv2-tv a.tv-card:hover .tv-card-more { text-decoration: underline; text-decoration-color: var(--hv2-yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.hv2-tv a.tv-card:focus-visible { outline: 3px solid var(--hv2-ink); outline-offset: 3px; }

/* Vidéos du moment : cartes plus grandes */
.hv2-tv .tv-card--grand .tv-card-play { width: 64px; height: 64px; }
.hv2-tv .tv-card--grand .tv-card-play svg { width: 30px; height: 30px; }
.hv2-tv .tv-card--grand .tv-card-body { padding: 22px 24px 24px; gap: 10px; }
.hv2-tv .tv-card--grand .tv-card-title { font-size: 21px; }
.hv2-tv .tv-card--grand .tv-card-text { font-size: 15px; -webkit-line-clamp: 3; }

/* Aperçu au survol et au focus : les 5 images de la planche défilent à la place de la vignette.
   Seulement avec une souris, et si le visiteur n'a pas demandé moins d'animations. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hv2-tv a.tv-card:hover .tv-card-apercu,
  .hv2-tv a.tv-card:focus-visible .tv-card-apercu {
    background-image: var(--tv-planche);
    opacity: 1;
    animation: tv-apercu 4s step-end infinite;
  }
  .hv2-tv a.tv-card:hover .tv-card-apercu ~ .tv-card-play,
  .hv2-tv a.tv-card:focus-visible .tv-card-apercu ~ .tv-card-play { opacity: 0; }
}
@keyframes tv-apercu {
  0% { background-position: 0 0; }
  20% { background-position: 25% 0; }
  40% { background-position: 50% 0; }
  60% { background-position: 75% 0; }
  80%, 100% { background-position: 100% 0; }
}

.hv2-tv .tv-resultats { margin: 0; font-size: 16px; color: var(--hv2-muted-2); }
.hv2-tv .tv-resultats a { margin-left: 12px; font-weight: 600; color: var(--hv2-ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Page d'une vidéo : vidéo à gauche, texte à droite ---------- */
.hv2-tv .tv-fiche { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; align-items: start; }
.hv2-tv .tv-fiche--verticale { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); }
.hv2-tv .tv-lecteur-cadre {
  position: relative;
  aspect-ratio: var(--tv-ratio, 16 / 9);
  /* Jamais plus haut que 80 % de l'écran : la largeur se réduit, le format est conservé. */
  width: min(100%, calc(80vh * var(--tv-r, 1.7778)));
  margin: 0 auto;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}
.hv2-tv .tv-lecteur-cadre > video { display: block; width: 100%; height: 100%; background: #000; }
.hv2-tv .tv-lecteur-cadre > video[hidden] { display: none; }

.hv2-tv .tv-lecteur-affiche { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.hv2-tv .tv-lecteur-affiche[hidden] { display: none; }
.hv2-tv .tv-lecteur-affiche img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hv2-tv .tv-lecteur-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--hv2-yellow);
  color: var(--hv2-ink);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
  transition: transform .2s ease;
}
.hv2-tv .tv-lecteur-play svg { margin-left: 4px; }
.hv2-tv .tv-lecteur-affiche:hover .tv-lecteur-play { transform: translate(-50%, -50%) scale(1.06); }
.hv2-tv .tv-lecteur-affiche:focus-visible { outline: 3px solid var(--hv2-yellow); outline-offset: -6px; }

/* Encart Bodic avant la vidéo */
.hv2-tv .tv-encart { position: absolute; inset: 0; background: #000; }
.hv2-tv .tv-encart[hidden] { display: none; }
.hv2-tv .tv-encart-video { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.hv2-tv .tv-encart-video[hidden] { display: none; }
.hv2-tv .tv-encart-bandeau { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.hv2-tv .tv-encart-etiquette,
.hv2-tv .tv-encart-decompte { padding: 4px 12px; border-radius: 999px; font-size: 13px; line-height: 1.4; }
.hv2-tv .tv-encart-etiquette { background: var(--hv2-yellow); color: var(--hv2-ink); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hv2-tv .tv-encart-decompte { background: rgba(14, 27, 61, .9); color: var(--hv2-white); font-variant-numeric: tabular-nums; }
.hv2-tv .tv-encart-lancer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--hv2-yellow);
  color: var(--hv2-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.hv2-tv .tv-encart-lancer[hidden] { display: none; }
.hv2-tv .tv-encart-lancer:focus-visible { outline: 3px solid var(--hv2-white); outline-offset: 3px; }

/* Panneau de fin : vidéo complète, autres vidéos, revoir */
.hv2-tv .tv-fin {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  background: rgba(14, 27, 61, .94);
  color: var(--hv2-white);
  overflow-y: auto;
}
.hv2-tv .tv-fin[hidden] { display: none; }
.hv2-tv .tv-fin-lien { background: var(--hv2-yellow); color: var(--hv2-ink); font-weight: 700; text-align: center; }
.hv2-tv .tv-fin-lien:hover { background: #FFD45C; color: var(--hv2-ink); }
.hv2-tv .tv-fin-titre { margin: 4px 0 0; font-family: var(--hv2-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--hv2-on-dark); }
.hv2-tv .tv-fin-liste { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 620px; margin: 0; padding: 0; list-style: none; }
.hv2-tv .tv-card--mini { border-color: transparent; border-radius: 10px; }
.hv2-tv .tv-card--mini .tv-card-body { padding: 8px 10px 10px; }
.hv2-tv .tv-card--mini .tv-card-title { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hv2-tv .tv-card--mini .tv-card-play { width: 32px; height: 32px; }
.hv2-tv .tv-card--mini .tv-card-play svg { width: 16px; height: 16px; }
.hv2-tv .tv-card--mini .tv-card-duree { display: none; }
.hv2-tv .tv-fin-revoir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 20px;
  border: 1.5px solid var(--hv2-white);
  border-radius: 999px;
  background: transparent;
  color: var(--hv2-white);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.hv2-tv .tv-fin-revoir:hover { background: var(--hv2-white); color: var(--hv2-ink); }
.hv2-tv .tv-fin a:focus-visible,
.hv2-tv .tv-fin button:focus-visible { outline: 3px solid var(--hv2-yellow); outline-offset: 3px; }
/* Cadre vertical : pas la place pour trois cartes côte à côte */
.hv2-tv .tv-fiche--verticale .tv-fin-liste { grid-template-columns: minmax(0, 1fr); max-width: 220px; }
.hv2-tv .tv-fiche--verticale .tv-fin-liste li:nth-child(n+2) { display: none; }

.hv2-tv .tv-brouillon { margin: 0; padding: 12px 18px; border-left: 4px solid var(--hv2-yellow); border-radius: 8px; background: var(--hv2-yellow-soft); color: var(--hv2-ink); font-weight: 600; }

.hv2-tv .tv-lecteur-msg { margin-top: 12px; font-size: 15px; color: var(--hv2-muted-2); text-align: center; }
.hv2-tv .tv-lecteur-msg:empty { display: none; }

.hv2-tv .tv-texte { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.hv2-tv .tv-description { font-size: 18px; line-height: 1.7; color: var(--hv2-text); overflow-wrap: break-word; }
.hv2-tv .tv-lien, .hv2-tv .tv-retour { margin: 0; }
.hv2-tv .tv-lien .hv2-btn,
.hv2-tv .tv-fin-lien { gap: 8px; text-align: center; }
.hv2-tv .tv-retour a { font-weight: 600; color: var(--hv2-ink); text-decoration: underline; text-decoration-color: var(--hv2-yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hv2-tv .tv-grille { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hv2-tv .tv-fiche { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hv2-tv .tv-fiche--verticale { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .hv2-tv .tv-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .hv2-tv .tv-carousel-item { flex-basis: 86%; }
  .hv2-tv .tv-fiche--verticale { grid-template-columns: minmax(0, 1fr); }
  .hv2-tv .tv-fiche--verticale .tv-lecteur-cadre { width: min(340px, 100%, calc(70vh * var(--tv-r, .5625))); }
  .hv2-tv .tv-description { font-size: 17px; }
  .hv2-tv .tv-fin-liste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hv2-tv .tv-fin-liste li:nth-child(n+3) { display: none; }
}
@media (max-width: 480px) {
  .hv2-tv .tv-grille { grid-template-columns: minmax(0, 1fr); }
  .hv2-tv .tv-encart-bandeau { left: 6px; right: 6px; bottom: 6px; gap: 4px; }
  .hv2-tv .tv-encart-etiquette,
  .hv2-tv .tv-encart-decompte { font-size: 11px; padding: 2px 8px; }
  .hv2-tv .tv-fin { gap: 10px; padding: 12px; }
  .hv2-tv .tv-fin-titre, .hv2-tv .tv-fin-liste { display: none; }
  .hv2-tv .tv-lecteur-play { width: 64px; height: 64px; }
}
