/* ===== Glassmorphism Floating Navigation Bar ===== */

.floating-nav {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(32px) saturate(200%) brightness(1.1);
    -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.12),
        0 2px 8px 0 rgba(0, 0, 0, 0.08),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.2);
    opacity: 0;
    max-width: min(90vw, 1100px);
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    will-change: scroll-position, top, opacity;
    contain: layout style paint;
    transition: none;
}

.floating-nav::-webkit-scrollbar {
    display: none;
}

.floating-nav.visible {
    animation: slideDownNav 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes slideDownNav {
    0% {
        top: -100px;
        opacity: 0;
        transform: translateX(-50%);
    }
    100% {
        top: var(--spacing-md);
        opacity: 1;
        transform: translateX(-50%);
    }
}

/* Navigation container */
.nav-container {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    position: relative;
    padding: 6px;
}

/* Active indicator blob */
.nav-blob {
    position: absolute;
    height: 40px;
    background: var(--accent);
    border-radius: 25px;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 0;
    box-shadow:
        0 4px 12px rgba(var(--accent-rgb, 108, 92, 231), 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    will-change: transform, width, left;
    transform: translateZ(0);
}

/* Navigation items */
.nav-item {
    position: relative;
    z-index: 1;
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    color: white;
}

/* Dark theme adjustments */
[data-theme="dark"] .floating-nav {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(32px) saturate(200%) brightness(1.2);
    -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.4),
        0 2px 8px 0 rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-item {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .nav-item:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-item.active {
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .floating-nav {
        max-width: calc(100vw - var(--spacing-lg) * 2);
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .floating-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .nav-blob {
        height: 36px;
    }
}

@media (max-width: 768px) {
    .floating-nav {
        top: -100px;
        padding: 4px;
    }

    .floating-nav.visible {
        animation: slideDownNavMobile 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    }

    @keyframes slideDownNavMobile {
        0% {
            top: -100px;
            opacity: 0;
            transform: translateX(-50%);
        }
        100% {
            top: var(--spacing-sm);
            opacity: 1;
            transform: translateX(-50%);
        }
    }

    .nav-item {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .nav-blob {
        height: 32px;
    }

    .nav-container {
        gap: 4px;
        padding: 4px;
    }
}

@media (max-width: 480px) {
    .nav-item {
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .nav-blob {
        height: 28px;
    }
}

/* Smooth scroll behavior - optimized for performance */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Section spacing for proper scroll tracking */
.project-section {
    scroll-margin-top: 100px;
}
