/* ============================================
   Primary Navigation Component
   Responsive navigation with brand gradient and mobile menu
   ============================================ */

.nav-primary {
    background:
    /* Subtle metallic sheen overlay - positioned behind logo */
        linear-gradient(
            110deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.03) 15%,
            transparent 25%,
            transparent 100%
        ),
        /* Vertical highlight for polish effect */
            linear-gradient(
                to bottom,
                rgba(255, 255, 255, 0.02) 0%,
                transparent 15%,
                transparent 85%,
                rgba(0, 0, 0, 0.02) 100%
            ),
        /* Base dark purple gradient */
            linear-gradient(
                to bottom,
                rgba(45, 38, 62, 0.9),
                rgba(35, 30, 48, 0.9)
            ); /* Dark purple gradient with subtle metallic sheen */
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    position: sticky;
    top: 1rem;
    z-index: 1070;
    margin: 1rem 1rem 0 1rem;
    border-radius: var(--radius-xl);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06),
        /* Subtle shadow for definition */ inset 0 -1px 0 0
            rgba(255, 255, 255, 0.1); /* Bottom border highlight */
    border: 1px solid rgba(255, 255, 255, 0.03); /* Very subtle overall border */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* Slightly stronger bottom border */
    overflow: visible; /* Allow mobile menu to break out */
}

/* Backdrop overlay that creates the fade effect above the nav */
/* Using pseudo-element on body for cleaner implementation */
body:has(.nav-primary)::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 75px; /* Compact fade area as requested */
    pointer-events: none;
    z-index: 1019; /* Just below nav-primary (1020) */

    /* Gradient from solid blur to transparent - optimized for 50px height */
    background: linear-gradient(
        180deg,
        rgba(45, 38, 62, 0.85) 0%,
        /* Solid at top */ rgba(26, 21, 47, 0.6) 30%,
        /* Quick fade start */ rgba(26, 21, 47, 0.3) 60%,
        /* Medium opacity */ rgba(26, 21, 47, 0.1) 85%,
        /* Nearly transparent */ transparent 100%
            /* Fully transparent at bottom */
    );

    /* Apply blur effect */
    backdrop-filter: blur(25px) saturate(140%);
    -webkit-backdrop-filter: blur(25px) saturate(140%);
}

/* Mobile menu active state - no longer needs backdrop-filter handling */

.nav-wrapper {
    /* max-width: 1400px; */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    position: relative;
    overflow: visible; /* Allow mobile menu to break out */
}

/* Logo */
.nav-logo {
    font-size: 1.75rem;
    text-decoration: none;
    transition: var(--transition-fast);
    z-index: 10;
    display: inline-flex;
    align-items: center;
}

.logo-text {
    display: inline-block;
    /* padding: 0.375rem 0.75rem; */
    font-family:
        "SF Pro Display",
        -apple-system,
        system-ui,
        sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--gradient-brand);
    text-shadow:
        1px 1px 0 rgba(138, 43, 226, 0.9),
        /* Enhanced purple shadow on hover */ 0 0 30px rgba(138, 43, 226, 0.4),
        /* Stronger glow effect */ -1px -1px 2px rgba(45, 38, 62, 0.9); /* Darker backdrop */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    position: relative;
}

.nav-logo:hover .logo-text {
    transform: scale(1.25);
    text-shadow:
        1px 1px 0 rgba(138, 43, 226, 1),
        /* Enhanced purple shadow on hover */ 0 0 30px rgba(138, 43, 226, 0.4),
        /* Stronger glow effect */ -1px -1px 2px rgba(45, 38, 62, 0.9); /* Darker backdrop */
}

/* Desktop Navigation */
.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: right;
    flex: 1;
    justify-content: right;
}

.nav-links > a,
.nav-links .nav-link {
    color: white;
    text-decoration: none;
    font-weight: var(--font-medium);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    opacity: 0.85;
    position: relative;
    overflow: hidden;
}

.nav-links > a::before,
.nav-links .nav-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gradient-brand);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-md);
}

.nav-links > a:hover,
.nav-links .nav-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.nav-links > a:hover::before,
.nav-links .nav-link:hover::before {
    opacity: 0.15;
}

.nav-links > a.active,
.nav-links .nav-link.active {
    opacity: 1;
    font-weight: var(--font-semibold);
    color: white;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.2);
}

.nav-links > a.active::before,
.nav-links .nav-link.active::before {
    opacity: 0.15;
}

/* Auth buttons */
.nav-auth {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.nav-primary .button {
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
}

.nav-primary .button-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
}

.nav-primary .button-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 10;
}

.hamburger {
    display: flex;
    flex-direction: column;
    width: 24px;
    height: 24px;
    justify-content: space-around;
    position: relative;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: left center;
}

/* Hamburger animation */
.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(1) {
    transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; /* Ensure it's above everything including sticky nav */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
    margin: 0;
    padding: 0;
}

.mobile-menu-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Match nav-primary gradient for consistency */
    background:
    /* Subtle metallic sheen overlay */
        linear-gradient(
            110deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.03) 15%,
            transparent 25%,
            transparent 100%
        ),
        /* Vertical highlight for polish effect */
            linear-gradient(
                to bottom,
                rgba(255, 255, 255, 0.02) 0%,
                transparent 15%,
                transparent 85%,
                rgba(0, 0, 0, 0.02) 100%
            ),
        /* Base dark purple gradient - slightly darker for fullscreen */
            linear-gradient(
                to bottom,
                rgba(45, 38, 62, 0.98),
                rgba(35, 30, 48, 0.98)
            );
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

/* Mobile Menu Navigation */
.mobile-menu-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1.5rem;
}

.mobile-menu-nav a {
    color: white;
    text-decoration: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: var(--font-medium);
    transition: var(--transition-fast);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.mobile-menu-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: var(--font-semibold);
}

/* Mobile Menu Auth */
.mobile-menu-auth {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-auth .button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

/* Mobile Menu Footer */
.mobile-menu-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-footer .glass-button-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mobile-menu-footer .glass-button-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    .nav-wrapper {
        padding: 0.75rem 1rem;
    }

    .nav-links,
    .nav-auth {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-primary .glass-button-toggle {
        display: none;
    }
}

@media (max-width: 480px) {
    .nav-logo {
        font-size: 1.25rem;
    }

    .mobile-menu-nav a {
        font-size: 1rem;
    }
}
