/* woocommerce single product template */
.woocommerce-product-gallery-video {
    display: block;
    width: 100%;
    height: 0;
    /* Square unless scripts.js found the photos' proportions (--mpvw-ratio-pad). */
    padding: 0 0 var(--mpvw-ratio-pad, 100%);
    margin: 0;
    position: relative;
}

/*  when flexslider disabled */
.woocommerce-product-gallery__video {
    width: 25%;
    display: inline-block;
}

.woocommerce-product-gallery-video__player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.woocommerce-product-gallery-video__player > video {
    display: block;
    width: 100%;
    height: 100%;
}

/* popup for video */
.mpvw-thumbnail {
    position: relative;
    cursor: pointer;
}

/* Source for the WooCommerce lightbox only. Themes often set `video { display: block }`,
   which beats the [hidden] attribute, so hide it explicitly. */
.mpvw-lightbox-source {
    display: none !important;
}

/* The poster slide takes the photos' proportions, so the gallery keeps its height. */
.woocommerce-product-gallery__image--mpvw .mpvw-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--mpvw-ratio, auto);
    object-fit: cover;
}

/* play badge on the video thumbnail in flexslider nav (class set by JS,
   so it follows the video wherever it sits — start or end) */
.flex-control-thumbs li.mpvw-video-thumb,
.flexy-pills li.mpvw-video-thumb {
    position: relative;
}

.flex-control-thumbs li.mpvw-video-thumb:before,
.flexy-pills li.mpvw-video-thumb:before,
.mpvw-thumbnail:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-left: 1.3rem solid #fff;
    border-top: 1rem solid transparent;
    border-bottom: 1rem solid transparent;
    z-index: 1;
    pointer-events: none;
}

.mpvw-video-container {
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 1);
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.mpvw-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.mpvw-video-container button.mpvw-video-container__button {
    background-color: transparent;
    background-position: 0 -2.75rem;
    background-repeat: no-repeat;
    background-size: 16.5rem 5.5rem;
    width: 2.75rem;
    height: 2.75rem;
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    border: none;
    cursor: pointer;
    z-index: 10000;
}

.video-js {
    background: transparent;
}


/* Product loop (shop / archive): a square aspect box (matching the default
   WooCommerce product thumbnail) holding the original image with the video
   overlaid on top. Self-contained so it doesn't depend on theme/block
   container heights. */
.mpvw-loop-video {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.mpvw-loop-video img,
.mpvw-loop-video__el {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Blocksy: the card's own image (in .ct-media-container, at the shop's image ratio) sizes the box, so a card
   with a video is as tall as the others. */
.mpvw-loop-video:has(> .ct-media-container) {
    aspect-ratio: auto;
}

.mpvw-loop-video > .ct-media-container img {
    position: static;
    height: auto;
}

/* Gallery without a slider: the video is a tile in the list, its poster with a play mark;
   it plays in the lightbox. The poster takes the photos' proportions (--mpvw-ratio). */
.woocommerce-product-gallery__image--mpvw .mpvw-tile {
    position: relative;
    display: block;
}

.woocommerce-product-gallery__image--mpvw .mpvw-tile__poster {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: var(--mpvw-ratio, auto);
    object-fit: cover;
}

.woocommerce-product-gallery__image--mpvw .mpvw-tile__play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.75rem;
    height: 2.75rem;
    margin: -1.375rem 0 0 -1.375rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 0 0 .3rem rgba(255, 255, 255, .25), 0 .5rem 1rem -.4rem rgba(0, 0, 0, .6);
    pointer-events: none;
}

.woocommerce-product-gallery__image--mpvw .mpvw-tile__play::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -.5rem 0 0 -.28rem;
    border-left: .85rem solid #20113d;
    border-top: .55rem solid transparent;
    border-bottom: .55rem solid transparent;
}

/* Blocksy: the video is a slide of the theme's own slider (includes/blocksy.php). The poster image keeps
   the slide the size of the photos; the player covers it. */
.mpvw-blocksy-slide {
    position: relative;
}

/* The poster under the player only sizes the slide (it would show at the edges of a video that does not fill it). */
.mpvw-blocksy-slide > img {
    visibility: hidden;
}

.mpvw-blocksy-slide > .woocommerce-product-gallery__image--mpvw {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.mpvw-blocksy-slide .woocommerce-product-gallery-video {
    height: 100%;
    padding: 0;
}

.mpvw-blocksy-slide .mpvw-thumbnail,
.mpvw-blocksy-slide .woocommerce-product-gallery__image--mpvw .mpvw-thumbnail img {
    height: 100%;
}
