/* ============================================================
   UBKOUTV — FEUILLE DE STYLE DE LA WEBTV
   Fichier : css/webtv.css
   ------------------------------------------------------------
   Remplace le CDN Tailwind (≈ 300 Ko de JS qui génère le CSS dans
   le navigateur à chaque visite) par une feuille fixe, mise en cache.

   Direction : sobre. Neutres (blanc, gris), un seul accent orange
   réservé à l'action (lecture, élément actif) et le rouge réservé
   au direct. Les images et les vidéos portent la couleur.
   Animations : transform/opacity uniquement, coupées sous
   prefers-reduced-motion.
   ============================================================ */

:root {
  --tv-bg: #F7F7F8;
  --tv-surface: #FFFFFF;
  --tv-text: #111827;
  --tv-muted: #4B5563;      /* 7,5:1 sur blanc */
  --tv-subtle: #6B7280;     /* 4,8:1 sur blanc */
  --tv-border: #E5E7EB;
  --tv-hover: #F3F4F6;
  --tv-accent: #F7941E;     /* décor (bouton lecture, filets) */
  --tv-accent-text: #B45309;/* texte orange, 5:1 */
  --tv-live: #DC2626;
  --tv-on-accent: #1A0F00;
  --tv-radius: 12px;
  --tv-ombre: 0 1px 2px rgba(17, 24, 39, 0.06), 0 8px 24px -12px rgba(17, 24, 39, 0.18);
  --tv-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tv-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --tv-dur: 250ms;
  --tv-entete: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tv-bg: #0E1116;
    --tv-surface: #161B22;
    --tv-text: #E6EAF0;
    --tv-muted: #B3BCC8;
    --tv-subtle: #8E99A8;
    --tv-border: #262D37;
    --tv-hover: #1D232C;
    --tv-accent-text: #FDBA74;
    --tv-ombre: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tv-bg);
  color: var(--tv-text);
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--tv-accent-text); outline-offset: 2px; border-radius: 6px; }
.tv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tv-saut {
  position: absolute; left: 1rem; top: 0.5rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: 8px;
  background: var(--tv-text); color: var(--tv-surface); font-weight: 700;
  transform: translateY(-160%); transition: transform var(--tv-dur) var(--tv-ease);
}
.tv-saut:focus { transform: none; }
.tv-conteneur { width: 100%; max-width: 1280px; margin: 0 auto; padding-inline: clamp(1rem, 4vw, 2rem); }

/* Transitions entre pages (navigateurs récents) : fondu, en-tête immobile. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 150ms ease both tv-sortie; }
  ::view-transition-new(root) { animation: 320ms var(--tv-ease) both tv-entree; }
}
@keyframes tv-sortie { to { opacity: 0; } }
@keyframes tv-entree { from { opacity: 0; transform: translateY(10px); } }
@keyframes tv-monte  { from { opacity: 0; transform: translateY(16px); } }
@keyframes tv-recule { from { transform: scale(1.1); } }
@keyframes tv-pouls  { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes tv-glisse { from { opacity: 0; transform: translateX(-12px); } }

/* ---------- En-tête ---------- */
.tv-entete {
  position: sticky; top: 0; z-index: 40;
  view-transition-name: tv-entete;
  background: color-mix(in srgb, var(--tv-surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
          backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--tv-border);
}
.tv-entete__barre { display: flex; align-items: center; gap: 0.5rem; height: var(--tv-entete); }
.tv-logo { display: inline-flex; align-items: center; gap: 0.6rem; margin-right: auto; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.tv-logo img { width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--tv-border); transition: transform 500ms var(--tv-spring); }
.tv-logo:hover img { transform: rotate(-12deg) scale(1.06); }
.tv-logo__tv { color: var(--tv-accent-text); }
.tv-nav { display: flex; align-items: center; gap: 0.25rem; }
.tv-nav__lien,
.tv-bouton-icone {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 44px; min-width: 44px; padding: 0 0.85rem;
  border: 0; border-radius: 999px; background: transparent;
  font-size: 0.9rem; font-weight: 700; color: var(--tv-muted);
  cursor: pointer;
  transition: background-color var(--tv-dur) var(--tv-ease), color var(--tv-dur) var(--tv-ease);
}
.tv-bouton-icone { padding: 0; font-size: 1.1rem; }
.tv-nav__lien:hover, .tv-bouton-icone:hover { background: var(--tv-hover); color: var(--tv-text); }
.tv-nav__lien[aria-current="page"] { color: var(--tv-text); }
.tv-nav__lien[aria-current="page"]::after {
  content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 6px; height: 2px; border-radius: 2px;
  background: var(--tv-accent);
  animation: tv-trait 400ms var(--tv-ease) both; transform-origin: 0 50%;
}
@keyframes tv-trait { from { transform: scaleX(0); } }
.tv-nav__site { display: none; }
@media (min-width: 768px) { .tv-nav__site { display: inline-flex; } }

/* Point « en direct » : un anneau qui s'étend (transform), pas un clignotement. */
.tv-point {
  position: relative; width: 8px; height: 8px; border-radius: 50%;
  background: var(--tv-subtle); flex-shrink: 0;
}
.tv-point.est-en-direct { background: var(--tv-live); }
.tv-point.est-en-direct::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: tv-pouls 1.6s ease-out infinite;
}

/* Recherche : panneau qui glisse sous l'en-tête. */
.tv-recherche {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--tv-dur) var(--tv-ease);
}
.tv-recherche.est-ouverte { grid-template-rows: 1fr; }
.tv-recherche > div { overflow: hidden; }
.tv-recherche form { display: flex; gap: 0.5rem; max-width: 640px; margin: 0 auto; padding: 0.25rem 0 0.9rem; }
.tv-champ {
  flex: 1; min-height: 44px; padding: 0 1.1rem;
  border: 1px solid var(--tv-border); border-radius: 999px;
  background: var(--tv-surface); color: var(--tv-text);
  transition: border-color var(--tv-dur) var(--tv-ease), box-shadow var(--tv-dur) var(--tv-ease);
}
.tv-champ::placeholder { color: var(--tv-subtle); }
.tv-champ:focus { outline: none; border-color: var(--tv-accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tv-accent) 25%, transparent); }

/* Rubriques : pastilles défilantes, visibles sur tous les écrans. */
.tv-rubriques { border-top: 1px solid var(--tv-border); }
.tv-rubriques ul {
  display: flex; gap: 0.5rem; margin: 0; padding: 0.6rem 0; list-style: none;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.tv-rubriques ul::-webkit-scrollbar { display: none; }
.tv-rubriques li { scroll-snap-align: start; flex-shrink: 0; }
.tv-pastille {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 36px; padding: 0 0.95rem;
  border: 1px solid var(--tv-border); border-radius: 999px;
  background: var(--tv-surface); color: var(--tv-muted);
  font-size: 0.85rem; font-weight: 700; white-space: nowrap;
  transition: background-color var(--tv-dur) var(--tv-ease), color var(--tv-dur) var(--tv-ease), transform var(--tv-dur) var(--tv-spring);
}
.tv-pastille:hover { color: var(--tv-text); transform: translateY(-1px); }
.tv-pastille[aria-current="page"] { background: var(--tv-text); border-color: var(--tv-text); color: var(--tv-surface); }

/* ---------- Bannière et présentation de la chaîne ---------- */
.tv-banniere { position: relative; height: clamp(110px, 18vw, 220px); overflow: hidden; background: #1F2937; }
.tv-banniere img { width: 100%; height: 100%; object-fit: cover; animation: tv-recule 2s var(--tv-ease) both; }
.tv-banniere::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.35)); }
.tv-chaine { display: flex; align-items: flex-start; gap: 1.25rem; padding-block: 0 1.5rem; border-bottom: 1px solid var(--tv-border); }
.tv-chaine__logo {
  width: 88px; height: 88px; margin-top: -36px; flex-shrink: 0;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 4px var(--tv-bg), var(--tv-ombre);
  position: relative; z-index: 1;
  animation: tv-monte 600ms var(--tv-ease) 150ms both;
}
.tv-chaine__nom { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.tv-chaine__desc { margin-top: 0.25rem; max-width: 62ch; color: var(--tv-muted); font-size: 0.95rem; }
.tv-chaine__stats { margin-top: 0.35rem; color: var(--tv-subtle); font-size: 0.85rem; }
.tv-chaine > div { padding-top: 0.9rem; animation: tv-monte 600ms var(--tv-ease) 220ms both; }

/* ---------- Sections et grille de vidéos ---------- */
.tv-page { padding-block: clamp(1.5rem, 4vw, 2.5rem) 4rem; }
.tv-section { margin-bottom: clamp(2rem, 5vw, 3rem); }
.tv-section__titre {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem;
  font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em;
}
.tv-section__titre .bi { color: var(--tv-subtle); }
.tv-info { margin-bottom: 1.25rem; color: var(--tv-muted); font-size: 0.95rem; }
.tv-grille {
  display: grid; gap: clamp(1rem, 2.5vw, 1.5rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

/* Carte vidéo : la vignette s'agrandit légèrement, le bouton lecture
   apparaît, une fine barre se trace sous l'image. */
.tv-carte { display: flex; flex-direction: column; gap: 0.6rem; border-radius: var(--tv-radius); }
.tv-vignette {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  border-radius: var(--tv-radius); background: var(--tv-hover);
  transition: transform var(--tv-dur) var(--tv-ease), box-shadow var(--tv-dur) var(--tv-ease);
}
.tv-vignette img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--tv-ease); }
.tv-vignette__vide { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--tv-subtle); font-size: 2rem; }
.tv-vignette::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--tv-accent); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 500ms var(--tv-ease);
}
.tv-lecture {
  position: absolute; left: 50%; top: 50%;
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: var(--tv-accent); color: var(--tv-on-accent);
  font-size: 1.5rem; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0; transform: scale(0.7);
  transition: opacity var(--tv-dur) var(--tv-ease), transform var(--tv-dur) var(--tv-spring);
}
.tv-lecture .bi { margin-left: 3px; }
.tv-duree {
  position: absolute; right: 8px; bottom: 8px;
  padding: 0.1rem 0.45rem; border-radius: 6px;
  background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 0.75rem; font-weight: 700;
}
.tv-carte:hover .tv-vignette,
.tv-carte:focus-visible .tv-vignette { transform: translateY(-4px); box-shadow: var(--tv-ombre); }
.tv-carte:hover .tv-vignette img { transform: scale(1.06); }
.tv-carte:hover .tv-vignette::after,
.tv-carte:focus-visible .tv-vignette::after { transform: scaleX(1); }
.tv-carte:hover .tv-lecture,
.tv-carte:focus-visible .tv-lecture { opacity: 1; transform: scale(1); }
@media (hover: none) { .tv-lecture { opacity: 0.92; transform: scale(0.85); } }
.tv-carte__titre {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 0.95rem; font-weight: 700; line-height: 1.35;
}
.tv-carte__meta { color: var(--tv-subtle); font-size: 0.8rem; }

/* Apparition des cartes au défilement, pilotée par le navigateur
   (scroll-driven animations) : zéro JS ; ignorée ailleurs. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .tv-grille > .tv-carte {
      animation: tv-monte linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

/* « À la une » : grande carte horizontale. */
.tv-une {
  display: grid; gap: 0; overflow: hidden; margin-bottom: clamp(2rem, 5vw, 3rem);
  border: 1px solid var(--tv-border); border-radius: calc(var(--tv-radius) + 4px);
  background: var(--tv-surface); box-shadow: var(--tv-ombre);
  animation: tv-monte 600ms var(--tv-ease) 120ms both;
}
@media (min-width: 900px) { .tv-une { grid-template-columns: 1.25fr 1fr; } }
.tv-une .tv-vignette { border-radius: 0; }
.tv-une:hover .tv-vignette { transform: none; box-shadow: none; }
.tv-une:hover .tv-vignette img { transform: scale(1.04); }
.tv-une:hover .tv-lecture, .tv-une:focus-visible .tv-lecture { opacity: 1; transform: scale(1.08); }
.tv-une .tv-lecture { opacity: 1; transform: scale(1); width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 1.9rem; }
.tv-une:hover .tv-vignette::after { transform: scaleX(1); }
.tv-une__texte { display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; padding: clamp(1.25rem, 4vw, 2.25rem); }
.tv-etiquette { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tv-accent-text); }
.tv-une__titre { font-size: clamp(1.3rem, 2.6vw, 1.75rem); font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
.tv-une__desc { color: var(--tv-muted); font-size: 0.95rem; }
.tv-vide { padding: 4rem 1rem; text-align: center; color: var(--tv-subtle); }
.tv-vide .bi { display: block; margin-bottom: 0.75rem; font-size: 2.25rem; }

/* ---------- Page vidéo et direct ---------- */
.tv-ariane { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; font-size: 0.85rem; color: var(--tv-subtle); }
.tv-ariane a:hover { color: var(--tv-text); }
.tv-lecteur-grille { display: grid; gap: clamp(1.5rem, 4vw, 2.5rem); }
@media (min-width: 1024px) { .tv-lecteur-grille { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.tv-lecteur {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  border-radius: var(--tv-radius); background: #000; box-shadow: var(--tv-ombre);
  animation: tv-monte 500ms var(--tv-ease) both;
}
.tv-lecteur iframe, .tv-lecteur video { width: 100%; height: 100%; border: 0; }
.tv-lecteur__attente {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.6rem; padding: 1.5rem; text-align: center; color: rgba(255, 255, 255, 0.78);
}
.tv-lecteur__attente .bi { font-size: 2.5rem; }
.tv-lecteur__attente strong { color: #fff; font-size: 1.1rem; }
.tv-lecteur__fond { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.35; }
.tv-titre-video { margin: 1.25rem 0 0.6rem; font-size: clamp(1.3rem, 2.8vw, 1.75rem); font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
.tv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; color: var(--tv-subtle); font-size: 0.875rem; }
.tv-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.tv-badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.7rem;
  border: 1px solid var(--tv-border); border-radius: 999px;
  background: var(--tv-surface); color: var(--tv-muted); font-size: 0.78rem; font-weight: 700;
}
.tv-badge--direct { border-color: transparent; background: var(--tv-live); color: #fff; letter-spacing: 0.05em; text-transform: uppercase; }
.tv-badge--direct .tv-point { background: #fff; }
.tv-description { margin-top: 1rem; max-width: 70ch; color: var(--tv-muted); }
.tv-partage { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--tv-border); }
.tv-partage__label { margin-right: 0.25rem; color: var(--tv-subtle); font-size: 0.875rem; font-weight: 600; }
.tv-partage a {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1px solid var(--tv-border); border-radius: 50%; background: var(--tv-surface); color: var(--tv-muted);
  transition: transform var(--tv-dur) var(--tv-spring), color var(--tv-dur) var(--tv-ease);
}
.tv-partage a:hover { transform: translateY(-3px); color: var(--tv-text); }

/* Liste « À voir aussi ». */
.tv-suite__titre { margin-bottom: 1rem; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tv-subtle); }
.tv-suite { display: flex; flex-direction: column; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.tv-suite li { animation: tv-glisse 500ms var(--tv-ease) both; }
.tv-suite li:nth-child(2) { animation-delay: 60ms; }
.tv-suite li:nth-child(3) { animation-delay: 120ms; }
.tv-suite li:nth-child(n+4) { animation-delay: 180ms; }
.tv-suite .tv-carte { flex-direction: row; gap: 0.75rem; }
.tv-suite .tv-vignette { width: 148px; flex-shrink: 0; border-radius: 10px; }
.tv-suite .tv-lecture { width: 36px; height: 36px; margin: -18px 0 0 -18px; font-size: 1.1rem; }
.tv-suite .tv-duree { font-size: 0.7rem; }

/* Commentaires du direct. */
.tv-commentaires-bloc { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--tv-border); }
.tv-commentaires {
  display: flex; flex-direction: column; gap: 0.75rem;
  max-height: 24rem; overflow-y: auto; margin: 0 0 1rem; padding: 0 0.25rem 0 0; list-style: none;
  overscroll-behavior: contain;
}
.tv-commentaire { padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--tv-surface); border: 1px solid var(--tv-border); font-size: 0.9rem; }
.tv-commentaire.est-nouveau { animation: tv-glisse 400ms var(--tv-ease) both; }
.tv-commentaire__nom { font-weight: 800; }
.tv-commentaire__heure { margin-left: 0.4rem; color: var(--tv-subtle); font-size: 0.75rem; }
.tv-commentaire p { margin-top: 0.15rem; color: var(--tv-muted); overflow-wrap: anywhere; }
.tv-formulaire { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tv-formulaire .tv-champ { min-width: 0; }
.tv-formulaire .tv-champ--nom { flex: 0 1 180px; }
.tv-bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0 1.4rem; border: 0; border-radius: 999px;
  background: var(--tv-text); color: var(--tv-surface); font-weight: 800; cursor: pointer;
  transition: transform var(--tv-dur) var(--tv-spring), opacity var(--tv-dur) var(--tv-ease);
}
.tv-bouton:hover { transform: translateY(-2px); }
.tv-bouton:disabled { opacity: 0.6; cursor: progress; transform: none; }
.tv-erreur { margin-top: 0.5rem; color: var(--tv-live); font-size: 0.85rem; }
.tv-en-ligne { color: var(--tv-subtle); font-size: 0.875rem; }

/* Pied de page minimal. */
.tv-pied { padding-block: 2rem; border-top: 1px solid var(--tv-border); color: var(--tv-subtle); font-size: 0.85rem; }
.tv-pied a { text-decoration: underline; text-underline-offset: 3px; }
.tv-pied a:hover { color: var(--tv-text); }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .tv-point.est-en-direct::after { animation: none; }
}
