/* Shared nav bar styles for all pages */

/* Global overflow guard — prevent any element from making the page
   wider than the viewport and forcing a zoom-out on mobile.
   NOTE: 100vw includes scrollbar width, so use 100% instead. */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.site-nav {
    background: #0a0a0a;
    border-bottom: 1px solid #222;
    padding: 0 1rem;
    font-family: 'Courier New', Courier, monospace;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    flex-shrink: 0;
}

.nav-spacer {
    height: 44px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.site-nav .nav-links {
    display: flex;
    gap: 0;
    align-items: center;
    height: 100%;
    min-width: 0;
}

.site-nav a {
    color: #888;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0 0.8rem;
    height: 100%;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.site-nav a:hover {
    color: #fff;
    background: #111;
}

.site-nav a.active {
    color: #fff;
    border-bottom-color: #fff;
}

.site-nav .nav-brand {
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 0 0.8rem 0 0;
    border-right: 1px solid #222;
    margin-right: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ── Dropdown menus ── */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    color: #888;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    padding: 0 0.8rem;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-dropdown-toggle::after {
    content: ' ▾';
    font-size: 0.65rem;
    margin-left: 0.25rem;
    opacity: 0.6;
}

.nav-dropdown-toggle:hover {
    color: #fff;
    background: #111;
}

.nav-dropdown-toggle.active {
    color: #fff;
    border-bottom-color: #fff;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #0a0a0a;
    border: 1px solid #222;
    border-top: none;
    min-width: 140px;
    z-index: 10001;
    flex-direction: column;
}

.nav-dropdown-menu a {
    padding: 0.6rem 1rem !important;
    height: auto !important;
    border-bottom: none !important;
    width: 100%;
}

/* Desktop: show on hover or open class */
@media (min-width: 769px) {
    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown.open .nav-dropdown-menu {
        display: flex;
    }
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    margin: 4px 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile styles */
@media (max-width: 768px) {
    .nav-hamburger {
        display: block;
    }

    .site-nav .nav-links {
        display: none !important;
        position: absolute;
        top: 44px;
        left: 0;
        right: 0;
        background: #0a0a0a;
        border-bottom: 1px solid #222;
        flex-direction: column;
        height: auto;
        padding: 0.5rem 0;
        z-index: 10000;
    }

    .site-nav .nav-links.open {
        display: flex !important;
    }

    .site-nav .nav-links > a {
        height: auto;
        padding: 0.7rem 1.2rem;
        border-bottom: none;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .site-nav .nav-links > a.active {
        background: #111;
        border-bottom: none;
        border-left: 3px solid #fff;
    }

    /* Mobile dropdowns */
    .nav-dropdown {
        flex-direction: column;
        height: auto;
        width: 100%;
    }

    .nav-dropdown-toggle {
        height: auto;
        padding: 0.7rem 1.2rem;
        width: 100%;
        justify-content: flex-start;
    }

    .nav-dropdown-toggle.active {
        background: #111;
        border-bottom: none;
        border-left: 3px solid #fff;
    }

    .nav-dropdown-menu {
        position: static;
        border: none;
        min-width: 0;
        width: 100%;
        background: #050505;
    }

    .nav-dropdown.open .nav-dropdown-menu {
        display: flex;
    }

    .nav-dropdown-menu a {
        padding: 0.6rem 1.2rem 0.6rem 2.2rem !important;
        font-size: 0.8rem !important;
        text-align: left !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .nav-dropdown-menu a.active {
        background: #111;
        border-left: 3px solid #fff;
    }

    .site-nav .nav-brand {
        border-right: none;
    }
}
