/* ==========================================================================
   Animations - AppsLuna
   ========================================================================== */

/* ==========================================================================
   Keyframes
   ========================================================================== */

/* Fade animations */
@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(-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);
    }
}

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

@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hero background mesh */
@keyframes meshFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scroll indicator line */
@keyframes scrollLine {
    0% {
        top: -100%;
    }
    50% {
        top: 100%;
    }
    50.1% {
        top: -100%;
    }
    100% {
        top: -100%;
    }
}

/* Floating animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

/* Glow pulse */
@keyframes glowPulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

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

/* Text shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Particle float */
@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Border glow */
@keyframes borderGlow {
    0%, 100% {
        border-color: var(--border-color);
        box-shadow: none;
    }
    50% {
        border-color: var(--wordwise-color);
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
    }
}

/* Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Animation Classes (for JS triggers)
   ========================================================================== */

/* Fade animations */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

/* Scale animations */
.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

.animate-scale-bounce {
    animation: scaleInBounce 0.6s ease-out forwards;
}

/* Floating elements */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
    animation: floatSlow 8s ease-in-out infinite;
}

/* Glow animations */
.animate-glow-pulse {
    animation: glowPulse 3s ease-in-out infinite;
}

/* Gradient animations */
.animate-gradient {
    background-size: 200% auto;
    animation: gradientShift 4s ease infinite;
}

/* Text shimmer */
.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--text-primary) 0%,
        var(--wordwise-color-light) 25%,
        var(--text-primary) 50%,
        var(--otter-color-light) 75%,
        var(--text-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

/* ==========================================================================
   GSAP Animation States
   ========================================================================== */

/* Initial state for GSAP animations */
[data-animate] {
    opacity: 0;
}

[data-animate="fade-up"] {
    transform: translateY(50px);
}

[data-animate="fade-down"] {
    transform: translateY(-50px);
}

[data-animate="fade-left"] {
    transform: translateX(50px);
}

[data-animate="fade-right"] {
    transform: translateX(-50px);
}

[data-animate="scale"] {
    transform: scale(0.9);
}

[data-animate="blur"] {
    filter: blur(10px);
    transform: translateY(20px);
}

/* Stagger children */
[data-stagger] > * {
    opacity: 0;
    transform: translateY(30px);
}

/* Split text letters */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
}

.split-text .word {
    display: inline-block;
    overflow: hidden;
    margin-right: 0.25em;
}

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

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

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

/* Scale on hover */
.hover-scale {
    transition: transform var(--transition-base);
}

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

/* Glow on hover */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

/* Underline animation */
.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
}

.hover-underline:hover::after {
    width: 100%;
}

/* ==========================================================================
   Parallax
   ========================================================================== */

[data-parallax] {
    will-change: transform;
}

/* ==========================================================================
   3D Tilt Effect
   ========================================================================== */

.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tilt-card__inner {
    transition: transform var(--transition-base);
    transform-style: preserve-3d;
}

.tilt-card:hover .tilt-card__inner {
    transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

.tilt-card__shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
    border-radius: inherit;
}

.tilt-card:hover .tilt-card__shine {
    opacity: 1;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-tertiary) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s, transform 0.3s;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    [data-animate],
    [data-stagger] > *,
    .split-text .char {
        opacity: 1;
        transform: none;
        filter: none;
    }
}
