:root {
  --aw-yt-popup-max-width: 1100px;
  --aw-yt-popup-radius: 14px;
  --aw-yt-popup-overlay: rgba(0, 0, 0, 0.88);
  --aw-yt-popup-close-bg: #fff;
  --aw-yt-popup-close-color: #111;
}

html.aw-yt-popup-lock,
body.aw-yt-popup-lock {
  overflow: hidden !important;
}

.aw-yt-popup {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 56px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
  box-sizing: border-box;
}

.aw-yt-popup *,
.aw-yt-popup *::before,
.aw-yt-popup *::after {
  box-sizing: border-box;
}

.aw-yt-popup--open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.aw-yt-popup__backdrop {
  position: absolute;
  inset: 0;
  background: var(--aw-yt-popup-overlay);
  cursor: pointer;
}

.aw-yt-popup__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, var(--aw-yt-popup-max-width));
  outline: 0;
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition: transform 220ms ease, opacity 180ms ease;
}

.aw-yt-popup--open .aw-yt-popup__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.aw-yt-popup__media {
  width: 100%;
  overflow: hidden;
  border-radius: var(--aw-yt-popup-radius);
  background: #000;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.aw-yt-popup__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.aw-yt-popup--portrait .aw-yt-popup__dialog {
  width: min(100%, 520px);
  max-height: calc(100vh - 40px);
}

.aw-yt-popup--portrait .aw-yt-popup__frame {
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 40px);
}

.aw-yt-popup__frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.aw-yt-popup__close {
  position: absolute;
  top: -18px;
  right: -18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--aw-yt-popup-close-bg);
  color: var(--aw-yt-popup-close-color);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
  font: 400 34px/1 Arial, sans-serif;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.aw-yt-popup__close span {
  display: block;
  margin-top: -3px;
}

.aw-yt-popup__close:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
}

.aw-yt-popup__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 767px) {
  .aw-yt-popup {
    padding: 22px 14px;
  }

  .aw-yt-popup__close {
    top: -16px;
    right: -4px;
    width: 40px;
    height: 40px;
    font-size: 30px;
  }

  .aw-yt-popup--portrait .aw-yt-popup__dialog {
    width: min(88vw, 430px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aw-yt-popup,
  .aw-yt-popup__dialog,
  .aw-yt-popup__close {
    transition: none !important;
  }
}
