/* ═══════════════════════════════════════════
   nav.css — Shared Navigation Styles
   Memory Forge · memoryforge.ai
   
   Loaded in <head> on every page.
   Paired with nav.js which injects the HTML.
   ═══════════════════════════════════════════ */

/* ═══ NAV CONTAINER ═══
   #site-nav is the actual nav element.
   nav.js injects .nav-inner directly into it.
   Single element = no double-background stacking. */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 150;
    height: 56px;
    background: rgba(0, 8, 18, 0.92);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border, rgba(212, 175, 55, 0.16));
}

.nav-inner {
    max-width: 860px;
    margin: 0 auto;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

/* ═══ LOGO ═══ */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.nav-logo-wm {
    text-align: center;
    line-height: 1;
    display: inline-block;
    position: relative;
    padding: 0.3em 0;
}

.nav-logo-wm::before,
.nav-logo-wm::after {
    content: '';
    display: block;
    height: 1px;
    background: var(--gold, #D4AF37);
    opacity: 0.4;
}

.nav-logo-wm::before { margin-bottom: 0.3em; }
.nav-logo-wm::after { margin-top: 0.3em; }

.nav-logo-wm .wm-top {
    display: block;
    font-family: 'Raleway', sans-serif;
    font-weight: 200;
    font-size: 0.38rem;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: var(--text-secondary, rgba(232, 228, 220, 0.78));
    line-height: 1;
}

.nav-logo-wm .wm-bot {
    display: block;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    color: var(--gold, #D4AF37);
    line-height: 1;
}

/* ═══ NAV LINKS ═══ */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--text-dim, rgba(232, 228, 220, 0.55));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--gold, #D4AF37);
}

.nav-link.active {
    color: var(--gold, #D4AF37);
}

/* ═══ FOR PARENTS DROPDOWN ═══ */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    font-family: 'Raleway', sans-serif;
    cursor: pointer;
    padding: 0;
}

.nav-chevron {
    transition: transform 0.2s;
    opacity: 0.5;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    background: rgba(10, 22, 40, 0.96);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border, rgba(212, 175, 55, 0.16));
    border-radius: 10px;
    padding: 0.5rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Invisible bridge so hover doesn't break crossing the gap */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    width: 100%;
    height: 14px;
}

/* Desktop: hover opens dropdown */
@media (min-width: 769px) {
    .nav-dropdown:hover .nav-dropdown-menu {
        display: block;
    }
    .nav-dropdown:hover .nav-chevron {
        transform: rotate(180deg);
    }
}

/* Mobile fallback: JS toggle */
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-item {
    display: block;
    padding: 0.65rem 1.2rem;
    text-decoration: none;
    transition: background 0.15s;
    white-space: normal;
}

.nav-dropdown-item:hover {
    background: rgba(212, 175, 55, 0.06);
}

.nav-dropdown-item.active .ndi-title {
    color: var(--gold, #D4AF37);
}

.ndi-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim, rgba(232, 228, 220, 0.55));
    line-height: 1.3;
    transition: color 0.15s;
}

.nav-dropdown-item:hover .ndi-title {
    color: var(--gold, #D4AF37);
}

.ndi-desc {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--text-muted, rgba(232, 228, 220, 0.35));
    line-height: 1.4;
    margin-top: 0.15rem;
}

.nav-dropdown-item:focus-visible {
    outline: 2px solid var(--gold, #D4AF37);
    outline-offset: -2px;
    border-radius: 6px;
}

/* Auth link — hidden until JS determines state */
.nav-auth {
    font-size: 0.8rem;
    color: var(--text-dim, rgba(232, 228, 220, 0.55));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    font-family: 'Raleway', sans-serif;
    padding: 0;
    display: none;
}

.nav-auth:hover {
    color: var(--gold, #D4AF37);
}

.nav-auth.active {
    color: var(--gold, #D4AF37);
}

.nav-auth.visible {
    display: inline;
}

/* ═══ SEPARATORS ═══ */
.nav-sep {
    width: 1px;
    height: 16px;
    background: var(--border, rgba(212, 175, 55, 0.16));
    flex-shrink: 0;
}

/* Auth separator — hidden until auth link is revealed.
   Own styles (not inheriting .nav-sep) to avoid mobile specificity conflicts. */
.nav-sep-auth {
    width: 1px;
    height: 16px;
    background: var(--border, rgba(212, 175, 55, 0.16));
    flex-shrink: 0;
    display: none;
}

.nav-sep-auth.visible {
    display: block;
}

/* ═══ CTA BUTTON ═══ */
.nav-btn {
    padding: 0.42rem 1rem;
    background: var(--gold, #D4AF37);
    border: none;
    border-radius: 7px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--navy-dark, #111E33);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--gold-hover, #C4A030);
    transform: translateY(-1px);
}

/* ═══ SIGN OUT (quiet, right-aligned) ═══ */
.nav-signout {
    font-size: 0.72rem;
    color: var(--text-muted, rgba(232, 228, 220, 0.35));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
    cursor: pointer;
    display: none;
    white-space: nowrap;
}

.nav-signout:hover {
    color: var(--gold, #D4AF37);
}

.nav-signout.visible {
    display: inline;
}

/* ═══ MOBILE HAMBURGER ═══ */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: -10px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-muted, rgba(232, 228, 220, 0.35));
    border-radius: 2px;
    transition: all 0.25s ease-in-out;
}

.nav-hamburger:hover span {
    background: var(--gold, #D4AF37);
}

.nav-open .nav-hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
    background: var(--gold, #D4AF37);
}

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

.nav-open .nav-hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    background: var(--gold, #D4AF37);
}

/* ═══ FOCUS STYLES ═══ */
.nav-logo:focus-visible,
.nav-link:focus-visible,
.nav-auth:focus-visible,
.nav-btn:focus-visible,
.nav-signout:focus-visible,
.nav-hamburger:focus-visible {
    outline: 2px solid var(--gold, #D4AF37);
    outline-offset: 3px;
    border-radius: 10px;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .nav-inner {
        padding: 0 1rem;
    }

    /* Page-specific overrides that declare same-specificity rules in their
       own <style> blocks (loaded after nav.css). !important required to win. */
    body[data-page="home"] #site-nav .nav-inner,
    body[data-page="generator"] #site-nav .nav-inner {
        padding: 0 1rem !important;
    }

    .nav-hamburger {
        display: flex;
    }

    /* Mobile closed: hide nav links */
    .nav-right {
        display: none;
    }

    /* Mobile open: dropdown panel */
    #site-nav.nav-open .nav-right {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 56px;
        left: 0;
        width: 100%;
        background: rgba(0, 8, 18, 0.88);
        -webkit-backdrop-filter: blur(24px);
        backdrop-filter: blur(24px);
        border-bottom: 1px solid var(--border, rgba(212, 175, 55, 0.16));
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        padding: 1rem 1.5rem 1.5rem;
        gap: 0;
    }

    #site-nav.nav-open .nav-link,
    #site-nav.nav-open .nav-auth,
    #site-nav.nav-open .nav-signout,
    #site-nav.nav-open .nav-btn {
        width: 100%;
    }

    .nav-link,
    .nav-auth {
        font-size: 0.88rem;
        padding: 0.75rem 0;
        text-align: left;
    }

    .nav-signout {
        font-size: 0.88rem;
        padding: 0.75rem 0;
        text-align: left;
        order: 98;
    }

    .nav-signout.visible {
        display: block;
        width: 100%;
    }

    .nav-auth.visible {
        display: block;
        width: 100%;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
        margin-top: 0.75rem;
        padding: 0.8rem 1rem;
        font-size: 0.88rem;
        order: 99;
    }

    .nav-sep,
    .nav-sep-auth.visible {
        display: none;
    }

    /* Mobile dropdown — inline expand instead of absolute */
    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-trigger {
        width: 100%;
        text-align: left;
        font-size: 0.88rem;
        padding: 0.75rem 0;
    }

    .nav-dropdown-menu {
        position: static;
        transform: none;
        min-width: 0;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        padding: 0 0 0.25rem 1rem;
    }

    .nav-dropdown-menu::before {
        display: none;
    }

    .nav-dropdown-item {
        padding: 0.5rem 0;
    }

    .ndi-title {
        font-size: 0.82rem;
    }

    .ndi-desc {
        font-size: 0.7rem;
    }

    .nav-chevron {
        margin-left: auto;
    }
}
