/* ==========================================================================
   Alpha Media — custom video player chrome
   Pairs with videoplayer.js. Inherits the site's purple/gold tokens.
   ========================================================================== */

.vp {
  --vp-accent: var(--accent, #f0b429);
  --vp-wave:   var(--wave, #c026d3);
  --vp-chrome: 46px;

  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-lg, 20px);
  overflow: hidden;
  direction: ltr;            /* scrub bars read L→R even on an RTL page */
  isolation: isolate;
  outline: none;
  box-shadow: var(--sh-lg), 0 0 70px rgba(168, 85, 247, .28);
  border: 1px solid rgba(192, 132, 252, .28);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.vp:focus-visible { box-shadow: 0 0 0 3px var(--vp-accent), var(--sh-lg); }
.vp.is-full { border-radius: 0; border: 0; aspect-ratio: auto; height: 100%; }

.vp__video {
  width: 100%; height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

/* ---------- hide the cursor when the chrome auto-hides ---------- */
.vp.is-idle { cursor: none; }
.vp.is-idle .vp__chrome,
.vp.is-idle .vp__top { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* ==========================================================================
   Title bar
   ========================================================================== */
.vp__top {
  position: absolute;
  z-index: 4;
  inset-inline: 0;
  inset-block-start: 0;
  padding: 14px 18px 34px;
  background: linear-gradient(180deg, rgba(0,0,0,.72), transparent);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.vp.has-title:hover .vp__top,
.vp.has-title:not(.is-playing) .vp__top,
.vp.has-title:focus-within .vp__top { opacity: 1; transform: none; }
.vp.is-idle .vp__top { opacity: 0; }

.vp__title {
  direction: rtl;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}

/* ==========================================================================
   Big centre play
   ========================================================================== */
.vp__bigplay {
  position: absolute;
  z-index: 5;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  width: 78px; height: 78px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(21, 5, 32, .55);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,.35);
  color: #fff;
  cursor: pointer;
  transition: opacity .25s, transform .25s, background .2s, border-color .2s;
}
.vp__bigplay svg { width: 32px; height: 32px; fill: currentColor; margin-inline-start: 3px; }
.vp__bigplay:hover {
  background: var(--vp-accent);
  color: var(--purple-950, #150520);
  border-color: transparent;
  transform: translate(-50%, -50%) scale(1.07);
}
.vp.is-playing .vp__bigplay { opacity: 0; pointer-events: none; transform: translate(-50%,-50%) scale(.75); }
.vp.is-waiting .vp__bigplay { opacity: 0; pointer-events: none; }

/* ==========================================================================
   Buffering spinner
   ========================================================================== */
.vp__spinner {
  position: absolute;
  z-index: 5;
  inset-block-start: 50%; inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.vp.is-waiting .vp__spinner { opacity: 1; }
.vp__spinner i {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: var(--vp-accent);
  animation: vpSpin .8s linear infinite;
}
@keyframes vpSpin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Double-tap / skip feedback
   ========================================================================== */
.vp__gesture {
  position: absolute;
  z-index: 4;
  inset-block: 0;
  width: 34%;
  display: grid; place-items: center;
  pointer-events: none;
  opacity: 0;
}
.vp__gesture--back { inset-inline-start: 0; }
.vp__gesture--fwd  { inset-inline-end: 0; }
.vp__gesture span {
  display: grid; place-items: center; gap: 2px;
  padding: 16px 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  color: #fff;
  backdrop-filter: blur(4px);
}
.vp__gesture svg { width: 26px; height: 26px; fill: currentColor; }
.vp__gesture b { font-size: .7rem; font-weight: 700; }
.vp__gesture.is-on { animation: vpGesture .55s ease-out; }
@keyframes vpGesture {
  0%   { opacity: 0; transform: scale(.85); }
  25%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}

/* ==========================================================================
   Toast (speed / volume feedback)
   ========================================================================== */
.vp__toast {
  position: absolute;
  z-index: 6;
  inset-block-start: 16px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  direction: rtl;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.vp__toast.is-on { animation: vpToast 1.5s ease-out; }
@keyframes vpToast {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ==========================================================================
   Chrome
   ========================================================================== */
.vp__chrome {
  position: absolute;
  z-index: 6;
  inset-inline: 0;
  inset-block-end: 0;
  padding: 40px 14px 8px;
  background: linear-gradient(0deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.55) 42%, transparent 100%);
  transition: opacity .25s, transform .25s;
}

/* ---------- seek bar ---------- */
.vp__seek {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  outline: none;
  margin-bottom: 2px;
}
.vp__seek-hit { position: absolute; inset-inline: 0; inset-block: -6px; }

.vp__rail {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.26);
  overflow: visible;
  transition: height .15s;
}
.vp__seek:hover .vp__rail,
.vp__seek.is-scrubbing .vp__rail,
.vp__seek:focus-visible .vp__rail { height: 7px; }

.vp__buffer, .vp__progress {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  border-radius: 999px;
}
.vp__buffer { background: rgba(255,255,255,.34); width: 0; }
.vp__progress {
  background: linear-gradient(90deg, var(--vp-wave), var(--vp-accent));
  width: 0;
}
.vp__knob {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: 50%;
  transform: translate(50%, -50%) scale(0);
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--vp-accent);
  box-shadow: 0 1px 6px rgba(0,0,0,.6);
  transition: transform .15s;
}
.vp__seek:hover .vp__knob,
.vp__seek.is-scrubbing .vp__knob,
.vp__seek:focus-visible .vp__knob { transform: translate(50%, -50%) scale(1); }

/* ---------- hover preview ---------- */
.vp__preview {
  position: absolute;
  inset-block-end: 24px;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  text-align: center;
}
.vp__seek.is-hover .vp__preview { opacity: 1; }
.vp__preview-img {
  width: 160px; height: 90px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 8px 22px rgba(0,0,0,.6);
  background: #000 no-repeat;
}
.vp__preview.is-textonly .vp__preview-img { display: none; }
.vp__preview-t {
  margin-top: 5px;
  font-size: .74rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,.9);
  font-variant-numeric: tabular-nums;
}

/* ---------- button row ---------- */
.vp__bar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--vp-chrome);
}
.vp__spacer { flex: 1; }

.vp__btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: none; border: 0;
  color: #fff;
  cursor: pointer;
  opacity: .88;
  transition: opacity .15s, background .15s, color .15s, transform .15s;
  flex-shrink: 0;
}
.vp__btn svg { width: 21px; height: 21px; fill: currentColor; }
.vp__btn:hover { opacity: 1; background: rgba(255,255,255,.14); }
.vp__btn:active { transform: scale(.92); }
.vp__btn.is-on { color: var(--vp-accent); opacity: 1; }
.vp__btn:focus-visible { outline: 2px solid var(--vp-accent); outline-offset: -2px; }

/* ---------- volume ---------- */
.vp__vol { display: flex; align-items: center; }
.vp__vol-slider {
  width: 0;
  opacity: 0;
  height: 4px;
  margin-inline-start: 2px;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--vp-accent) var(--fill, 100%), rgba(255,255,255,.3) var(--fill, 100%));
  border-radius: 999px;
  cursor: pointer;
  transition: width .22s cubic-bezier(.4,0,.2,1), opacity .22s;
}
.vp__vol:hover .vp__vol-slider,
.vp__vol:focus-within .vp__vol-slider { width: 74px; opacity: 1; margin-inline: 6px 4px; }
.vp__vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
  cursor: pointer;
}
.vp__vol-slider::-moz-range-thumb {
  width: 12px; height: 12px; border: 0;
  border-radius: 50%; background: #fff; cursor: pointer;
}

/* ---------- time ---------- */
.vp__time {
  display: flex; align-items: center; gap: 4px;
  margin-inline-start: 8px;
  font-size: .78rem;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.vp__sep { opacity: .5; }
.vp__dur { opacity: .72; }

/* ---------- settings menu ---------- */
.vp__menu-wrap { position: relative; }
.vp__menu {
  position: absolute;
  z-index: 8;
  inset-block-end: 46px;
  inset-inline-end: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(24, 9, 35, .97);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(192,132,252,.28);
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  direction: rtl;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.96);
  transform-origin: bottom left;
  transition: opacity .16s, transform .16s, visibility .16s;
}
.vp__menu.is-open { opacity: 1; visibility: visible; transform: none; }

.vp__menu-head {
  padding: 6px 10px 8px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--purple-200, #c084fc);
  border-bottom: 1px solid rgba(192,132,252,.18);
  margin-bottom: 4px;
}
.vp__menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: none; border: 0;
  color: #e9dcf5;
  font-family: inherit;
  font-size: .82rem;
  text-align: start;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.vp__menu-item:hover { background: rgba(168,85,247,.2); color: #fff; }
.vp__menu-item.is-on { color: var(--vp-accent); font-weight: 700; }
.vp__menu-tick { width: 15px; height: 15px; flex-shrink: 0; opacity: 0; }
.vp__menu-tick svg { width: 100%; height: 100%; fill: currentColor; }
.vp__menu-item.is-on .vp__menu-tick { opacity: 1; }

/* ==========================================================================
   Lightbox integration
   ========================================================================== */
.lightbox__stage { width: 100%; }
.lightbox__video {   /* native fallback if videoplayer.js fails to load */
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  border-radius: var(--r-lg, 20px);
  background: #000;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .vp__preview-img { width: 128px; height: 72px; }
}

@media (max-width: 768px) {
  .vp { --vp-chrome: 42px; border-radius: var(--r-md, 14px); }
  .vp__chrome { padding: 34px 8px 6px; }
  .vp__btn { width: 36px; height: 36px; }
  .vp__btn svg { width: 19px; height: 19px; }
  .vp__bigplay { width: 62px; height: 62px; }
  .vp__bigplay svg { width: 25px; height: 25px; }
  .vp__time { font-size: .72rem; margin-inline-start: 4px; }

  /* touch: no hover, so keep the volume slider collapsed and rely on mute */
  .vp__vol:hover .vp__vol-slider { width: 0; opacity: 0; margin-inline: 0; }
  .vp__preview-img { width: 108px; height: 61px; }
  .vp__title { font-size: .84rem; }
}

@media (max-width: 480px) {
  .vp__btn[data-a="pip"] { display: none !important; }
  .vp__btn[data-a="back"], .vp__btn[data-a="fwd"] { display: none; }
  .vp__menu { min-width: 148px; }
}

/* pointer-coarse devices never get hover, so pin the chrome open */
@media (hover: none) {
  .vp.is-idle .vp__chrome { opacity: 1; transform: none; pointer-events: auto; }
  .vp.is-idle { cursor: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .vp__chrome, .vp__top, .vp__bigplay, .vp__menu,
  .vp__rail, .vp__knob, .vp__vol-slider { transition: none; }
  .vp__spinner i { animation-duration: 2s; }
  .vp__gesture.is-on, .vp__toast.is-on { animation-duration: .01s; }
}
