/* ============================================================================
   Patriarchy.com — Video Player (Wistia-modelled redesign)
   Framework-agnostic. Pairs with patriarchy-player.js.
   Philosophy: the video is the hero. No overlays, no darkening, no centre
   button. Controls are transient furniture that fade in on interaction.
   ========================================================================== */

.pv-holder { position: relative; }
.pv-spacer { display: none; }

.pv {
  /* brand tokens */
  --gold: #c9a851;
  --gold-bright: #e9d57d;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: inherit;
  aspect-ratio: 16 / 9;
  width: 100%;
  outline: none;
}
.pv:focus-visible { box-shadow: 0 0 0 3px rgba(201, 168, 81, 0.7); }
.pv[data-controls="hidden"] { cursor: none; }

.pv__video,
.pv__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pv__video { background: #000; }
.pv__poster { z-index: 1; transition: opacity 0.3s var(--ease); }
.pv[data-state="loading"] .pv__poster { filter: blur(6px); }
.pv[data-state="playing"] .pv__poster,
.pv[data-state="paused"] .pv__poster,
.pv[data-state="preview"] .pv__poster { opacity: 0; pointer-events: none; }

/* transparent full-frame click target for click-anywhere play/pause */
.pv__hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---- loading spinner (subtle, only while buffering) ---- */
.pv__spinner {
  position: absolute;
  z-index: 3;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--gold-bright);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.pv.is-waiting .pv__spinner { opacity: 1; animation: pv-spin 0.8s linear infinite; }
@keyframes pv-spin { to { transform: rotate(360deg); } }

/* ---- pre-play affordance: small bottom-left chip (NOT a centre disc) ---- */
.pv__preplay {
  position: absolute;
  z-index: 4;
  left: 18px; bottom: 18px;
  width: 58px; height: 58px;
  border: 1px solid rgba(233, 213, 125, 0.5);
  border-radius: 50%;
  cursor: pointer;
  color: #0a0a0a;
  display: grid;
  place-items: center;
  background: rgba(201, 168, 81, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s var(--ease), background 0.15s, opacity 0.3s;
  animation: pv-preplay-pulse 2.4s ease-in-out infinite;
}
.pv__preplay:hover { background: var(--gold-bright); transform: scale(1.06); }
.pv__preplay svg { width: 24px; height: 24px; margin-left: 3px; }
@keyframes pv-preplay-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,.45), 0 0 0 0 rgba(201,168,81,.5); }
  50% { box-shadow: 0 4px 16px rgba(0,0,0,.45), 0 0 0 10px rgba(201,168,81,0); }
}
.pv[data-state="playing"] .pv__preplay,
.pv[data-state="paused"] .pv__preplay,
.pv[data-state="preview"] .pv__preplay,
.pv[data-state="loading"] .pv__preplay { opacity: 0; visibility: hidden; pointer-events: none; }
@media (max-width: 640px) { .pv__preplay { left: 12px; bottom: 12px; width: 52px; height: 52px; } }

/* "Click for sound" — modelled on Wistia's own: top-right, translucent black,
   white speaker with pulsing sound-waves, label to the LEFT of the icon.
   Shown during the muted autoplay preview. */
.pv__sound {
  display: none;
  position: absolute;
  z-index: 6;
  top: 18px; right: 18px;
  align-items: center;
  padding: 5px 6px 5px 16px;
  border: 0; border-radius: 999px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  white-space: nowrap;
}
.pv.pv--inview:not(.pv--sound) .pv__sound { display: inline-flex; animation: pv-sound-attn 2.8s ease-in-out infinite; }
.pv__sound:hover { background: rgba(0, 0, 0, 0.9); }
.pv__sound-label { font: 600 16px/1 inherit; padding-right: 12px; letter-spacing: .01em; }
.pv__sound .pv__sound-ic { width: 46px; height: 46px; display: block; }
.pv__sound .wave-sm { animation: pv-wave 2s infinite; opacity: 0; }
.pv__sound .wave-lg { animation: pv-wave 2s infinite 0.3s; opacity: 0; }
@keyframes pv-wave { 0% { opacity: 0; } 33% { opacity: 1; } 66% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pv-sound-attn { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (max-width: 640px) {
  .pv__sound { top: 12px; right: 12px; padding: 4px 5px 4px 13px; }
  .pv__sound-label { font-size: 14px; padding-right: 9px; }
  .pv__sound .pv__sound-ic { width: 40px; height: 40px; }
}

/* ---- centre play/pause NOTIFIER (transient flash only — not a button) ---- */
.pv__notifier {
  position: absolute;
  z-index: 4;
  inset: 0; margin: auto;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  pointer-events: none;
  opacity: 0;
}
.pv__notifier svg { width: 34px; height: 34px; }
.pv__notifier.flash { animation: pv-flash 0.5s ease-out; }
@keyframes pv-flash {
  0% { opacity: 0.85; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* ---- captions ---- */
.pv__captions {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; bottom: 24px;
  text-align: center;
  padding: 0 8%;
  pointer-events: none;
  transition: bottom 0.22s var(--ease);
}
.pv[data-controls="visible"] .pv__captions { bottom: 76px; }
.pv__captions span {
  display: inline;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: clamp(14px, 2.4vw, 20px);
  line-height: 1.45;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---- bottom scrim (ONLY dimming allowed — never full-frame) ---- */
.pv__scrim {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; bottom: 0;
  height: 120px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.22) 45%, rgba(0, 0, 0, 0) 100%);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

/* ---- control bar ---- */
.pv__bar {
  position: absolute;
  z-index: 5;
  left: 0; right: 0; bottom: 0;
  padding: 0 14px 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  pointer-events: none;
}
/* Control bar appears ONLY once playback has started — never over the pre-play
   poster (pre-play shows just the bottom-left play chip). */
.pv[data-controls="visible"][data-state="playing"] .pv__scrim,
.pv[data-controls="visible"][data-state="paused"] .pv__scrim { opacity: 1; }
.pv[data-controls="visible"][data-state="playing"] .pv__bar,
.pv[data-controls="visible"][data-state="paused"] .pv__bar { opacity: 1; transform: none; pointer-events: auto; }

/* ---- scrubber ---- */
.pv__scrub {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.pv__scrub-track, .pv__scrub-buffered, .pv__scrub-played {
  position: absolute;
  left: 0;
  height: 3px;
  border-radius: 2px;
  transition: height 0.12s var(--ease);
}
.pv__scrub-track { width: 100%; background: rgba(255, 255, 255, 0.3); }
.pv__scrub-buffered { width: 0%; background: rgba(255, 255, 255, 0.5); }
.pv__scrub-played { width: 0%; background: var(--gold); }
.pv__scrub:hover .pv__scrub-track,
.pv__scrub:hover .pv__scrub-buffered,
.pv__scrub:hover .pv__scrub-played,
.pv__scrub.is-scrubbing .pv__scrub-track,
.pv__scrub.is-scrubbing .pv__scrub-buffered,
.pv__scrub.is-scrubbing .pv__scrub-played { height: 7px; }
.pv__scrub:hover .pv__scrub-played,
.pv__scrub.is-scrubbing .pv__scrub-played { background: var(--gold-bright); }
.pv__scrub-handle {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 13px; height: 13px;
  margin-top: -6.5px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transform: scale(0);
  transition: transform 0.12s var(--ease);
  pointer-events: none;
}
.pv__scrub:hover .pv__scrub-handle,
.pv__scrub.is-scrubbing .pv__scrub-handle { transform: scale(1); }
.pv__scrub-tooltip {
  position: absolute;
  bottom: 22px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font: 12px/1 inherit;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.pv__scrub:hover .pv__scrub-tooltip,
.pv__scrub.is-scrubbing .pv__scrub-tooltip { opacity: 1; }

/* ---- icon row ---- */
.pv__row { display: flex; align-items: center; gap: 4px; margin-top: 4px; height: 44px; }
.pv__left { display: flex; align-items: center; }
.pv__right { margin-left: auto; display: flex; align-items: center; gap: 1px; }
.pv__btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: none; border: 0; padding: 0;
  color: #fff; cursor: pointer;
  opacity: 0.9;
  border-radius: 8px;
  transition: color 0.15s, opacity 0.15s, background 0.15s, transform 0.12s var(--ease);
}
.pv__btn:hover { opacity: 1; color: var(--gold-bright); background: rgba(255, 255, 255, 0.08); }
.pv__btn:active { transform: scale(0.9); }
.pv__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.pv__btn svg { width: 20px; height: 20px; display: block; }
.pv__btn[hidden] { display: none; }

/* play/pause + fullscreen icon swaps */
.pv__play .ic-pause, .pv[data-state="paused"] .pv__play .ic-play,
.pv[data-state="idle"] .pv__play .ic-play, .pv[data-state="loading"] .pv__play .ic-play { display: block; }
.pv__play .ic-play, .pv[data-state="paused"] .pv__play .ic-pause,
.pv[data-state="idle"] .pv__play .ic-pause, .pv[data-state="loading"] .pv__play .ic-pause { display: none; }
.pv[data-state="playing"] .pv__play .ic-play { display: none; }
.pv[data-state="playing"] .pv__play .ic-pause { display: block; }

.pv__fs .ic-fs-exit { display: none; }
.pv.is-fullscreen .pv__fs .ic-fs-enter { display: none; }
.pv.is-fullscreen .pv__fs .ic-fs-exit { display: block; }

.pv__time {
  font: 13px/1 inherit;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
  padding: 0 6px;
  white-space: nowrap;
  user-select: none;
}
.pv__time .dur { opacity: 0.7; }

/* volume */
.pv__volume { display: flex; align-items: center; }
.pv__vol-slider {
  width: 0; opacity: 0; overflow: hidden;
  height: 40px; display: flex; align-items: center;
  transition: width 0.22s var(--ease), opacity 0.18s;
  cursor: pointer; touch-action: none;
}
.pv__volume:hover .pv__vol-slider,
.pv__volume:focus-within .pv__vol-slider { width: 70px; opacity: 1; }
.pv__vol-track {
  position: relative;
  width: 60px; height: 4px;
  margin: 0 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}
.pv__vol-fill { position: absolute; left: 0; top: 0; height: 100%; width: 100%; border-radius: 2px; background: #fff; }
.pv__vol-knob {
  position: absolute; top: 50%; left: 100%;
  width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pv .ic-vol-mute { display: none; }
.pv.is-muted .ic-vol-high, .pv.is-muted .ic-vol-low { display: none; }
.pv.is-muted .ic-vol-mute { display: block; }
.pv .ic-vol-low { display: none; }

/* CC active */
.pv__cc[aria-pressed="true"] { color: var(--gold-bright); box-shadow: inset 0 -2px 0 var(--gold); }
.pv__cc[disabled] { opacity: 0.35; cursor: default; }
.pv__cc[disabled]:hover { color: #fff; background: none; }

/* settings menu */
.pv__settings { position: relative; }
.pv__menu {
  position: absolute;
  right: 0; bottom: 48px;
  min-width: 170px;
  padding: 6px;
  background: rgba(18, 18, 20, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}
.pv__menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.pv__menu-label {
  padding: 6px 10px 4px;
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); opacity: 0.9;
}
.pv__menu button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 34px; padding: 0 10px;
  background: none; border: 0; color: #fff; cursor: pointer;
  border-radius: 6px; font: inherit;
}
.pv__menu button:hover { background: rgba(255, 255, 255, 0.08); }
.pv__menu button[aria-checked="true"] { color: var(--gold-bright); }
.pv__menu button[aria-checked="true"]::after { content: "●"; font-size: 10px; color: var(--gold); }

/* ===========================================================================
   MINI-PLAYER (dock on scroll) + EXPANDED OVERLAY
   Portaled to <body> when floating, so it always sits above page content and
   position:fixed is never trapped by an ancestor transform/filter.
   ========================================================================== */
.pv { --pv-cta-h: 0px; }           /* runtime-measured height of a sticky bottom CTA */
.pv__mini-close { display: none; }
.pv__expand-close { display: none; }

.pv.pv-docked {
  position: fixed;
  /* default anchor (bottom-right); the .pv--corner-* class overrides all four */
  bottom: calc(24px + var(--pv-cta-h)); right: 24px; top: auto; left: auto;
  width: min(360px, 42vw);
  aspect-ratio: 16 / 9; height: auto;
  z-index: 2147483000;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  touch-action: none;               /* we own the gesture — don't let the page scroll-steal it */
  will-change: transform;
  cursor: grab;
  animation: pv-fade-in 0.22s var(--ease);
}
@keyframes pv-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* corner anchors (desktop) — set all four insets so switching corners is clean */
.pv.pv-docked.pv--corner-br { top: auto; left: auto; bottom: calc(24px + var(--pv-cta-h)); right: 24px; }
.pv.pv-docked.pv--corner-bl { top: auto; right: auto; bottom: calc(24px + var(--pv-cta-h)); left: 24px; }
.pv.pv-docked.pv--corner-tr { bottom: auto; left: auto; top: 24px; right: 24px; }
.pv.pv-docked.pv--corner-tl { bottom: auto; right: auto; top: 24px; left: 24px; }

.pv.pv-docked.pv--dragging { cursor: grabbing; box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55); animation: none; transition: none; }
.pv.pv-docked.pv--snapping { transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1); }

/* dismiss × (docked only) */
.pv.pv-docked .pv__mini-close {
  display: grid; place-items: center;
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; z-index: 7;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.pv.pv-docked .pv__mini-close:hover { background: rgba(0, 0, 0, 0.85); }
.pv.pv-docked .pv__preplay { display: none; }
.pv.pv-docked .pv__sound { display: none !important; }
/* controls must remain tappable even though the tile has touch-action:none */
.pv.pv-docked .pv__bar, .pv.pv-docked .pv__mini-close { touch-action: auto; }

/* docked control sizing — shrink the PIECES (never scale the row, which would
   leave dead space on the right). margin-left:auto keeps the cluster flush-right. */
.pv.pv-docked .pv__bar { padding: 0 8px 6px; }
.pv.pv-docked .pv__row { height: 38px; margin-top: 2px; }
.pv.pv-docked .pv__btn { width: 34px; height: 34px; border-radius: 6px; }
.pv.pv-docked .pv__btn svg { width: 17px; height: 17px; }
.pv.pv-docked .pv__scrub { height: 12px; }
.pv.pv-docked .pv__time { display: none; }
.pv.pv-docked .pv__settings { display: none; }
.pv.pv-docked .pv__fs { display: none; }

@media (max-width: 640px) {
  .pv.pv-docked { width: 172px; max-width: 46vw; border-radius: 10px; }
  .pv.pv-docked.pv--corner-br, .pv.pv-docked.pv--corner-bl { bottom: calc(12px + var(--pv-cta-h) + env(safe-area-inset-bottom)); }
  .pv.pv-docked.pv--corner-tr, .pv.pv-docked.pv--corner-tl { top: calc(12px + env(safe-area-inset-top)); }
  .pv.pv-docked.pv--corner-br, .pv.pv-docked.pv--corner-tr { right: calc(12px + env(safe-area-inset-right)); }
  .pv.pv-docked.pv--corner-bl, .pv.pv-docked.pv--corner-tl { left: calc(12px + env(safe-area-inset-left)); }
  /* Mobile corner tile: NO controls at all — just the video + the close ×.
     The tile is too small to scrub/tap accurately, and a centre scrubber was
     stealing drag touches. Only three gestures remain: × to close, tap
     elsewhere to expand (controls live in the expanded view), swipe to move. */
  .pv.pv-docked .pv__bar,
  .pv.pv-docked .pv__scrim,
  .pv.pv-docked .pv__captions,
  .pv.pv-docked .pv__notifier { display: none !important; }
  .pv.pv-docked .pv__mini-close { width: 30px; height: 30px; font-size: 18px; top: 6px; right: 6px; }
}
@media (max-width: 380px) { .pv.pv-docked { width: 150px; } }

/* ---- expanded (centred overlay) ---- */
.pv-backdrop {
  position: fixed; inset: 0; z-index: 2147482999;
  background: rgba(4, 6, 10, 0.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.pv-backdrop.is-on { opacity: 1; pointer-events: auto; }

.pv.pv-expanded {
  position: fixed;
  inset: 0; margin: auto;                 /* centres both axes without a transform (FLIP-friendly) */
  width: min(92vw, 1100px);
  height: auto; aspect-ratio: 16 / 9; max-height: 86vh;
  z-index: 2147483000;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  cursor: default;
}
.pv.pv-expanded .pv__mini-close { display: none; }
.pv.pv-expanded .pv__expand-close {
  display: grid; place-items: center;
  position: absolute; top: 10px; right: 10px; z-index: 8;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.pv.pv-expanded .pv__expand-close:hover { background: rgba(0, 0, 0, 0.8); }

/* fullscreen: hide the dock/collapse affordances */
.pv.is-fullscreen .pv__mini-close,
.pv.is-fullscreen .pv__expand-close { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pv__notifier.flash { animation-duration: 0.01s; }
  .pv.pv-docked { animation: none; }
  .pv.pv-docked.pv--snapping { transition: none; }
  .pv-backdrop { transition: opacity 0.05s; }
  .pv__scrim, .pv__bar { transition-duration: 0.05s; }
}
