/* === NAV PILL & DROPDOWNS === */

:root {
    --z-pill: 60; /* pill rail */
    --z-dd: 2000; /* dropdowns above everything */
    --header-h: 70px; /* top info row height */
    --pill-h-desktop: 70px;
    --pill-h-mobile: 56px;
}

/* Pill rail wrapper */
.pill-rail {
    position: absolute;
    top: var(--pill-top);
    inset-inline: 0;
    display: flex;
    justify-content: center;
    z-index: var(--z-pill);
    background: transparent;
}
.pill-rail > .navpill {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
}

/* NAV PILL core */
.navpill {
    position: relative; /* stacking context for fades */
    height: var(--pill-h-desktop);
    width: 100%;
    background: var(--c-surface);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 12px;
    box-sizing: border-box;
    overflow: visible; /* menus can escape on desktop */
    z-index: 1;
}

/* Edge fade helper (no mask that would clip) */
.navpill--mask {
    mask-image: none;
    -webkit-mask-image: none;
}

/* Glass dropdown panel look */
.glass {
    background: rgba(0, 122, 61, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
}

/* Down-caret icon */
.nav-caret {
    inline-size: 1em;
    block-size: 0.35em;
    opacity: 0.5;
    pointer-events: none;
    transform: translateY(1px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
button:hover .nav-caret {
    opacity: 0.8;
    transform: translateY(2px);
}

/* Dropdown positioning (desktop default) */
.menu-dd {
    position: absolute;
    top: 2.1rem; /* slightly tighter to reduce gaps */
    left: 0;
    z-index: var(--z-dd);
    overflow: visible;
}

/* Dropdown internals */
.menu-panel {
    display: inline-block;
    padding: 12px;
    inline-size: max-content;
    max-inline-size: 92vw;
    text-align: center;
    box-sizing: border-box;
}
.menu-items-item {
    color: #fff;
    font: 700 1rem/1.2 Roboto, system-ui, sans-serif;
    text-align: center;
}
.menu-item,
.menu-items-item {
    display: block;
    padding: 8px 12px;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    transition: all 0.25s ease;
    border-radius: 8px;
}
.menu-item:hover,
.menu-items-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.03);
    opacity: 1;
}
.menu-subcard {
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    inline-size: max-content;
    max-inline-size: 100vw;
}
.menu-subcard > * {
    display: block;
    inline-size: 100%;
    white-space: nowrap;
}
.menu-sep {
    border-color: rgba(255, 255, 255, 0.4);
    margin: 8px 0;
}

/* Utilities */
.z-pill {
    z-index: 50;
}
.sticky-pill {
    position: sticky;
    top: 12px;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ===== Mobile / tablet ===== */
@media (max-width: 1024px) {
    /* Pill placed in normal flow */
    .pill-rail {
        position: relative;
        top: auto;
        padding: 0;
    }

    .navpill {
        height: var(--pill-h-mobile);
        padding: 0 8px;
        border-radius: 8px;
        overflow: visible; /* UL scrolls horizontally, but we won't clip menus */
    }

    /* Edge fades as overlays (below content & menus) */
    .navpill::before,
    .navpill::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 24px;
        pointer-events: none;
        z-index: 0;
    }
    .navpill::before {
        left: 0;
        background: linear-gradient(to right, var(--c-surface), rgba(255, 255, 255, 0));
    }
    .navpill::after {
        right: 0;
        background: linear-gradient(to left, var(--c-surface), rgba(255, 255, 255, 0));
    }

    /* UL scrolls horizontally only, sits above fades */
    .navpill > ul {
        overflow-x: auto;
        overflow-y: visible !important; /* helps in some browsers, but we still switch menus to fixed */
        position: relative;
        z-index: 1;
    }

    /* IMPORTANT: menus render as FIXED overlay so they are NOT clipped by the scrolling UL */
    .menu-dd {
        position: fixed;
        left: 8px;
        right: 8px;
        top: calc(var(--header-h) + var(--pill-h-mobile) + 6px); /* just under the pill */
        z-index: var(--z-dd);
    }

    /* Seal bottom edge to remove any green strip */
    .pill-rail::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 1px;
        background: var(--c-surface);
        z-index: 1;
    }
}

/* ===== Desktop ===== */
@media (min-width: 1025px) {
    .pill-rail {
        position: absolute;
    }
    .navpill {
        height: var(--pill-h-desktop);
        overflow: visible;
    }
    .navpill > ul {
        overflow: visible !important;
    } /* ensure dropdowns can escape */
}
