/* Animated Mesh Gradients */
@keyframes float-gradient {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.mesh-gradient-1 {
    animation: float-gradient 20s ease-in-out infinite;
}

.mesh-gradient-2 {
    animation: float-gradient 15s ease-in-out infinite;
    animation-delay: -5s;
}

.mesh-gradient-3 {
    animation: float-gradient 18s ease-in-out infinite;
    animation-delay: -10s;
}

/* Typing cursor */
.typing-cursor {
    display: block;
    white-space: nowrap;
    /* Không bao giờ xuống dòng */
    overflow: hidden;
    /* Clip nếu tràn container */
    max-width: 100%;
    min-height: 1.2em;
    /* Giữ chiều cao cố định khi text rỗng, tránh layout nhảy */
}

.typing-cursor::after {
    content: '|';
    animation: blink 1s step-start infinite;
    color: #D9FF00;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ===== ENHANCED TYPING TEXT EFFECTS ===== */

/* Gradient Text Animation - Elegant Aurora Style */
.typing-text {
    background: linear-gradient(
        135deg,
        #667eea 0%,
        #764ba2 20%,
        #f093fb 35%,
        #f5576c 50%,
        #4facfe 70%,
        #00f2fe 85%,
        #667eea 100%
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: auroraFlow 8s ease infinite;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

/* Typing cursor container */
.typing-cursor {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    min-height: 1.2em;
}

/* Enhanced Cursor - Soft Glow */
.typing-cursor::after {
    content: '|';
    animation: blink 1.2s step-start infinite;
    color: #a5b4fc;
    text-shadow:
        0 0 8px rgba(167, 139, 250, 0.6),
        0 0 16px rgba(167, 139, 250, 0.4);
    font-weight: 300;
}

/* 1. Enhanced Typewriter with Gradient Cursor */
@keyframes gradientShift {

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

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

/* Smooth reveal class */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

/* Enhanced Reveal Variants - Phase 3 */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

.reveal-fade {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal-fade.active {
    opacity: 1;
}

/* Stagger animation for children */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.5, 0, 0, 1);
}

.stagger-children.active>* {
    opacity: 1;
    transform: translateY(0);
}

.stagger-children.active>*:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children.active>*:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-children.active>*:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-children.active>*:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-children.active>*:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-children.active>*:nth-child(6) {
    transition-delay: 0.6s;
}

.stagger-children.active>*:nth-child(7) {
    transition-delay: 0.7s;
}

.stagger-children.active>*:nth-child(8) {
    transition-delay: 0.8s;
}

/* 4. Enhanced Number Counter with Glow */
.stat-number {
    position: relative;
    display: inline-block;
}

.stat-number.counting {
    animation: numberGlow 0.5s ease-in-out;
}

@keyframes numberGlow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(217, 255, 0, 0.3);
    }

    50% {
        text-shadow: 0 0 20px rgba(217, 255, 0, 0.8),
            0 0 30px rgba(217, 255, 0, 0.6);
    }
}

/* Page fade-in animation */
body {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Page Navigation Transition */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   MOBILE ANIMATION OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {

    /* Reduce animation complexity on mobile */
    .mesh-gradient-1,
    .mesh-gradient-2,
    .mesh-gradient-3 {
        animation-duration: 30s;
        opacity: 0.5;
    }

    /* Disable complex transitions on mobile for performance */
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        transition-duration: 0.5s;
    }

    /* Simpler stagger on mobile */
    .stagger-children>* {
        transition-duration: 0.4s;
    }

    .stagger-children.active>*:nth-child(1) {
        transition-delay: 0.05s;
    }

    .stagger-children.active>*:nth-child(2) {
        transition-delay: 0.1s;
    }

    .stagger-children.active>*:nth-child(3) {
        transition-delay: 0.15s;
    }

    .stagger-children.active>*:nth-child(4) {
        transition-delay: 0.2s;
    }

    .stagger-children.active>*:nth-child(5) {
        transition-delay: 0.25s;
    }

    .stagger-children.active>*:nth-child(6) {
        transition-delay: 0.3s;
    }

    .stagger-children.active>*:nth-child(7) {
        transition-delay: 0.35s;
    }

    .stagger-children.active>*:nth-child(8) {
        transition-delay: 0.4s;
    }
}

@media (max-width: 480px) {

    /* Further reduce animations on very small screens */
    .mesh-gradient-1,
    .mesh-gradient-2,
    .mesh-gradient-3 {
        animation: none;
        opacity: 0.3;
    }

    /* Disable parallax on mobile */
    .parallax-slow,
    .parallax-fast {
        transform: none !important;
    }
}

/* Project Stagger Animation (Missing CSS Fix) */
.project-stagger {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.project-stagger.active {
    opacity: 1;
    transform: translateY(0);
}

.project-stagger:nth-child(1) {
    transition-delay: 0.1s;
}

.project-stagger:nth-child(2) {
    transition-delay: 0.2s;
}

.project-stagger:nth-child(3) {
    transition-delay: 0.3s;
}

.project-stagger:nth-child(4) {
    transition-delay: 0.4s;
}

.project-stagger:nth-child(5) {
    transition-delay: 0.5s;
}

.project-stagger:nth-child(6) {
    transition-delay: 0.6s;
}