/* =========================================================
   VIDEO CARD SYSTEM — FINAL CSS
   Convention:
     - Webflow markup   → .video-card + data-* attributes
     - Injected elements → classes .vc-*
     - State toggles    → classes .is-*
========================================================= */
:root {
  --plyr-color-main: #FC5F2B;
}
/* ---------------------------------------------------------
   CARD WRAPPER
--------------------------------------------------------- */
.video-card {
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  background: transparent;

  /* Transition tuning */
  --vc-fade-in: 420ms;
  --vc-fade-out: 520ms;
  --vc-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* GPU stability (Safari esp.) */
  -webkit-transform: translateZ(0);
}

/* ---------------------------------------------------------
   MEDIA LAYERS
--------------------------------------------------------- */

/* Poster fallback image (default visible state, stays put) */
.video-card .vc-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
  opacity: 1;
  pointer-events: none;

  transition: opacity var(--vc-fade-out) var(--vc-ease);
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Video layer (hidden by default, fades in ON TOP of poster) */
.video-card video.vc-video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;

  transition: opacity var(--vc-fade-in) var(--vc-ease);
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Show video ONLY when previewing AND ready */
.video-card.is-preview.is-ready video.vc-video {
  opacity: 1;
}

/* Show video during active playback */
.video-card.is-active video.vc-video {
  opacity: 1;
}

/* Poster stays visible underneath during preview + active playback —
   the video covers it once fully opaque (z-index 1 vs 0).
   Only hide the poster in bg mode where the video loops forever. */
.video-card.is-bg .vc-poster {
  opacity: 0;
  pointer-events: none;
}

/* Error fallback — force poster back, hide video */
.video-card.is-error .vc-poster {
  opacity: 1 !important;
}
.video-card.is-error video.vc-video {
  opacity: 0 !important;
}

/* ---------------------------------------------------------
   WEBFLOW UI LAYERING
--------------------------------------------------------- */

/* Keep Webflow UI above media */
.video-card > :not(.vc-poster):not(.vc-video) {
  z-index: 10;
}

/* Hide play UI when active */
.video-card.is-active [data-vc-play] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

/* ---------------------------------------------------------
   SCRIPT-INJECTED OVERLAY
--------------------------------------------------------- */

/* Default overlay behavior */
.video-card .vc-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 5;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 180ms ease, transform 220ms ease;
}

/* Hover preview keeps overlay visible */
.video-card.is-preview .vc-overlay {
  opacity: 1;
  transform: scale(0.98);
}

/* Active playback hides overlay */
.video-card.is-active .vc-overlay {
  opacity: 0;
  pointer-events: none;
}

/* BG looping videos: overlay must never block clicks */
.video-card[data-vc-bg] .vc-overlay {
  pointer-events: none !important;
  opacity: 0;
}

/* ---------------------------------------------------------
   PLYR CONSTRAINTS
--------------------------------------------------------- */

.video-card .plyr {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  /* Prevent GPU layers from breaking overflow clip */
  transform: translateZ(0);
  isolation: isolate;
}

.video-card .plyr__video-wrapper {
  overflow: hidden;
  border-radius: inherit;
}

/* Bottom controls must respect card radius */
.video-card .plyr__controls {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

/* ---------------------------------------------------------
   PLYR UI OVERRIDES
--------------------------------------------------------- */

/* Hide Plyr center play */
.video-card .plyr__control--overlaid {
  display: none !important;
}

/* Bottom controls */
.video-card .plyr__controls {
  background: rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(8px);
  padding: 8px 16px !important;
  min-height: unset !important;
}

/* Controls sizing */
.video-card .plyr__control {
  padding: 4px !important;
  height: 28px;
  width: 28px;
}

/* Time */
.video-card .plyr__time {
  font-size: 12px;
  line-height: 1;
}

/* Remove vertical spacing */
.video-card .plyr__controls > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Timeline */
.video-card .plyr__progress input[type="range"] {
  height: 4px;
}

/* Icons */
.video-card .plyr__control svg,
.video-card .plyr__volume svg {
  width: 16px;
  height: 16px;
}

/* Hide controls during preview */
.video-card.is-preview .plyr__controls {
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------
   BACKGROUND VIDEO MODE
--------------------------------------------------------- */

/* Background video always visible (once is-bg lands) */
.video-card.is-bg video.vc-video {
  opacity: 1 !important;
}

/* Show poster as fallback when bg video errors */
.video-card.is-bg.is-error .vc-poster {
  opacity: 1 !important;
}

/* ---------------------------------------------------------
   BACKGROUND PLAY / PAUSE TOGGLE
--------------------------------------------------------- */

.video-card [data-vc-toggle] {
  position: relative;
}

/* Icon wrappers overlap perfectly */
.video-card [data-vc-toggle] [data-vc-icon] {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

/* Playing */
.video-card[data-vc-bg] [data-vc-icon="play"] {
  opacity: 0;
  transform: scale(0.9);
}
.video-card[data-vc-bg] [data-vc-icon="pause"] {
  opacity: 1;
  transform: scale(1);
}

/* Paused */
.video-card[data-vc-bg].is-paused [data-vc-icon="play"] {
  opacity: 1;
  transform: scale(1);
}
.video-card[data-vc-bg].is-paused [data-vc-icon="pause"] {
  opacity: 0;
  transform: scale(0.9);
}

/* ---------------------------------------------------------
   NO-LOOP ENDED STATE
   When [data-vc-no-loop] bg video finishes, it gets .is-ended
--------------------------------------------------------- */
.video-card[data-vc-bg].is-ended [data-vc-icon="play"] {
  opacity: 1;
  transform: scale(1);
}
.video-card[data-vc-bg].is-ended [data-vc-icon="pause"] {
  opacity: 0;
  transform: scale(0.9);
}

/* =========================================================
   VC LIGHTBOX (modal) — stacking-safe
========================================================= */

.vc-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  isolation: isolate;
}

.vc-modal.is-open { display: block; }

.vc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.vc-modal__dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: pointer;
}

.vc-modal__panel {
  width: min(1100px, 92vw);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 70px rgba(0,0,0,0.55);
}

.vc-modal__panel .plyr {
  width: 100%;
  height: 100%;
}

.vc-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.vc-modal__close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.vc-modal__close:focus {
  outline: none;
  box-shadow: none;
}

.vc-modal__close:focus-visible {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

/* Card cursor */
.video-card:not([data-vc-no-cardclick]):is(
  [data-vc-lightbox],
  [data-vc-bg],
  :not([data-vc-bg])
) {
  cursor: pointer;
}

/* Lock scroll when modal open */
html.vc-modal-lock,
body.vc-modal-lock { overflow: hidden !important; }

/* ---------------------------------------------------------
   HOVERLAY — Script-managed Webflow overlay
   JS sets inline styles on [data-vc-hoverlay] elements.
   Inline styles override stylesheet :hover rules.

   IMPORTANT: Remove any existing CSS :hover rules that
   target [data-vc-hoverlay] elements, OR ensure they don't
   use !important on opacity/transform/pointer-events.
--------------------------------------------------------- */
[data-vc-hoverlay] {
  transition: opacity 0.5s ease, transform 0.5s ease !important;
}

/* ---------------------------------------------------------
   REDUCED MOTION
--------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .video-card .vc-poster,
  .video-card video.vc-video,
  .video-card .vc-overlay,
  .video-card [data-vc-toggle] [data-vc-icon],
  [data-vc-hoverlay] {
    transition: none !important;
  }
}
