/* ==========================================================================
   Shared Top Navigation — single source of truth across ALL pages.
   Self-contained (hardcoded palette, no page :root vars) so the bar renders
   pixel-identical on every page. Tuned to blend with the editorial cool-sky
   palette used site-wide (--bg #f6f8fb, ink #0f1b2d, accent #2f76ea, gold
   #9c6410). Included via app/templates/partials/_nav.html.
   ========================================================================== */

/* Clear the fixed top bar. `body` (0,0,1) outranks any `* { padding:0 }`
   reset (0,0,0), so this offset holds on every page that links nav.css. */
body { padding-top: 64px; }

.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    /* Frosted glass that dissolves into the cool-sky canvas instead of
       sitting on top of it as a warm slab. */
    background: rgba(245, 248, 252, 0.78);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(219, 230, 241, 0.7);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 1000;
    transition: box-shadow 0.25s ease, background 0.25s ease;
}
/* Soft lift once the page scrolls under the bar (toggled by main.js). */
.top-nav.is-scrolled {
    background: rgba(245, 248, 252, 0.92);
    box-shadow: 0 6px 24px -12px rgba(15, 27, 45, 0.22);
}
.top-nav a { text-decoration: none; }

.nav-brand { display: flex; align-items: center; gap: 14px; }
.nav-brand a {
    display: flex; align-items: center; gap: 11px;
    font-size: 16px; font-weight: 700; letter-spacing: -0.02em;
    color: #0f1b2d;
}
/* Gradient logomark badge — modern brand cue, blue→gold editorial accents. */
.nav-brand i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 9px;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(135deg, #2f76ea 0%, #1d5fce 100%);
    box-shadow: 0 4px 12px -3px rgba(47, 118, 234, 0.5);
}
.nav-brand a span { line-height: 1; }

/* Ticker chip — quick jump back to the stock's Stock IQ page. */
.nav-ticker {
    display: inline-flex; align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
    color: #2f76ea !important;
    background: rgba(47, 118, 234, 0.08);
    border: 1px solid rgba(47, 118, 234, 0.18);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.nav-ticker:hover {
    background: rgba(47, 118, 234, 0.14);
    border-color: rgba(47, 118, 234, 0.32);
    color: #024b73 !important;
}

.nav-links { display: flex; align-items: center; gap: 4px; }

.nav-link {
    position: relative;
    display: flex; align-items: center; gap: 7px;
    padding: 8px 13px;
    border-radius: 9px;
    font-size: 13.5px; font-weight: 550;
    color: #4a5a70;
    transition: background 0.18s ease, color 0.18s ease;
}
.nav-link i { font-size: 12.5px; opacity: 0.85; transition: opacity 0.18s ease; }
/* Animated underline indicator — grows from the center on hover/active. */
.nav-link::after {
    content: "";
    position: absolute; left: 13px; right: 13px; bottom: 4px;
    height: 2px; border-radius: 2px;
    background: #2f76ea;
    transform: scaleX(0); transform-origin: center;
    transition: transform 0.2s ease;
}
.nav-link:hover { background: rgba(15, 27, 45, 0.045); color: #0f1b2d; }
.nav-link:hover i { opacity: 1; }
.nav-link.active { color: #2f76ea; font-weight: 650; }
.nav-link.active i { opacity: 1; }
.nav-link.active::after { transform: scaleX(1); }

/* Auth cluster */
.nav-auth {
    display: flex; align-items: center; gap: 8px;
    margin-left: 10px; padding-left: 14px;
    border-left: 1px solid rgba(219, 230, 241, 0.9);
}
.nav-auth-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 15px;
    border-radius: 9px;
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
/* Primary CTA — solid accent, the one obvious action in the bar. */
.nav-auth-btn.sign-in {
    color: #fff;
    background: linear-gradient(135deg, #2f76ea 0%, #1d5fce 100%);
    box-shadow: 0 4px 12px -4px rgba(47, 118, 234, 0.6);
}
.nav-auth-btn.sign-in:hover {
    box-shadow: 0 6px 16px -4px rgba(47, 118, 234, 0.7);
    transform: translateY(-1px);
}
.nav-auth-btn.sign-out { color: #8493a6; }
.nav-auth-btn.sign-out:hover { color: #b8324a; background: rgba(190, 18, 60, 0.07); }
.nav-auth-user {
    font-size: 13px; font-weight: 550; color: #4a5a70;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile hamburger toggle (hidden on desktop) */
.nav-hamburger {
    display: none;
    background: none; border: none;
    font-size: 22px; color: #0f1b2d;
    cursor: pointer; padding: 6px; line-height: 1;
}

/* ── Mobile: hamburger + dropdown ── */
@media (max-width: 768px) {
    .top-nav { padding: 0 16px; }
    .nav-hamburger { display: block; }
    .nav-links {
        display: none;
        position: fixed; top: 64px; left: 0; right: 0;
        flex-direction: column; align-items: stretch;
        background: rgba(245, 248, 252, 0.98);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        backdrop-filter: blur(16px) saturate(180%);
        padding: 12px 16px; gap: 4px;
        border-bottom: 1px solid #dfe7f0;
        box-shadow: 0 12px 28px -10px rgba(15, 27, 45, 0.18);
        z-index: 999;
    }
    .nav-links.open { display: flex; }
    .nav-link { padding: 12px 16px; font-size: 15px; min-height: 44px; border-radius: 10px; }
    /* Stacked links read better as filled rows than as underlined tabs. */
    .nav-link::after { display: none; }
    .nav-link.active { background: rgba(47, 118, 234, 0.09); }
    .nav-auth {
        margin-left: 0; padding-left: 0; border-left: none;
        margin-top: 4px; padding-top: 8px;
        border-top: 1px solid #dfe7f0;
    }
    .nav-auth-btn { min-height: 44px; }
    .nav-auth-btn.sign-in { justify-content: center; }
}
