/* SciPortX shared navigation — matches sciportx_homepage_v2.html */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-cb {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
}

nav.site-nav,
body > nav[aria-label="Primary"] {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 0 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav.site-nav .container,
body > nav[aria-label="Primary"] .container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    position: relative;
}

nav.site-nav .logo,
body > nav[aria-label="Primary"] .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.5px;
    flex: 1;
    min-width: 0;
    line-height: 1.25;
    text-decoration: none;
}

nav.site-nav .logo span,
body > nav[aria-label="Primary"] .logo span {
    color: #666;
    font-weight: 400;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e5e5;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-toggle:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.nav-toggle-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
    pointer-events: none;
}

.nav-toggle-bars span {
    display: block;
    height: 2px;
    background: #000;
    border-radius: 1px;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

#nav-cb:checked ~ nav .container .nav-toggle .nav-toggle-bars span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#nav-cb:checked ~ nav .container .nav-toggle .nav-toggle-bars span:nth-child(2) {
    opacity: 0;
}

#nav-cb:checked ~ nav .container .nav-toggle .nav-toggle-bars span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-panel {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.75rem;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #000;
}

.nav-links a.active {
    color: #000;
    font-weight: 600;
}

.nav-btn {
    background: #000;
    color: #fff !important;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-weight: 600 !important;
}

.nav-btn:hover {
    background: #333 !important;
    color: #fff !important;
}

.nav-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .nav-toggle {
        display: flex;
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 998;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.25s ease, visibility 0.25s;
    }

    #nav-cb:checked ~ nav .nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    nav.site-nav .container,
    body > nav[aria-label="Primary"] .container {
        padding: 0.75rem 0;
    }

    .nav-panel {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: max-height 0.35s ease, opacity 0.22s ease, visibility 0.35s;
        z-index: 999;
    }

    #nav-cb:checked ~ nav .container .nav-panel {
        max-height: 28rem;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 0 1rem;
    }

    .nav-links li {
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-links li:last-child {
        border-bottom: none;
        padding-top: 0.5rem;
    }

    .nav-links a {
        display: block;
        padding: 0.9rem 1.25rem;
        white-space: normal;
    }

    .nav-links .nav-btn {
        margin: 0.25rem 1.25rem 0.5rem;
        text-align: center;
    }
}
