/* Animation for title underline */
@keyframes underlineGrow {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Responsive animations */
@media (max-width: 768px) {
    @keyframes underlineGrow {
        from {
            width: 0;
        }
        to {
            width: 80%;
        }
    }
}

/* Smooth transitions for all elements */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .orbit {
        animation: none !important;
    }
    
    .title-slider {
        transition: none !important;
    }
}

/* Loading animation for better perceived performance */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade-in animation for content */
.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for project cards */
.project-card {
    animation: fadeIn 0.6s ease forwards;
    animation-delay: calc(var(--delay, 0) * 0.1s);
}

/* Hover animations for better interactivity */
@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-5px) scale(1.02);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .project-card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
}