/* =====================================================
   WEBLY DIGITAL SOLUTIONS - Animations
   Keyframes and animation utilities
   ===================================================== */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ==================== ROTATE ANIMATIONS ==================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==================== GLOW ANIMATIONS ==================== */

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(199, 125, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(199, 125, 255, 0.6);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* ==================== LOADING ANIMATION ==================== */

@keyframes loading {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--color-bg-card);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: loading 0.8s linear infinite;
}

/* ==================== PAGE LOADER ==================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-max);
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.page-loader .logo {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== HERO ANIMATIONS ==================== */

.hero-title {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-subtitle {
    animation: fadeInUp 1s ease-out 0.1s both;
}

.hero-description {
    animation: fadeInUp 1s ease-out 0.3s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease-out 0.4s both;
}

/* ==================== GEOMETRIC SHAPES ==================== */

@keyframes morph {

    0%,
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(150px) rotate(0deg);
    }

    to {
        transform: rotate(360deg) translateX(150px) rotate(-360deg);
    }
}

.geometric-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    z-index: 0;
}

.geometric-shape {
    position: absolute;
    background: var(--gradient-primary);
    opacity: 0.1;
    animation: morph 8s ease-in-out infinite;
}

.geometric-shape-1 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
}

.geometric-shape-2 {
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -2s;
    opacity: 0.15;
}

.geometric-shape-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -4s;
    opacity: 0.2;
}

/* Orbiting Dots */
.orbit-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
}

.orbit-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--color-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-glow);
    animation: orbit 15s linear infinite;
}

.orbit-dot:nth-child(2) {
    animation-delay: -5s;
    background: var(--color-primary-light);
}

.orbit-dot:nth-child(3) {
    animation-delay: -10s;
    background: var(--color-primary-dark);
}

/* ==================== SCROLL REVEAL CLASSES ==================== */

.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Children */
.stagger-children>* {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.stagger-children.active>*:nth-child(1) {
    transition-delay: 0.05s;
}

.stagger-children.active>*:nth-child(2) {
    transition-delay: 0.1s;
}

.stagger-children.active>*:nth-child(3) {
    transition-delay: 0.15s;
}

.stagger-children.active>*:nth-child(4) {
    transition-delay: 0.2s;
}

.stagger-children.active>*:nth-child(5) {
    transition-delay: 0.25s;
}

.stagger-children.active>*:nth-child(6) {
    transition-delay: 0.3s;
}

.stagger-children.active>*:nth-child(7) {
    transition-delay: 0.35s;
}

.stagger-children.active>*:nth-child(8) {
    transition-delay: 0.4s;
}

.stagger-children.active>* {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== HOVER ANIMATIONS ==================== */

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ==================== BUTTON RIPPLE ==================== */

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

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ==================== TEXT ANIMATIONS ==================== */

@keyframes textGlow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(199, 125, 255, 0.5);
    }

    50% {
        text-shadow: 0 0 30px rgba(199, 125, 255, 0.8), 0 0 60px rgba(199, 125, 255, 0.4);
    }
}

.text-glow {
    animation: textGlow 3s ease-in-out infinite;
}

/* ==================== BACKGROUND ANIMATIONS ==================== */

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background: linear-gradient(-45deg, var(--color-bg-dark), var(--color-secondary), var(--color-primary-dark), var(--color-bg-dark));
    background-size: 400% 400%;
    animation: gradientMove 15s ease infinite;
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}