/**
 * Video Background Styles
 * Let's Talk - Dynamic Video Background System
 * Created: 2026-01-31
 */

/* ===== Video Container ===== */
.video-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

/* ===== Video Element (MP4) ===== */
.video-background {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100vw;
    min-height: 100vh;
    width: auto;
    height: auto;
    object-fit: cover; /* Crop, never stretch */
}

/* Low resolution video blur compensation */
.video-background.low-res {
    filter: blur(3px);
}

/* ===== YouTube Video Container ===== */
.video-background-youtube {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden;
}

.video-background-youtube iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Scale to cover viewport while maintaining 16:9 aspect ratio */
    width: 177.78vh; /* 100vh * 16/9 */
    height: 100vh;
    min-width: 100vw;
    min-height: 56.25vw; /* 100vw * 9/16 */
    pointer-events: none;
}

/* ===== Overlay Layer ===== */
.video-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

/* Dark theme overlay */
.video-bg-overlay.dark {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

/* Light theme overlay */
.video-bg-overlay.light {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.7) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.7) 100%
    );
}

/* Transition state - full opacity for fade */
.video-bg-overlay.transitioning {
    opacity: 1 !important;
}

/* ===== Overlay Effects ===== */

/* Blur overlay for low-res videos */
.video-bg-overlay.blur-compensation {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Color tint modes */
.video-bg-overlay.tint-warm {
    background-color: rgba(255, 180, 100, 0.15);
    mix-blend-mode: overlay;
}

.video-bg-overlay.tint-cool {
    background-color: rgba(100, 150, 255, 0.15);
    mix-blend-mode: overlay;
}

.video-bg-overlay.tint-purple {
    background-color: rgba(150, 100, 255, 0.15);
    mix-blend-mode: overlay;
}

/* ===== Audio Sync Animations ===== */

/* Breathing/pulsing effect (CSS fallback) */
@keyframes video-overlay-breathe {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.35;
    }
}

.video-bg-overlay.breathing {
    animation: video-overlay-breathe 4s ease-in-out infinite;
}

/* ===== Mobile Optimizations ===== */
@media (max-width: 768px) {
    .video-bg-overlay {
        /* Slightly more overlay on mobile for readability */
        opacity: 0.6;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .video-background {
        display: none;
    }

    .video-bg-overlay {
        animation: none;
        opacity: 0.7;
    }
}

/* ===== Performance Hints ===== */
.video-bg-container,
.video-background,
.video-bg-overlay {
    will-change: opacity;
    contain: strict;
}

/* ===== Fallback for no video ===== */
.video-bg-container:empty + .video-bg-overlay {
    /* Static gradient background when no video */
    background: linear-gradient(
        135deg,
        var(--bg-gradient-start, #1a1a2e) 0%,
        var(--bg-gradient-mid, #16213e) 50%,
        var(--bg-gradient-end, #0f3460) 100%
    );
    opacity: 1;
}

/* Dark theme fallback gradient */
.video-bg-overlay.dark.fallback {
    background: linear-gradient(
        135deg,
        #1a1a2e 0%,
        #16213e 50%,
        #0f3460 100%
    );
}

/* Light theme fallback gradient */
.video-bg-overlay.light.fallback {
    background: linear-gradient(
        135deg,
        #f0f4f8 0%,
        #d9e2ec 50%,
        #bcccdc 100%
    );
}
