/* ── Navbar ── */
.navbar {
    width: max-content;
    max-width: calc(100% - 2rem);
    margin: 0 auto;
    padding: 0.6em 2em;
    /* Glass pill */
    background: color-mix(in hsl, var(--c-background-light), transparent 35%);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid color-mix(in hsl, var(--c-lines), transparent 65%);
    color: white;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: calc(1rem + var(--top-banner-h, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    gap: 0.5em;
    border-radius: 9999px;
    --nav-margin-y: 0.75em;
    transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.scrolled {
    background: color-mix(in hsl, var(--c-background-light), transparent 10%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-color: color-mix(in hsl, var(--c-lines), transparent 40%);
}

.mobileNavOpen {
    border-radius: 1.5rem;
    top: 0;
    max-width: 100%;
    width: 100%;
}

/* ── Brand ── */
.logo {
    padding-right: 1.5em;
    border-right: 1px solid color-mix(in hsl, var(--c-lines), transparent 55%);
    flex-shrink: 0;
}

.logo a {
    font-size: 1.5em;
    font-weight: 800;
    color: white;
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}

.logo a:hover {
    color: var(--c-text);
    text-shadow: 0 0 1rem color-mix(in hsl, var(--c-text), transparent 40%);
}

/* ── Burger ── */
.burger {
    display: none;
    background: none;
    border: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
    border-radius: 0.6rem;
    color: var(--c-text);
    font-size: 1.2em;
    padding: 0.3em 0.5em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.burger:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 60%);
}

/* ── Links container ── */
.links {
    display: flex;
    gap: 0.5em;
    align-items: center;
    justify-content: center;
}

/* ── Simple link ── */
.linkSimple {
    color: color-mix(in hsl, var(--c-text), transparent 20%);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.45em 0.9em;
    border-radius: 9999px;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
}

.linkSimple:hover {
    color: white;
    background: color-mix(in hsl, var(--c-boxes), transparent 70%);
}

/* ── Dropdown item wrapper ── */
.dropdownItem {
    position: relative;
}

/* ── Dropdown trigger button ── */
.linkButton {
    background: none;
    border: none;
    color: color-mix(in hsl, var(--c-text), transparent 20%);
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.45em 0.9em;
    border-radius: 9999px;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.linkButton:hover {
    color: white;
    background: color-mix(in hsl, var(--c-boxes), transparent 70%);
    transform: none;
}

.chev {
    font-size: 0.7em;
    transition: transform 0.25s ease;
}

/* ── Dropdown panel ── */
.dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: max-content;
    min-width: 10rem;
    background: color-mix(in hsl, var(--c-background-light), transparent 10%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
    padding: 0.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Invisible bridge fills the gap so moving the mouse from trigger → dropdown
   doesn't briefly un-hover the parent and flicker the menu closed. */
.dropdown::before {
    content: '';
    position: absolute;
    top: -0.6rem;
    left: -0.5rem;
    right: -0.5rem;
    height: 0.6rem;
}

/* Desktop (hover-capable): pure CSS hover — no click required */
@media (hover: hover) {
    .dropdownItem:hover .chev {
        transform: rotate(180deg);
    }
    .dropdownItem:hover .dropdown {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
}

/* Keyboard navigation: focus-within keeps it accessible via Tab */
.dropdownItem:focus-within .chev {
    transform: rotate(180deg);
}
.dropdownItem:focus-within .dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.dropdown a,
.dropdown button {
    color: color-mix(in hsl, var(--c-text), transparent 15%);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
}

.dropdown a:hover,
.dropdown button:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 60%);
    color: white;
    transform: none;
}

/* ── Icons ── */
.iconSmall {
    font-size: 0.9em;
    flex-shrink: 0;
}

/* ── Login button ── */
.loginBtn {
    background: linear-gradient(135deg, var(--c-other), color-mix(in hsl, var(--c-other), var(--c-boxes) 40%));
    border: none;
    border-radius: 9999px;
    padding: 0.45em 1.1em;
    color: #031D44;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.loginBtn:hover {
    opacity: 0.9;
    transform: scale(1.04);
    box-shadow: 0 0 1rem color-mix(in hsl, var(--c-other), transparent 50%);
}

/* ── User avatar + username ── */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.username {
    font-weight: 600;
    font-size: 0.9em;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Logout button ── */
.logoutBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: color-mix(in hsl, #ff6b6b, var(--c-text) 30%);
    cursor: pointer;
    border-radius: 0.6rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9em;
    font-weight: 500;
    width: 100%;
    transition: background 0.15s ease, color 0.15s ease;
}

.logoutBtn:hover {
    background: color-mix(in hsl, #ff6b6b, transparent 80%);
    color: #ff9898;
    transform: none;
}

/* ── Mobile — hide links, show burger ── */
@media (max-width: 900px) {
    .navbar {
        width: 100%;
        max-width: 100%;
        top: var(--top-banner-h, 0px);
        border-radius: 0;
        padding: 0.7em 1.2em;
        border-left: none;
        border-right: none;
        border-top: none;
    }
    .logo {
        border-right: none;
        padding-right: 0;
        flex: 1;
    }
    .links { display: none; }
    .burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── Backdrop overlay ── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(3, 29, 68, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.overlayVisible {
    display: block;
    opacity: 1;
}

/* ── Mobile drawer ── */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    z-index: 200;
    background: color-mix(in hsl, var(--c-background-light), transparent 8%);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-left: 1px solid color-mix(in hsl, var(--c-lines), transparent 60%);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
.drawerOpen {
    transform: translateX(0);
}

/* ── Drawer header ── */
.drawerHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid color-mix(in hsl, var(--c-lines), transparent 70%);
    flex-shrink: 0;
}
.drawerLogo {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--c-other) 0%, var(--c-lines) 50%, var(--c-text) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.drawerClose {
    background: none;
    border: 1px solid color-mix(in hsl, var(--c-lines), transparent 65%);
    border-radius: 0.6rem;
    color: var(--c-text);
    font-size: 1rem;
    padding: 0.35em 0.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}
.drawerClose:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 60%);
}

/* ── Drawer nav items ── */
.drawerNav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0.75rem;
    flex: 1;
}
.drawerItem {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: color-mix(in hsl, var(--c-text), transparent 15%);
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}
.drawerItem:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 65%);
    color: white;
}

/* ── Accordion trigger ── */
.drawerAccordion {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: color-mix(in hsl, var(--c-text), transparent 15%);
    cursor: pointer;
    text-align: left;
    transition: background 0.18s, color 0.18s;
}
.drawerAccordion:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 65%);
    color: white;
    transform: none;
    box-shadow: none;
}
.drawerAccordion .chev {
    margin-left: auto;
    transition: transform 0.25s ease;
}
.chevOpen {
    transform: rotate(180deg) !important;
}

/* ── Accordion sub-items ── */
.drawerSub {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    padding-left: 0.75rem;
}
.drawerSubOpen {
    max-height: 300px;
    opacity: 1;
}
.drawerSubItem {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border-radius: 0.65rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: color-mix(in hsl, var(--c-text), transparent 25%);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    transition: background 0.18s, color 0.18s;
}
.drawerSubItem:hover {
    background: color-mix(in hsl, var(--c-boxes), transparent 70%);
    color: white;
    transform: none;
    box-shadow: none;
}
.drawerLogout {
    color: color-mix(in hsl, #ff6b6b, var(--c-text) 30%);
}
.drawerLogout:hover {
    background: color-mix(in hsl, #ff6b6b, transparent 80%);
    color: #ff9898;
}

/* ── Drawer divider ── */
.drawerDivider {
    height: 1px;
    margin: 0.5rem 0.25rem;
    background: color-mix(in hsl, var(--c-lines), transparent 72%);
}

/* ── Drawer login button ── */
.drawerLoginBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85em 1em;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--c-other), color-mix(in hsl, var(--c-other), var(--c-boxes) 40%));
    border: none;
    color: #031D44;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}
.drawerLoginBtn:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 0 1rem color-mix(in hsl, var(--c-other), transparent 50%);
}
