

/* ========================================
   MODERN NAV — Slim bar + "Explore" dropdown panel
   Built by js/nav-enhance.js. Desktop: slim bar (logo + Explore +
   theme toggle + login), full menu in a grouped dropdown panel.
   Mobile (<=768px): existing hamburger drawer takes over — the
   Explore trigger is hidden and the grouped panel flows vertically.
   ======================================== */

/* --- Slim bar layout (desktop, enhanced) --- */
header.main-header.nav-enhanced .container {
    padding: 10px 20px;            /* slimmer than the old 15px row */
}

/* The remaining bar list holds: Explore trigger, (toggle), auth.
   Keep right padding so the absolutely-positioned theme toggle
   (top:12px right:16px) never overlaps the login button. */
header.main-header.nav-enhanced .main-nav ul.nav-bar-list {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 54px;           /* clearance for floating theme toggle */
}

header.main-header.nav-enhanced .main-nav ul.nav-bar-list > li {
    width: auto;
}

/* --- Explore trigger button --- */
.nav-explore {
    position: relative;
}

.nav-explore-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    padding: 9px 16px;
    font-family: var(--font-body, 'Roboto', sans-serif);
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.nav-explore-trigger:hover {
    background: rgba(155, 89, 182, 0.35);
    border-color: rgba(187, 107, 217, 0.6);
}

.nav-explore-trigger .nav-explore-caret {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.nav-explore.is-open .nav-explore-trigger {
    background: rgba(155, 89, 182, 0.4);
    border-color: rgba(187, 107, 217, 0.7);
}

.nav-explore.is-open .nav-explore-trigger .nav-explore-caret {
    transform: rotate(180deg);
}

/* --- Dropdown panel --- */
.nav-explore-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 620px;
    background: linear-gradient(135deg, #1a252f 0%, #232f3e 55%, #2c3e50 100%);
    border: 1px solid rgba(187, 107, 217, 0.25);
    border-top: 3px solid var(--accent-arcane-bright, #bb6bd9);
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    padding: 22px 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1200;
}

.nav-explore.is-open .nav-explore-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-explore-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 10px 26px;
}

.nav-explore-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-header, 'Spectral', serif);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-arcane-bright, #bb6bd9);
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-explore-heading i {
    font-size: 0.95rem;
    opacity: 0.85;
}

.nav-explore-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-explore-col li.nav-explore-item {
    width: 100%;
}

.nav-explore-panel a {
    display: block;
    color: #d8dee8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 10px;
    border-radius: 6px;
    border: 0;
    transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.nav-explore-panel a:hover {
    background: rgba(155, 89, 182, 0.22);
    color: #fff;
    padding-left: 14px;
}

.nav-explore-panel li.active a {
    background: rgba(155, 89, 182, 0.3);
    color: #fff;
}

/* The auth/login button keeps its pill style on the enhanced bar */
header.main-header.nav-enhanced .auth-nav-item {
    margin-left: 4px;
}

/* Light theme: panel stays dark (matches site's dark-nav-across-themes
   convention), but nudge the trigger contrast on a light bar if ever used. */
[data-theme="light"] .nav-explore-trigger {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Explore panel — mobile (<=768px)
   The hamburger drawer (mobile-nav.js) already turns .main-nav into a
   vertical drawer. Inside it, render the grouped panel as stacked
   sections rather than a floating dropdown.
   ======================================== */
@media (max-width: 768px) {
    /* Hide the Explore trigger on mobile — the hamburger opens the drawer */
    .nav-explore-trigger {
        display: none;
    }

    /* The bar list becomes the vertical drawer content */
    header.main-header.nav-enhanced .main-nav ul.nav-bar-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
        padding-right: 0;
    }

    header.main-header.nav-enhanced .main-nav ul.nav-bar-list > li {
        width: 100%;
    }

    /* Explore container + panel flow inline inside the drawer */
    .nav-explore,
    .nav-explore-panel {
        position: static;
        min-width: 0;
    }

    .nav-explore-panel {
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .nav-explore-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .nav-explore-heading {
        padding: 12px 20px 8px;
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(0, 0, 0, 0.2);
    }

    .nav-explore-panel a {
        padding: 13px 28px;
        border-radius: 0;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-explore-panel a:hover {
        padding-left: 28px;
        background: rgba(155, 89, 182, 0.18);
    }
}

/* ========================================
   Mobile drawer (<=768px) — pairs with js/mobile-nav.js
   mobile-nav.js injects .mobile-nav-toggle and toggles
   .main-nav.is-open. These are the styles that hide the
   nav on mobile and turn it into a slide-down drawer.
   ======================================== */

/* Hamburger hidden on desktop */
.mobile-nav-toggle {
    display: none;
}

@media (max-width: 768px) {
    header.main-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        position: relative;
    }

    /* --- Hamburger button --- */
    .mobile-nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 8px;
        cursor: pointer;
        z-index: 1300;
    }

    .mobile-nav-toggle-bar {
        display: block;
        width: 100%;
        height: 2px;
        background: #f5f7fa;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .mobile-nav-toggle.is-open .mobile-nav-toggle-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-nav-toggle.is-open .mobile-nav-toggle-bar:nth-child(2) {
        opacity: 0;
    }

    .mobile-nav-toggle.is-open .mobile-nav-toggle-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* --- Drawer: hidden by default, slides down when open --- */
    header.main-header .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: 0;
        overflow: hidden;
        overflow-y: auto;
        /* padding/border are not clamped by max-height, so zero them
           when closed or an empty strip shows under the header */
        padding: 0;
        border-bottom: 0 solid var(--accent-arcane-bright, #bb6bd9);
        box-shadow: none;
        /* Solid dark surface (matches the Explore panel) so page
           content can never bleed through the open drawer. */
        background: linear-gradient(135deg, #1a252f 0%, #232f3e 55%, #2c3e50 100%);
        transition: max-height 0.3s ease;
        z-index: 1250;
    }

    header.main-header .main-nav.is-open {
        max-height: min(75vh, 560px);
        border-bottom-width: 2px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    }

    /* Drawer keeps its dark surface in light theme too, matching the
       site's dark-nav-across-themes convention. */
    [data-theme="light"] header.main-header .main-nav {
        background: linear-gradient(135deg, #1a252f 0%, #232f3e 55%, #2c3e50 100%);
    }
}

/* ========================================
   Auth button + user dropdown (site-wide)
   Markup built by js/nav-auth.js on every page. These rules
   previously lived in index-page.css, so only the homepage
   rendered the dropdown correctly — every other page showed
   the menu items permanently expanded and unstyled.
   ======================================== */
.auth-button {
    background: var(--accent-arcane);
    color: white !important;
    padding: 10px 24px !important;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
    border: 2px solid var(--accent-arcane);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-button:hover {
    background: white;
    color: var(--accent-arcane) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(138, 43, 226, 0.4);
}

.auth-button i {
    font-size: 1.1rem;
}

.main-nav li.auth-nav-item {
    margin-left: 10px;
    position: relative;
}

.user-menu-container {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-menu-container:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 5px 0;
}

/* Dropdown sits on a white card — force dark text over
   .main-nav a's white link color */
.user-dropdown .dropdown-item {
    color: #333 !important;
}

.user-dropdown .dropdown-item i {
    font-size: 1rem;
    color: #666;
}

/* Inside the mobile drawer the dropdown flows inline as stacked
   entries (hover reveal doesn't exist on touch) and adopts the
   drawer's dark surface. */
@media (max-width: 768px) {
    .main-nav li.auth-nav-item {
        margin-left: 0;
        padding: 8px 20px 14px;
    }

    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        box-shadow: none;
        min-width: 0;
        margin-top: 6px;
    }

    .user-dropdown .dropdown-item {
        color: #e8ecf3 !important;
        padding: 12px 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .user-dropdown .dropdown-item:hover {
        background: rgba(155, 89, 182, 0.18);
    }

    .user-dropdown .dropdown-item i {
        color: #bb6bd9;
    }

    .dropdown-divider {
        background: rgba(255, 255, 255, 0.12);
    }
}
