/* ================================================================
   GLASS CORE - Animations & Keyframes
   ================================================================ */

/* ===== FLOATING ANIMATION (Idle State) ===== */

.float-animation {
    animation: floating var(--float-duration, 6s) ease-in-out infinite;
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
    }
    50% {
        transform: translateY(-15px) translateX(5px);
    }
}


/* ===== 3D ORBIT ANIMATION (CTA Cubes) ===== */

.orbit-cube {
    animation: orbit3d 8s infinite ease-in-out;
}

.orbit-1 {
    animation-delay: 0s;
    animation-duration: 8s;
}

.orbit-2 {
    animation-delay: -2.6s;
    animation-duration: 9s;
}

.orbit-3 {
    animation-delay: -5.2s;
    animation-duration: 10s;
}

@keyframes orbit3d {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    25% {
        transform: translate3d(100px, -50px, 50px) rotate(90deg);
    }
    50% {
        transform: translate3d(0, -100px, 100px) rotate(180deg);
    }
    75% {
        transform: translate3d(-100px, -50px, 50px) rotate(270deg);
    }
}


/* ===== ROTATION ANIMATIONS ===== */

.rotate-slow {
    animation: rotate-360 20s linear infinite;
}

.rotate-reverse {
    animation: rotate-360 20s linear infinite reverse;
}

@keyframes rotate-360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


/* ===== FADE IN ANIMATIONS ===== */

.fade-in {
    animation: fade-in var(--duration-slow) var(--ease-standard) forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fade-in-up var(--duration-slow) var(--ease-drift) forwards;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fade-in-down var(--duration-slow) var(--ease-drift) forwards;
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===== SCALE ANIMATIONS ===== */

.scale-in {
    animation: scale-in var(--duration-slow) var(--ease-snap) forwards;
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* ===== GLOW PULSE ===== */

.glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(51, 153, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(51, 153, 255, 0.6);
    }
}

.glow-pulse-ruby {
    animation: glow-pulse-ruby 2s ease-in-out infinite;
}

@keyframes glow-pulse-ruby {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 77, 77, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 77, 77, 0.6);
    }
}

.glow-pulse-emerald {
    animation: glow-pulse-emerald 2s ease-in-out infinite;
}

@keyframes glow-pulse-emerald {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 204, 102, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 204, 102, 0.6);
    }
}


/* ===== SHIMMER EFFECT ===== */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}


/* ===== PARTICLE DRIFT ===== */

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-sapphire);
    border-radius: 50%;
    opacity: 0.6;
    animation: particle-drift 10s linear infinite;
}

@keyframes particle-drift {
    from {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    20% {
        opacity: 0.6;
    }
    80% {
        opacity: 0.6;
    }
    to {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}


/* ===== TYPING CURSOR (for text effects) ===== */

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent-sapphire);
    margin-left: 4px;
    animation: blink 1s step-end infinite;
}

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


/* ===== STAR FIELD ANIMATION ===== */

.star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 60px 70px, white, transparent),
        radial-gradient(1px 1px at 50px 50px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 90px 10px, white, transparent);
    background-size: 200px 200px;
    background-repeat: repeat;
    opacity: 0.3;
    animation: star-drift 100s linear infinite;
}

@keyframes star-drift {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-200px);
    }
}


/* ===== LOADING SPINNER ===== */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-sapphire);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


/* ===== REVEAL FROM BLUR ===== */

.blur-reveal {
    animation: blur-reveal var(--duration-slow) var(--ease-drift) forwards;
}

@keyframes blur-reveal {
    from {
        filter: blur(10px);
        opacity: 0;
    }
    to {
        filter: blur(0);
        opacity: 1;
    }
}


/* ===== SLIDE IN ANIMATIONS ===== */

.slide-in-left {
    animation: slide-in-left var(--duration-slow) var(--ease-drift) forwards;
}

@keyframes slide-in-left {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-right {
    animation: slide-in-right var(--duration-slow) var(--ease-drift) forwards;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 768px) {
    /* Reduce animation complexity on mobile for performance */
    .float-animation {
        animation-duration: 8s;
    }

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

    .orbit-cube {
        animation-duration: 12s;
    }

    @keyframes orbit3d {
        0%, 100% {
            transform: translate3d(0, 0, 0) rotate(0deg);
        }
        25% {
            transform: translate3d(50px, -25px, 0) rotate(90deg);
        }
        50% {
            transform: translate3d(0, -50px, 0) rotate(180deg);
        }
        75% {
            transform: translate3d(-50px, -25px, 0) rotate(270deg);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    /* Respect user's motion preferences */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
