/**
 * Post video gallery / listing-popup styles.
 * Deferred: not in first-paint header CSS. Loaded when opening the image popup
 * or when rendering a single-ad gallery that may include video.
 */

/* Clip on the wrapper — native <video> + controls often ignore border-radius. */
.popup-video-wrap,
.slider-item--video,
.single-post-lightbox__slide--video {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    -webkit-border-radius: 10px;
    overflow: hidden;
    transform: translateZ(0);
    background: #000;
}

.single-post-gallery-col .slider-item--video {
    border-radius: 8px;
    -webkit-border-radius: 8px;
    width: 100%;
    aspect-ratio: 3 / 4;
}

/*
 * Listing popup: same footprint as a full-width photo (JS sets height to the
 * tallest image in the gallery). Absolute video so the clip cannot shrink the box.
 */
#imageModal .popup-video-wrap {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 3 / 4;
    max-height: none;
    height: auto;
}

.container-single-post .slick-slide video,
#imageModal .slick-slide video,
#imageModal .popup-video-wrap video,
.single-post-gallery-col .slider-item--video video,
.single-post-lightbox__slide--video video {
    border-radius: inherit;
    -webkit-border-radius: inherit;
    display: block;
    -webkit-tap-highlight-color: transparent;
    background: #000;
}

#imageModal .popup-video-wrap video {
    position: absolute;
    inset: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.single-post-gallery-col .slider-item--video video {
    width: auto !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Lightbox: keep intrinsic aspect ratio (same as photos) — never force landscape */
.single-post-lightbox__slide--video video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    object-fit: contain;
}

/* Centered red YouTube-style play — icon only, no text label.
   Bottom inset keeps native media controls clickable. */
.post-video-play-facade {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 3.1rem;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: inherit;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    color: #ff0000;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.post-video-play-facade__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2.4rem, 8vmin, 3.4rem);
    line-height: 1;
    color: #ff0000;
    pointer-events: none;
    filter: drop-shadow(0 3px 14px rgba(0, 0, 0, 0.55));
}
.post-video-play-facade__icon .ui-icon--youtube-play {
    width: 1.15em;
    height: 1.15em;
    color: #ff0000;
    display: block;
}
.post-video-play-facade__text {
    display: none !important;
}

/* While playing, let the mouse hit the <video> so native controls appear. */
.popup-video-wrap.is-playing .post-video-play-facade,
.slider-item--video.is-playing .post-video-play-facade,
.single-post-lightbox__slide--video.is-playing .post-video-play-facade {
    pointer-events: none !important;
}
.popup-video-wrap.is-playing .post-video-play-facade__icon,
.slider-item--video.is-playing .post-video-play-facade__icon,
.single-post-lightbox__slide--video.is-playing .post-video-play-facade__icon,
.videos-card__media.is-playing .post-video-play-facade__icon {
    opacity: 0;
    visibility: hidden;
}

#imageModal video,
.single-post-gallery-col video,
.single-post-lightbox video,
.popup-video-wrap video,
.slider-item--video video {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Native bar stays the browser’s own buttons.
   WebKit’s “panel” is often the FULL video overlay — never fill that with black.
   Darken only a bottom strip behind the white controls. */
#imageModal video::-webkit-media-controls,
.single-post-gallery-col video::-webkit-media-controls,
.single-post-lightbox video::-webkit-media-controls,
.popup-video-wrap video::-webkit-media-controls,
.slider-item--video video::-webkit-media-controls,
#imageModal video::-webkit-media-controls-overlay-enclosure,
.single-post-gallery-col video::-webkit-media-controls-overlay-enclosure,
.single-post-lightbox video::-webkit-media-controls-overlay-enclosure,
.popup-video-wrap video::-webkit-media-controls-overlay-enclosure,
.slider-item--video video::-webkit-media-controls-overlay-enclosure,
#imageModal video::-webkit-media-controls-enclosure,
.single-post-gallery-col video::-webkit-media-controls-enclosure,
.single-post-lightbox video::-webkit-media-controls-enclosure,
.popup-video-wrap video::-webkit-media-controls-enclosure,
.slider-item--video video::-webkit-media-controls-enclosure {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#imageModal video::-webkit-media-controls-panel,
.single-post-gallery-col video::-webkit-media-controls-panel,
.single-post-lightbox video::-webkit-media-controls-panel,
.popup-video-wrap video::-webkit-media-controls-panel,
.slider-item--video video::-webkit-media-controls-panel {
    background-color: transparent !important;
    background-image: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0,
        rgba(0, 0, 0, 0.82) 3.5rem,
        rgba(0, 0, 0, 0) 3.5rem
    ) !important;
    color: #fff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
#imageModal video::-webkit-media-controls-current-time-display,
#imageModal video::-webkit-media-controls-time-remaining-display,
.single-post-gallery-col video::-webkit-media-controls-current-time-display,
.single-post-gallery-col video::-webkit-media-controls-time-remaining-display,
.single-post-lightbox video::-webkit-media-controls-current-time-display,
.single-post-lightbox video::-webkit-media-controls-time-remaining-display,
.popup-video-wrap video::-webkit-media-controls-current-time-display,
.popup-video-wrap video::-webkit-media-controls-time-remaining-display,
.slider-item--video video::-webkit-media-controls-current-time-display,
.slider-item--video video::-webkit-media-controls-time-remaining-display {
    color: #fff !important;
    text-shadow: none;
}
#imageModal video::-webkit-media-controls-enclosure,
.single-post-gallery-col video::-webkit-media-controls-enclosure,
.single-post-lightbox video::-webkit-media-controls-enclosure,
.popup-video-wrap video::-webkit-media-controls-enclosure,
.slider-item--video video::-webkit-media-controls-enclosure {
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
}

.popup-video-wrap:fullscreen,
.popup-video-wrap:-webkit-full-screen,
.slider-item--video:fullscreen,
.slider-item--video:-webkit-full-screen,
.single-post-lightbox__slide--video:fullscreen,
.single-post-lightbox__slide--video:-webkit-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}
.popup-video-wrap:fullscreen video,
.popup-video-wrap:-webkit-full-screen video,
.slider-item--video:fullscreen video,
.slider-item--video:-webkit-full-screen video,
.single-post-lightbox__slide--video:fullscreen video,
.single-post-lightbox__slide--video:-webkit-full-screen video {
    width: auto !important;
    height: auto !important;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
}
video:fullscreen,
video:-webkit-full-screen,
video:-moz-full-screen {
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: #000 !important;
}
video::-internal-media-controls-download-button,
video::-webkit-media-controls-download-button {
    display: none !important;
}

/* Safari: hide the giant overlay play disc only — keep the native bottom bar.
   Chrome does not paint this disc, so this is a no-op there. */
#imageModal video::-webkit-media-controls-start-playback-button,
#imageModal video::-webkit-media-controls-overlay-play-button,
.single-post-gallery-col video::-webkit-media-controls-start-playback-button,
.single-post-gallery-col video::-webkit-media-controls-overlay-play-button,
.single-post-lightbox video::-webkit-media-controls-start-playback-button,
.single-post-lightbox video::-webkit-media-controls-overlay-play-button,
.popup-video-wrap video::-webkit-media-controls-start-playback-button,
.popup-video-wrap video::-webkit-media-controls-overlay-play-button,
.slider-item--video video::-webkit-media-controls-start-playback-button,
.slider-item--video video::-webkit-media-controls-overlay-play-button,
.videos-card__media video::-webkit-media-controls-start-playback-button,
.videos-card__media video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    background-image: none !important;
    color: transparent !important;
    overflow: hidden !important;
}

/* Apple WebKit: hide native chrome when our Chrome-like bar is attached. */
html.apple-webkit .apple-chrome-video video::-webkit-media-controls,
html.apple-webkit .apple-chrome-video video::-webkit-media-controls-enclosure,
html.apple-webkit .apple-chrome-video video::-webkit-media-controls-overlay-enclosure,
html.apple-webkit .apple-chrome-video video::-webkit-media-controls-panel,
html.apple-webkit .apple-chrome-video video::-webkit-media-controls-start-playback-button,
html.apple-webkit .apple-chrome-video video::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

.chrome-video-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-sizing: border-box;
    padding: 0.4rem 0.55rem 0.5rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0,
        rgba(0, 0, 0, 0.82) 2.6rem,
        rgba(0, 0, 0, 0) 2.6rem
    );
    color: #fff;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.apple-chrome-video:hover .chrome-video-bar,
.apple-chrome-video.chrome-bar-on .chrome-video-bar {
    opacity: 1;
    pointer-events: auto;
}
.chrome-video-bar__btn {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.chrome-video-bar__play::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    margin-left: 0.2rem;
    border-style: solid;
    border-width: 0.38rem 0 0.38rem 0.62rem;
    border-color: transparent transparent transparent #fff;
}
.chrome-video-bar__play:not(.is-paused)::before {
    width: 0.42rem;
    height: 0.72rem;
    margin-left: 0.28rem;
    border: 0;
    background: linear-gradient(#fff, #fff) 0 0 / 0.14rem 100% no-repeat,
        linear-gradient(#fff, #fff) 100% 0 / 0.14rem 100% no-repeat;
}
.chrome-video-bar__time {
    flex: 0 0 auto;
    min-width: 2.1rem;
    opacity: 0.95;
    font-variant-numeric: tabular-nums;
}
.chrome-video-bar__seek {
    flex: 1 1 auto;
    min-width: 0;
    height: 4px;
    margin: 0;
    accent-color: #fff;
    cursor: pointer;
}
.chrome-video-bar__vol::before {
    content: "";
    display: block;
    width: 0.7rem;
    height: 0.55rem;
    margin: 0.35rem auto 0;
    background: #fff;
    clip-path: polygon(0 30%, 40% 30%, 80% 0, 80% 100%, 40% 70%, 0 70%);
}
.chrome-video-bar__vol.is-muted::before {
    opacity: 0.35;
}
.chrome-video-bar__fs::before {
    content: "";
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    margin: 0.28rem auto 0;
    border: 2px solid #fff;
    border-radius: 1px;
    box-sizing: border-box;
}
