/**
 * Navigation Micro-interactions
 * Advanced hover effects and polish
 */

/* ============================================
   Advanced Hover Effects
   ============================================ */

/* Magnetic hover effect */
@media (hover: hover) {
    .main-navigation a {
        position: relative;
        transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    }
    
    .main-navigation a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 0;
        height: 2px;
        background: var(--nav-primary);
        transform: translateX(-50%);
        transition: width 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    }
    
    .main-navigation a:hover::after {
        width: 80%;
    }
}

/* Ripple effect on click */
.main-navigation a {
    position: relative;
    overflow: hidden;
}

.main-navigation a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(46, 125, 50, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.main-navigation a:active::before {
    width: 300px;
    height: 300px;
}

/* Glow effect for Submit Trek button */
@keyframes buttonGlow {
    0% {
        box-shadow: 0 0 5px var(--nav-primary),
                    0 0 10px var(--nav-primary),
                    0 0 15px var(--nav-primary);
    }
    50% {
        box-shadow: 0 0 10px var(--nav-primary),
                    0 0 20px var(--nav-primary),
                    0 0 30px var(--nav-primary);
    }
    100% {
        box-shadow: 0 0 5px var(--nav-primary),
                    0 0 10px var(--nav-primary),
                    0 0 15px var(--nav-primary);
    }
}

.main-navigation a[href*="submit-trek"]:hover {
    animation: buttonGlow 2s infinite;
}

/* ============================================
   Logo Animation
   ============================================ */
.site-title a {
    display: inline-block;
    transition: all 0.3s ease;
}

.site-title a:hover {
    transform: scale(1.05);
}

/* Letter spacing animation on hover */
@media (hover: hover) {
    .site-title a {
        transition: letter-spacing 0.3s ease, color 0.3s ease;
    }
    
    .site-title a:hover {
        letter-spacing: 1px;
    }
}

/* ============================================
   Mobile Menu Animations
   ============================================ */

/* Staggered menu item animation */
@media (max-width: 768px) {
    .main-navigation.active .menu-item {
        opacity: 0;
        transform: translateX(-20px);
        animation: slideInLeft 0.3s forwards;
    }
    
    .main-navigation.active .menu-item:nth-child(1) { animation-delay: 0.05s; }
    .main-navigation.active .menu-item:nth-child(2) { animation-delay: 0.1s; }
    .main-navigation.active .menu-item:nth-child(3) { animation-delay: 0.15s; }
    .main-navigation.active .menu-item:nth-child(4) { animation-delay: 0.2s; }
    .main-navigation.active .menu-item:nth-child(5) { animation-delay: 0.25s; }
    .main-navigation.active .menu-item:nth-child(6) { animation-delay: 0.3s; }
    .main-navigation.active .menu-item:nth-child(7) { animation-delay: 0.35s; }
    .main-navigation.active .menu-item:nth-child(8) { animation-delay: 0.4s; }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   Loading States
   ============================================ */

/* Navigation link loading animation */
.main-navigation a.loading {
    position: relative;
    color: transparent !important;
}

.main-navigation a.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--nav-primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: navSpinner 0.75s linear infinite;
}

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

/* ============================================
   Focus Improvements
   ============================================ */

/* Custom focus ring */
.main-navigation a:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.3);
}

/* Skip animation on focus */
.main-navigation a:focus::after {
    width: 100%;
    transition: none;
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* Use GPU acceleration for transforms */
.main-navigation a,
.mobile-menu-toggle,
.hamburger span {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================
   Seasonal Theme (Optional Fun)
   ============================================ */

/* St. Patrick's Day Theme */
.st-patricks-day .main-navigation a:hover {
    color: #2e7d32;
    background: linear-gradient(45deg, #2e7d32 25%, #4caf50 25%, #4caf50 50%, #2e7d32 50%, #2e7d32 75%, #4caf50 75%, #4caf50);
    background-size: 10px 10px;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 10px 10px;
    }
}