/* Animation Keyframes */
@keyframes fadeInUp {
    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);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Circular Floating Animations for Hero Shapes */
@keyframes floatCircular1 {
    0% {
        transform: translate(0, 0) rotate(-45deg);
    }
    25% {
        transform: translate(20px, -15px) rotate(-45deg);
    }
    50% {
        transform: translate(30px, 10px) rotate(-45deg);
    }
    75% {
        transform: translate(-10px, 20px) rotate(-45deg);
    }
    100% {
        transform: translate(0, 0) rotate(-45deg);
    }
}

@keyframes floatCircular2 {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-15px, 20px);
    }
    50% {
        transform: translate(-25px, -10px);
    }
    75% {
        transform: translate(10px, -15px);
    }
    100% {
        transform: translate(0, 0);
    }
}

/* Subtle rotation for organic movement */
@keyframes rotateSubtle1 {
    0%, 100% {
        transform: rotate(-45deg);
    }
    50% {
        transform: rotate(-40deg);
    }
}

@keyframes rotateSubtle2 {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(3deg);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -8px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out;
}

.animate-slide-in-down {
    animation: slideInDown 0.6s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s;
}

/* Stagger Animations */
.animate-stagger > * {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-stagger > *:nth-child(1) {
    animation-delay: 0.1s;
}

.animate-stagger > *:nth-child(2) {
    animation-delay: 0.2s;
}

.animate-stagger > *:nth-child(3) {
    animation-delay: 0.3s;
}

.animate-stagger > *:nth-child(4) {
    animation-delay: 0.4s;
}

.animate-stagger > *:nth-child(5) {
    animation-delay: 0.5s;
}

.animate-stagger > *:nth-child(6) {
    animation-delay: 0.6s;
}

/* Hover Animations */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-tilt {
    transition: transform var(--transition-base);
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(10deg) rotateY(10deg);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
}

/* Loading Shimmer Effect */
.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Text Animations */
.text-gradient-animate {
    background: linear-gradient(
        45deg,
        var(--color-primary),
        var(--color-secondary),
        var(--color-accent),
        var(--color-primary)
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Typing Animation */
.typing-animation {
    overflow: hidden;
    border-right: 0.15em solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--color-primary);
    }
}

/* Morphing Shapes */
.morph-shape {
    transition: all var(--transition-slow);
}

.morph-shape:hover {
    border-radius: 50% 20% 80% 40%;
    transform: rotate(5deg);
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease-out;
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease-out;
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Interactive Animations */
.interactive-card {
    transition: all var(--transition-base);
    transform-style: preserve-3d;
}

.interactive-card:hover {
    transform: perspective(1000px) rotateY(5deg) rotateX(5deg);
}

.interactive-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 107, 53, 0.1) 0%,
        rgba(255, 167, 38, 0.1) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    border-radius: inherit;
}

.interactive-card:hover::before {
    opacity: 1;
}

/* Navigation Animations */
.nav-slide-in {
    transform: translateY(-100%);
    animation: slideInDown 0.5s ease-out forwards;
}

.nav-fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Page Transitions */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease-out;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-out;
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 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;
    }
    
    .animate-float,
    .animate-pulse,
    .typing-animation {
        animation: none;
    }
    
    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right {
        opacity: 1;
        transform: none;
    }
}

/* Dark Mode Animations */
@media (prefers-color-scheme: dark) {
    .shimmer {
        background: linear-gradient(
            90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0) 100%
        );
    }
}

/* Custom Easing Functions */
.ease-out-cubic {
    transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}

.ease-in-out-quart {
    transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000);
}

.ease-out-expo {
    transition-timing-function: cubic-bezier(0.190, 1.000, 0.220, 1.000);
}

.ease-out-back {
    transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.275);
}
