/* =========================================
   JUSTWEB OS — NAVIGATION CORE v4.0
   Precision Engineered. Enterprise Grade.
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Brand System */
    --red:           #D93025;
    --red-glow:      rgba(217, 48, 37, 0.16);
    --blue:          #1A56E8;
    --blue-glow:     rgba(26, 86, 232, 0.14);
    --green:         #00C96B;
    --green-dim:     rgba(0, 201, 107, 0.65);

    /* Surface System — charcoal-navy, not pure black */
    --ink:           #0F1117;
    --ink-soft:      #161A24;
    --surface-0:     rgba(15, 17, 23, 0.97);
    --surface-1:     rgba(255, 255, 255, 0.04);
    --surface-2:     rgba(255, 255, 255, 0.06);
    --border:        rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.13);

    /* Text — warmer, more readable */
    --text-primary:  #EEF0F5;
    --text-secondary:#9BA3B8;
    --text-dim:      #525A6E;

    /* Fonts */
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-mono:    'IBM Plex Mono', monospace;

    /* Motion */
    --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in:   cubic-bezier(0.7, 0, 0.84, 0);
    --ease-circ: cubic-bezier(0.85, 0, 0.15, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.mono  { font-family: var(--font-mono); }
.no-scroll { overflow: hidden; }

/* ─────────────────────────────────────────
   1. SYSTEM TICKER
   ───────────────────────────────────────── */
.system-ticker {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 36px;
    background: var(--ink);
    border-bottom: 1px solid var(--border);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.system-ticker::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 120px,
        rgba(255,255,255,0.015) 120px,
        rgba(255,255,255,0.015) 121px
    );
    pointer-events: none;
}

.ticker-content {
    width: 100%;
    max-width: 1600px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.ticker-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ticker-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.ticker-right-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
}

.ticker-right-item.active {
    color: var(--text-secondary);
}

.ticker-divider {
    width: 1px;
    height: 12px;
    background: var(--border-bright);
}

.pulse-dot {
    width: 5px;
    height: 5px;
    background: var(--green);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 var(--green-dim);
    animation: heartbeat 2.4s ease infinite;
}

@keyframes heartbeat {
    0%   { box-shadow: 0 0 0 0 var(--green-dim); }
    60%  { box-shadow: 0 0 0 5px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

#intel-stream {
    transition: opacity 0.35s ease;
    color: var(--text-secondary);
}

.ticker-version {
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

/* ─────────────────────────────────────────
   2. MAIN HEADER
   ───────────────────────────────────────── */
.os-header {
    position: fixed;
    top: 36px; left: 0;
    width: 100%;
    height: 72px;
    background: var(--surface-0);
    backdrop-filter: blur(40px) saturate(160%);
    -webkit-backdrop-filter: blur(40px) saturate(160%);
    border-bottom: 1px solid var(--border);
    z-index: 9990;
    transition: height 0.5s var(--ease-out), background 0.4s ease, border-color 0.4s ease;
    font-family: var(--font-display);
}

.os-header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--red) 20%,
        var(--blue) 50%,
        var(--red) 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    opacity: 0;
    animation: shimmerBorder 6s linear infinite;
    transition: opacity 0.5s ease;
}

.os-header.scrolled::after { opacity: 1; }

@keyframes shimmerBorder {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.os-header.scrolled {
    height: 64px;
    background: rgba(15, 17, 23, 0.99);
    border-bottom-color: var(--border-bright);
}

/* ─────────────────────────────────────────
   3. NAV GRID
   ───────────────────────────────────────── */
.nav-grid {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    align-items: center;
    height: 100%;
    padding: 0 40px;
    max-width: 1600px;
    margin: 0 auto;
}

.nav-slot {
    display: flex;
    align-items: center;
    height: 100%;
}

.slot-left  { justify-content: flex-start; }
.slot-center { justify-content: center; }
.slot-right { justify-content: flex-end; gap: 20px; }

/* ─────────────────────────────────────────
   4. LOGO
   ───────────────────────────────────────── */
.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 36px;
    position: relative;
}

.main-logo {
    height: 100%;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: opacity 0.3s ease;
}

.brand-link:hover .main-logo { opacity: 0.8; }

.fallback-logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1;
}

.fallback-logo .red-accent { color: var(--red); }

/* Logo badge */
.brand-link::after {
    content: 'v4.0';
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    position: absolute;
    bottom: -4px;
    right: 0;
}

/* ─────────────────────────────────────────
   5. NAV MENU & MEGA PANEL
   ───────────────────────────────────────── */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    height: 100%;
    align-items: center;
}

.menu-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.menu-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0 18px;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
    transition: color 0.25s ease;
}

.menu-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 18px;
    width: calc(100% - 36px);
    height: 1px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease-out);
}

.menu-item:hover .menu-link {
    color: var(--text-primary);
}
.menu-item:hover .menu-link::after {
    transform: scaleX(1);
}

/* Mega Panel */
.mega-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #161A24;
    border: 1px solid var(--border-bright);
    border-radius: 0 0 4px 4px;
    padding: 36px 40px;
    min-width: 540px;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.35s var(--ease-out),
        transform 0.35s var(--ease-out),
        visibility 0.35s;
    box-shadow:
        0 40px 80px rgba(0,0,0,0.6),
        0 0 0 1px rgba(255,255,255,0.04) inset;
}

/* hover bridge so menu doesn't flicker */
.mega-panel::before {
    content: '';
    position: absolute;
    top: -24px; left: 0;
    width: 100%; height: 24px;
}

.menu-item:hover .mega-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Top accent line on panel */
.mega-panel::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg, var(--red), var(--blue));
}

.mega-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 40px;
}

.mega-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.col-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    display: block;
}

.mega-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s ease, padding-left 0.25s var(--ease-out);
    border-bottom: 1px solid transparent;
    position: relative;
}

.mega-link:hover {
    color: var(--text-primary);
    padding-left: 10px;
    border-bottom-color: var(--border);
}

.mega-link .link-arrow {
    margin-left: auto;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.25s var(--ease-out);
    font-size: 12px;
    color: var(--red);
}
.mega-link:hover .link-arrow {
    opacity: 1;
    transform: translateX(0);
}

.badge {
    background: var(--red);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 2px;
    letter-spacing: 0.1em;
    line-height: 1.6;
}

.badge.badge-blue {
    background: var(--blue);
}

/* Panel footer */
.mega-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mega-footer-text {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 0.12em;
}

.mega-footer-link {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--red);
    text-decoration: none;
    letter-spacing: 0.12em;
    transition: opacity 0.2s;
}
.mega-footer-link:hover { opacity: 0.7; }

/* ─────────────────────────────────────────
   6. RIGHT SLOT
   ───────────────────────────────────────── */
.status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.status-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.14em;
    color: var(--green);
    text-transform: uppercase;
    animation: statusPulse 3s ease infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.login-link {
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    transition: color 0.25s ease;
}
.login-link:hover { color: var(--text-primary); }

/* Separator */
.nav-separator {
    width: 1px;
    height: 20px;
    background: var(--border-bright);
    flex-shrink: 0;
}

/* CTA Button */
.cta-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--red);
    color: #fff;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    padding: 0 22px;
    height: 38px;
    border-radius: 2px;
    overflow: hidden;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    white-space: nowrap;
}

.cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.12) 0%,
        transparent 60%
    );
    transition: opacity 0.3s ease;
}

.cta-btn:hover {
    background: #c91f15;
    box-shadow: 0 0 0 1px var(--red), 0 8px 30px var(--red-glow);
    transform: translateY(-1px);
}

.cta-arrow {
    font-size: 14px;
    transition: transform 0.3s var(--ease-out);
}
.cta-btn:hover .cta-arrow { transform: translateX(3px); }

/* ─────────────────────────────────────────
   7. HAMBURGER
   ───────────────────────────────────────── */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-bright);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    position: relative;
    z-index: 10001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.nav-toggle:hover {
    background: var(--surface-2);
    border-color: var(--border-bright);
}

.bar {
    display: block;
    width: 100%;
    height: 1.5px;
    background: var(--text-primary);
    transition: 0.4s var(--ease-circ);
    transform-origin: center;
}

.bar.short { width: 60%; align-self: flex-end; }

.nav-toggle.active .bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); width: 100%; }
.nav-toggle.active .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.active .bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); width: 100%; }

/* ─────────────────────────────────────────
   8. MOBILE OVERLAY
   ───────────────────────────────────────── */
.mobile-ui {
    position: fixed;
    inset: 0;
    background: var(--ink);
    z-index: 9980;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition:
        opacity 0.5s var(--ease-out),
        transform 0.5s var(--ease-out),
        visibility 0.5s;
    font-family: var(--font-display);
    display: flex;
    flex-direction: column;
}

.mobile-ui.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Grid lines decoration */
.mobile-ui::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.4;
    pointer-events: none;
}

.mobile-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 72px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.mobile-brand {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}

.mobile-brand .red-accent { color: var(--red); }

.mobile-close-btn {
    background: var(--surface-2);
    border: 1px solid var(--border-bright);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 14px;
    border-radius: 3px;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: background 0.2s;
}
.mobile-close-btn:hover { background: var(--surface-1); }

.mobile-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px 28px 60px;
    position: relative;
    z-index: 1;
}

.mobile-group {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.mobile-group:last-of-type { border-bottom: none; }

.mob-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 20px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.mob-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text-primary);
    font-size: clamp(28px, 6vw, 42px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    line-height: 1.15;
}

.mob-link:hover {
    color: var(--red);
    border-bottom-color: var(--border);
}

.mob-link-arrow {
    font-size: 20px;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.25s var(--ease-out);
}

.mob-link:hover .mob-link-arrow {
    opacity: 1;
    transform: translateX(6px);
}

.mob-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 30px 0;
}

.mob-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
}

.mob-login {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid var(--border-bright);
    padding: 12px 20px;
    border-radius: 3px;
    transition: color 0.2s, border-color 0.2s;
}

.mob-login:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.mob-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    background: var(--red);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: 3px;
    transition: background 0.25s ease;
}

.mob-cta:hover { background: #c91f15; }

/* Mobile status strip at bottom */
.mobile-status-strip {
    border-top: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.mobile-status-strip .pulse-dot { width: 4px; height: 4px; }

.mob-status-text {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 0.14em;
}

/* ─────────────────────────────────────────
   9. RESPONSIVE
   ───────────────────────────────────────── */
@media (max-width: 1100px) {
    .hide-mobile { display: none !important; }
    .nav-toggle  { display: flex; }
    .os-header   { height: 68px; }
    .nav-grid    { grid-template-columns: 1fr auto; padding: 0 24px; }
    .ticker-content { padding: 0 24px; }
    body         { padding-top: 104px; }
    .ticker-right .ticker-right-item:not(.keep-mobile) { display: none; }
}

@media (max-width: 480px) {
    .nav-grid   { padding: 0 16px; }
    .cta-btn    { padding: 0 14px; font-size: 9px; }
}