/* ==========================================
   BFS — ELEMENTOR VIDEO LIGHTBOX
   ========================================== */

/* Lightbox backdrop */

.elementor-lightbox:has(.elementor-video-container) {
  --bfs-lightbox-gutter: 48px;
  --bfs-lightbox-height: calc(100vh - 112px);

  background-color: rgba(0, 0, 0, 0.94);
}

@supports (height: 100dvh) {
  .elementor-lightbox:has(.elementor-video-container) {
    --bfs-lightbox-height: calc(100dvh - 112px);
  }
}

/* ==========================================
   LIGHTBOX LAYOUT
   ========================================== */

.elementor-lightbox:has(.elementor-video-container)
.dialog-lightbox-widget-content {
  width: 100% !important;
  max-width: none !important;
  height: 100%;
  padding: 0;
}

.elementor-lightbox:has(.elementor-video-container)
.dialog-lightbox-message {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100% !important;
  max-width: none !important;
  height: 100%;

  padding: 0 !important;
  box-sizing: border-box;
}

/* ==========================================
   VIDEO CONTAINER
   ========================================== */

.elementor-lightbox .elementor-video-container {
  width: fit-content !important;
  max-width: 100% !important;

  margin: auto;
  padding: 0 !important;

  /*
   * Empty areas allow clicks to pass through
   * to Elementor's native backdrop handler.
   */
  pointer-events: none;
}

/* ==========================================
   RESPONSIVE VIDEO WRAPPER
   ========================================== */

.elementor-lightbox .elementor-video-wrapper {
  position: relative;

  width: min(
    1200px,
    calc(100vw - var(--bfs-lightbox-gutter, 48px)),
    calc(
      var(--bfs-lightbox-height, 80vh) *
      var(--video-aspect-ratio, 1.777778)
    )
  ) !important;

  max-width: 100%;
  height: auto !important;
  max-height: none !important;

  aspect-ratio: var(--video-aspect-ratio, 1.777778);

  padding: 0 !important;
  margin: 0;

  overflow: hidden;
  background: #000;

  /* Keep the actual player fully interactive. */
  pointer-events: auto;
}

/* ==========================================
   VIDEO PLAYER
   ========================================== */

.elementor-lightbox .elementor-video-wrapper iframe,
.elementor-lightbox .elementor-video-wrapper video {
  position: absolute;
  inset: 0;

  display: block;

  width: 100% !important;
  height: 100% !important;

  border: 0;
}

/* ==========================================
   CLOSE BUTTON
   ========================================== */

.elementor-lightbox:has(.elementor-video-container)
.dialog-lightbox-close-button {
  position: absolute;

  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));

  display: flex;
  align-items: center;
  justify-content: center;

  width: 48px;
  height: 48px;

  margin: 0;

  color: #fff;
  background: rgba(255, 255, 255, 0.12);

  border-radius: 50%;
  font-size: 22px;

  opacity: 1;
  z-index: 10;

  cursor: pointer;

  transition: background-color 0.2s ease;
}

.elementor-lightbox:has(.elementor-video-container)
.dialog-lightbox-close-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.elementor-lightbox:has(.elementor-video-container)
.dialog-lightbox-close-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* ==========================================
   MOBILE — FULL-VIEWPORT LIGHTBOX
   ========================================== */

@media (max-width: 767px) {

  .elementor-lightbox:has(.elementor-video-container) {
    --bfs-lightbox-gutter: 0px;

    background-color: #000;
  }

  .elementor-lightbox:has(.elementor-video-container)
  .dialog-lightbox-close-button {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {

  .elementor-lightbox:has(.elementor-video-container)
  .dialog-lightbox-message {
    animation: none !important;
  }

  .elementor-lightbox:has(.elementor-video-container)
  .dialog-lightbox-close-button {
    transition: none;
  }
}