/* ============================================
   LogicMesh - Animations Library
   ============================================ */

/* ============================================
   Keyframe Definitions
   ============================================ */

/* Pulse Animation */
@keyframes pulse {

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

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

/* Glow Pulse */
@keyframes glowPulse {

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

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

/* Float Animation */
@keyframes float {

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

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

/* Float with Rotation */
@keyframes floatRotate {

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

    25% {
        transform: translateY(-10px) rotate(2deg);
    }

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

    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

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

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

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

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

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

/* Slide In Up */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Rotate */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

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

/* Slow Rotate */
@keyframes slowRotate {
    from {
        transform: rotate(0deg);
    }

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

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

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

/* Border Glow */
@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(0, 212, 255, 0.3);
    }

    50% {
        border-color: rgba(0, 212, 255, 0.8);
    }
}

/* Particle Float */
@keyframes particleFloat {

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

    25% {
        transform: translate(10px, -10px) scale(1.1);
        opacity: 0.8;
    }

    50% {
        transform: translate(0, -20px) scale(1);
        opacity: 0.6;
    }

    75% {
        transform: translate(-10px, -10px) scale(0.9);
        opacity: 0.7;
    }
}

/* ============================================
   Animation Classes
   ============================================ */

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

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

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-rotate {
    animation: floatRotate 8s ease-in-out infinite;
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

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

.animate-slow-rotate {
    animation: slowRotate 40s linear infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.1),
            transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   Scroll Animations (Initial State)
   ============================================ */

.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: all 0.6s ease;
}

.fade-in-down.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s ease;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Animation Delays */
.delay-100 {
    transition-delay: 100ms;
}

.delay-200 {
    transition-delay: 200ms;
}

.delay-300 {
    transition-delay: 300ms;
}

.delay-400 {
    transition-delay: 400ms;
}

.delay-500 {
    transition-delay: 500ms;
}

.delay-600 {
    transition-delay: 600ms;
}

.delay-700 {
    transition-delay: 700ms;
}

.delay-800 {
    transition-delay: 800ms;
}

/* ============================================
   Hover Animations
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-border-glow {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hover-border-glow:hover {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.1);
}

/* ============================================
   Text Animations
   ============================================ */

.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: slideInUp 0.6s ease forwards;
}

.typing-cursor::after {
    content: '|';
    animation: pulse 1s infinite;
    color: var(--color-primary);
}

/* ============================================
   Loading Animations
   ============================================ */

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loader-dots {
    display: flex;
    gap: 8px;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================
   Page Transitions
   ============================================ */

.page-transition {
    animation: fadeIn 0.5s ease;
}

/* ============================================
   Particle Effect Styles
   ============================================ */

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    opacity: 0.5;
    animation: particleFloat 10s ease-in-out infinite;
}

.particle:nth-child(2n) {
    background: var(--color-accent);
    animation-duration: 12s;
    animation-delay: -2s;
}

.particle:nth-child(3n) {
    background: var(--color-secondary);
    animation-duration: 14s;
    animation-delay: -4s;
}

/* ============================================
   Mesh/Grid Animation
   ============================================ */

.mesh-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    animation: gradientShift 20s ease infinite;
    pointer-events: none;
}

/* ============================================
   Interactive Elements
   ============================================ */

.interactive-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.interactive-card:hover {
    transform: translateY(-10px) scale(1.02);
}

.interactive-card:active {
    transform: translateY(-5px) scale(1);
}

/* Magnetic Button Effect (requires JS) */
.magnetic-btn {
    transition: transform 0.3s ease;
}

/* ============================================
   Counter Animation
   ============================================ */

.counter {
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Line Animations
   ============================================ */

.line-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: lineDraw 2s ease forwards;
}

@keyframes lineDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ============================================
   Reveal on Scroll Container
   ============================================ */

.reveal-container>* {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.reveal-container.visible>* {
    opacity: 1;
    transform: translateY(0);
}

.reveal-container.visible>*:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal-container.visible>*:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal-container.visible>*:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal-container.visible>*:nth-child(4) {
    transition-delay: 0.4s;
}

.reveal-container.visible>*:nth-child(5) {
    transition-delay: 0.5s;
}

.reveal-container.visible>*:nth-child(6) {
    transition-delay: 0.6s;
}