/*
 * Chat-style video player controls (IntroVideo.jsx).
 *
 * Extracted from bn_chat.css so the album lightbox can use the same player
 * instead of the browser's native controls. Both pages link this file — a
 * second copy would have drifted the moment either was touched.
 */

/* ==========================================================================
   INTRO VIDEO — custom control surface
   Replaces the browser's default chrome, which does not match anything else
   in the app. Muted by contract unless the caller passes allowSound.
   ========================================================================== */

.iv {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  /* Same incoming-bubble tail as bn_chat.css uses, so the video corners match
     every other message from her. */
  border-radius: 12px 12px 12px 4px;
  overflow: hidden;
  background: #000;
  line-height: 0;
}

.iv-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* ── Centre play affordance (paused only) ── */

.iv-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  padding: 0;
  background: rgba(12, 8, 16, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: ivPop 0.2s ease both;
  z-index: 2;
}
.iv-center:hover { background: rgba(20, 12, 26, 0.7); }
@keyframes ivPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.86); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Control bar ── */

.iv-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 11px 10px;
  line-height: 1;
  /* Scrim rather than a solid bar, so the frame stays visible behind it. */
  background: linear-gradient(to top, rgba(6, 4, 10, 0.82) 0%, rgba(6, 4, 10, 0.42) 55%, transparent 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  z-index: 3;
}
/* Visible on hover, on focus within, and whenever the component says so
   (paused, just interacted with, or not yet playing). */
.iv.show .iv-bar,
.iv:hover .iv-bar,
.iv:focus-within .iv-bar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.iv-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  transition: background 0.15s ease;
}
.iv-btn:hover { background: rgba(255, 255, 255, 0.24); }
.iv-btn:focus-visible {
  outline: 2px solid var(--purple-400, #CC95FF);
  outline-offset: 2px;
}

.iv-track {
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;              /* generous hit area around a 3px line */
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  position: relative;
}
.iv-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}
.iv-track:focus-visible {
  outline: 2px solid var(--purple-400, #CC95FF);
  outline-offset: 2px;
  border-radius: 4px;
}

.iv-fill {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: var(--purple-400, #CC95FF);
  max-width: 100%;
}
/* Scrub handle, revealed with the bar. */
.iv-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple-400, #CC95FF);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
}
.iv:hover .iv-fill::after,
.iv.show .iv-fill::after { transform: translateY(-50%) scale(1); }

.iv-time {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* ── Fullscreen ──
   The wrapper is the fullscreen element, so its bubble geometry has to go —
   otherwise the video keeps a 3/4 box and rounded corners on a black screen. */
.iv.fs {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}
.iv.fs .iv-video { object-fit: contain; }
.iv.fs .iv-bar { padding: 34px 22px 22px; gap: 14px; }
.iv.fs .iv-btn { width: 34px; height: 34px; }
.iv.fs .iv-time { font-size: 13px; }

@media (max-width: 480px) {
  .iv-bar { padding: 18px 9px 9px; gap: 7px; }
  .iv-time { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .iv-bar, .iv-fill::after, .iv-center { transition: none; animation: none; }
}

/*
 * Lightbox variant.
 *
 * The player fills the stage and the VIDEO does the fitting, via
 * object-fit: contain. That is the only arrangement here that works:
 *
 *   - The base .iv is a chat bubble (fixed 3/4 aspect, full parent width),
 *     so both of those must be cleared.
 *   - Sizing the wrapper to the clip does NOT work. `max-height: 100%` on the
 *     video resolves against a wrapper whose own height is auto, so it never
 *     applies; the video renders at intrinsic size and .iv's overflow:hidden
 *     crops it. That is a massively zoomed clip, not a fitted one.
 *
 * The background is transparent and the radius dropped so a full-stage box
 * leaves no visible slab — the clip reads as centred and letterbox-free,
 * matching how the <img> beside it presents.
 */
.iv.iv-lightbox {
  /* Fallback until the ratio is known; the component then sets width/height/
     aspect-ratio inline to hug the clip. */
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: transparent;
  border-radius: 0;
  /* Nothing to clip once the video fits itself; keeping hidden here would
     only re-introduce the cropping this variant exists to avoid. */
  overflow: visible;
}

.iv.iv-lightbox .iv-video {
  width: 100%;
  height: 100%;
  /* Centres the clip and preserves its aspect — no circular percentages. */
  object-fit: contain;
  border-radius: 12px;
}
