/**
 * BLACK HORNET RACING - DYNAMIC BACKGROUND SYSTEM
 * Cinematisches Hintergrundsystem mit Ken Burns Effekt, Parallax und Racing-Vibes
 */

/* ============================================
   HAUPTCONTAINER
   ============================================ */

.bhr-dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Auf gleicher Ebene wie Body, hinter Content */
    overflow: hidden;
    background: #0C1117;
    pointer-events: none; /* Klicks gehen durch zum Content */
}

/* Mehrschichtiges System für Tiefe */
.bhr-bg-layer {
    position: absolute;
    top: -10%; /* Raum für Ken Burns Zoom */
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    z-index: 1; /* Sichtbar über dem Container-Hintergrund */
}

.bhr-bg-layer.active {
    opacity: 1 !important; /* Wichtig: Überschreibt andere Opacity-Regeln */
    animation: kenBurns 25s ease-in-out infinite alternate;
}

.bhr-bg-layer.next {
    opacity: 0;
}

/* ============================================
   KEN BURNS EFFEKT (Zoom & Pan)
   Verschiedene Varianten für Abwechslung
   ============================================ */

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.15) translate(-5%, -3%);
    }
}

@keyframes kenBurnsReverse {
    0% {
        transform: scale(1.15) translate(-5%, -3%);
    }
    100% {
        transform: scale(1) translate(0, 0);
    }
}

@keyframes kenBurnsDiagonal {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.12) translate(-8%, 5%);
    }
}

@keyframes kenBurnsRotate {
    0% {
        transform: scale(1) translate(0, 0) rotate(0deg);
    }
    100% {
        transform: scale(1.1) translate(-3%, -3%) rotate(1deg);
    }
}

/* Varianten für verschiedene Bilder */
.bhr-bg-layer:nth-child(1) { animation: kenBurns 25s ease-in-out infinite alternate; }
.bhr-bg-layer:nth-child(2) { animation: kenBurnsReverse 30s ease-in-out infinite alternate; }
.bhr-bg-layer:nth-child(3) { animation: kenBurnsDiagonal 28s ease-in-out infinite alternate; }
.bhr-bg-layer:nth-child(4) { animation: kenBurnsRotate 32s ease-in-out infinite alternate; }

/* ============================================
   OVERLAYS FÜR LESBARKEIT & STIMMUNG
   ============================================ */

/* Dunkler Gradient von oben und unten */
.bhr-bg-overlay-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.3) 15%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.4) 85%,
        rgba(0, 0, 0, 0.9) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* BHR-Grüner Glow von unten (TESTWEISE DEAKTIVIERT) */
.bhr-bg-overlay-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background: transparent; /* Komplett transparent = kein Glow */
    pointer-events: none;
    z-index: 2;
}

/* Subtiles Rauschen für Film-Look */
.bhr-bg-overlay-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noise"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noise)" opacity="0.05"/%3E%3C/svg%3E');
    opacity: 0.4;
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: overlay;
}

/* ============================================
   PARALLAX SCROLLING EFFEKT
   ============================================ */

.bhr-dynamic-bg.parallax .bhr-bg-layer {
    transition: transform 0.3s ease-out, opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wird via JavaScript gesteuert */

/* ============================================
   RACING PARTIKEL (Optional)
   ============================================ */

.bhr-bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.bhr-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(5, 238, 136, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(5, 238, 136, 0.8);
    animation: particleFloat 8s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(100vw, -100vh) scale(0.5);
        opacity: 0;
    }
}

/* Verschiedene Partikel-Größen */
.bhr-particle:nth-child(2n) { 
    width: 3px; 
    height: 3px; 
    animation-duration: 12s;
    animation-delay: 2s;
}

.bhr-particle:nth-child(3n) { 
    width: 1px; 
    height: 1px; 
    animation-duration: 6s;
    animation-delay: 4s;
}

/* ============================================
   BLUR EFFEKT (immer aktiv)
   ============================================ */

.bhr-bg-layer {
    filter: blur(8px) brightness(0.7);
}

/* ============================================
   MOBILE OPTIMIERUNGEN
   ============================================ */

@media (max-width: 768px) {
    /* Weniger intensive Animationen für Mobile */
    .bhr-bg-layer {
        animation: none !important;
        filter: blur(8px) brightness(0.7); /* Blur bleibt auch auf Mobile aktiv */
    }
    
    .bhr-bg-layer.active {
        transform: scale(1.05);
        filter: blur(8px) brightness(0.7); /* Blur bleibt auch auf Mobile aktiv */
    }
    
    /* Kein Parallax auf Mobile */
    .bhr-dynamic-bg.parallax .bhr-bg-layer {
        transform: scale(1.05) !important;
    }
    
    /* Weniger Partikel */
    .bhr-particle:nth-child(n+6) {
        display: none;
    }
}

/* ============================================
   PRELOAD OPTIMIZATION
   ============================================ */

.bhr-bg-layer {
    background-repeat: no-repeat;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ============================================
   ZEITBASIERTE WECHSEL
   Bilder wechseln alle 15 Sekunden
   ============================================ */

.bhr-bg-transition-fade {
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RACING SPEED LINES (Optional Overlay)
   ============================================ */

.bhr-speed-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
    opacity: 0.15;
}

.bhr-speed-line {
    position: absolute;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(5, 238, 136, 0.8), transparent);
    animation: speedLine 2s linear infinite;
}

@keyframes speedLine {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(100vw);
        opacity: 0;
    }
}

.bhr-speed-line:nth-child(1) { top: 20%; animation-delay: 0s; }
.bhr-speed-line:nth-child(2) { top: 40%; animation-delay: 0.5s; }
.bhr-speed-line:nth-child(3) { top: 60%; animation-delay: 1s; }
.bhr-speed-line:nth-child(4) { top: 80%; animation-delay: 1.5s; }

/* ============================================
   VIGNETTE EFFEKT (Dunkle Ecken)
   ============================================ */

.bhr-bg-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.6);
}

/* ============================================
   PERFORMANCE: GPU ACCELERATION
   ============================================ */

.bhr-dynamic-bg,
.bhr-bg-layer,
.bhr-bg-overlay-gradient,
.bhr-bg-overlay-glow,
.bhr-particle,
.bhr-speed-line {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

