/**
 * @file
 * Shared video thumbnail: image, hover play icon + scrim, duration badge.
 *
 * Hover and focus are read from the nearest .rn-video-thumb-host, so a whole
 * card or tile reveals the icon, not just the image.
 */

.rn-video-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e5e7eb;
}

.rn-video-thumb__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 300ms ease, transform 400ms ease;
}

/* Set by video-thumbnail.js until the image arrives, so it fades in. */
.rn-video-thumb__img.is-loading {
  opacity: 0;
}

/* Scrim keeps the white icon readable on bright thumbnails. */
.rn-video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 200ms ease;
}

.rn-video-thumb__play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%) scale(0.85);
  background: url(../../assets/images/video-card-play.svg) center / 44px 44px no-repeat;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
}

.rn-video-thumb-host:hover .rn-video-thumb::after,
.rn-video-thumb-host:focus-visible .rn-video-thumb::after,
.rn-video-thumb-host:focus-within .rn-video-thumb::after {
  background: rgba(0, 0, 0, 0.2);
}

.rn-video-thumb-host:hover .rn-video-thumb__play,
.rn-video-thumb-host:focus-visible .rn-video-thumb__play,
.rn-video-thumb-host:focus-within .rn-video-thumb__play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.rn-video-thumb-host:hover .rn-video-thumb__img {
  transform: scale(1.03);
}

.rn-video-thumb__duration {
  position: absolute;
  right: 8px;
  bottom: 7px;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  background: rgba(18, 18, 18, 0.7);
  font-family: Poppins, sans-serif;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: #fff;
}

/* Touch screens have no hover, so a hover-only icon would never show. */
@media (hover: none) {
  .rn-video-thumb::after {
    background: rgba(0, 0, 0, 0.1);
  }

  .rn-video-thumb__play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rn-video-thumb__img,
  .rn-video-thumb__play,
  .rn-video-thumb::after {
    transition: none;
  }

  .rn-video-thumb-host:hover .rn-video-thumb__img {
    transform: none;
  }
}
