/* Kykastory Motion Video for Elementor v1.3.0 */
.kmv-motion-section {
    --kmv-yt-zoom: 1;
    --kmv-yt-zoom-tablet: 1;
    --kmv-yt-zoom-mobile: 1;
    --kmv-yt-x: 50%;
    --kmv-yt-y: 50%;
    --kmv-yt-frame-w: 100%;
    --kmv-yt-frame-h: 100%;
}

/* Keep the player hidden until playback is actually running. This prevents
   the YouTube center play/pause overlay from flashing during startup. */
.kmv-motion-section[data-kmv-enabled="yes"][data-kmv-disable-autoplay="yes"]:not(.kmv-video-ready) .elementor-background-video-container {
    opacity: 0 !important;
    visibility: hidden !important;
}

.kmv-motion-section .elementor-background-video-container {
    overflow: hidden !important;
    transition: opacity .28s ease !important;
}

/* Hosted / MP4 */
.kmv-motion-section[data-kmv-size="cover"] .elementor-background-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.kmv-motion-section[data-kmv-size="contain"] .elementor-background-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.kmv-motion-section[data-kmv-size="fill"] .elementor-background-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
}

/* YouTube iframe */
.kmv-motion-section .elementor-background-video-container iframe,
.kmv-motion-section iframe.elementor-background-video-embed {
    position: absolute !important;
    top: var(--kmv-yt-y) !important;
    left: var(--kmv-yt-x) !important;
    max-width: none !important;
    border: 0 !important;
    transform-origin: center center !important;
}

/* Smart Cover: JS calculates an iframe with the same aspect ratio as the
   actual source video (9:16 by default). This avoids forcing portrait video
   into a 16:9 player on desktop. */
.kmv-motion-section[data-kmv-youtube-smart-cover="yes"] .elementor-background-video-container iframe,
.kmv-motion-section[data-kmv-youtube-smart-cover="yes"] iframe.elementor-background-video-embed {
    width: var(--kmv-yt-frame-w) !important;
    height: var(--kmv-yt-frame-h) !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Legacy cover mode, kept for non-smart-cover users. */
.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="cover"] .elementor-background-video-container iframe,
.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="cover"] iframe.elementor-background-video-embed,
.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="custom"] .elementor-background-video-container iframe,
.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="custom"] iframe.elementor-background-video-embed {
    width: max(100vw, 177.7778vh) !important;
    height: max(56.25vw, 100vh) !important;
    min-width: 100% !important;
    min-height: 100% !important;
}

.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="contain"] .elementor-background-video-container iframe,
.kmv-motion-section[data-kmv-youtube-smart-cover="no"][data-kmv-youtube-fit="contain"] iframe.elementor-background-video-embed {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

.kmv-motion-section .elementor-background-video-container iframe,
.kmv-motion-section iframe.elementor-background-video-embed {
    transform: translate(-50%, -50%) scale(var(--kmv-yt-zoom)) !important;
}

@media (max-width: 1024px) {
    .kmv-motion-section .elementor-background-video-container iframe,
    .kmv-motion-section iframe.elementor-background-video-embed {
        transform: translate(-50%, -50%) scale(var(--kmv-yt-zoom-tablet)) !important;
    }
}

@media (max-width: 767px) {
    .kmv-motion-section .elementor-background-video-container iframe,
    .kmv-motion-section iframe.elementor-background-video-embed {
        transform: translate(-50%, -50%) scale(var(--kmv-yt-zoom-mobile)) !important;
    }
}

/* Motion text. Opacity-only fade intentionally avoids fighting Elementor
   transforms/positioning/entrance animations. */
.kmv-motion-target {
    will-change: opacity;
}

.kmv-motion-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.kmv-motion-visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

html.kmv-scroll-locked,
body.kmv-scroll-locked {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none;
}

/* Block all direct interaction with the YouTube layer. The shield is created
   inside Elementor's background-video container, so normal page content stays
   clickable while the iframe never receives taps/clicks. */
.kmv-motion-section[data-kmv-youtube-disable-interaction="yes"] .elementor-background-video-container iframe,
.kmv-motion-section[data-kmv-youtube-disable-interaction="yes"] iframe.elementor-background-video-embed {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

.kmv-motion-section .kmv-youtube-shield {
    position: absolute !important;
    inset: 0 !important;
    z-index: 20 !important;
    background: transparent !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}


/* v1.3.0: click-driven motionText hardening */
.kmv-motion-target[data-kmv-motion-state="hidden"] {
    opacity: 0 !important;
    visibility: hidden !important;
}

.kmv-motion-target[data-kmv-motion-state="revealing"],
.kmv-motion-target[data-kmv-motion-state="visible"] {
    visibility: visible !important;
}
