/* Hero Professional Animations - Software Development Theme */

/* Enhanced CSS Variables for Animations */
:root {
    --animation-duration-fast: 0.3s;
    --animation-duration-normal: 0.6s;
    --animation-duration-slow: 1.2s;
    --animation-easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --animation-easing-elegant: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* Matrix/Code effect colors */
    --matrix-primary: #00ff41;
    --matrix-secondary: #008f11;
    --code-bg: rgba(0, 0, 0, 0.8);
}

/* Typing Effect for Hero Title */
.hero-title.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--accent);
    white-space: nowrap;
    animation: 
        typing 2s steps(50, end),  /* Giảm từ 3.5s xuống 2s */
        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(--accent); 
    }
}

/* Progressive Reveal Animations */
.hero-content > * {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp var(--animation-duration-normal) var(--animation-easing-elegant) forwards;
}

.hero-title {
    animation-delay: 0.1s;  /* Giảm từ 0.2s */
}

.hero-description {
    animation-delay: 0.2s;  /* Giảm từ 0.4s */
}

.hero-buttons {
    animation-delay: 0.3s;  /* Giảm từ 0.6s */
}

.technologies {
    animation-delay: 0.4s;  /* Giảm từ 0.8s */
}

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

/* Technology Badges Advanced Animations */
.tech-badge {
    position: relative;
    overflow: hidden;
    transition: all var(--animation-duration-fast) var(--animation-easing-smooth);
    cursor: pointer;
    transform: translateY(0);
    animation: slideInScale 0.6s var(--animation-easing-bounce) forwards;
    opacity: 0;
}

/* Staggered animation for tech badges - faster timing */
.tech-badge:nth-child(1) { animation-delay: 0.5s; }  /* Giảm từ 0.9s */
.tech-badge:nth-child(2) { animation-delay: 0.55s; } /* Giảm từ 1.0s */
.tech-badge:nth-child(3) { animation-delay: 0.6s; }  /* Giảm từ 1.1s */
.tech-badge:nth-child(4) { animation-delay: 0.65s; } /* Giảm từ 1.2s */
.tech-badge:nth-child(5) { animation-delay: 0.7s; }  /* Giảm từ 1.3s */
.tech-badge:nth-child(6) { animation-delay: 0.75s; } /* Giảm từ 1.4s */
.tech-badge:nth-child(7) { animation-delay: 0.8s; }  /* Giảm từ 1.5s */
.tech-badge:nth-child(8) { animation-delay: 0.85s; } /* Giảm từ 1.6s */
.tech-badge:nth-child(9) { animation-delay: 0.9s; }  /* Giảm từ 1.7s */
.tech-badge:nth-child(10) { animation-delay: 0.95s; } /* Giảm từ 1.8s */
.tech-badge:nth-child(11) { animation-delay: 1.0s; } /* Giảm từ 1.9s */

@keyframes slideInScale {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Tech badge hover effects */
.tech-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tech-badge:hover::before {
    left: 100%;
}

.tech-badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
}

/* Advanced Floating Elements */
.floating-element {
    animation: float-advanced 6s ease-in-out infinite;
}

.floating-1 {
    animation-delay: 0s;
    background: radial-gradient(circle, var(--matrix-primary) 0%, transparent 70%);
}

.floating-2 {
    animation-delay: 3s;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
}

@keyframes float-advanced {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(20px, -20px) rotate(90deg) scale(1.1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-10px, -40px) rotate(180deg) scale(0.9);
        opacity: 0.4;
    }
    75% {
        transform: translate(-30px, -10px) rotate(270deg) scale(1.2);
        opacity: 0.6;
    }
}

/* Matrix Code Rain Effect */
.matrix-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.1;
}

.matrix-column {
    position: absolute;
    top: -100%;
    color: var(--matrix-primary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    animation: matrix-fall linear infinite;
    text-shadow: 0 0 5px var(--matrix-primary);
}

@keyframes matrix-fall {
    to {
        transform: translateY(100vh);
    }
}

/* Button Enhanced Animations */
.btn-hero, .btn-outline {
    position: relative;
    overflow: hidden;
    transition: all var(--animation-duration-fast) var(--animation-easing-smooth);
}

.btn-hero::before, .btn-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-hero:hover::before, .btn-outline:hover::before {
    left: 100%;
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 223, 101, 0.4);
}

.btn-outline:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

/* Code Particles Effect */
.code-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.code-particle {
    position: absolute;
    color: var(--matrix-secondary);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    opacity: 0;
    animation: particle-float 8s linear infinite;
}

@keyframes particle-float {
    0% {
        opacity: 0;
        transform: translateY(100vh) rotate(0deg);
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) rotate(360deg);
    }
}

/* Loading Screen */
.hero-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--secondary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease-out;
}

.hero-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-code {
    font-family: 'Courier New', monospace;
    color: var(--matrix-primary);
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;  /* Căn giữa text */
    padding: 0 1rem;    /* Thêm padding cho mobile */
    max-width: 90%;     /* Giới hạn width trên mobile */
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(0, 255, 65, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--matrix-primary);
    border-radius: 2px;
    animation: loading-progress 2s ease-out forwards;
    box-shadow: 0 0 10px var(--matrix-primary);
}

@keyframes loading-progress {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Parallax Effect for Background */
.hero-background {
    transform: scale(1.1);
    animation: parallax-zoom 20s ease-in-out infinite alternate;
}

@keyframes parallax-zoom {
    0% {
        transform: scale(1.1) translateY(0);
    }
    100% {
        transform: scale(1.15) translateY(-10px);
    }
}

/* Glitch Effect for Title (optional) */
.hero-title.glitch {
    position: relative;
    color: var(--primary-foreground);
    animation: glitch 2s infinite;
}

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

.hero-title.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0040;
    z-index: -1;
}

.hero-title.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ff40;
    z-index: -2;
}

@keyframes glitch {
    0%, 74%, 100% {
        transform: translate(0);
    }
    75% {
        transform: translate(2px, 0);
    }
    76% {
        transform: translate(-2px, 0);
    }
    77% {
        transform: translate(0);
    }
}

@keyframes glitch-1 {
    0%, 74%, 100% {
        transform: translate(0);
    }
    75% {
        transform: translate(2px, -2px);
        opacity: 0.3;
    }
}

@keyframes glitch-2 {
    0%, 74%, 100% {
        transform: translate(0);
    }
    75% {
        transform: translate(-2px, 2px);
        opacity: 0.3;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-title.typing-effect {
        white-space: normal;
        border-right: none;
        animation: fadeInUp var(--animation-duration-normal) var(--animation-easing-elegant) forwards;
        animation-delay: 0.1s;  /* Giảm từ 0.2s để phù hợp với timing mới */
    }
    
    .tech-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .floating-element {
        width: 60%;
        height: 60%;
    }
    
    .loading-code {
        font-size: 14px;
        text-align: center;
        padding: 0 1rem;
        line-height: 1.4;  /* Thêm line-height cho dễ đọc */
    }
    
    .loading-bar {
        width: 250px;
    }
    
    /* Căn giữa hoàn toàn cho mobile */
    .hero-loading {
        text-align: center;
        padding: 1rem;
    }
}

/* Performance Optimizations */
.hero * {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth scrolling trigger animations */
.hero.in-view .hero-content > * {
    animation-play-state: running;
}

/* Custom scrollbar for matrix effect */
.matrix-overlay::-webkit-scrollbar {
    display: none;
} 