/* ============================================================
   VAIDEO — Page d'une vidéo (/video/{id})
   Le lecteur en haut, comme sur YouTube ; dessous le titre, la chaîne, le lien vers la
   plateforme et les commentaires de cette plateforme.
   ============================================================ */

/* La vidéo et ses informations sur les trois quarts, le panneau sur le quart restant,
   comme sur YouTube ; sur un écran plus étroit, le panneau passe sous la vidéo. */
.vd-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr); gap: 24px; align-items: start;
  width: 100%; max-width: 1760px; margin: 0 auto; padding: 20px 24px 64px; }
.vd-main { width: 100%; min-width: 0; }
/* Une vidéo portrait se regarde sur une colonne étroite, comme un Short. */
.vd-main--portrait .vd-info { max-width: 640px; margin-left: auto; margin-right: auto; }

.vd-player { position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--r-lg); overflow: hidden;
  background: #000; border: 1px solid var(--border); }
.vd-player--portrait { aspect-ratio: 9 / 16; width: min(100%, calc((100vh - 200px) * 9 / 16)); min-width: min(100%, 300px); margin: 0 auto; }
.vd-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.vd-cover { position: absolute; inset: 0; display: block; color: #fff; text-decoration: none; }
.vd-cover > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vd-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgb(0 0 0 / 0.55)); }
.vd-cover__cta { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center;
  gap: 10px; padding: 12px 20px; border-radius: var(--r-pill); background: rgb(0 0 0 / 0.72); backdrop-filter: blur(6px);
  font-weight: var(--fw-semibold); white-space: nowrap; transition: background var(--dur) var(--ease); }
.vd-cover:hover .vd-cover__cta, .vd-cover:focus-visible .vd-cover__cta { background: var(--primary); }

.vd-info { margin-top: 14px; }
.vd-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.vd-sources__label { font-size: var(--t-xs); color: var(--text-muted); margin-right: 4px; }
.vd-source { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: var(--t-sm);
  font-weight: var(--fw-semibold); text-decoration: none; }
.vd-source:hover, .vd-source:focus-visible { color: var(--text); border-color: var(--primary); outline: none; }
.vd-source.is-active { color: var(--text); border-color: var(--primary); background: var(--primary-tint); }

.vd-title { font-size: clamp(1.15rem, 2.4vw, 1.45rem); font-weight: var(--fw-bold); line-height: 1.3; overflow-wrap: anywhere; }
.vd-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; color: var(--text-muted); font-size: var(--t-sm); }

.vd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.vd-bar form { margin: 0; }
.vd-channel { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.vd-channel__avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.vd-channel__avatar--initials { display: grid; place-items: center; background: oklch(0.55 0.14 280); color: #fff; font-weight: var(--fw-bold); font-size: 0.85rem; }
.vd-channel__names { display: flex; flex-direction: column; min-width: 0; }
.vd-channel__name { font-weight: var(--fw-semibold); }
.vd-channel__followers { font-size: var(--t-xs); color: var(--text-muted); }
.vd-open { gap: 8px; }

.vd-desc { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--t-sm); }
.vd-desc summary { cursor: pointer; font-weight: var(--fw-semibold); }
.vd-desc p { margin: 10px 0 0; white-space: pre-line; overflow-wrap: anywhere; color: var(--text-muted); }

/* ── Commentaires de la plateforme ── */
.vd-comments { margin-top: 28px; }
.vd-comments__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.vd-comments__title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: var(--fw-bold); }
.vd-comments__count { font-size: var(--t-sm); font-weight: var(--fw-semibold); color: var(--text-muted); }
.vd-comments__loading, .vd-comments__empty { color: var(--text-muted); font-size: var(--t-sm); }
.vd-comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.vd-comment { display: flex; gap: 12px; min-width: 0; }
.vd-comment__avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.vd-comment__body { min-width: 0; flex: 1; }
.vd-comment__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: var(--t-xs); color: var(--text-muted); }
.vd-comment__author { font-weight: var(--fw-semibold); color: var(--text); text-decoration: none; }
a.vd-comment__author:hover { text-decoration: underline; }
.vd-comment__text { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; font-size: var(--t-sm); line-height: 1.5; }
.vd-comment__stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: var(--t-xs); color: var(--text-muted); }
.vd-comment__stats span { display: inline-flex; align-items: center; gap: 4px; }
.vd-comment__stats a { color: var(--primary); text-decoration: none; }
.vd-comments__more { display: inline-block; margin-top: 18px; color: var(--primary); font-weight: var(--fw-semibold); text-decoration: none; }

@media (max-width: 1100px) {
  .vd-layout { grid-template-columns: minmax(0, 1fr); }
  .vd-main--portrait { max-width: 640px; width: 100%; margin: 0 auto; }
}
@media (max-width: 640px) {
  .vd-layout { padding: 0 0 48px; gap: 8px; }
  .vd-side { padding: 0 16px; }
  .vd-player { border-radius: 0; border-left: 0; border-right: 0; }
  .vd-info { padding: 0 16px; }
  .vd-open { width: 100%; }
}

/* ── Panneau de droite ── */
.vd-side { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.vd-block { min-width: 0; }
/* Pas de playlist (ou pas encore chargée) : pas d'espace vide dans le panneau. */
[data-side-playlist]:empty { display: none; }
.vd-block__title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 1rem; font-weight: var(--fw-bold); }
.vd-block__subtitle { margin: 16px 0 8px; font-size: var(--t-xs); font-weight: var(--fw-semibold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; }

.vd-creator { padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.vd-creator__id { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none; }
.vd-creator__id:hover .vd-creator__name, .vd-creator__id:focus-visible .vd-creator__name { color: var(--primary); }
.vd-creator__avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.vd-creator__avatar--initials { display: grid; place-items: center; background: oklch(0.55 0.14 280); color: #fff; font-weight: var(--fw-bold); }
.vd-creator__names { display: flex; flex-direction: column; min-width: 0; }
.vd-creator__name { font-size: 1.05rem; font-weight: var(--fw-bold); }
.vd-creator__handle, .vd-creator__followers { font-size: var(--t-xs); color: var(--text-muted); }
.vd-creator__follow { margin-top: 12px; }
.vd-creator__follow form, .vd-creator__follow .btn { width: 100%; }
.vd-creator__follow form { margin: 0; }

.vd-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.vd-links__link { display: block; line-height: 0; border-radius: 6px; transition: transform var(--dur) var(--ease); }
.vd-links__link:hover, .vd-links__link:focus-visible { transform: scale(1.12); outline: none; box-shadow: 0 0 0 2px var(--primary); }

/* Vidéos en ligne : vignette à gauche, texte à droite. */
.vd-list { display: flex; flex-direction: column; gap: 10px; }
.vd-list--scroll { max-height: 420px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.vd-item { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px; padding: 4px; margin: -4px; border-radius: var(--r-md);
  color: var(--text); text-decoration: none; }
.vd-item:hover, .vd-item:focus-visible { background: var(--surface-2); outline: none; }
.vd-item.is-current { background: var(--primary-tint); }
.vd-item__thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-sm, 8px); overflow: hidden; background: var(--surface-2); }
.vd-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vd-item__seen { position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 4px; background: rgb(0 0 0 / 0.75);
  color: #fff; font-size: 0.68rem; font-weight: var(--fw-semibold); }
.vd-item__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vd-item__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--t-sm); font-weight: var(--fw-semibold); line-height: 1.3; overflow-wrap: anywhere; }
.vd-item__channel, .vd-item__meta { font-size: var(--t-xs); color: var(--text-muted); }
.vd-item__meta { display: flex; flex-wrap: wrap; gap: 4px; }

.vd-channels { display: flex; flex-direction: column; gap: 4px; }
.vd-chan { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px; margin: 0 -8px; border-radius: var(--r-md);
  color: var(--text); text-decoration: none; }
.vd-chan:hover, .vd-chan:focus-visible { background: var(--surface-2); outline: none; }
.vd-chan__avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.vd-chan__avatar--initials { display: grid; place-items: center; background: oklch(0.55 0.14 280); color: #fff; font-size: 0.75rem; font-weight: var(--fw-bold); }
.vd-chan__names { display: flex; flex-direction: column; min-width: 0; }
.vd-chan__name { font-size: var(--t-sm); font-weight: var(--fw-semibold); }
.vd-chan__followers { font-size: var(--t-xs); color: var(--text-muted); }

.vd-playlist__link { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.vd-playlist__link:hover, .vd-playlist__link:focus-visible { color: var(--primary); outline: none; }
.vd-playlist__count { margin: -8px 0 10px; font-size: var(--t-xs); color: var(--text-muted); }

/* Bas de la liste sans fin : même mécanique que le fil (feed.css). */
.vd-more { margin-top: 16px; }
.vd-side--infinite .vd-more:not(.is-failed) [data-side-next] { display: none; }
.vd-side--infinite .vd-more.is-loading .fd-more__spinner { display: block; }
