/* Product page: videos in the product gallery (components/product_gallery.php + gallery.js).
   Loaded after styles.css, builds on .main-image-slide / .lightbox-slide / .gallery-thumbs / .lightbox-thumbs. */

/* A video slide behaves like a picture slide: sized like .main-image-slide img (fits the slide,
   no letterbox bars, transparent background), click opens the lightbox. No native controls —
   gallery.js plays on hover / when the slide is the active one and loops. */
.main-video {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: transparent;
    cursor: zoom-in;
}

/* Mute/unmute toggle, top-right of the page gallery picture (bottom-right in the lightbox, see below); gallery.js un-hides it only on video slides. */
.gallery-mute {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.gallery-mute[hidden] {
    display: none;
}

.gallery-mute .icon-sound-off,
.gallery-mute.is-muted .icon-sound-on {
    display: none;
}

.gallery-mute.is-muted .icon-sound-off {
    display: block;
}

/* In the lightbox the modal's close button floats over the card's top-right corner, so the mute
   button sits bottom-right of the picture instead (the counter is bottom-left). */
.lightbox-image-wrap .gallery-mute {
    top: auto;
    bottom: 12px;
    right: 12px;
}

/* Inside the lightbox it is already shown large; sizing comes from .lightbox-content. */
.lightbox-video {
    background: transparent;
    cursor: default;
    /* A video is its own compositor layer; at a fractional size/position (depends on the window
       size) its outer pixel row/column can bleed black onto the white card. A white outline
       (from 1px inside to 2px outside the box, painted above the video) covers that on every
       side without clipping the picture. The lightbox card is white, so it is invisible. */
    outline: 3px solid #fff;
    outline-offset: -1px;
}

/* Thumbnail of a video: the poster with a play badge on top. The wrapper only exists for videos,
   so picture thumbs keep their exact markup. */
.thumb-video-wrap {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.thumb-video-wrap .thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.thumb-video-wrap .thumb-play svg {
    width: 14px;
    height: 14px;
    margin-left: 2px;
}

/* .lightbox-thumbs img:first-child clears the modal's close button; with a wrapper that job moves up a level. */
.lightbox-thumbs .thumb-video-wrap img:first-child {
    margin-top: 0;
}

.lightbox-thumbs > .thumb-video-wrap:first-child {
    margin-top: 40px;
}

@media (max-width: 900px) {
    .lightbox-thumbs > .thumb-video-wrap:first-child {
        margin-top: 0;
    }
}
