/*
 * .video-facade — block acf/video-facade: poster + Play, the player after
 * the click (blocks/video-facade/render.php, video-facade.js).
 * Figma: Article D 337:10855 (926 × 500) / M 337:10563 (335 × 340).
 *
 * The block sits in a .nv-block wrapper, so .rich-text leaves it alone; the
 * caption repeats the image caption pill of rich-text.css (Figma 337:10816).
 */

.video-facade {
  position: relative;
  margin: 0;
}

/* .video-facade__media — fixed frame: almost square on phones, 926 × 500 from 768 px */
.video-facade__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 335 / 340;
  border-radius: var(--nv-radius-m);
  background-color: var(--nv-navy);

  /* @media (width >= 48em) .video-facade__media */
  @media (width >= 48em) {
    aspect-ratio: 926 / 500;
  }
}

/* .video-facade--playing .video-facade__media — 16:9 for the player at every width */
.video-facade--playing .video-facade__media {
  aspect-ratio: 16 / 9;
}

/* .video-facade__poster — fills the frame */
.video-facade__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .video-facade__play — the whole poster is the link; 110 px Play in the middle */
.video-facade__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  /* .video-facade__play::before */
  &::before {
    content: "";
    width: 6.875rem;
    height: 6.875rem;
    border-radius: 50%;
    background: url("../../img/icons/play-circle.svg") center / contain no-repeat;

    /* @media (prefers-reduced-motion: no-preference) .video-facade__play::before */
    @media (prefers-reduced-motion: no-preference) {
      transition: transform 0.2s ease;
    }
  }

  /* .video-facade__play:hover::before, .video-facade__play:focus-visible::before */
  &:hover::before,
  &:focus-visible::before {
    transform: scale(1.08);
  }

  /* .video-facade__play:focus-visible */
  &:focus-visible {
    outline: none;
  }

  /* .video-facade__play:focus-visible::before */
  &:focus-visible::before {
    outline: 0.1875rem solid var(--nv-blue-light);
    outline-offset: 0.25rem;
  }
}

/* .video-facade__frame — the player iframe */
.video-facade__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* .video-facade--playing .video-facade__caption — out of the player's controls */
.video-facade--playing .video-facade__caption {
  display: none;
}

/* .video-facade__caption — frosted pill on the poster, as image captions */
.video-facade__caption {
  position: absolute;
  bottom: clamp(0.625rem, 0.4028rem + 0.9479vw, 1.25rem);
  left: clamp(0.625rem, 0.4028rem + 0.9479vw, 1.25rem);
  z-index: 1;
  isolation: isolate;
  max-width: calc(100% - 2 * clamp(0.625rem, 0.4028rem + 0.9479vw, 1.25rem));
  border-radius: var(--nv-radius-pill);
  padding: 0.9375rem;
  color: var(--nv-navy);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: -0.02em;
  pointer-events: none;

  /* .video-facade__caption::before — blur on a pseudo-element: Safari fades backdrop-filter on a rounded box */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(0.625rem);
  }
}

