/* Shared navigation styles */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transform: translateY(-100%);
    transition: transform 0.5s ease, opacity 0.5s ease;
    opacity: 0;
}

.navbar.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Fallback: Show navbar after short delay if JS hasn't made it visible yet */
.navbar:not(.visible):not([data-nav-initialized]) {
    animation: navFadeIn 0.5s ease 0.5s forwards;
}

@keyframes navFadeIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Prevent animation when JS is controlling visibility */
.navbar.visible,
.navbar[data-nav-initialized] {
    animation: none;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
    height: 80px;
}

.nav-logo a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.nav-logo .logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.nav-logo .logo-img:hover {
    transform: scale(1.05);
}

.nav-brand-text {
    font-family: "Anton", sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4af37;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-block;
    position: relative;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    margin: 0 15px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 10px 15px;
    display: block;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.nav-link:hover {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    transform: scale(1.05);
}

.nav-link:focus,
.btn:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    min-width: 200px;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.nav-item.dropdown:hover .dropdown-menu,
.nav-item.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    color: #fff;
    padding: 12px 20px;
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
}

.dropdown-menu a:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    padding-left: 25px;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
    background: transparent;
    border: none;
}

.hamburger .bar {
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active .bar:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.hamburger:hover .bar {
    background-color: #d4af37;
}

/* Glitch animation */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-text {
    0%, 100% { text-shadow: 2px 0 #ff00c1, -2px 0 #00fff9, 0 0 0; }
    10%, 30%, 50%, 70%, 90% { text-shadow: -2px 0 #ff00c1, 2px 0 #00fff9, 0 0 0; }
    20%, 40%, 60%, 80% { text-shadow: 2px 0 #ff00c1, -2px 0 #00fff9, 0 0 0; }
}

@keyframes glitch-anim-1 {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    20% { clip: rect(23px, 9999px, 98px, 0); }
    40% { clip: rect(86px, 9999px, 100px, 0); }
    60% { clip: rect(26px, 9999px, 100px, 0); }
    80% { clip: rect(35px, 9999px, 100px, 0); }
    100% { clip: rect(73px, 9999px, 100px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 100px, 0); }
    20% { clip: rect(82px, 9999px, 100px, 0); }
    40% { clip: rect(50px, 9999px, 100px, 0); }
    60% { clip: rect(37px, 9999px, 100px, 0); }
    80% { clip: rect(68px, 9999px, 100px, 0); }
    100% { clip: rect(24px, 9999px, 100px, 0); }
}

.nav-brand-text.glitch-active {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
               glitch-text 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.nav-brand-text.glitch-active::before,
.nav-brand-text.glitch-active::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.nav-brand-text.glitch-active::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-1 0.3s infinite linear alternate-reverse;
}

.nav-brand-text.glitch-active::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 0.3s infinite linear alternate-reverse;
}

/* Additional brand animations per page */
.nav-brand-text.nav-brand-anim-shimmer {
    animation: navShimmerGlow 5.5s ease-in-out infinite;
}

.nav-brand-text.nav-brand-anim-mountain {
    animation: navMountainRise 6.5s ease-in-out infinite;
}

.nav-brand-text.nav-brand-anim-prayer {
    animation: navPrayerFlags 7s linear infinite;
}

.nav-brand-text.nav-brand-anim-mist {
    animation: navMistDrift 6s ease-in-out infinite;
}

.nav-brand-text.nav-brand-anim-dragon {
    animation: navDragonPulse 5.5s ease-in-out infinite;
}

.nav-brand-text.nav-brand-anim-spotlight {
    animation: navSpotlightSweep 8s linear infinite;
}

.nav-brand-text.nav-brand-anim-heritage {
    animation: navHeritagePulse 9s ease-in-out infinite;
}

.nav-brand-text.nav-brand-anim-wheelz {
    animation: navWheelRush 4.5s ease-in-out infinite;
}

@keyframes navShimmerGlow {
    0%, 100% {
        text-shadow: 0 0 6px rgba(212, 175, 55, 0.35), 0 0 12px rgba(255, 255, 255, 0.15);
    }
    50% {
        text-shadow: 0 0 15px rgba(212, 175, 55, 0.85), 0 0 25px rgba(255, 255, 255, 0.4);
    }
}

@keyframes navMountainRise {
    0%, 100% {
        letter-spacing: 2px;
        text-shadow: 0 0 6px rgba(212, 175, 55, 0.35), 0 6px 12px rgba(0, 0, 0, 0.25);
    }
    50% {
        letter-spacing: 3px;
        text-shadow: 0 -6px 18px rgba(166, 213, 255, 0.6), 0 8px 16px rgba(0, 0, 0, 0.4);
    }
}

@keyframes navPrayerFlags {
    0% {
        text-shadow: 3px 3px 0 rgba(255, 70, 70, 0.6), -3px -3px 0 rgba(30, 136, 229, 0.6);
    }
    33% {
        text-shadow: 3px -3px 0 rgba(67, 160, 71, 0.6), -3px 3px 0 rgba(255, 241, 118, 0.6);
    }
    66% {
        text-shadow: -3px 3px 0 rgba(255, 70, 70, 0.6), 3px -3px 0 rgba(30, 136, 229, 0.6);
    }
    100% {
        text-shadow: 3px 3px 0 rgba(255, 70, 70, 0.6), -3px -3px 0 rgba(30, 136, 229, 0.6);
    }
}

@keyframes navMistDrift {
    0%, 100% {
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.2), 0 0 16px rgba(212, 175, 55, 0.3);
        filter: blur(0px);
    }
    50% {
        text-shadow: 0 0 16px rgba(255, 255, 255, 0.45), 0 0 28px rgba(212, 175, 55, 0.5);
        filter: blur(0.3px);
    }
}

@keyframes navDragonPulse {
    0%, 100% {
        text-shadow: 0 0 8px rgba(212, 175, 55, 0.4), 0 0 18px rgba(255, 140, 0, 0.25);
    }
    50% {
        text-shadow: 0 0 16px rgba(255, 191, 0, 0.75), 0 0 28px rgba(255, 94, 0, 0.45);
    }
}

@keyframes navSpotlightSweep {
    0% {
        text-shadow: -12px 0 12px rgba(255, 255, 255, 0.1), 12px 0 12px rgba(212, 175, 55, 0.25);
    }
    50% {
        text-shadow: 0 0 22px rgba(255, 255, 255, 0.6), 0 0 28px rgba(212, 175, 55, 0.5);
    }
    100% {
        text-shadow: 12px 0 12px rgba(255, 255, 255, 0.1), -12px 0 12px rgba(212, 175, 55, 0.25);
    }
}

@keyframes navHeritagePulse {
    0%, 100% {
        letter-spacing: 2px;
        text-shadow: 0 0 6px rgba(212, 175, 55, 0.35);
    }
    50% {
        letter-spacing: 3.5px;
        text-shadow: 0 0 14px rgba(255, 255, 255, 0.4);
    }
}

@keyframes navWheelRush {
    0%, 100% {
        text-shadow: -6px 0 8px rgba(212, 175, 55, 0.25), 6px 0 8px rgba(255, 255, 255, 0.25);
    }
    50% {
        text-shadow: -14px 0 14px rgba(212, 175, 55, 0.45), 14px 0 14px rgba(255, 255, 255, 0.45);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-brand-text.nav-brand-anim-shimmer,
    .nav-brand-text.nav-brand-anim-mountain,
    .nav-brand-text.nav-brand-anim-prayer,
    .nav-brand-text.nav-brand-anim-mist,
    .nav-brand-text.nav-brand-anim-dragon,
    .nav-brand-text.nav-brand-anim-spotlight,
    .nav-brand-text.nav-brand-anim-heritage,
    .nav-brand-text.nav-brand-anim-wheelz {
        animation: none !important;
        filter: none !important;
        text-shadow: inherit;
        letter-spacing: inherit;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 80px;
        flex-direction: column;
        background-color: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.5);
        padding: 20px 0;
        z-index: 1000;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 10px 0;
        width: 100%;
    }

    .nav-link {
        padding: 15px;
        width: 100%;
        text-align: center;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: rgba(0, 0, 0, 0.5);
        box-shadow: none;
        margin-top: 5px;
        display: none;
    }

    .nav-item.dropdown.active .dropdown-menu {
        display: block;
    }

    .nav-logo .logo-img {
        height: 40px;
    }

    .nav-brand-text {
        display: none;
    }
}

