/* Mystical/Spiritual Navigation Enhancement */
/* =========================================== */

/* ---- shared knobs ---- */
.top-nav{
  --nav-w: 350px;          /* JS already updates this */
  --nav-right: 24px;       /* distance from viewport right to nav edge */
  --toggle-gap: 12px;      /* gap between toggle and nav edge */
  --toggle-top: 24px;      /* vertical align of toggle + nav */
}

/* Desktop */
@media (min-width: 769px){
  /* hide mobile toggle */
  .top-nav .nav-toggle{ display:none; }

  /* FIX: make the nav panel fixed and aligned to our vars */
  .top-nav .nav-menu{
    position: fixed;
    top: var(--toggle-top);
    right: var(--nav-right);
    width: var(--nav-w);
    /* keep your existing visuals below as-is */
  }

  /* FIX: glue toggle to the nav's left edge */
  .top-nav .desktop-nav-toggle{
    position: fixed;
    top: calc(var(--toggle-top) + 15px);
    right: calc(var(--nav-right) + var(--nav-w) + 50px);
    display: inline-flex;
    align-items: center; 
    justify-content: center;
    width: 30px; 
    height: 30px;
    cursor: pointer;
    z-index: 10001;
    background: transparent;
    border: none;
    transition: right .35s ease, transform .25s ease;
  }
  .top-nav .desktop-nav-toggle:hover{
    transform: scale(1.1);
  }
  .top-nav .desktop-nav-toggle:hover .chevron{
    filter: drop-shadow(0 0 8px rgba(255,215,0,0.8)) drop-shadow(0 0 4px rgba(255,215,0,1));
    opacity: 1;
  }

  /* On collapse, park it at the top-right corner (same offset as the nav) */
  .top-nav.nav-collapsed .desktop-nav-toggle{
    right: 30px;
  }

  /* Chevron icon */
  .top-nav .desktop-nav-toggle .chevron{
    width: 14px; 
    height: 14px;
    border-right: 4px solid #ffd700;
    border-top: 4px solid #ffd700;
    transform: rotate(45deg);
    transition: transform .25s ease, filter .25s ease;
    filter: drop-shadow(0 0 4px rgba(255,215,0,0.4)) drop-shadow(0 0 2px rgba(255,215,0,0.6));
    opacity: 0.85;
  }
  .top-nav.nav-collapsed .desktop-nav-toggle .chevron{
    transform: rotate(225deg);
  }

  @media (prefers-reduced-motion: reduce){
    .top-nav .desktop-nav-toggle,
    .top-nav .desktop-nav-toggle .chevron{ transition:none; }
  }

    /* Enhanced glass effect with divine glow */
    .top-nav .nav-menu {
        background: linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.03) 0%,
            rgba(138, 43, 226, 0.02) 25%,
            rgba(255, 255, 255, 0.01) 50%,
            rgba(255, 215, 0, 0.03) 75%,
            rgba(138, 43, 226, 0.02) 100%
        );
        backdrop-filter: blur(15px) saturate(150%);
        -webkit-backdrop-filter: blur(15px) saturate(150%);
        border: 1px solid rgba(255, 215, 0, 0.15);
        box-shadow: 
            0 8px 32px rgba(138, 43, 226, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 0 80px rgba(255, 215, 0, 0.05);
        position: relative;
        overflow: hidden;
        animation: divineBreathing 4s ease-in-out infinite;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Collapsed state for desktop navigation */
    .top-nav.nav-collapsed .nav-menu {
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%) scale(0.9);
        pointer-events: none;
    }

    /* Animated divine breathing effect */
    @keyframes divineBreathing {
        0%, 100% {
            box-shadow: 
                0 8px 32px rgba(138, 43, 226, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1),
                0 0 80px rgba(255, 215, 0, 0.05);
        }
        50% {
            box-shadow: 
                0 8px 40px rgba(138, 43, 226, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                0 0 100px rgba(255, 215, 0, 0.1);
        }
    }

    /* Ethereal shimmer overlay */
    .top-nav .nav-menu::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: linear-gradient(
            45deg,
            transparent 30%,
            rgba(255, 215, 0, 0.1) 50%,
            transparent 70%
        );
        animation: etherealShimmer 8s linear infinite;
        pointer-events: none;
    }

    @keyframes etherealShimmer {
        0% {
            transform: translateX(-100%) translateY(-100%) rotate(0deg);
        }
        100% {
            transform: translateX(100%) translateY(100%) rotate(360deg);
        }
    }

    /* Mystical link styling */
    .top-nav .nav-link {
        color: #ffd700;
        text-decoration: none;
        font-size: 1.1em;
        font-weight: 500;
        text-shadow: 
            0 0 10px rgba(255, 215, 0, 0.5),
            0 0 20px rgba(255, 215, 0, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.3);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        letter-spacing: 0.5px;
    }

    /* Divine hover effect - Wave underline */
    .top-nav .nav-link::before {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        width: 0;
        height: 3px;
        background: linear-gradient(
            90deg,
            transparent,
            #ffd700,
            #ff380085,
            #ffd700,
            #ff380085,
            #ffd700,
            #ff380085,
            #ffd700,
            transparent
        );
        background-size: 200% 100%;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-50%);
        filter: blur(1px);
        border-radius: 2px;
    }

    /* Activated hover state - Neon Red */
    .top-nav .nav-link:hover {
        color: #ff0040;
        text-shadow: 
            0 0 10px rgba(255, 0, 64, 0.8),
            0 0 20px rgba(255, 0, 64, 0.6),
            0 0 30px rgba(255, 0, 64, 0.4),
            0 0 40px rgba(255, 0, 64, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.5);
        transform: translateY(-2px);
    }

    .top-nav .nav-link:hover::before {
        width: 120%;
        animation: waveAnimation 15s linear infinite;
        box-shadow: 
            0 0 10px rgba(255, 215, 0, 0.8),
            0 0 5px rgba(255, 204, 0, 0.6);
    }

    @keyframes waveAnimation {
        0% {
            background-position: 0% 50%;
        }
        100% {
            background-position: 200% 50%;
        }
    }

    /* Spiritual particles animation */
    .top-nav .nav-menu::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: 
            radial-gradient(circle, rgba(255, 215, 0, 0.3) 1px, transparent 1px),
            radial-gradient(circle, rgba(138, 43, 226, 0.2) 1px, transparent 1px);
        background-size: 50px 50px, 30px 30px;
        background-position: 0 0, 25px 25px;
        animation: floatingParticles 20s linear infinite;
        opacity: 0.5;
        pointer-events: none;
    }

    @keyframes floatingParticles {
        0% {
            transform: translate(0, 0);
        }
        100% {
            transform: translate(-50px, -30px);
        }
    }

    /* Subtle pulsing glow for the entire nav container */
    .top-nav {
        animation: subtlePulse 3s ease-in-out infinite;
    }

    @keyframes subtlePulse {
        0%, 100% {
            filter: brightness(1);
        }
        50% {
            filter: brightness(1.05) contrast(1.05);
        }
    }
}

/* Hide the desktop toggle on mobile */
@media (max-width: 768px) {
  .top-nav .desktop-nav-toggle { display: none; }
}

/* Mobile Navigation Enhancement */
@media (max-width: 768px) {
    /* Mystical toggle button */
    .top-nav .nav-toggle {
        background: linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.05),
            rgba(138, 43, 226, 0.03)
        );
        border: 1px solid rgba(255, 215, 0, 0.2);
        box-shadow: 
            0 4px 15px rgba(138, 43, 226, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }

    .top-nav .nav-toggle:hover {
        background: linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.1),
            rgba(138, 43, 226, 0.05)
        );
        border-color: rgba(255, 215, 0, 0.4);
        box-shadow: 
            0 4px 20px rgba(255, 215, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }

    .top-nav .hamburger-icon {
        color: #ffd700;
        text-shadow: 
            0 0 10px rgba(255, 215, 0, 0.5),
            0 2px 4px rgba(0, 0, 0, 0.5);
    }

    /* Mystical dropdown menu */
    .top-nav .nav-menu {
        background: linear-gradient(
            180deg,
            rgba(255, 215, 0, 0.05) 0%,
            rgba(138, 43, 226, 0.03) 50%,
            rgba(0, 0, 0, 0.2) 100%
        );
        backdrop-filter: blur(20px) saturate(150%);
        -webkit-backdrop-filter: blur(20px) saturate(150%);
        border: 1px solid rgba(255, 215, 0, 0.15);
        box-shadow: 
            0 10px 40px rgba(138, 43, 226, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .top-nav .nav-link {
        color: #ffd700;
        text-shadow: 
            0 0 8px rgba(255, 215, 0, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.5);
        border-bottom: 1px solid rgba(255, 215, 0, 0.1);
        transition: all 0.3s ease;
    }

    .top-nav .nav-link:hover {
        color: #ff0040;
        background: linear-gradient(
            90deg,
            rgba(255, 0, 64, 0.1),
            rgba(255, 0, 64, 0.05)
        );
        text-shadow: 
            0 0 10px rgba(255, 0, 64, 0.8),
            0 0 20px rgba(255, 0, 64, 0.6),
            0 0 30px rgba(255, 0, 64, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.5);
        padding-left: 25px;
    }
}


/* Ensure proper layering */
.top-nav {
    z-index: 10000;
}

/* Add subtle animation on page load */
.top-nav .nav-menu {
    animation: fadeInMystical 1.5s ease-out;
}

@keyframes fadeInMystical {
    0% {
        opacity: 0;
        transform: translateY(-10px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}