/* A video from the channel (`VideosHelper#youtube_video_tag`): its poster
   with a play button until the reader presses it, then YouTube's player in
   the same 16:9 frame, and a caption under it. Shared by the guides and the
   marketing pages. */

@layer components {
  /* At zero specificity: the page placing a video sets its margins and
     width (`.guide-video`, `.mpage-video`), and this file loads after theirs. */
  :where(.video) {
    margin: 0;
    min-inline-size: 0;
  }

  .video__poster,
  .video__frame {
    aspect-ratio: 16 / 9;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    box-sizing: border-box;
    display: block;
    inline-size: 100%;
  }

  .video__poster {
    overflow: hidden;
    position: relative;

    &:hover .video__play,
    &:focus-visible .video__play {
      background: var(--color-brand-fill-strong);
      transform: translate(-50%, -50%) scale(1.06);
    }

    &:focus-visible {
      box-shadow: var(--shadow-focus);
      outline: none;
    }
  }

  .video__image {
    block-size: 100%;
    display: block;
    inline-size: 100%;
    object-fit: cover;
  }

  .video__play {
    align-items: center;
    background: var(--color-brand-fill);
    block-size: 4rem;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lifted);
    color: var(--color-ink-inverted);
    display: flex;
    inline-size: 4rem;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    justify-content: center;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: background 150ms ease, transform 150ms ease;

    /* The glyph's triangle sits left of its box's centre; nudge it so the
       button reads as centred. */
    & .icon {
      margin-inline-start: 0.1875rem;
    }
  }

  .video__caption {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-block-start: 0.75rem;
  }

  .video__title {
    color: var(--color-ink);
    font-weight: 600;
    line-height: 1.35;
  }

  .video__summary {
    color: var(--color-ink-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
  }
}
