:root {
    --bg: #0f1117;
    --surface: #161b27;
    --surface-2: #111724;
    --border: #252d3d;
    --accent: #4f8ef7;
    --accent2: #35d9a4;
    --warn: #f79c4f;
    --text: #d6dce8;
    --muted: #7a86a0;
    --heading: #edf0f7;
    --radius: 10px;
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #dde2ed;
    --accent: #2563eb;
    --accent2: #059669;
    --warn: #d97706;
    --text: #374151;
    --muted: #6b7280;
    --heading: #111827;
}

.ns-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 40px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
}

.ns-header .logo-mark {
    width: 36px;
    height: 36px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.ns-header .header-titles {
    display: flex;
    flex-direction: column;
    gap: 1px;
    justify-content: center;
    min-height: 36px;
    min-width: 150px;
}

.ns-header h1 {
    color: var(--heading);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .02em;
}

.ns-header h1 span { color: var(--accent); }

.ns-header .header-sub {
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
}

.ns-header .header-nav {
    margin-left: 20px;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.ns-header .nav-link,
.ns-header .nav-menu summary {
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .01em;
    transition: color .18s, background .18s;
}

.ns-header .nav-link:hover,
.ns-header .nav-link.active,
.ns-header .nav-menu summary.active,
.ns-header .nav-menu summary:hover,
.ns-header .nav-menu[open] summary { color: var(--accent); }

.ns-header .nav-menu {
    position: relative;
}

.ns-header .nav-menu summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 32px;
    border-radius: 6px;
    padding: 0 2px;
}

.ns-header .nav-menu summary::-webkit-details-marker { display: none; }

.ns-header .nav-menu summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s;
}

.ns-header .nav-menu[open] summary::after {
    transform: rotate(225deg) translate(-1px, -1px);
}

.ns-header .nav-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    left: -16px;
    width: 280px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 14px 36px rgba(0,0,0,.28);
    display: grid;
    gap: 4px;
    z-index: 40;
    transform-origin: top left;
}

.ns-header .nav-dropdown::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10px;
    right: 10px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
}

.ns-header .nav-menu.is-entering[open] .nav-dropdown {
    animation: nsDropdownIn .18s ease both;
}

.ns-header .nav-dropdown-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 360px;
}

.ns-header .nav-dropdown a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
    transition: background .18s, color .18s;
}

.ns-header .nav-dropdown a:hover {
    color: var(--accent);
    background: rgba(79,142,247,.08);
}

.ns-header .nav-dropdown strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: inherit;
}

.ns-header .nav-dropdown-wide strong {
    color: var(--accent2);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    letter-spacing: .04em;
}

.ns-header .nav-dropdown span {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

@keyframes nsDropdownIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ns-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.ns-header #theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    height: auto;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: .72rem;
    padding: 6px 14px;
    transition: border-color .2s, box-shadow .2s, background .35s, color .35s;
    box-shadow: 0 4px 24px rgba(0,0,0,.16);
    user-select: none;
    flex-shrink: 0;
}

.ns-header #theme-toggle:hover {
    color: var(--accent);
    border-color: rgba(79,142,247,.4);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79,142,247,.18);
}

.ns-header #theme-toggle .toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform .4s cubic-bezier(.4,0,.2,1);
}

.ns-header #theme-toggle .toggle-label {
    display: inline;
}

[data-theme="dark"] .ns-header #theme-toggle .toggle-icon { transform: rotate(180deg); }

.ns-header .quick-link {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s, transform .18s;
}

.ns-header .quick-link:hover {
    background: #6ba3ff;
    transform: translateY(-1px);
}

.site-footer.ns-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 46px 40px 34px;
}

.ns-footer .footer-inner {
    max-width: 1120px;
    margin: 0 auto;
}

.ns-footer .footer-links-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(132px, 1fr));
    gap: 34px 48px;
    margin-bottom: 52px;
}

.ns-footer .footer-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.ns-footer .footer-column h4 {
    color: var(--heading);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 3px;
}

.ns-footer .footer-column a {
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
    transition: color .18s, transform .18s;
}

.ns-footer .footer-column a:hover {
    color: var(--accent);
    transform: translateX(2px);
}

.ns-footer .footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.ns-footer .footer-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ns-footer .footer-logo {
    width: 48px;
    height: 48px;
    border: 2px solid var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.ns-footer .footer-brand h3 {
    color: var(--heading);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1;
}

.ns-footer .footer-brand h3 span { color: var(--accent); }

.ns-footer .footer-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}

.ns-footer .footer-social {
    display: flex;
    gap: 10px;
}

.ns-footer .footer-social a {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: color .18s, border-color .18s;
}

.ns-footer .footer-social a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 900px) {
    .ns-header {
        align-items: center;
        flex-wrap: wrap;
        padding: 16px 22px;
    }

    .ns-header .header-nav {
        order: 3;
        width: 100%;
        margin: 4px 0 0;
        gap: 14px 18px;
    }

    .ns-header .header-actions { margin-left: auto; }

    .ns-footer .footer-links-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
        gap: 30px 34px;
    }
}

@media (max-width: 560px) {
    .ns-header { gap: 12px; }
    .ns-header .header-titles { min-width: 0; }
    .ns-header .quick-link { display: none; }

    .site-footer.ns-footer {
        padding: 38px 22px 30px;
    }

    .ns-footer .footer-links-grid {
        grid-template-columns: 1fr;
        gap: 26px;
        margin-bottom: 38px;
    }

    .ns-footer .footer-column {
        gap: 10px;
    }

    .ns-footer .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
    }
}
