/* ========================================
   导航链接性能优化样式
   ======================================== */

/* 导航链接基础优化 */
.nav-link,
.nav-cta {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* 导航链接悬停效果 */
.nav-link:hover,
.nav-cta:hover {
    transform: translateY(-1px);
}

/* 导航loading状态 */
.nav-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.nav-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: nav-spin 1s linear infinite;
}

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

/* 已预取状态指示 */
.nav-prefetched::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: nav-pulse 2s infinite;
}

@keyframes nav-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 导航链接点击效果 */
.nav-link:active,
.nav-cta:active {
    transform: translateY(0) scale(0.98);
}

/* 关于我们链接特殊优化 */
.nav-link[href*="about"]:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 4px;
    padding: 4px 8px;
    margin: -4px -8px;
}

/* 导航预取状态提示（开发模式） */
.nav-prefetch-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.nav-prefetch-indicator.show {
    transform: translateX(0);
}

.nav-prefetch-indicator.hide {
    opacity: 0;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .nav-loading::after {
        right: -15px;
        width: 10px;
        height: 10px;
        margin-top: -5px;
        border-width: 1.5px;
    }
    
    .nav-link[href*="about"]:hover {
        background: none;
        padding: inherit;
        margin: inherit;
    }
    
    .nav-link:hover,
    .nav-cta:hover {
        transform: none; /* 移动端减少动画 */
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .nav-link[href*="about"]:hover {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.15));
    }
    
    .nav-loading::after {
        border-top-color: #60a5fa;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .nav-loading::after {
        border-width: 3px;
        border-top-color: var(--primary-blue);
    }
    
    .nav-prefetched::before {
        background: #059669;
        box-shadow: 0 0 0 1px white;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .nav-link,
    .nav-cta,
    .nav-prefetch-indicator {
        transition: none;
        animation: none;
    }
    
    .nav-link:hover,
    .nav-cta:hover {
        transform: none;
    }
    
    .nav-loading::after {
        animation: none;
        border: 2px solid var(--primary-blue);
    }
}

/* 焦点状态优化 - 现代化样式 */
.nav-link:focus-visible,
.nav-cta:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), 
                0 0 0 4px rgba(37, 99, 235, 0.1);
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.05);
    transition: all 0.2s ease;
}

/* 为导航链接的焦点状态添加更柔和的效果 */
.nav-link:focus-visible {
    color: var(--primary-blue);
    transform: translateY(-1px);
}

/* CTA按钮的焦点状态保持简洁 */
.nav-cta:focus-visible {
    background: var(--dark-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3),
                0 0 0 2px rgba(37, 99, 235, 0.2);
}