/*
 * Welcome Video popup (assets/js/welcome-video.js).
 *
 * Sits below Popup Maker (z-index ~2,000,000,000) and above the theme's
 * header. Not below every dialog — the Terms Popup on User Login box is at
 * 1050 — so the script, not the stacking order, is what keeps it from
 * covering them: it waits until they close.
 */

html.ftm-wv-open {
  overflow: hidden;
}

.ftm-wv[hidden] {
  display: none;
}

.ftm-wv {
  position: fixed;
  inset: 0;
  z-index: 999990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ftm-wv__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.ftm-wv__dialog {
  position: relative;
  width: min(960px, 100%);
}

/* 16:9 at any width. */
.ftm-wv__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

@supports not (aspect-ratio: 16 / 9) {
  .ftm-wv__frame {
    height: 0;
    padding-top: 56.25%;
  }
}

.ftm-wv__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Above the video, set in from its corner so it reads as its own control. */
.ftm-wv__close {
  position: absolute;
  top: -56px;
  right: 0px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

/* The × is two drawn bars rather than a text character, which sits off
   centre by a different amount in every font. */
.ftm-wv__close::before,
.ftm-wv__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  margin: -1px 0 0 -9px;
  border-radius: 1px;
  background: #fff;
  transform: rotate(45deg);
}

.ftm-wv__close::after {
  transform: rotate(-45deg);
}

.ftm-wv__close:hover,
.ftm-wv__close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Phones held sideways: no room above the video, so the button sits inside
   its corner instead. Upright phones have room and keep it above. */
@media (max-height: 500px) {
  .ftm-wv__close {
    top: 8px;
    right: 8px;
    z-index: 1;
    background: rgba(0, 0, 0, 0.6);
  }
}
