/* ============================================================
   Lecteur vidéo maison (.vp) — réutilisable sur toutes les pages
   Script : js/components/video-player.js
   Sans JS : <video controls> natif, l'habillage est masqué.
   ============================================================ */
.vp {
  --vp-accent: #0066ff;
  --vp-progress: 0%;
  --vp-buffered: 0%;
  width: 100%;
  margin: 0;
}

.vp__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 20px;
  background: #0a0d14;
  box-shadow: 0 24px 60px -24px rgba(10, 13, 20, 0.35);
  isolation: isolate;
}

.vp__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0d14;
}

.vp__start,
.vp__bar {
  display: none;
}

/* ---------- Écran de départ (poster + bouton) ---------- */
.vp--enhanced .vp__start {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 clamp(16px, 4%, 36px);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.vp__start-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 8px;
  border-radius: 9999px;
  background: #ffffff;
  color: #0a0d14;
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 32px -8px rgba(10, 13, 20, 0.45);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.vp__start-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--vp-accent);
  color: #ffffff;
}

.vp__start-icon svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
}

.vp__start-time {
  color: #6b7280;
  font-weight: 500;
}

.vp__start:hover .vp__start-pill,
.vp__start:focus-visible .vp__start-pill {
  transform: scale(1.05);
}

.vp__start:focus-visible {
  outline: 3px solid var(--vp-accent);
  outline-offset: -3px;
  border-radius: 20px;
}

.vp--started .vp__start {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Barre de contrôle ---------- */
.vp--enhanced.vp--started .vp__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 40px 12px 10px;
  background: linear-gradient(180deg, rgba(10, 13, 20, 0) 0%, rgba(10, 13, 20, 0.7) 100%);
  color: #ffffff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.vp--idle .vp__bar {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.vp--idle .vp__frame {
  cursor: none;
}

.vp__btn {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.vp__btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.vp__btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

.vp__btn svg {
  width: 20px;
  height: 20px;
}

/* Icônes à deux états : les classes d'état du lecteur choisissent laquelle afficher */
.vp__icon-alt,
.vp--playing .vp__play .vp__icon-main,
.vp--muted .vp__mute .vp__icon-main,
.vp--fullscreen .vp__fs .vp__icon-main {
  display: none;
}

.vp--playing .vp__play .vp__icon-alt,
.vp--muted .vp__mute .vp__icon-alt,
.vp--fullscreen .vp__fs .vp__icon-alt {
  display: block;
}

.vp__time {
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}

/* Piste de lecture : input range stylé, remplissage via --vp-progress */
.vp__seek {
  flex: 1 1 auto;
  min-width: 0;
  height: 20px;
  margin: 0 4px;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.vp__seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 9999px;
  background: linear-gradient(90deg,
    var(--vp-accent) var(--vp-progress),
    rgba(255, 255, 255, 0.45) var(--vp-progress) var(--vp-buffered),
    rgba(255, 255, 255, 0.2) var(--vp-buffered));
}

.vp__seek::-moz-range-track {
  height: 4px;
  border-radius: 9999px;
  background: linear-gradient(90deg,
    var(--vp-accent) var(--vp-progress),
    rgba(255, 255, 255, 0.45) var(--vp-progress) var(--vp-buffered),
    rgba(255, 255, 255, 0.2) var(--vp-buffered));
}

.vp__seek::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  -webkit-appearance: none;
  transition: transform 0.2s ease;
}

.vp__seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
}

.vp__seek:hover::-webkit-slider-thumb { transform: scale(1.2); }
.vp__seek:hover::-moz-range-thumb { transform: scale(1.2); }

.vp__seek:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Plein écran : la vidéo occupe tout l'écran, sans arrondi */
.vp__frame:fullscreen {
  aspect-ratio: auto;
  border-radius: 0;
}

.vp__frame:fullscreen .vp__media {
  object-fit: contain;
}

@media (max-width: 767px) {
  .vp__frame,
  .vp__start:focus-visible {
    border-radius: 12px;
  }

  .vp__start-pill {
    gap: 10px;
    padding: 6px 16px 6px 6px;
    font-size: 14px;
  }

  .vp__start-icon {
    width: 34px;
    height: 34px;
  }

  .vp--enhanced.vp--started .vp__bar {
    gap: 2px;
    padding: 32px 6px 4px;
    font-size: 12px;
  }

  /* Petit écran : on garde lecture, piste, temps restant et plein écran */
  .vp__current,
  .vp__mute {
    display: none;
  }
}

/* ---------- Vitrine (.vp-showcase) : carte sombre, lecteur + playlist ---------- */
.vp-showcase {
  --vp-accent: #0066ff;
  display: grid;
  gap: 20px;
  padding: 12px;
  border-radius: 24px;
  background: #14173a;
  color: #ffffff;
  font-family: Inter, system-ui, sans-serif;
  box-shadow: 0 32px 80px -32px rgba(10, 13, 20, 0.55);
}

.vp-showcase .vp__frame {
  box-shadow: none;
}

/* Bouton de départ : grand rond blanc centré */
.vp-showcase .vp--enhanced .vp__start {
  align-items: center;
  padding: 0;
}

.vp-showcase .vp__start-pill {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.vp-showcase .vp__start-pill > span:not(.vp__start-icon) {
  display: none;
}

.vp-showcase .vp__start-icon {
  width: 72px;
  height: 72px;
  background: #ffffff;
  color: var(--vp-accent);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.08), 0 16px 48px -8px rgba(0, 102, 255, 0.6);
}

.vp-showcase .vp__start-icon svg {
  width: 26px;
  height: 26px;
  margin-left: 4px;
}

.vp-showcase__meta {
  padding: 16px 8px 8px;
}

.vp-showcase__tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 500;
}

.vp-showcase__title {
  margin: 12px 0 8px;
  color: #ffffff;
  font-size: clamp(1.375rem, 2.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.vp-showcase__desc {
  max-width: 60ch;
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  line-height: 1.6;
}

.vp-showcase__label {
  margin: 0 0 12px;
  padding: 0 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  font-weight: 500;
}

/* ---------- Playlist (.vp-list) ---------- */
.vp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vp-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.vp-list__item[aria-current="true"] {
  border-color: transparent;
  background: var(--vp-accent);
}

.vp-list__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 112px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: #0a0d14;
}

.vp-list__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Voile + triangle de lecture sur la miniature */
.vp-list__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5.14v13.72a1 1 0 0 0 1.52.85l11.1-6.86a1 1 0 0 0 0-1.7L9.52 4.29A1 1 0 0 0 8 5.14Z'/%3E%3C/svg%3E") center / 20px no-repeat,
    rgba(10, 13, 40, 0.45);
  transition: background-color 0.2s ease;
}

.vp-list__item[aria-current="true"] .vp-list__thumb::after {
  background-color: rgba(255, 255, 255, 0.18);
}

.vp-list__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.vp-list__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.vp-list__time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.vp-list__item[aria-current="true"] .vp-list__time {
  color: rgba(255, 255, 255, 0.8);
}

@media (hover: hover) {
  .vp-list__item:not([aria-current="true"]):hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
  }

  .vp-list__item:hover .vp-list__thumb img {
    transform: scale(1.06);
  }
}

.vp-list__item:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .vp-showcase .vp__start-icon {
    width: 56px;
    height: 56px;
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08), 0 12px 32px -8px rgba(0, 102, 255, 0.6);
  }

  .vp-showcase .vp__start-icon svg {
    width: 20px;
    height: 20px;
  }
}

@media (min-width: 768px) {
  .vp-showcase {
    padding: 20px;
    border-radius: 32px;
  }

  .vp-list__thumb {
    width: 128px;
  }
}

@media (min-width: 1024px) {
  .vp-showcase {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
    padding: 24px;
  }

  .vp-showcase__label {
    margin-top: 12px;
  }

  .vp-list__title {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vp__start,
  .vp__start-pill,
  .vp--enhanced.vp--started .vp__bar,
  .vp-list__item,
  .vp-list__thumb img,
  .vp-list__thumb::after {
    transition: none;
  }
}
