/* PLM reusable video modal - v3: fluid viewport sizing */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  padding: 1rem;
  overflow: hidden;
  isolation: isolate;
  background: color-mix(in srgb, var(--_main-colors---primary, #1a384a) 94%, transparent);
  color: var(--_main-colors---accent-bright, #65eaff);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.video-modal-media {
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  /* Portrait: 65% of viewport height, limited by viewport width */
  width: min(36.5625dvh, 85vw);
  aspect-ratio: 9 / 16;
  height: auto;
  max-height: none;
  overflow: hidden;
  border-radius: 1rem;
  background: #08141d;
  opacity: 0;
}
/* Landscape: 70vw, constrained to 70dvh so gallery controls fit.
   Use a more specific selector to override any old Webflow media widths. */
.video-modal.video-modal.is-landscape .video-modal-media {
  width: min(70vw, 124.444dvh) !important;
  height: auto !important;
  max-width: none;
  max-height: none;
  aspect-ratio: 16 / 9;
}
/* Single videos have no gallery controls, so they can be taller. */
.video-modal.video-modal.is-landscape.is-single .video-modal-media {
  width: min(70vw, 138.667dvh) !important;
}
.video-modal-media iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-zoom-image {
  position: fixed;
  z-index: 10000;
  display: block;
  margin: 0;
  object-fit: cover;
  border-radius: 1rem;
  pointer-events: none;
  will-change: left, top, width, height, opacity;
}
.video-modal-close,
.video-modal-prev,
.video-modal-next {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  width: 3rem;
  height: 3rem;
  color: var(--_main-colors---accent-bright, #65eaff);
  border: 1px solid var(--_main-colors---accent, #3da5d9);
  border-radius: 50%;
  background: color-mix(in srgb, var(--_main-colors---primary, #1a384a) 75%, transparent);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 200ms ease;
}
.video-modal-close { position: absolute; top: 1.5rem; right: 1.5rem; }
.video-modal-prev,
.video-modal-next { position: absolute; top: 50%; transform: translateY(-50%); }
.video-modal-prev { left: max(1rem, calc(50% - 280px)); }
.video-modal-next { right: max(1rem, calc(50% - 280px)); }
/* Place landscape controls outside the fluid player when space permits. */
.video-modal.is-landscape .video-modal-prev { left: max(0.5rem, calc(50% - min(35vw, 62.222dvh) - 4rem)); }
.video-modal.is-landscape .video-modal-next { right: max(0.5rem, calc(50% - min(35vw, 62.222dvh) - 4rem)); }
.video-modal-close:hover,
.video-modal-prev:hover,
.video-modal-next:hover { background: color-mix(in srgb, var(--_main-colors---accent, #3da5d9) 30%, transparent); }
.video-modal-thumbnails {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  z-index: 2;
}
.video-gallery-thumb {
  position: relative;
  flex: 0 0 auto;
  width: clamp(42px, 4vw, 60px);
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 0.5rem;
  background: var(--_main-colors---primary, #1a384a);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 200ms ease, border-color 200ms ease;
}
.video-gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-gallery-thumb:hover,
.video-gallery-thumb.is-active { opacity: 1; }
.video-gallery-thumb.is-active { border-color: var(--_main-colors---accent-bright, #65eaff); }
.video-modal-dots {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.video-gallery-dot {
  width: 0.65rem;
  height: 0.65rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--_main-colors---accent-bright, #65eaff) 35%, transparent);
  cursor: pointer;
}
.video-gallery-dot.is-active { background: var(--_main-colors---accent-bright, #65eaff); }
/* A single video has no gallery navigation. */
.video-modal.is-single .video-modal-prev,
.video-modal.is-single .video-modal-next,
.video-modal.is-single .video-modal-thumbnails,
.video-modal.is-single .video-modal-dots {
  display: none !important;
}
.video-modal button:focus-visible {
  outline: 2px solid var(--_main-colors---accent-bright, #65eaff);
  outline-offset: 3px;
}
@media (max-width: 767px) {
  .video-modal { width: 100vw; height: 100dvh; padding: 0; }
  .video-modal-media {
    width: min(36.5625dvh, 85vw);
    max-width: none;
    max-height: none;
    margin: -4dvh auto 0;
    flex-shrink: 0;
    transform: none;
  }
  /* Landscape on narrow screens: fill most of the available width. */
  .video-modal.video-modal.is-landscape .video-modal-media {
    width: min(94vw, 124.444dvh) !important;
    max-width: none;
    max-height: none;
    aspect-ratio: 16 / 9;
    margin-top: -3dvh;
  }
  .video-modal.video-modal.is-landscape.is-single .video-modal-media {
    width: min(94vw, 138.667dvh) !important;
  }
  .video-modal-thumbnails { display: none; }
  .video-modal-dots { display: flex; bottom: max(1.5rem, env(safe-area-inset-bottom)); }
  .video-modal-prev,
  .video-modal-next { width: 2.5rem; height: 2.5rem; }
  .video-modal-prev,
  .video-modal.is-landscape .video-modal-prev { left: 0.5rem; }
  .video-modal-next,
  .video-modal.is-landscape .video-modal-next { right: 0.5rem; }
  .video-modal-close { top: max(1rem, env(safe-area-inset-top)); right: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .video-gallery-thumb,
  .video-modal-close,
  .video-modal-prev,
  .video-modal-next { transition: none; }
}
