/**
 * ============================================
 * PRELOADER & EFFEKTE
 * Sternen-Hintergrund, Lade-Animation
 * ============================================
 */

/* ============================================
 * PRELOADER (Loading Screen)
 * ============================================ */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s, visibility 0.5s;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-logo {
    font-size: 4rem;
    font-weight: 700;
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    animation: pulse-logo 2s ease-in-out infinite;
    margin-bottom: 2rem;
    letter-spacing: 5px;
}

@keyframes pulse-logo {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 30px rgba(0, 212, 255, 0.9);
    }
}

.preloader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.preloader-text {
    margin-top: 1.5rem;
    color: #99900;
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: fade-in-out 1.5s ease-in-out infinite;
}

@keyframes fade-in-out {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ============================================
 * STERNEN-HINTERGRUND (Starfield)
 * ============================================ */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #83D7E8 0%, #090a0f 100%);
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--duration) infinite;
    opacity: 0;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: var(--opacity);
    }
}

/* Shooting Stars */
.shooting-star {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, #fff, transparent);
    animation: shoot 3s linear infinite;
    opacity: 0;
}

@keyframes shoot {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(1000px) translateY(500px);
        opacity: 0;
    }
}

/* ============================================
 * SCROLL-ANIMATIONEN
 * ============================================ */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
 * GLITCH-EFFEKT (für Logo/Titel)
 * ============================================ */
.glitch {
    position: relative;
    color: #00d4ff;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00de;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(93px, 9999px, 34px, 0);
    }
    20% {
        clip: rect(110px, 9999px, 71px, 0);
    }
    40% {
        clip: rect(12px, 9999px, 105px, 0);
    }
    60% {
        clip: rect(83px, 9999px, 26px, 0);
    }
    80% {
        clip: rect(49px, 9999px, 92px, 0);
    }
    100% {
        clip: rect(17px, 9999px, 44px, 0);
    }
}

/* ============================================
 * PARALLAX-EFFEKT
 * ============================================ */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* ============================================
 * HOVER-EFFEKTE (Glow)
 * ============================================ */
.glow-on-hover {
    transition: all 0.3s ease;
}

.glow-on-hover:hover {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    transform: translateY(-2px);
}

/* ============================================
 * RESPONSIVE
 * ============================================ */
@media (max-width: 768px) {
    .preloader-logo {
        font-size: 2.5rem;
    }
    
    #starfield {
        display: none; /* Sterne auf Mobile ausblenden für Performance */
    }
}
