/* Starscape Background Animation */

.starscape-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    /* Realistic night sky gradient - darker at top, slightly lighter at horizon */
    background: linear-gradient(
        180deg,
        #000000 0%,
        #010103 20%,
        #020206 40%,
        #030309 60%,
        #04040c 80%,
        #05050f 100%
    );
    /* Subtle radial gradient for depth */
    background-image: 
        radial-gradient(ellipse at top, rgba(5, 5, 15, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(10, 10, 20, 0.2) 0%, transparent 50%);
}

/* Star Field */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #ffffff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #ffffff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 200px 90px, #ffffff, transparent),
        radial-gradient(2px 2px at 240px 50px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 280px 10px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 320px 70px, #ffffff, transparent),
        radial-gradient(2px 2px at 360px 20px, rgba(255,255,255,0.6), transparent);
    background-repeat: repeat;
    background-size: 400px 200px;
    animation: sparkle 30s linear infinite;
}

@keyframes sparkle {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(-200px) translateX(-400px); }
}

/* Shooting Stars */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: linear-gradient(45deg, transparent, #ffffff, transparent);
    border-radius: 50%;
    animation: shoot 15s linear infinite;
    opacity: 0;
}

.shooting-star:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.shooting-star:nth-child(2) {
    top: 30%;
    left: 80%;
    animation-delay: 1s;
}

.shooting-star:nth-child(3) {
    top: 60%;
    left: 40%;
    animation-delay: 2s;
}

.shooting-star:nth-child(4) {
    top: 80%;
    left: 90%;
    animation-delay: 0.5s;
}

.shooting-star:nth-child(5) {
    top: 20%;
    left: 60%;
    animation-delay: 1.5s;
}

@keyframes shoot {
    0% {
        opacity: 0;
        transform: translateX(0) translateY(0) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateX(-50px) translateY(-50px) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateX(-400px) translateY(-400px) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translateX(-500px) translateY(-500px) scale(0);
    }
}

/* Nebula Effects */
.nebula {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 800px 600px at 10% 20%, rgba(79, 70, 229, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 600px 800px at 90% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
    animation: nebula-pulse 60s ease-in-out infinite alternate;
}

@keyframes nebula-pulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.4;
        transform: scale(0.95);
    }
}

/* Constellation Lines */
.constellation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.1;
}

.constellation-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: constellation-twinkle 4s ease-in-out infinite;
}

.constellation-line:nth-child(1) {
    top: 15%;
    left: 10%;
    width: 100px;
    transform: rotate(45deg);
    animation-delay: 0s;
}

.constellation-line:nth-child(2) {
    top: 25%;
    left: 30%;
    width: 80px;
    transform: rotate(-30deg);
    animation-delay: 0.5s;
}

.constellation-line:nth-child(3) {
    top: 45%;
    left: 70%;
    width: 120px;
    transform: rotate(60deg);
    animation-delay: 1s;
}

.constellation-line:nth-child(4) {
    top: 65%;
    left: 20%;
    width: 90px;
    transform: rotate(-45deg);
    animation-delay: 1.5s;
}

@keyframes constellation-twinkle {
    0%, 100% {
        opacity: 0.1;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    }
    50% {
        opacity: 0.3;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    }
}

/* Galaxy Spiral */
.galaxy-spiral {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(79, 70, 229, 0.1) 90deg,
        transparent 180deg,
        rgba(124, 58, 237, 0.1) 270deg,
        transparent 360deg
    );
    border-radius: 50%;
    animation: galaxy-rotate 300s linear infinite;
    opacity: 0.3;
}

@keyframes galaxy-rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Particle Field */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 1px;
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: particle-float 80s linear infinite;
}

.particle:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 20%;
    left: 30%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    top: 30%;
    left: 50%;
    animation-delay: 4s;
}

.particle:nth-child(4) {
    top: 40%;
    left: 70%;
    animation-delay: 6s;
}

.particle:nth-child(5) {
    top: 50%;
    left: 90%;
    animation-delay: 8s;
}

.particle:nth-child(6) {
    top: 60%;
    left: 20%;
    animation-delay: 10s;
}

.particle:nth-child(7) {
    top: 70%;
    left: 40%;
    animation-delay: 12s;
}

.particle:nth-child(8) {
    top: 80%;
    left: 60%;
    animation-delay: 14s;
}

.particle:nth-child(9) {
    top: 90%;
    left: 80%;
    animation-delay: 16s;
}

.particle:nth-child(10) {
    top: 15%;
    left: 85%;
    animation-delay: 18s;
}

@keyframes particle-float {
    0% {
        transform: translateY(0) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateY(-20px) translateX(10px) scale(1);
        opacity: 1;
    }
    90% {
        transform: translateY(-200px) translateX(-100px) scale(0.5);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-300px) translateX(-200px) scale(0);
        opacity: 0;
    }
}

/* Aurora Effect */
.aurora {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(
        180deg,
        rgba(79, 70, 229, 0.1) 0%,
        rgba(124, 58, 237, 0.05) 30%,
        transparent 100%
    );
    animation: aurora-wave 45s ease-in-out infinite;
    transform-origin: top;
}

@keyframes aurora-wave {
    0%, 100% {
        transform: scaleY(1) rotateX(0deg);
        opacity: 0.3;
    }
    50% {
        transform: scaleY(1.2) rotateX(5deg);
        opacity: 0.6;
    }
}

/* Meteor Shower */
.meteor {
    position: absolute;
    width: 3px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    border-radius: 2px;
    animation: meteor-fall 20s linear infinite;
    opacity: 0;
    transform-origin: top center;
}

.meteor:nth-child(1) {
    top: -100px;
    left: 15%;
    animation-delay: 0s;
}

.meteor:nth-child(2) {
    top: -100px;
    left: 35%;
    animation-delay: 1.5s;
}

.meteor:nth-child(3) {
    top: -100px;
    left: 55%;
    animation-delay: 3s;
}

.meteor:nth-child(4) {
    top: -100px;
    left: 75%;
    animation-delay: 4.5s;
}

@keyframes meteor-fall {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) rotate(45deg) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(50px) translateX(25px) rotate(45deg) scale(1);
    }
    90% {
        opacity: 0.6;
        transform: translateY(800px) translateX(400px) rotate(45deg) scale(0.3);
    }
    100% {
        opacity: 0;
        transform: translateY(1000px) translateX(500px) rotate(45deg) scale(0);
    }
}

/* Deep Space Background */
.space-dust {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 25px 25px, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 75px 75px, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 125px 25px, rgba(255, 255, 255, 0.15), transparent),
        radial-gradient(1px 1px at 175px 75px, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 225px 25px, rgba(255, 255, 255, 0.2), transparent);
    background-repeat: repeat;
    background-size: 250px 100px;
    animation: space-dust 120s linear infinite;
    opacity: 0.4;
}

@keyframes space-dust {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-250px) translateY(-100px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .galaxy-spiral {
        width: 150px;
        height: 150px;
    }

    .meteor {
        height: 60px;
    }

    @keyframes meteor-fall {
        0% {
            opacity: 0;
            transform: translateY(0) translateX(0) rotate(45deg) scale(0);
        }
        10% {
            opacity: 1;
            transform: translateY(30px) translateX(15px) rotate(45deg) scale(1);
        }
        90% {
            opacity: 0.6;
            transform: translateY(500px) translateX(250px) rotate(45deg) scale(0.3);
        }
        100% {
            opacity: 0;
            transform: translateY(600px) translateX(300px) rotate(45deg) scale(0);
        }
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stars,
    .shooting-star,
    .nebula,
    .constellation-line,
    .galaxy-spiral,
    .particle,
    .aurora,
    .meteor,
    .space-dust {
        animation: none !important;
    }

    .shooting-star,
    .particle,
    .meteor {
        opacity: 0.3 !important;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .starscape-background {
        background: #000000;
    }

    .shooting-star,
    .particle,
    .meteor {
        background: #ffffff !important;
        opacity: 0.8 !important;
    }
}
