/**
 * Product videos in the single-product gallery.
 * Loaded only on product pages that have videos (inc/ms-shop-product-video.php).
 */

/* Slide: square frame, same height as the image slides (see style.css). */
.ms-shop-video-slide__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #0b1726;
}
.ms-shop-video-slide img {
  height: 100% !important;
}

.ms-shop-video-slide__poster,
.ms-shop-video-slide__video,
.ms-shop-video-slide__player,
.ms-shop-video-slide__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
}

/* 16:9 posters sit centred in the square frame instead of being cropped. */
.ms-shop-video-slide__poster {
  object-fit: contain;
}

.ms-shop-video-slide__video {
  object-fit: contain;
  background: #000;
}

.ms-shop-video-slide__player:empty {
  display: none;
}

/* Play button (slide and lightbox) */
.ms-shop-video-slide__play,
.ms-shop-pswp-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0;
  padding: 0 0 0 4px; /* optically centre the triangle */
  border: 0;
  border-radius: 50%;
  background: rgba(8, 18, 37, 0.72);
  color: #fff;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.ms-shop-video-slide__play:hover,
.ms-shop-video-slide__play:focus-visible,
.ms-shop-pswp-video__play:hover,
.ms-shop-pswp-video__play:focus-visible {
  background: rgba(8, 18, 37, 0.9);
  color: #fff;
  transform: translate(-50%, -50%) scale(1.06);
}

.ms-shop-video-slide__play:focus-visible,
.ms-shop-pswp-video__play:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ms-shop-video-slide.is-playing .ms-shop-video-slide__poster,
.ms-shop-video-slide.is-playing .ms-shop-video-slide__play {
  display: none;
}

/* Thumbnail strip: play overlay on video thumbnails */
.woocommerce-product-gallery .flex-control-thumbs li.ms-shop-video-thumb {
  position: relative;
}

.woocommerce-product-gallery
  .flex-control-thumbs
  li.ms-shop-video-thumb::before,
.woocommerce-product-gallery
  .flex-control-thumbs
  li.ms-shop-video-thumb::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
}

.woocommerce-product-gallery
  .flex-control-thumbs
  li.ms-shop-video-thumb::before {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 18, 37, 0.72);
  transform: translate(-50%, -50%);
}

.woocommerce-product-gallery
  .flex-control-thumbs
  li.ms-shop-video-thumb::after {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-35%, -50%);
}

/* Lightbox (PhotoSwipe html item) */
.ms-shop-pswp-video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ms-shop-pswp-video__poster {
  display: block;
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
}

@media (prefers-reduced-motion: reduce) {
  .ms-shop-video-slide__play,
  .ms-shop-pswp-video__play {
    transition: none;
  }
}
