/* ============================================
   Animations & Transitions
   ============================================ */

/* ===== 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.3);
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

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

/* ===== Float Animation ===== */
@keyframes float {

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

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

/* ===== Pulse Animation for FAB ===== */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.quick-contact-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    opacity: 0;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.quick-contact-fab {
    animation: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.5s backwards;
}

/* ===== Shimmer Effect for Project Overlay ===== */
    100% {
        transform: translateY(0);
    }

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

/* ===== Pulse Animation ===== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    }
}

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

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

/* ===== Bounce Animation ===== */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }

    50% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* ===== Typing Animation ===== */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {

    0%,
    50% {
        border-color: var(--primary-400);
    }

    51%,
    100% {
        border-color: transparent;
    }
}

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

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

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

/* ===== Wave Animation ===== */
@keyframes wave {
    0% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(14deg);
    }

    20% {
        transform: rotate(-8deg);
    }

    30% {
        transform: rotate(14deg);
    }

    40% {
        transform: rotate(-4deg);
    }

    50% {
        transform: rotate(10deg);
    }

    60% {
        transform: rotate(0deg);
    }

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

/* ===== Slide Animations ===== */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

/* ===== Blob Animation ===== */
@keyframes blob {

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

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

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

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

/* ===== Counter Animation ===== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ===== Animation Classes ===== */
.animate-fadeIn {
    animation: fadeIn var(--transition-slower) ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease forwards;
}

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

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

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-wave {
    animation: wave 2.5s infinite;
    transform-origin: 70% 70%;
    display: inline-block;
}

.animate-blob {
    animation: blob 8s ease-in-out infinite;
}

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

/* ===== Scroll Reveal Classes ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Stagger Children ===== */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.active>*:nth-child(1) {
    animation: fadeInUp 0.5s ease 0.1s forwards;
}

.stagger-children.active>*:nth-child(2) {
    animation: fadeInUp 0.5s ease 0.2s forwards;
}

.stagger-children.active>*:nth-child(3) {
    animation: fadeInUp 0.5s ease 0.3s forwards;
}

.stagger-children.active>*:nth-child(4) {
    animation: fadeInUp 0.5s ease 0.4s forwards;
}

.stagger-children.active>*:nth-child(5) {
    animation: fadeInUp 0.5s ease 0.5s forwards;
}

.stagger-children.active>*:nth-child(6) {
    animation: fadeInUp 0.5s ease 0.6s forwards;
}

.stagger-children.active>*:nth-child(7) {
    animation: fadeInUp 0.5s ease 0.7s forwards;
}

.stagger-children.active>*:nth-child(8) {
    animation: fadeInUp 0.5s ease 0.8s forwards;
}

/* ===== Hover Animations ===== */
.hover-lift {
    transition: transform var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

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

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

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

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

/* ===== Transition Delays ===== */
.delay-100 {
    transition-delay: 100ms;
    animation-delay: 100ms;
}

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

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

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

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

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

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

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

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

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

@keyframes shineSweep {
    0% {
        left: -100%;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        left: 100%;
        opacity: 0;
    }
}

/* ===== Glow Pulse Effect ===== */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5),
            0 0 20px rgba(99, 102, 241, 0.3),
            0 0 40px rgba(99, 102, 241, 0.1);
    }

    50% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.8),
            0 0 30px rgba(99, 102, 241, 0.5),
            0 0 60px rgba(99, 102, 241, 0.3);
    }
}

/* ===== Morphing Gradient Background ===== */
@keyframes morphGradient {

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

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

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

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

/* ===== Border Gradient Animation ===== */
@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(99, 102, 241, 0.5);
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    }

    50% {
        border-color: rgba(139, 92, 246, 0.8);
        box-shadow: 0 0 25px rgba(139, 92, 246, 0.4);
    }
}

/* ===== Floating 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);
    }
}

/* ===== Scale Pop ===== */
@keyframes scalePop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

/* ===== Draw Line ===== */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* ===== Ripple Effect ===== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }

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

/* ===== Text Reveal ===== */
@keyframes textReveal {
    0% {
        clip-path: inset(0 100% 0 0);
    }

    100% {
        clip-path: inset(0 0 0 0);
    }
}

/* ===== Rotate In ===== */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate3d(0, 0, 1, -200deg);
    }

    to {
        opacity: 1;
        transform: rotate3d(0, 0, 1, 0deg);
    }
}

/* ===== Flip In ===== */
@keyframes flipInX {
    from {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg);
    }

    40% {
        transform: perspective(400px) rotateX(-20deg);
    }

    60% {
        transform: perspective(400px) rotateX(10deg);
        opacity: 1;
    }

    80% {
        transform: perspective(400px) rotateX(-5deg);
    }

    to {
        opacity: 1;
        transform: perspective(400px);
    }
}

/* ===== Modern Animation Classes ===== */
.animate-shimmer {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

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

.animate-morph-gradient {
    background-size: 400% 400%;
    animation: morphGradient 15s ease infinite;
}

.animate-border-glow {
    animation: borderGlow 3s ease-in-out infinite;
}

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

.animate-ripple {
    animation: ripple 0.6s linear;
}

.animate-text-reveal {
    animation: textReveal 0.8s ease forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.6s ease forwards;
}

.animate-flip-in {
    animation: flipInX 0.8s ease forwards;
}

/* ===== Shine Sweep on Hover ===== */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transform: skewX(-25deg);
    transition: none;
}

.shine-effect:hover::after {
    animation: shineSweep 0.6s ease forwards;
}

/* ===== 3D Tilt Effect Container ===== */
.tilt-effect {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-effect:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) scale(1.02);
}

.tilt-effect .tilt-content {
    transform: translateZ(30px);
}

/* ===== Magnetic Hover ===== */
.magnetic-hover {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Glow Text ===== */
.glow-text {
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5),
        0 0 20px rgba(99, 102, 241, 0.3),
        0 0 40px rgba(99, 102, 241, 0.1);
}

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

/* ===== Enhanced Reveal Animations ===== */
.reveal-3d {
    opacity: 0;
    transform: perspective(600px) rotateX(-15deg) translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-3d.active {
    opacity: 1;
    transform: perspective(600px) rotateX(0) translateY(0);
}

/* ===== Stagger with More Children ===== */
.stagger-children.active>*:nth-child(9) {
    animation: fadeInUp 0.5s ease 0.9s forwards;
}

.stagger-children.active>*:nth-child(10) {
    animation: fadeInUp 0.5s ease 1s forwards;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

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