/* Shared off-canvas site nav for the static pages (map, radar).
 *
 * Usage: <link rel="stylesheet" href="/shared/nav.css"> plus an empty
 * <nav class="site-nav" aria-label="Site navigation"></nav> placeholder and
 * /shared/nav.js (which injects the links and wires the drawer).
 *
 * Theming: set these custom properties on .site-nav (all optional):
 *   --nav-link-color          desktop + drawer link colour (default: inherit)
 *   --nav-active-color        active link colour
 *   --nav-active-bg           active link background
 *   --nav-drawer-bg           mobile drawer background (default: white)
 *   --nav-drawer-border       drawer right border colour
 *   --nav-drawer-link-color   drawer link colour (default: --nav-link-color)
 *   --nav-drawer-active-color drawer active link colour (default: --nav-active-color)
 *   --nav-drawer-active-bg    drawer active link background (default: --nav-active-bg)
 *   --nav-close-fg / --nav-close-bg / --nav-close-border   drawer close button
 *
 * IMPORTANT: the drawer and backdrop are position:fixed with z-index 1090-1200.
 * If .site-nav sits inside an ancestor that creates a stacking context (any
 * positioned element with a z-index), that ancestor's z-index must beat every
 * sibling the drawer should cover — otherwise the drawer paints underneath
 * page content. Give such an ancestor z-index >= 1200.
 */

.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-nav__burger {
    display: none;
    background: none;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    font-size: 1.2rem;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--nav-link-color, inherit);
}

.site-nav__links {
    display: flex;
    gap: 18px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.site-nav__links a {
    display: inline-flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    padding: 8px 2px 6px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    color: var(--nav-link-color, inherit);
    font-weight: 600;
    font-size: 0.95em;
}

.site-nav__links a:hover {
    text-decoration: none;
    border-bottom-color: var(--nav-link-color, currentColor);
}

.site-nav__links a.active {
    font-weight: 800;
    color: var(--nav-active-color, inherit);
    background: transparent;
    border-bottom-color: var(--nav-active-color, currentColor);
}

/* Backdrop + in-drawer close button are mobile-drawer only. */
.site-nav__backdrop { display: none; }
.site-nav__close { display: none; }
body.no-scroll { overflow: hidden; }

@media (max-width: 768px) {
    .site-nav { position: relative; min-height: 44px; }

    /* Fixed so it floats with the page on scroll, staying reachable. */
    .site-nav__burger {
        display: inline-flex;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1200;
    }

    .site-nav__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1090;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    .site-nav.is-open .site-nav__backdrop { opacity: 1; visibility: visible; }

    /* Off-canvas left drawer. */
    .site-nav__links {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1100;
        height: 100%;
        width: min(82vw, 320px);
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin: 0;
        padding: 64px 14px 24px;
        background: var(--nav-drawer-bg, #ffffff);
        border-right: 1.5px solid var(--nav-drawer-border, #e3ecf3);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.28s cubic-bezier(0.23, 1, 0.32, 1), visibility 0.28s;
    }
    .site-nav.is-open .site-nav__links { transform: translateX(0); visibility: visible; }

    .site-nav__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 1.1em;
        line-height: 1;
        color: var(--nav-close-fg, inherit);
        background: var(--nav-close-bg, rgba(0, 0, 0, 0.06));
        border: 1.5px solid var(--nav-close-border, currentColor);
        border-radius: 6px;
        cursor: pointer;
    }

    .site-nav__links a {
        width: 100%;
        padding: 12px 14px;
        color: var(--nav-drawer-link-color, var(--nav-link-color, inherit));
    }
    .site-nav__links a.active {
        color: var(--nav-drawer-active-color, var(--nav-active-color, inherit));
        background: var(--nav-drawer-active-bg, var(--nav-active-bg, transparent));
    }
}
