/* ================================
   DS PLAYER
   Custom video controls, Vimeo-style.
   Pairs with js/player.js — any <video class="ds-player">
   gets wrapped in this chrome automatically.
================================ */

/* Before JS runs, keep the raw <video> filling its frame */
video.ds-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.dsp {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.dsp:focus-visible {
  outline: 1px solid var(--gold, #c9a74c);
  outline-offset: -1px;
}

.dsp video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.dsp:fullscreen,
.dsp:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

/* Hide the cursor over a playing fullscreen video once controls fade */
.dsp:fullscreen.playing:not(.show-controls) { cursor: none; }

/* ── CENTER PLAY BUTTON ── */
.dsp-bigplay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  padding: 0;
  transition: opacity 0.3s ease, transform 0.3s ease,
              background 0.25s ease, border-color 0.25s ease;
}

.dsp-bigplay svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  margin-left: 3px;
  display: block;
}

.dsp-bigplay:hover {
  background: rgba(0, 0, 0, 0.58);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%) scale(1.06);
}

.dsp.started .dsp-bigplay {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.82);
}

/* ── BUFFERING SPINNER ── */
.dsp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.2s ease;
  animation: dsp-spin 0.8s linear infinite;
}

.dsp.buffering .dsp-spinner { opacity: 1; }

@keyframes dsp-spin { to { transform: rotate(360deg); } }

/* ── CONTROL BAR ── */
.dsp-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 10px 7px;
  z-index: 5;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: linear-gradient(to top,
              rgba(0, 0, 0, 0.75) 0%,
              rgba(0, 0, 0, 0.38) 45%,
              transparent 100%);
}

.dsp.show-controls .dsp-controls {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ── SCRUBBER ── */
.dsp-scrub {
  position: relative;
  padding: 7px 0;
  cursor: pointer;
  touch-action: none;
}

.dsp-track {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.24);
  transition: height 0.15s ease;
}

.dsp-scrub:hover .dsp-track,
.dsp.scrubbing .dsp-track { height: 5px; }

.dsp-buffered,
.dsp-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: 2px;
}

.dsp-buffered { background: rgba(255, 255, 255, 0.32); }
.dsp-played   { background: var(--gold, #c9a74c); }

.dsp-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: var(--gold, #c9a74c);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
}

.dsp-scrub:hover .dsp-handle,
.dsp.scrubbing .dsp-handle { transform: translateY(-50%) scale(1); }

.dsp-tooltip {
  position: absolute;
  bottom: 18px;
  left: 0;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.78);
  color: rgba(255, 255, 255, 0.92);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.dsp-scrub:hover .dsp-tooltip,
.dsp.scrubbing .dsp-tooltip { opacity: 1; }

/* ── BUTTON ROW ── */
.dsp-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dsp-btn {
  background: none;
  border: 0;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: color 0.18s ease;
  flex: 0 0 auto;
}

.dsp-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  display: block;
}

.dsp-btn:hover { color: #fff; }

.dsp-btn:focus-visible {
  outline: 1px solid var(--gold, #c9a74c);
  outline-offset: 1px;
}

.dsp-time {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
  user-select: none;
  flex: 0 0 auto;
  margin: 0;
  max-width: none;
}

.dsp-spacer { flex: 1 1 auto; }

/* ── VOLUME ── */
.dsp-volume {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.dsp-vol-track {
  position: relative;
  width: 0;
  height: 3px;
  margin: 0;
  opacity: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.26);
  cursor: pointer;
  touch-action: none;
  transition: width 0.22s ease, opacity 0.22s ease, margin 0.22s ease;
}

.dsp-volume:hover .dsp-vol-track,
.dsp-volume:focus-within .dsp-vol-track,
.dsp-volume.open .dsp-vol-track {
  width: 46px;
  opacity: 1;
  margin: 0 5px 0 2px;
}

.dsp-vol-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
}

/* ── COMPACT PLAYERS ──
   These tiles get narrow in the grid, so drop pieces of the bar
   as the player itself (not the viewport) shrinks. */
@container (max-width: 230px) {
  .dsp-volume { display: none; }
}

@container (max-width: 175px) {
  .dsp-dur { display: none; }
  .dsp-controls { padding: 24px 7px 5px; }
  .dsp-row { gap: 5px; }
}

@container (max-width: 260px) {
  .dsp-bigplay { width: 44px; height: 44px; }
  .dsp-bigplay svg { width: 14px; height: 14px; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  .dsp-spinner { animation-duration: 2s; }
  .dsp-controls,
  .dsp-bigplay,
  .dsp-track,
  .dsp-handle,
  .dsp-vol-track { transition: none; }
}
