/* ============================================
   ASoftware — Animations
   ============================================ */

/* --- Keyframes --- */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    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);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(108, 99, 255, 0.3); }
    50% { box-shadow: 0 0 25px rgba(108, 99, 255, 0.6), 0 0 50px rgba(108, 99, 255, 0.2); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    0%, 100% { border-right-color: var(--accent-primary); }
    50% { border-right-color: transparent; }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes border-glow {
    0%, 100% { border-color: rgba(108, 99, 255, 0.2); }
    50% { border-color: rgba(108, 99, 255, 0.6); }
}

@keyframes particle-float {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(100px) rotate(720deg); opacity: 0; }
}

/* --- Neon Glow Border --- */
@keyframes neon-border {
    0%, 100% {
        box-shadow:
            0 0 5px rgba(108, 99, 255, 0.3),
            inset 0 0 5px rgba(108, 99, 255, 0.1);
    }
    50% {
        box-shadow:
            0 0 15px rgba(108, 99, 255, 0.5),
            0 0 30px rgba(0, 212, 255, 0.2),
            inset 0 0 10px rgba(108, 99, 255, 0.15);
    }
}

/* --- Rotating gradient border --- */
@keyframes spin-border {
    0% { --angle: 0deg; }
    100% { --angle: 360deg; }
}

/* --- Animation Classes --- */
.anim-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.anim-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.anim-fade-in-down {
    animation: fadeInDown 0.5s ease forwards;
}

.anim-fade-in-left {
    animation: fadeInLeft 0.6s ease forwards;
}

.anim-fade-in-right {
    animation: fadeInRight 0.6s ease forwards;
}

.anim-scale-in {
    animation: scaleIn 0.5s ease forwards;
}

.anim-float {
    animation: float 3s ease-in-out infinite;
}

.anim-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.anim-glow {
    animation: glow 2s ease-in-out infinite;
}

.anim-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-elevated) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% auto;
    animation: shimmer 2s linear infinite;
}

.anim-gradient-text {
    background: linear-gradient(
        90deg,
        var(--accent-primary),
        var(--accent-secondary),
        var(--accent-tertiary),
        var(--accent-primary)
    );
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 4s ease infinite;
}

/* --- Stagger Animation Delays --- */
.anim-delay-100 { animation-delay: 0.1s; }
.anim-delay-200 { animation-delay: 0.2s; }
.anim-delay-300 { animation-delay: 0.3s; }
.anim-delay-400 { animation-delay: 0.4s; }
.anim-delay-500 { animation-delay: 0.5s; }
.anim-delay-600 { animation-delay: 0.6s; }
.anim-delay-700 { animation-delay: 0.7s; }
.anim-delay-800 { animation-delay: 0.8s; }

/* --- Typewriter --- */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--accent-primary);
    animation:
        typewriter 2.5s steps(30) 0.5s forwards,
        blink-caret 0.75s step-end infinite;
    width: 0;
}

/* --- Hover Lift --- */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* --- Neon Glow on Hover --- */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--accent-glow);
}

/* --- Particle Background --- */
.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    opacity: 0;
    animation: particle-float linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; width: 3px; height: 3px; }
.particle:nth-child(2) { left: 25%; animation-duration: 12s; animation-delay: 2s; width: 2px; height: 2px; background: var(--accent-secondary); }
.particle:nth-child(3) { left: 40%; animation-duration: 10s; animation-delay: 4s; }
.particle:nth-child(4) { left: 55%; animation-duration: 14s; animation-delay: 1s; width: 5px; height: 5px; background: var(--accent-secondary); }
.particle:nth-child(5) { left: 70%; animation-duration: 9s; animation-delay: 3s; width: 2px; height: 2px; }
.particle:nth-child(6) { left: 85%; animation-duration: 11s; animation-delay: 5s; width: 3px; height: 3px; background: var(--accent-tertiary); }
.particle:nth-child(7) { left: 15%; animation-duration: 13s; animation-delay: 6s; }
.particle:nth-child(8) { left: 60%; animation-duration: 7s; animation-delay: 2s; width: 2px; height: 2px; background: var(--accent-secondary); }

/* --- Preloader --- */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-preloader);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader__logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    animation: pulse 1.5s ease-in-out infinite;
}

/* --- Reduce motion for accessibility --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* --- Mobile: fewer/smaller particles, simpler animations --- */
@media (max-width: 768px) {
    .particle:nth-child(n+5) {
        display: none;
    }

    .particle {
        width: 2px !important;
        height: 2px !important;
    }

    .anim-fade-in,
    .anim-fade-in-up,
    .anim-fade-in-down,
    .anim-fade-in-left,
    .anim-fade-in-right,
    .anim-scale-in {
        animation-duration: 0.4s;
    }

    .hover-lift:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .particle:nth-child(n+3) {
        display: none;
    }
}
