/**
 * Front office styles of the product video.
 *
 * The rules that hide the photo and the zoom layer are sibling selectors rather
 * than :has(), because the hook renders the video as the first child of
 * .product-cover and everything it has to hide comes after it. That keeps the
 * whole switch working without JavaScript and without support for :has().
 */

/**
 * The frame keeps the shape of the large product photo, because the hook prints
 * the size of that image type onto the element and height: auto turns it into a
 * ratio. object-fit then fits a vertical reel inside that shape instead of
 * letting it stretch the page - a 9:16 clip in a square frame would otherwise
 * stand nearly twice as tall as the photo it replaces. What is left over shows
 * as bars in the same white the gallery already uses behind photos.
 */
.product-cover .js-noi-product-video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #fff;
}

.product-cover .js-noi-product-video:not(.is-active) {
    display: none;
}

.product-cover .js-noi-product-video.is-active ~ picture {
    display: none;
}

/**
 * The zoom layer opens a modal built out of the product photos, which the video
 * is not part of. Leaving it reachable over a playing video would take the
 * customer to an enlargement of something they were not looking at.
 */
.product-cover .js-noi-product-video.is-active ~ .layer {
    display: none;
}

/**
 * vertical-align matches what the theme sets on its photo thumbnails. Without
 * it the tile sits on the text baseline while the photos sit on their middle,
 * which puts the video roughly half a tile above the rest of the strip.
 */
.noi-video-thumb {
    position: relative;
    display: inline-block;
    line-height: 0;
    vertical-align: middle;
}

/**
 * The tile is sized by the width and height attributes the hook prints on it,
 * taken from the shop's own thumbnail image type - this theme sizes its photo
 * thumbnails the same way and gives them no size in CSS at all. object-fit
 * crops a vertical reel into that square instead of squashing it, and the
 * max-width is a guard: if the shop ever had no such image type, the tile would
 * fall back to the intrinsic size of the video, and that must not be allowed to
 * push the photo thumbnails out of the strip.
 */
.noi-video-thumb-media {
    max-width: 100%;
    object-fit: cover;
}

/**
 * The play triangle is drawn with borders instead of an icon font or an image,
 * so the tile needs no asset of its own and cannot be left without its marker
 * when a font fails to load.
 */
.noi-video-thumb::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    margin: -0.5rem 0 0 -0.25rem;
    content: "";
    border-top: 0.5rem solid transparent;
    border-bottom: 0.5rem solid transparent;
    border-left: 0.75rem solid #fff;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
    pointer-events: none;
}
