/* ============================================================
   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;
  }
}

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