/* GPU-Accelerated Animations */
.gif-item {
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Advanced Hover Effects */
.gif-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.gif-item:hover .gif-media {
    transform: scale(1.05);
    filter: brightness(1.1) contrast(1.05);
}

/* Loading Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Staggered Entrance Animations */
.gif-item {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.gif-item:nth-child(1) { animation-delay: 0.1s; }
.gif-item:nth-child(2) { animation-delay: 0.2s; }
.gif-item:nth-child(3) { animation-delay: 0.3s; }
.gif-item:nth-child(4) { animation-delay: 0.4s; }

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

/* Portfolio Item Animations */
.portfolio-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.portfolio-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Fullscreen Modal Animations */
.gif-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gif-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.9);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.gif-modal.active .modal-content {
    transform: scale(1);
}

/* Interactive Controls Animations */
.gif-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.gif-item:hover .gif-overlay {
    opacity: 1;
}

.control-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    transform: scale(1);
}

.control-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* Hero Section Animations */
.hero h1 {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1s ease forwards 0.2s;
}

.hero .subtitle {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1s ease forwards 0.4s;
}

.hero .description {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1s ease forwards 0.6s;
}

.hero .cta-button {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1s ease forwards 0.8s;
}

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

/* Section Fade In Animation */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Button Hover Effects */
.cta-button {
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

/* Navigation Animations */
.navbar {
    transition: all 0.3s ease;
}

.mobile-menu {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.mobile-nav-links li {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.4s ease;
}

.mobile-menu.active .mobile-nav-links li {
    opacity: 1;
    transform: translateY(0);
}

/* Performance Optimizations */
.gif-media {
    will-change: transform;
    transform: translateZ(0);
}

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

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

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

.contact-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Skills Animation */
.skill-category {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.skill-category.visible {
    opacity: 1;
    transform: translateY(0);
}

.skill-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

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

.experience-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.experience-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}