/**
 * DiabloDesign Background Plugin
 * @package     DiabloDesign.Plugin
 * @subpackage  System.DdBackground
 * @author      DiabloDesign
 * @copyright   (C) 2025 DiabloDesign. All rights reserved.
 */

/* Particles container */
.dd-bg-particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.dd-bg-particles-container canvas {
    display: block;
    pointer-events: auto;
}

/* Video container */
.dd-bg-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.dd-bg-video-container iframe,
.dd-bg-video-container video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    pointer-events: none;
}

/* Ensure content is above background */
body.dd-bg-active {
    position: relative;
}

body.dd-bg-active > *:not(.dd-bg-particles-container):not(.dd-bg-video-container):not(#dd-background-styles) {
    position: relative;
    z-index: 1;
}

/* Pattern: Noise using SVG filter */
.dd-bg-noise::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Animation: Ken Burns */
@keyframes dd-bg-kenburns {
    0% {
        background-size: 100% auto;
        background-position: center center;
    }
    100% {
        background-size: 120% auto;
        background-position: center top;
    }
}

/* Animation: Gradient shift */
@keyframes dd-bg-gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .dd-bg-video-container {
        display: none;
    }
    
    body.dd-bg-video-fallback {
        background-size: cover !important;
        background-position: center center !important;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .dd-bg-particles-container,
    .dd-bg-video-container {
        display: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
