/* Product video card — inc/modules/product-video-card.php */
.wdpv-card {
    --wdpv-brand: #825c8d;
    --wdpv-surface: #fff;
    --wdpv-shade: rgba(0, 0, 0, .6);
    --wdpv-width: 110px;
    --wdpv-ratio: 9 / 16;
    position: absolute;
    z-index: 7;
    width: var(--wdpv-width);
    aspect-ratio: var(--wdpv-ratio);
}

.single-product .wd-gallery-images > .wd-carousel-inner {
    position: relative;
}

.wdpv-card.wdpv-landscape {
    --wdpv-width: 170px;
    --wdpv-ratio: 16 / 9;
}

.wdpv-card[hidden] {
    display: none !important;
}

.wdpv-pos-bottom-right { right: 15px; bottom: 15px; }
.wdpv-pos-bottom-left { left: 15px; bottom: 15px; }
.wdpv-pos-top-right { right: 15px; top: 15px; }
.wdpv-pos-top-left { left: 15px; top: 15px; }

/* The theme share button lives in the inline-start top corner. */
.rtl .wdpv-pos-top-right,
body:not(.rtl) .wdpv-pos-top-left {
    top: 70px;
}

.wdpv-card .wdpv-open {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 2px solid var(--wdpv-surface);
    border-radius: 14px;
    background: var(--wdpv-brand);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

.wdpv-card .wdpv-open:focus-visible,
.wdpv-card .wdpv-dismiss:focus-visible {
    outline: 3px solid var(--wdpv-brand);
    outline-offset: 2px;
}

.wdpv-card .wdpv-poster,
.wdpv-preview video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.wdpv-preview {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.wdpv-card.is-playing .wdpv-preview {
    opacity: 1;
}

/* YouTube lays out badly below 200px: render large, scale down. */
.wdpv-preview iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 300%;
    height: 300%;
    max-width: none;
    border: 0;
    transform: scale(.33334);
    transform-origin: 0 0;
}

.wdpv-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--wdpv-surface);
    color: var(--wdpv-brand);
    transform: translate(-50%, -50%);
}

.wdpv-card.is-playing .wdpv-play {
    display: none;
}

.wdpv-text {
    position: absolute;
    inset: auto 0 0;
    padding: 14px 6px 6px;
    background: linear-gradient(transparent, var(--wdpv-shade));
    color: var(--wdpv-surface);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.wdpv-card .wdpv-dismiss {
    position: absolute;
    top: -10px;
    inset-inline-end: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 0;
    height: 28px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--wdpv-surface);
    color: #333;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
    cursor: pointer;
}

/* Enlarge the × touch target to 44px without enlarging the circle. */
.wdpv-card .wdpv-dismiss::after {
    content: "";
    position: absolute;
    inset: -8px;
}

.wdpv-dialog {
    width: min(94vw, 394px);
    max-width: none;
    height: auto;
    max-height: 90vh;
    aspect-ratio: 9 / 16;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 14px;
    background: #000;
}

.wdpv-dialog.wdpv-landscape {
    width: min(94vw, 960px);
    aspect-ratio: 16 / 9;
}

.wdpv-dialog::backdrop {
    background: rgba(0, 0, 0, .75);
}

.wdpv-dialog iframe,
.wdpv-dialog video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 14px;
    object-fit: contain;
}

.wdpv-dialog .wdpv-dialog-close {
    position: absolute;
    top: -14px;
    inset-inline-end: -6px;
    z-index: 1;
    width: 44px;
    min-width: 0;
    height: 44px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.wdpv-dialog .wdpv-dialog-close:focus-visible {
    outline: 3px solid #825c8d;
    outline-offset: 2px;
}

/* Theme buttons. */
.wdpv-hide-title-all:not(.wdpv-dismissed) .single-product-page:not(.product-quick-view) .product-title-row .product-video-button {
    display: none !important;
}

body.wdpv-show-gallery-button .product-additional-galleries .product-video-button.wd-gallery-btn.wd-action-btn.wd-style-icon-bg-text.wd-play-icon {
    display: flex;
}

@media (min-width: 769px) {
    .wdpv-on-mobile {
        display: none;
    }

    .wdpv-hide-title-desktop:not(.wdpv-dismissed) .single-product-page:not(.product-quick-view) .product-title-row .product-video-button {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .wdpv-card {
        --wdpv-width: 84px;
    }

    .wdpv-card.wdpv-landscape {
        --wdpv-width: 130px;
    }

    .wdpv-on-desktop {
        display: none;
    }

    /* Clear the smart fitting button (scripts.js: bottom 20px, full width). */
    .wdpv-pos-bottom-right,
    .wdpv-pos-bottom-left {
        bottom: 84px;
    }

    .wdpv-text {
        font-size: 11px;
    }

    .wdpv-hide-title-mobile:not(.wdpv-dismissed) .single-product-page:not(.product-quick-view) .product-title-row .product-video-button {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wdpv-preview {
        transition: none;
    }
}
