/* ============================================================================
   Patriarchy.com — Custom Video Player ("Cinematic Gold-Leaf")
   Brand-matched, Wistia-style HTML5 player. Framework-agnostic.
   Pairs with patriarchy-player.js. Scope everything under .pc-player-frame so
   it can never leak into the host page.
   ========================================================================== */

.pc-player-frame {
  /* --- brand tokens (mirrors the site design system) --- */
  --pc-gold: #c9a851;
  --pc-gold-bright: #e9d57d;
  --pc-gold-soft: #ac8d41;
  --pc-gold-deep: #9e7d2d;
  --pc-ink: #071f2f;
  --pc-line: rgba(236, 230, 218, 0.14);
  --pc-line-2: rgba(236, 230, 218, 0.08);
  --pc-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --pc-control: rgba(255, 255, 255, 0.92);
  --pc-control-dim: rgba(255, 255, 255, 0.58);
  --pc-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --pc-font-display: "Poppins", system-ui, sans-serif;
  --pc-font-body: "Open Sans", system-ui, sans-serif;
  --pc-radius: 14px;

  position: relative;
  display: block;
  padding: 10px;
  border-radius: calc(var(--pc-radius) + 8px);
  background: linear-gradient(155deg, rgba(236, 230, 218, 0.07), rgba(236, 230, 218, 0.02));
  border: 1px solid var(--pc-line-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, var(--pc-shadow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  /* entrance */
  animation: pc-frame-in 0.7s var(--pc-ease) both;
}

@keyframes pc-frame-in {
  from { opacity: 0; transform: translateY(14px) scale(0.992); }
  to   { opacity: 1; transform: none; }
}

.pc-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--pc-radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--pc-line);
  font-family: var(--pc-font-body);
  color: var(--pc-control);
  isolation: isolate;
  cursor: pointer;
}
.pc-player:focus-visible { outline: 2px solid var(--pc-gold); outline-offset: 3px; }

.pc-player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

/* --- idle (auto-hide) state hides cursor + controls while playing --- */
.pc-player.is-playing.is-idle { cursor: none; }
.pc-player.is-playing.is-idle .pc-controls,
.pc-player.is-playing.is-idle .pc-topbar { opacity: 0; transform: translateY(6px); pointer-events: none; }

/* ===========================================================================
   POSTER / TITLE CARD (pre-play)
   ========================================================================== */
.pc-poster {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(16px, 3.2vw, 34px);
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.45) 70%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(180deg, rgba(7, 31, 47, 0.25), rgba(0, 0, 0, 0.4));
  transition: opacity 0.55s var(--pc-ease), visibility 0.55s;
}
/* grain overlay for cinematic depth */
.pc-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.pc-player.is-started .pc-poster { opacity: 0; visibility: hidden; }

.pc-eyebrow {
  position: relative;
  z-index: 2;
  font-family: var(--pc-font-body);
  font-weight: 600;
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--pc-gold);
  margin: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.pc-poster-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.pc-title {
  margin: 0;
  font-family: var(--pc-font-display);
  font-weight: 800;
  line-height: 1.04;
  font-size: clamp(24px, 4.4vw, 46px);
  letter-spacing: -0.01em;
  color: #fff;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
  max-width: 16ch;
}
.pc-title .pc-title-accent { color: var(--pc-gold-bright); }
.pc-duration-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--pc-line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pc-duration-chip::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pc-gold-bright);
  box-shadow: 0 0 8px var(--pc-gold);
}

/* --- the signature: breathing gold play button --- */
.pc-bigplay {
  position: absolute;
  z-index: 3;
  top: 50%; left: 50%;
  width: clamp(72px, 9vw, 96px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--pc-gold-bright);
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 60%, rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(233, 213, 125, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 10px 40px -6px rgba(0, 0, 0, 0.6),
    0 0 42px -2px rgba(201, 168, 81, 0.5);
  transition: transform 0.3s var(--pc-ease), box-shadow 0.3s var(--pc-ease), color 0.3s;
  animation: pc-breathe 3.6s ease-in-out infinite;
}
@keyframes pc-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 10px 40px -6px rgba(0,0,0,0.6), 0 0 36px -4px rgba(201,168,81,0.42); }
  50%      { box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 10px 40px -6px rgba(0,0,0,0.6), 0 0 58px 2px rgba(201,168,81,0.62); }
}
.pc-bigplay:hover { transform: translate(-50%, -50%) scale(1.06); color: #fff; }
.pc-bigplay:focus-visible { outline: 2px solid var(--pc-gold-bright); outline-offset: 5px; }
.pc-bigplay svg { width: 38%; height: 38%; margin-left: 8%; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45)); }
.pc-player.is-started .pc-bigplay { opacity: 0; visibility: hidden; pointer-events: none; }

/* ===========================================================================
   TOP BAR (title once playing — subtle, fades with controls)
   ========================================================================== */
.pc-topbar {
  position: absolute;
  z-index: 5;
  top: 0; left: 0; right: 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.35s var(--pc-ease), transform 0.35s var(--pc-ease);
  pointer-events: none;
}
.pc-player.is-started.is-active .pc-topbar { opacity: 1; transform: none; }
.pc-topbar-title {
  font-family: var(--pc-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
.pc-topbar-kicker { color: var(--pc-gold); font-weight: 700; margin-right: 4px; }

/* ===========================================================================
   CONTROL BAR
   ========================================================================== */
.pc-controls {
  position: absolute;
  z-index: 5;
  left: 0; right: 0; bottom: 0;
  padding: 0 clamp(10px, 1.6vw, 16px) clamp(8px, 1.2vw, 12px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 38%, rgba(0, 0, 0, 0.72) 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s var(--pc-ease), transform 0.35s var(--pc-ease);
  pointer-events: none;
}
.pc-player.is-active .pc-controls,
.pc-player:not(.is-started) .pc-controls { /* show scrubber-less? we keep hidden pre-start */ }
.pc-player.is-started.is-active .pc-controls { opacity: 1; transform: none; pointer-events: auto; }

/* --- scrubber --- */
.pc-scrubber {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.pc-scrub-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: visible;
  transition: height 0.18s var(--pc-ease);
}
.pc-scrubber:hover .pc-scrub-track { height: 6px; }
.pc-scrub-buffered {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}
.pc-scrub-played {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pc-gold-soft), var(--pc-gold-bright));
  box-shadow: 0 0 10px rgba(201, 168, 81, 0.55);
}
.pc-scrub-knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pc-gold-bright) 55%, var(--pc-gold-soft));
  box-shadow: 0 0 0 3px rgba(201, 168, 81, 0.25), 0 2px 6px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.16s var(--pc-ease);
}
.pc-scrubber:hover .pc-scrub-knob,
.pc-scrubber.is-scrubbing .pc-scrub-knob { transform: translate(-50%, -50%) scale(1); }
.pc-scrub-tooltip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(7, 31, 47, 0.92);
  border: 1px solid var(--pc-line);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.pc-scrubber:hover .pc-scrub-tooltip,
.pc-scrubber.is-scrubbing .pc-scrub-tooltip { opacity: 1; }

/* --- buttons row --- */
.pc-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
}
.pc-spacer { flex: 1; }
.pc-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--pc-control);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.15s var(--pc-ease);
}
.pc-btn:hover { color: var(--pc-gold-bright); background: rgba(255, 255, 255, 0.08); }
.pc-btn:active { transform: scale(0.92); }
.pc-btn:focus-visible { outline: 2px solid var(--pc-gold); outline-offset: 2px; }
.pc-btn svg { width: 21px; height: 21px; }
.pc-btn .pc-ic-pause, .pc-player.is-paused .pc-btn .pc-ic-play { display: block; }
.pc-btn .pc-ic-play, .pc-player.is-paused .pc-btn .pc-ic-pause { display: none; }

/* time read-out */
.pc-time {
  flex: none;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--pc-control);
  white-space: nowrap;
  user-select: none;
}
.pc-time .pc-time-sep { color: var(--pc-control-dim); margin: 0 3px; }
.pc-time .pc-time-total { color: var(--pc-control-dim); }

/* volume */
.pc-volume { display: flex; align-items: center; }
.pc-volume-slider {
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.24s var(--pc-ease), opacity 0.2s;
  display: flex;
  align-items: center;
}
.pc-volume:hover .pc-volume-slider,
.pc-volume:focus-within .pc-volume-slider { width: 72px; opacity: 1; }
.pc-volume-range {
  -webkit-appearance: none; appearance: none;
  width: 64px; height: 4px;
  margin: 0 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pc-gold-bright) var(--vol, 100%), rgba(255,255,255,0.25) var(--vol, 100%));
  cursor: pointer;
}
.pc-volume-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pc-gold-bright) 60%);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  cursor: pointer;
}
.pc-volume-range::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%;
  background: var(--pc-gold-bright);
}
.pc-player .pc-ic-vol-mute,
.pc-player .pc-ic-vol-low { display: none; }
.pc-player.is-muted .pc-ic-vol-high,
.pc-player.is-muted .pc-ic-vol-low { display: none; }
.pc-player.is-muted .pc-ic-vol-mute { display: block; }

/* text buttons (speed) */
.pc-btn-text {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  font-family: var(--pc-font-body);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* --- popover menu (speed) --- */
.pc-menu-wrap { position: relative; flex: none; }
.pc-menu {
  position: absolute;
  bottom: 48px;
  right: 0;
  min-width: 128px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(10, 14, 20, 0.86);
  border: 1px solid var(--pc-line);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.18s var(--pc-ease), transform 0.18s var(--pc-ease);
  z-index: 6;
}
.pc-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.pc-menu-label {
  padding: 4px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pc-gold);
}
.pc-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pc-control);
  font-family: var(--pc-font-body);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pc-menu-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.pc-menu-item[aria-checked="true"] { color: var(--pc-gold-bright); }
.pc-menu-item[aria-checked="true"]::after { content: "✓"; font-size: 12px; }
.pc-menu-item[aria-checked="false"]::after { content: ""; }

/* captions disabled hint */
.pc-btn[disabled] { opacity: 0.38; cursor: not-allowed; }
.pc-btn[disabled]:hover { color: var(--pc-control); background: transparent; }
.pc-player.is-captions-on .pc-ic-cc { color: var(--pc-gold-bright); }

/* ===========================================================================
   CENTRE FEEDBACK PULSE (on play/pause toggle)
   ========================================================================== */
.pc-pulse {
  position: absolute;
  z-index: 4;
  top: 50%; left: 50%;
  width: 84px; height: 84px;
  transform: translate(-50%, -50%) scale(0.7);
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
.pc-pulse svg { width: 34px; height: 34px; }
.pc-pulse.is-animating { animation: pc-pulse 0.5s var(--pc-ease) forwards; }
@keyframes pc-pulse {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}

/* ===========================================================================
   SPINNER (buffering)
   ========================================================================== */
.pc-spinner {
  position: absolute;
  z-index: 4;
  top: 50%; left: 50%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--pc-gold-bright);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.pc-player.is-waiting .pc-spinner { opacity: 1; animation: pc-spin 0.8s linear infinite; }
@keyframes pc-spin { to { transform: rotate(360deg); } }

/* ===========================================================================
   END SCREEN (replay + optional CTA slot)
   ========================================================================== */
.pc-endscreen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  gap: 18px;
  grid-auto-flow: row;
  align-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 45%, rgba(7,31,47,0.55), rgba(0,0,0,0.82));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--pc-ease), visibility 0.4s;
}
.pc-player.is-ended .pc-endscreen { opacity: 1; visibility: visible; }
.pc-replay {
  display: inline-grid;
  place-items: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(233, 213, 125, 0.5);
  background: rgba(255, 255, 255, 0.06);
  color: var(--pc-gold-bright);
  cursor: pointer;
  box-shadow: 0 0 40px -6px rgba(201, 168, 81, 0.5);
  transition: transform 0.25s var(--pc-ease);
}
.pc-replay:hover { transform: scale(1.07); }
.pc-replay svg { width: 30px; height: 30px; }
.pc-endscreen-cta { display: none; } /* host can opt-in via [data-cta] */
.pc-player[data-cta="true"] .pc-endscreen-cta { display: block; }
.pc-cta-btn {
  font-family: var(--pc-font-body);
  font-weight: 600;
  font-size: 17px;
  color: #fff;
  background: var(--pc-gold);
  border: 0;
  border-radius: 3px;
  padding: 12px 28px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 0 24px 0 rgba(158, 125, 45, 0.8);
  transition: transform 0.2s var(--pc-ease), box-shadow 0.2s;
}
.pc-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 0 34px 2px rgba(158, 125, 45, 0.95); }

/* ===========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .pc-player-frame { padding: 6px; border-radius: 16px; }
  .pc-volume { display: none; }            /* native volume on mobile */
  .pc-btn { width: 36px; height: 36px; }
  .pc-time { font-size: 12px; padding: 0 4px; }
  .pc-btn-text { min-width: 40px; padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-bigplay { animation: none; }
  .pc-player-frame { animation: none; }
  .pc-pulse.is-animating { animation-duration: 0.01s; }
}
