/* Brain Background Animation */
@keyframes brainFloat {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.03) rotate(0deg); /* Reduced scale change */
    }
}

/* Add Will-Change Properties for Better Performance */
.hero-background {
    will-change: transform;
}

.logo-img,
.highlight-icon,
.project-card,
.cta-button,
.github-button {
    will-change: transform;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Up Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 102, 255, 0.6);
    }
}

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

/* Gradient Flow Animation */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Animated Slogan - Flowing Marquee Effect */
@keyframes sloganCycle {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(33.33%);
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s var(--transition-normal) forwards; /* Reduced from 1s */
}

.slide-up {
    opacity: 0;
    animation: slideUp 0.6s var(--transition-normal) forwards; /* Reduced from 0.8s */
}

.pulse {
    animation: pulse 3s infinite; /* Increased from 2s for less frequent repaints */
}

.glow {
    animation: glow 3s infinite; /* Increased from 2s for less frequent repaints */
}

.float {
    animation: float 4s ease-in-out infinite; /* Increased from 3s */
}

/* Animation Delays */
.delay-1 {
    animation-delay: 0.3s;
}

.delay-2 {
    animation-delay: 0.6s;
}

.delay-3 {
    animation-delay: 0.9s;
}

.delay-4 {
    animation-delay: 1.2s;
}

/* Scroll Animation Classes */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s var(--transition-normal);
}

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

/* Button Hover Effects */
.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: var(--transition-normal);
    transform: translate(-50%, -50%);
}

.cta-button:hover::after {
    width: 300px;
    height: 300px;
}

/* Project Card Hover Effects */
.project-card {
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 102, 255, 0.1),
        transparent
    );
    transition: var(--transition-normal);
}

.project-card:hover::before {
    left: 100%;
}

/* Navigation Link Animation */
.nav-link {
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-cyan);
    transition: var(--transition-normal);
}

.nav-link:hover::before {
    width: 100%;
}

/* Logo Animation */
.logo-img {
    transition: var(--transition-normal);
    will-change: transform;
}

.logo:hover .logo-img {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 10px var(--primary-blue));
}

/* Highlight Icon Animation */
.highlight-icon {
    transition: var(--transition-normal);
    will-change: transform;
}

.highlight:hover .highlight-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px var(--accent-cyan));
}

/* Tech Tag Animation */
.tech-tag {
    transition: var(--transition-fast);
}

.tech-tag:hover {
    transform: translateY(-2px);
    background: rgba(0, 102, 255, 0.3);
}

/* GitHub Button Icon Animation */
.github-button {
    position: relative;
    will-change: transform;
}

.github-icon {
    transition: var(--transition-fast);
}

.github-button:hover .github-icon {
    transform: rotate(360deg);
}

/* Logo Animation */
.logo-img {
    transition: var(--transition-normal);
}

.logo:hover .logo-img {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 10px var(--primary-blue));
}

/* Highlight Icon Animation */
.highlight-icon {
    transition: var(--transition-normal);
}

.highlight:hover .highlight-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px var(--accent-cyan));
}

/* Tech Tag Animation */
.tech-tag {
    transition: var(--transition-fast);
}

.tech-tag:hover {
    transform: translateY(-2px);
    background: rgba(0, 102, 255, 0.3);
}

/* GitHub Button Icon Animation */
.github-button {
    position: relative;
}

.github-icon {
    transition: var(--transition-fast);
}

.github-button:hover .github-icon {
    transform: rotate(360deg);
}

/* Text Gradient Animation */
.gradient-text {
    background: linear-gradient(
        135deg,
        var(--primary-blue),
        var(--accent-cyan),
        var(--secondary-purple)
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease infinite;
}

/* Section Entrance Animation */
.section-entrance {
    opacity: 0;
    transform: translateY(100px);
    transition: all 1s var(--transition-normal);
}

.section-entrance.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
@keyframes loadingDots {
    0%, 20% {
        color: rgba(0, 0, 0, 0);
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    40% {
        color: var(--primary-blue);
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0), 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    60% {
        text-shadow: 0.25em 0 0 var(--primary-blue), 0.5em 0 0 rgba(0, 0, 0, 0);
    }
    80%, 100% {
        text-shadow: 0.25em 0 0 var(--primary-blue), 0.5em 0 0 var(--primary-blue);
    }
}

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

/* Animated Slogan */
.animated-slogan {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--accent-cyan);
    position: relative;
    overflow: hidden;
}

.slogan-text {
    display: inline-block;
    min-width: 150px;
    text-align: center;
    animation: sloganCycle 8s linear infinite;
}

.slogan-text:nth-child(1) {
    animation-delay: 0s;
}

.slogan-text:nth-child(3) {
    animation-delay: 2.67s;
}

.slogan-text:nth-child(5) {
    animation-delay: 5.33s;
}

.slogan-arrow {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-size: 1.2rem;
    animation: sloganCycle 8s linear infinite;
    opacity: 0.7;
}

.slogan-arrow:nth-child(2) {
    animation-delay: 0s;
}

.slogan-arrow:nth-child(4) {
    animation-delay: 2.67s;
}

.slogan-arrow:nth-child(6) {
    animation-delay: 5.33s;
}

/* Alternative approach: continuous flow */
.animated-slogan.flow {
    display: flex;
    overflow: hidden;
}

.animated-slogan.flow .slogan-text,
.animated-slogan.flow .slogan-arrow {
    flex-shrink: 0;
    animation: sloganFlow 12s linear infinite;
}

.animated-slogan.flow .slogan-text:nth-child(1),
.animated-slogan.flow .slogan-arrow:nth-child(2) {
    animation-delay: 0s;
}

.animated-slogan.flow .slogan-text:nth-child(3),
.animated-slogan.flow .slogan-arrow:nth-child(4) {
    animation-delay: 4s;
}

.animated-slogan.flow .slogan-text:nth-child(5),
.animated-slogan.flow .slogan-arrow:nth-child(6) {
    animation-delay: 8s;
}

/* Smooth Scroll Animation */
html {
    scroll-behavior: smooth;
}

/* Parallax Effect */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Mobile Menu Animation */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.mobile-menu-open {
    animation: slideInFromRight 0.3s ease forwards;
}

.mobile-menu-close {
    animation: slideOutToRight 0.3s ease forwards;
}