/* ============================================================
   RFF v3 — NAVIGATION SYSTEM (FINAL, STABLE)
   Desktop + Mobile, overlay-safe
   ============================================================ */


/* ============================================================
   HEADER
   ============================================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}


/* ============================================================
   NAV CONTAINER
   ============================================================ */

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}


/* ============================================================
   LOGO
   ============================================================ */

.site-logo-img {
    height: 46px;
    width: auto;
    display: block;
}


/* ============================================================
   DESKTOP NAV
   ============================================================ */

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-desktop > a,
.nav-desktop > button {
    display: inline-flex;
    align-items: center;

    background: none;
    border: none;

    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;

    cursor: pointer;
    padding: 0;

    transition: opacity 0.2s ease;
}

.nav-desktop > a:hover,
.nav-desktop > button:hover {
    opacity: 1;
}


/* ============================================================
   DESKTOP DROPDOWN
   ============================================================ */

.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;

    min-width: 220px;
    padding: 0.5rem 0;

    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;

    box-shadow: 0 12px 30px rgba(0,0,0,0.45);

    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;

    z-index: 1001;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;

    font-size: 0.95rem;
    color: #ffffff;
    opacity: 0.85;

    transition: background 0.15s ease, opacity 0.15s ease;
}

.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.08);
    opacity: 1;
}


/* ============================================================
   HAMBURGER BUTTON (MOBILE)
   ============================================================ */

.nav-toggle {
    display: none;
    width: 36px;
    height: 36px;

    flex-direction: column;
    justify-content: center;
    gap: 6px;

    background: none;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    width: 26px;
    height: 3px;
    border-radius: 2px;
    background: #ffffff;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}

/* Hamburger → X */
.nav-toggle.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}


/* ============================================================
   MOBILE NAV PANEL (FIXED + VIEWPORT SAFE)
   ============================================================ */

#nav-mobile {
    display: none;
    flex-direction: column;

    position: fixed;
    top: 64px; /* height of header */
    left: 0;
    width: 100%;

    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.1);

    padding: 0.75rem 1.25rem;

    z-index: 100000; /* above content, below chat */
    max-height: calc(100vh - 64px); /* viewport minus header */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#nav-mobile.open {
    display: flex;
}

#nav-mobile a,
#nav-mobile button {
    padding: 0.75rem 0;

    font-size: 1.05rem;
    color: #ffffff;

    background: none;
    border: none;
    text-align: left;
    cursor: pointer;

    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#nav-mobile a:last-child {
    border-bottom: none;
}


/* ============================================================
   MOBILE DROPDOWN
   ============================================================ */

.mobile-dropdown {
    display: flex;
    flex-direction: column;
}

.mobile-dropdown-menu {
    display: none;
    flex-direction: column;
    padding-left: 1rem;
}

.mobile-dropdown-menu.open {
    display: flex;
}

.mobile-dropdown-menu a {
    font-size: 0.95rem;
    opacity: 0.85;
}


/* ============================================================
   NAV OVERLAY (CLICK-TO-CLOSE)
   ============================================================ */

#nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);

    z-index: 99999;
    display: none;
}

#nav-overlay.show {
    display: block;
}


/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 860px) {

    .nav-desktop {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }
}

@media (min-width: 861px) {

    #nav-mobile,
    #nav-overlay {
        display: none !important;
    }

    .nav-toggle {
        display: none;
    }

    .nav-desktop {
        display: flex !important;
        align-items: center !important;
        gap: 2rem !important;
    }

    .nav-desktop > a,
    .nav-desktop > button {
        display: inline-flex !important;
        align-items: center !important;
    }
}

/* Prevent background scroll when mobile nav is open */
body.nav-open {
    overflow: hidden;
}