/* ========================================
   Engen Energy Inc. - Animation Library
   Advanced Animations and Effects
   ======================================== */

/* ========================================
   Particle Background Animation
   ======================================== */

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: var(--z-negative);
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-cyan);
    border-radius: var(--radius-full);
    opacity: 0.6;
    animation: particleFloat 10s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* ========================================
   Gradient Animation
   ======================================== */

.gradient-animate {
    background: linear-gradient(45deg,
            var(--color-cyan),
            var(--color-teal),
            var(--color-orange),
            var(--color-amber));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s ease-out;
}

.reveal-left active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s ease-out;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease-out;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation delays for multiple elements */
.reveal:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal:nth-child(4) {
    transition-delay: 0.4s;
}

.reveal:nth-child(5) {
    transition-delay: 0.5s;
}

.reveal:nth-child(6) {
    transition-delay: 0.6s;
}

/* ========================================
   Glow Effects
   ======================================== */

.glow-cyan {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    animation: glowPulseCyan 3s ease-in-out infinite;
}

.glow-orange {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    animation: glowPulseOrange 3s ease-in-out infinite;
}

@keyframes glowPulseCyan {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.8);
    }
}

@keyframes glowPulseOrange {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 107, 53, 0.8);
    }
}

/* ========================================
   Hover Lift Effect
   ======================================== */

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.3);
}

/* ========================================
   Typing Effect
   ======================================== */

.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--color-cyan);
    white-space: nowrap;
    animation: typing 3s steps(40) 1s both, blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* ========================================
   Floating Animation
   ======================================== */

.float-slow {
    animation: floatSlow 6s ease-in-out infinite;
}

.float-medium {
    animation: floatMedium 4s ease-in-out infinite;
}

.float-fast {
    animation: floatFast 2s ease-in-out infinite;
}

@keyframes floatSlow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes floatMedium {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes floatFast {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   Rotate Animation
   ======================================== */

.rotate-slow {
    animation: rotateSlow 20s linear infinite;
}

.rotate-medium {
    animation: rotateMedium 10s linear infinite;
}

@keyframes rotateSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateMedium {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Shimmer Effect
   ======================================== */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* ========================================
   Page Transition
   ======================================== */

.page-transition {
    animation: pageTransition 0.5s ease-out;
}

@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Count Up Animation
   ======================================== */

.count-up {
    font-family: var(--font-heading);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Ripple Effect on Click
   ======================================== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--radius-full);
    background: rgba(0, 212, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   Fade In序列 Animations
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease-out;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

/* ========================================
   Loading Skeleton
   ======================================== */

.skeleton {
    background: linear-gradient(90deg,
            rgba(26, 41, 66, 0.6) 25%,
            rgba(26, 41, 66, 0.8) 50%,
            rgba(26, 41, 66, 0.6) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   Pulse Ring Animation
   ======================================== */

.pulse-ring {
    position: relative;
}

.pulse-ring::before,
.pulse-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--color-cyan);
    border-radius: var(--radius-full);
    transform: translate(-50%, -50%);
    animation: pulseRing 2s ease-out infinite;
}

.pulse-ring::after {
    animation-delay: 1s;
}

@keyframes pulseRing {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }

    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* ========================================
   Energy Beam Effect
   ======================================== */

.energy-beam {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--color-cyan), transparent);
    animation: energyBeam 3s linear infinite;
    opacity: 0.6;
}

@keyframes energyBeam {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100vh);
    }
}

/* ========================================
   Responsive Animation Controls
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}