/* ===== Sphinx Shared Navbar + Mega Dropdowns =====
   Self-contained with safe fallbacks so it renders correctly
   even on pages that don't define the legacy --gray-*/--white
   variables locally. Shared across every page for consistency.
*/

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-800, #1f1f1f);
}

.navbar-inner {
    max-width: var(--max, 1280px);
    margin: 0 auto;
    padding: 0 var(--section-px, 64px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 2rem;
}

.navbar-logo img { height: 38px; width: auto; display: block; }

.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
    flex: 1;
    justify-content: center;
    height: 100%;
    margin: 0;
    padding: 0;
}

.nav-links > li {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-links > li > a {
    font-size: 15px;
    font-weight: 400;
    color: var(--gray-200, #dddddd);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
    transition: color 0.2s;
    text-decoration: none;
}

.nav-links > li > a:hover,
.nav-links > li:hover > a { color: var(--white, #fff); }

.nav-links > li > a .chevron {
    font-size: 10px;
    opacity: 0.5;
    transition: transform 0.3s;
}

.nav-links > li:hover > a .chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Mega dropdown panel */
.mega-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--panel, #0a0a0a);
    border: 1px solid var(--gray-800, #1f1f1f);
    border-top: 2px solid var(--blue, #00AEE6);
    border-radius: 0 0 8px 8px;
    width: 580px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    z-index: 200;
    overflow: hidden;
}

.nav-links > li:hover > .mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mega-inner {
    display: grid;
    grid-template-columns: 200px 1fr;
}

.mega-sidebar {
    background: var(--black, #000);
    padding: 28px 24px;
    border-right: 1px solid var(--gray-800, #1f1f1f);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mega-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--sx-gradient, linear-gradient(90deg, #00AEE6 0%, #2F2583 100%));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mega-sidebar-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--white, #fff);
    line-height: 1.3;
}

.mega-sidebar-desc {
    font-size: 13px;
    font-weight: 300;
    color: var(--gray-400, #8a8a8a);
    line-height: 1.5;
}

.mega-sidebar-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--blue, #00AEE6);
    margin-top: 4px;
    text-decoration: none;
}

.mega-items { padding: 16px 0; }

.mega-item {
    display: block;
    padding: 14px 24px;
    transition: background 0.15s;
    text-decoration: none;
}

.mega-item:hover { background: rgba(0, 174, 230, 0.06); }

.mega-item-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--white, #fff);
    margin-bottom: 2px;
}

.mega-item:hover .mega-item-title { color: var(--blue, #00AEE6); }

.mega-item-desc {
    font-size: 13px;
    font-weight: 300;
    color: var(--gray-400, #8a8a8a);
    line-height: 1.4;
}

.mega-divider {
    height: 1px;
    background: var(--gray-800, #1f1f1f);
    margin: 4px 24px;
}

/* ============================================================
   Mobile navigation — hamburger + drawer + tap-to-expand
   Parallel structure to the desktop hover nav. Only revealed at
   ≤900px. Desktop nav is untouched.
   ============================================================ */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    color: var(--white, #fff);
}
.mobile-nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.mobile-nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.mobile-nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-drawer {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 99;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.mobile-drawer.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.mobile-nav {
    list-style: none;
    padding: .5rem 0 2.5rem;
    margin: 0;
}
.mobile-nav-item { border-bottom: 1px solid var(--gray-800, #1f1f1f); }

.mobile-nav-section,
.mobile-nav-direct {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: 0;
    padding: 18px 24px;
    color: var(--white, #fff);
    font-family: 'Kanit', sans-serif;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s;
}
.mobile-nav-section:hover,
.mobile-nav-direct:hover { background: rgba(255, 255, 255, 0.03); }

.mobile-nav-section .mobile-nav-chev {
    font-size: 13px;
    opacity: 0.55;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.mobile-nav-section[aria-expanded="true"] .mobile-nav-chev { transform: rotate(180deg); opacity: 1; }

.mobile-nav-panel {
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    transition: max-height 0.3s ease;
}
.mobile-nav-section[aria-expanded="true"] + .mobile-nav-panel { max-height: 600px; }

.mobile-nav-panel a {
    display: block;
    padding: 14px 24px 14px 40px;
    color: var(--gray-200, #ddd);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    border-top: 1px solid var(--gray-800, #1f1f1f);
    transition: color 0.15s, background 0.15s;
}
.mobile-nav-panel a:first-child { border-top: none; }
.mobile-nav-panel a:hover,
.mobile-nav-panel a:focus { color: var(--blue, #00AEE6); background: rgba(0, 174, 230, 0.05); }

.mobile-nav-cta {
    padding: 20px 24px 0;
    border-bottom: none !important;
}
.mobile-nav-cta .btn.primary {
    display: flex;
    justify-content: center;
    width: 100%;
}

body.drawer-open { overflow: hidden; }

@media (max-width: 900px) {
    .navbar-inner { height: 60px; padding: 0 16px; gap: .65rem; }
    .nav-links { display: none; }
    .mobile-nav-toggle { display: flex; }
    .mobile-drawer { display: block; }

    /* Keep "Contact Us →" on a single line and compact at narrow widths,
       so the navbar's height isn't blown up by the CTA wrapping.
       NOTE: !important required because several page-local stylesheets
       (esp/*, max-factory/*) define `.btn.primary { padding: ... !important }`
       which would otherwise win this cascade. */
    .navbar .btn.primary,
    .navbar a.btn.primary {
        white-space: nowrap !important;
        padding: 7px 16px !important;
        font-size: 13px !important;
        flex-shrink: 0;
    }
}
@media (max-width: 420px) {
    .navbar .btn.primary,
    .navbar a.btn.primary {
        padding: 6px 12px !important;
        font-size: 12.5px !important;
    }
}
