/* =============================================================================
   CRUXFLUX.NET - Synthwave Animations
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CRT Scanline Overlay
   ----------------------------------------------------------------------------- */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: crtFlicker 0.1s infinite;
}

@keyframes crtFlicker {
    0%, 100% { opacity: 0.95; }
    50% { opacity: 1; }
}

/* -----------------------------------------------------------------------------
   Starfield
   ----------------------------------------------------------------------------- */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

/* Randomly position stars */
.star:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.star:nth-child(2) { top: 15%; left: 25%; animation-delay: 0.5s; }
.star:nth-child(3) { top: 8%; left: 45%; animation-delay: 1s; }
.star:nth-child(4) { top: 20%; left: 60%; animation-delay: 1.5s; }
.star:nth-child(5) { top: 10%; left: 80%; animation-delay: 2s; }
.star:nth-child(6) { top: 25%; left: 15%; animation-delay: 0.3s; }
.star:nth-child(7) { top: 30%; left: 35%; animation-delay: 0.8s; }
.star:nth-child(8) { top: 18%; left: 55%; animation-delay: 1.3s; }
.star:nth-child(9) { top: 35%; left: 70%; animation-delay: 1.8s; }
.star:nth-child(10) { top: 12%; left: 90%; animation-delay: 2.3s; }
.star:nth-child(11) { top: 40%; left: 8%; animation-delay: 0.2s; width: 3px; height: 3px; }
.star:nth-child(12) { top: 3%; left: 40%; animation-delay: 0.7s; }
.star:nth-child(13) { top: 28%; left: 50%; animation-delay: 1.2s; width: 3px; height: 3px; }
.star:nth-child(14) { top: 22%; left: 75%; animation-delay: 1.7s; }
.star:nth-child(15) { top: 38%; left: 85%; animation-delay: 2.2s; }
.star:nth-child(16) { top: 45%; left: 20%; animation-delay: 0.4s; }
.star:nth-child(17) { top: 7%; left: 65%; animation-delay: 0.9s; width: 3px; height: 3px; }
.star:nth-child(18) { top: 33%; left: 5%; animation-delay: 1.4s; }
.star:nth-child(19) { top: 15%; left: 95%; animation-delay: 1.9s; }
.star:nth-child(20) { top: 42%; left: 45%; animation-delay: 2.4s; width: 3px; height: 3px; }

@keyframes twinkle {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

/* -----------------------------------------------------------------------------
   Sun Glow Animation
   ----------------------------------------------------------------------------- */
.sun-glow {
    animation: sunPulse 4s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.6;
    }
}

/* -----------------------------------------------------------------------------
   Grid Floor Animation (Scrolling Toward Horizon)
   ----------------------------------------------------------------------------- */
.grid-floor {
    animation: gridScroll 1.5s linear infinite;
}

@keyframes gridScroll {
    from {
        background-position: 0 0, 0 0, 0 0;
    }
    to {
        background-position: 0 80px, 0 0, 0 80px;
    }
}

/* -----------------------------------------------------------------------------
   Taillight Glow Animation
   ----------------------------------------------------------------------------- */
.taillight-glow {
    animation: taillightPulse 1.5s ease-in-out infinite;
}

@keyframes taillightPulse {
    0%, 100% {
        filter: drop-shadow(0 0 3px #ff2a6d);
        opacity: 0.8;
    }
    50% {
        filter: drop-shadow(0 0 10px #ff2a6d) drop-shadow(0 0 20px #ff2a6d);
        opacity: 1;
    }
}

/* -----------------------------------------------------------------------------
   Road Grid Animation (Moving Forward)
   ----------------------------------------------------------------------------- */
.h-line {
    animation: roadLineMove 0.8s linear infinite;
}

.h-line-1 {
    animation-delay: 0s;
}

.h-line-2 {
    animation-delay: 0.27s;
}

.h-line-3 {
    animation-delay: 0.54s;
}

@keyframes roadLineMove {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    20% {
        opacity: 0.4;
    }
    80% {
        opacity: 0.4;
    }
    100% {
        opacity: 0;
        transform: translateY(40px);
    }
}

/* -----------------------------------------------------------------------------
   Center Road Line Animation
   ----------------------------------------------------------------------------- */
.center-line {
    animation: centerLinePulse 1s ease-in-out infinite;
}

@keyframes centerLinePulse {
    0%, 100% {
        opacity: 0.5;
        stroke-width: 2;
    }
    50% {
        opacity: 1;
        stroke-width: 3;
    }
}

/* -----------------------------------------------------------------------------
   Car Bounce Animation (Road Bumps)
   ----------------------------------------------------------------------------- */
.car-body {
    animation: carBounce 0.3s ease-in-out infinite;
}

@keyframes carBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* -----------------------------------------------------------------------------
   Palm Tree Sway Animation
   ----------------------------------------------------------------------------- */
.palm-tree {
    transform-origin: center bottom;
    animation: palmSway 3s ease-in-out infinite;
}

.palm-left {
    animation-delay: 0s;
}

.palm-right {
    animation-delay: 1.5s;
}

@keyframes palmSway {
    0%, 100% {
        transform: rotate(-1deg);
    }
    50% {
        transform: rotate(1deg);
    }
}

/* -----------------------------------------------------------------------------
   Sun Pulse Animation
   ----------------------------------------------------------------------------- */
.sun-group {
    animation: sunPulseGlow 4s ease-in-out infinite;
}

@keyframes sunPulseGlow {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
}

/* -----------------------------------------------------------------------------
   Star Twinkle Animation
   ----------------------------------------------------------------------------- */
.star-svg {
    animation: starTwinkle 5s ease-in-out infinite;
}

.s1 { animation-delay: 0s; }
.s2 { animation-delay: 0.8s; }
.s3 { animation-delay: 1.5s; }
.s4 { animation-delay: 2.5s; }
.s5 { animation-delay: 0.5s; }
.s6 { animation-delay: 2s; }
.s7 { animation-delay: 3.5s; }
.s8 { animation-delay: 1.2s; }
.s9 { animation-delay: 3s; }
.s10 { animation-delay: 0.3s; }
.s11 { animation-delay: 2.2s; }
.s12 { animation-delay: 4s; }

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* -----------------------------------------------------------------------------
   Window Flicker Animation
   ----------------------------------------------------------------------------- */
.window {
    animation: windowFlicker 4s ease-in-out infinite;
}

.w1 { animation-delay: 0s; animation-duration: 3s; }
.w2 { animation-delay: 0.5s; animation-duration: 5s; }
.w3 { animation-delay: 1.2s; animation-duration: 4s; }
.w4 { animation-delay: 2.1s; animation-duration: 6s; }
.w5 { animation-delay: 0.8s; animation-duration: 3.5s; }
.w6 { animation-delay: 1.5s; animation-duration: 4.5s; }
.w7 { animation-delay: 0.3s; animation-duration: 5.5s; }
.w8 { animation-delay: 1.9s; animation-duration: 3.2s; }
.w9 { animation-delay: 2.5s; animation-duration: 4.8s; }

@keyframes windowFlicker {
    0%, 100% {
        opacity: 0.6;
    }
    10% {
        opacity: 0.2;
    }
    20% {
        opacity: 0.7;
    }
    30% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
    70% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.7;
    }
}


/* -----------------------------------------------------------------------------
   Scene Glow Animation
   ----------------------------------------------------------------------------- */
.retro-scene {
    animation: sceneGlow 4s ease-in-out infinite;
}

@keyframes sceneGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px #ff2a6d);
    }
    50% {
        filter: drop-shadow(0 0 15px #05d9e8);
    }
}

/* -----------------------------------------------------------------------------
   Indicator Light Blink
   ----------------------------------------------------------------------------- */
@keyframes indicatorBlink {
    0%, 50%, 100% { opacity: 0.8; }
    25%, 75% { opacity: 0.3; }
}

/* -----------------------------------------------------------------------------
   Headlight Flicker Animation
   ----------------------------------------------------------------------------- */
.headlight {
    animation: headlightFlicker 3s infinite;
}

.headlight-inner {
    animation: headlightFlicker 3s infinite 0.1s;
}

.headlight-beam {
    animation: beamPulse 2s ease-in-out infinite;
}

@keyframes headlightFlicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        opacity: 1;
    }
    20%, 24%, 55% {
        opacity: 0.6;
    }
}

@keyframes beamPulse {
    0%, 100% {
        opacity: 0.1;
    }
    50% {
        opacity: 0.2;
    }
}

/* -----------------------------------------------------------------------------
   Taillight Glow Animation
   ----------------------------------------------------------------------------- */
.taillight {
    animation: taillightPulse 1.5s ease-in-out infinite;
}

@keyframes taillightPulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px #ff2a6d);
        opacity: 0.9;
    }
    50% {
        filter: drop-shadow(0 0 15px #ff2a6d) drop-shadow(0 0 25px #ff2a6d);
        opacity: 1;
    }
}

/* -----------------------------------------------------------------------------
   Ground Shadow Animation
   ----------------------------------------------------------------------------- */
.ground-shadow {
    animation: shadowPulse 2s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% {
        opacity: 0.1;
        transform: scaleX(1);
    }
    50% {
        opacity: 0.2;
        transform: scaleX(1.05);
    }
}

/* -----------------------------------------------------------------------------
   Title Glitch Effect
   ----------------------------------------------------------------------------- */
.title {
    position: relative;
}

.glitch-text {
    animation: glitchText 3s infinite;
}

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

.title::before {
    color: #ff2a6d;
    animation: glitchBefore 3s infinite;
    clip-path: inset(0 0 70% 0);
    text-shadow: -2px 0 #ff2a6d;
}

.title::after {
    color: #05d9e8;
    animation: glitchAfter 3s infinite;
    clip-path: inset(70% 0 0 0);
    text-shadow: 2px 0 #05d9e8;
}

@keyframes glitchText {
    0%, 90%, 100% {
        transform: translate(0);
    }
    92% {
        transform: translate(-2px, 1px);
    }
    94% {
        transform: translate(2px, -1px);
    }
    96% {
        transform: translate(-1px, 2px);
    }
    98% {
        transform: translate(1px, -2px);
    }
}

@keyframes glitchBefore {
    0%, 90%, 100% {
        transform: translate(0);
        opacity: 0;
    }
    92% {
        transform: translate(-3px, 0);
        opacity: 0.8;
    }
    94% {
        transform: translate(3px, 0);
        opacity: 0.8;
    }
    96%, 98% {
        transform: translate(0);
        opacity: 0;
    }
}

@keyframes glitchAfter {
    0%, 90%, 100% {
        transform: translate(0);
        opacity: 0;
    }
    93% {
        transform: translate(3px, 0);
        opacity: 0.8;
    }
    95% {
        transform: translate(-3px, 0);
        opacity: 0.8;
    }
    97%, 99% {
        transform: translate(0);
        opacity: 0;
    }
}

/* -----------------------------------------------------------------------------
   Tagline Fade In
   ----------------------------------------------------------------------------- */
.tagline {
    animation: fadeInUp 1s ease-out 1s both;
}

.bracket {
    animation: bracketPulse 2s ease-in-out infinite;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bracketPulse {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 5px #05d9e8;
    }
    50% {
        opacity: 0.7;
        text-shadow: 0 0 15px #05d9e8, 0 0 25px #05d9e8;
    }
}

/* -----------------------------------------------------------------------------
   Status Indicator Animation
   ----------------------------------------------------------------------------- */
.status {
    animation: fadeInUp 1s ease-out 1.5s both;
}

.status-dot {
    animation: statusBlink 1s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 50%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px #05d9e8;
    }
    25%, 75% {
        opacity: 0.5;
        box-shadow: 0 0 5px #05d9e8;
    }
}

/* -----------------------------------------------------------------------------
   Mountain Parallax (Subtle Sway)
   ----------------------------------------------------------------------------- */
.mountain {
    animation: mountainSway 8s ease-in-out infinite;
}

.mountain-1 {
    animation-delay: 0s;
}

.mountain-2 {
    animation-delay: 2s;
}

.mountain-3 {
    animation-delay: 4s;
}

@keyframes mountainSway {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

/* -----------------------------------------------------------------------------
   Logo Container Entrance Animation
   ----------------------------------------------------------------------------- */
.logo-container {
    animation: logoEntrance 1.5s ease-out both;
}

@keyframes logoEntrance {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* -----------------------------------------------------------------------------
   Hover Effects (Desktop)
   ----------------------------------------------------------------------------- */
@media (hover: hover) {
    .retro-car:hover .car-group {
        animation: 
            carGlow 1s ease-in-out infinite,
            carBounce 0.15s ease-in-out infinite;
    }
    
    .retro-car:hover .front-spokes,
    .retro-car:hover .rear-spokes {
        animation: spinWheel 0.15s linear infinite;
    }
    
    .retro-car:hover .headlight-beam {
        opacity: 0.3;
    }
}
