/* 
=====================================================
FanFacto - Animations
Logo-inspired dynamic animations and micro-interactions
=====================================================
*/

/* =====================================================
   SCROLL-TRIGGERED REVEAL ANIMATIONS
   ===================================================== */

/* Fade in from bottom */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in from left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in from right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale up */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Classes for scroll-triggered animations */
.fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in-left {
    opacity: 0;
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    opacity: 0;
    animation: fadeInRight 0.8s ease-out forwards;
}

.scale-in {
    opacity: 0;
    animation: scaleIn 0.6s ease-out forwards;
}

/* Staggered delays for sequential reveals */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

.delay-6 {
    animation-delay: 0.6s;
}

/* =====================================================
   LOGO-INSPIRED ANIMATIONS
   ===================================================== */

/* Dynamic lines animation (inspired by logo's top/bottom lines) */
@keyframes lineSweep {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }

    50% {
        transform: scaleX(1);
        transform-origin: left;
    }

    51% {
        transform-origin: right;
    }

    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

.animated-line {
    position: relative;
    overflow: hidden;
}

.animated-line::before,
.animated-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--color-primary);
    transform: scaleX(0);
}

.animated-line::before {
    top: 0;
    animation: lineSweep 3s ease-in-out infinite;
}

.animated-line::after {
    bottom: 0;
    animation: lineSweep 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

/* Curved line animation (inspired by logo's curved elements) */
@keyframes curvedGlow {

    0%,
    100% {
        opacity: 0.3;
        filter: blur(0px);
    }

    50% {
        opacity: 0.8;
        filter: blur(2px);
    }
}

.curved-accent {
    position: relative;
}

.curved-accent::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid var(--color-primary);
    border-radius: 50%;
    border-right-color: transparent;
    border-bottom-color: transparent;
    top: -20px;
    left: -20px;
    animation: curvedGlow 2s ease-in-out infinite, rotate 8s linear infinite;
    opacity: 0.3;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   MICRO-INTERACTIONS
   ===================================================== */

/* Button hover glow effect */
@keyframes buttonGlow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(239, 255, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 20px rgba(239, 255, 0, 0.8), 0 0 40px rgba(239, 255, 0, 0.4);
    }
}

.btn--primary:hover {
    animation: buttonGlow 1.5s ease-in-out infinite;
}

/* Card lift effect */
.lift-on-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lift-on-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Shimmer effect for attention-grabbing elements */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(239, 255, 0, 0.2) 50%,
            transparent 100%);
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

/* =====================================================
   TEXT ANIMATIONS
   ===================================================== */

/* Typing effect */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Highlight text animation */
@keyframes highlightText {
    0% {
        background-size: 0% 100%;
    }

    100% {
        background-size: 100% 100%;
    }
}

.highlight-animate {
    background: linear-gradient(to right,
            var(--color-primary) 0%,
            var(--color-primary) 100%);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    background-position: left center;
    animation: highlightText 1s ease-out forwards;
    padding: 0 0.2em;
}

/* =====================================================
   NUMBER COUNTER ANIMATION
   ===================================================== */

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 0.6s ease-out;
}

/* =====================================================
   FLOATING ELEMENTS
   ===================================================== */

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes floatSlow {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.float-slow {
    animation: floatSlow 6s ease-in-out infinite;
}

/* =====================================================
   PULSE ANIMATIONS
   ===================================================== */

@keyframes pulseScale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulseScale 2s ease-in-out infinite;
}

@keyframes pulseOpacity {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.pulse-opacity {
    animation: pulseOpacity 2s ease-in-out infinite;
}

/* =====================================================
   LOADING & SKELETON ANIMATIONS
   ===================================================== */

@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--color-surface) 0px,
            rgba(239, 255, 0, 0.08) 40px,
            var(--color-surface) 80px);
    background-size: 200px 100%;
    animation: skeleton 1.5s infinite;
}

/* Spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

/* =====================================================
   ENTRANCE ANIMATIONS FOR MODALS/POPUPS
   ===================================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.zoom-in {
    animation: zoomIn 0.3s ease-out;
}

/* =====================================================
   BACKGROUND PATTERN ANIMATIONS
   ===================================================== */

/* Animated grid pattern */
@keyframes gridMove {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 50px 50px;
    }
}

.animated-grid {
    background-image:
        linear-gradient(rgba(239, 255, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(239, 255, 0, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

/* Gradient shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background: linear-gradient(-45deg,
            var(--color-background),
            var(--color-surface),
            var(--color-gray-light),
            var(--color-surface));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* =====================================================
   PROGRESSIVE ENHANCEMENT
   ===================================================== */

/* For users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}

/* =====================================================
   UTILITY ANIMATION CLASSES
   ===================================================== */

/* Quick utility classes */
.animate-fast {
    animation-duration: 0.3s !important;
}

.animate-normal {
    animation-duration: 0.6s !important;
}

.animate-slow {
    animation-duration: 1s !important;
}

.animate-once {
    animation-iteration-count: 1 !important;
}

.animate-infinite {
    animation-iteration-count: infinite !important;
}

.animate-paused {
    animation-play-state: paused !important;
}

.animate-running {
    animation-play-state: running !important;
}