/* Advanced Animations */

/* Scroll Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

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

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

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

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

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

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

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

/* Stagger Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.stagger-item.animate {
    opacity: 1;
    transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

/* Floating Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Glow Effect */
.glow {
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.3);
    transition: box-shadow 0.3s ease;
}

.glow:hover {
    box-shadow: 0 0 30px rgba(39, 174, 96, 0.5);
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s 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(--primary-color);
    }
}

/* Slide In Animations */
.slide-in-left {
    transform: translateX(-100%);
    transition: transform 0.8s ease;
}

.slide-in-left.active {
    transform: translateX(0);
}

.slide-in-right {
    transform: translateX(100%);
    transition: transform 0.8s ease;
}

.slide-in-right.active {
    transform: translateX(0);
}

.slide-in-top {
    transform: translateY(-100%);
    transition: transform 0.8s ease;
}

.slide-in-top.active {
    transform: translateY(0);
}

.slide-in-bottom {
    transform: translateY(100%);
    transition: transform 0.8s ease;
}

.slide-in-bottom.active {
    transform: translateY(0);
}

/* Rotate Animations */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg);
    transition: all 0.8s ease;
}

.rotate-in.active {
    opacity: 1;
    transform: rotate(0deg);
}

/* Zoom Animations */
.zoom-in {
    opacity: 0;
    transform: scale(0);
    transition: all 0.8s ease;
}

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

.zoom-out {
    opacity: 0;
    transform: scale(2);
    transition: all 0.8s ease;
}

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

/* Flip Animations */
.flip-in-x {
    opacity: 0;
    transform: perspective(400px) rotateX(90deg);
    transition: all 0.8s ease;
}

.flip-in-x.active {
    opacity: 1;
    transform: perspective(400px) rotateX(0deg);
}

.flip-in-y {
    opacity: 0;
    transform: perspective(400px) rotateY(90deg);
    transition: all 0.8s ease;
}

.flip-in-y.active {
    opacity: 1;
    transform: perspective(400px) rotateY(0deg);
}

/* Bounce Animations */
.bounce-in {
    opacity: 0;
    transform: scale(0.3);
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Elastic Animations */
.elastic-in {
    opacity: 0;
    transform: scale(0);
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Wobble Effect */
.wobble {
    animation: wobble 1s ease-in-out;
}

@keyframes wobble {
    0% { transform: translateX(0%); }
    15% { transform: translateX(-25%) rotate(-5deg); }
    30% { transform: translateX(20%) rotate(3deg); }
    45% { transform: translateX(-15%) rotate(-3deg); }
    60% { transform: translateX(10%) rotate(2deg); }
    75% { transform: translateX(-5%) rotate(-1deg); }
    100% { transform: translateX(0%); }
}

/* Shake Effect */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Gradient Animation */
.gradient-animate {
    background: linear-gradient(-45deg, #27ae60, #2ecc71, #3498db, #9b59b6);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Text Animations */
.text-focus-in {
    animation: text-focus-in 1s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}

@keyframes text-focus-in {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0px);
        opacity: 1;
    }
}

.text-shadow-drop-center {
    animation: text-shadow-drop-center 0.6s both;
}

@keyframes text-shadow-drop-center {
    0% {
        text-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
    100% {
        text-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
    }
}

/* Loading Animations */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Particle Effect */
.particles {
    position: relative;
    overflow: hidden;
}

.particles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.2), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: particles 20s linear infinite;
}

@keyframes particles {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-200px); }
}

/* Morphing Shapes */
.morph {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch 2s linear infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s linear infinite reverse;
    color: #ff0000;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s linear infinite reverse;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-1 {
    0% { clip: rect(42px, 9999px, 44px, 0); }
    25% { clip: rect(12px, 9999px, 59px, 0); }
    50% { clip: rect(85px, 9999px, 140px, 0); }
    75% { clip: rect(63px, 9999px, 54px, 0); }
    100% { clip: rect(26px, 9999px, 85px, 0); }
}

@keyframes glitch-2 {
    0% { clip: rect(65px, 9999px, 119px, 0); }
    25% { clip: rect(52px, 9999px, 74px, 0); }
    50% { clip: rect(79px, 9999px, 85px, 0); }
    75% { clip: rect(75px, 9999px, 5px, 0); }
    100% { clip: rect(67px, 9999px, 61px, 0); }
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        transform: none;
        opacity: 1;
    }
    
    .stagger-item {
        transform: none;
        opacity: 1;
        transition-delay: 0s;
    }
    
    .typewriter {
        animation: none;
        border-right: none;
        white-space: normal;
    }
}

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