@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}
/* Anchor offset strategy: single source of truth.
   Sections and inner targets own their scroll-margin-top
   (see stage1.css, platform.css, ecosystem.css, research.css,
   services.css, contact.css, doctrine.css).
   html must NOT add scroll-padding-top: the two values are
   additive per spec and double-compensate, landing anchors
   ~96px early and exposing the previous section's tail. */
html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #2a3554 var(--inst-ink);
}

body {
    margin: 0;
    padding-top: var(--nav-h);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-base);
    color: var(--text-primary);
    background: var(--bg);
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, li {
    overflow-wrap: break-word;
}

img {
    max-width: 100%;
    height: auto;
}

::selection {
    background: rgba(91, 124, 255, 0.35);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--inst-ink);
}

::-webkit-scrollbar-thumb {
    background: #232c4a;
    border: 2px solid var(--inst-ink);
    border-radius: var(--radius-pill);
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--inst-blue-600);
    }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}

a:focus-visible, button:focus-visible {
    border-radius: 4px;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1003;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 16px var(--section-pad-x);
    background: var(--bg);
    border-bottom: 1px solid #222;
    transition: background 0.25s ease, border-color 0.25s ease;
}

    .navbar.scrolled {
        background: rgba(11, 15, 26, 0.85);
        backdrop-filter: blur(10px);
        border-bottom-color: #333;
    }

.logo {
    font-weight: 700;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

.logo a {
    text-decoration: none;
    color: #fff;
}

.navbar nav {
    display: flex;
    gap: 8px;
    min-width: 0;
}

    .navbar nav a {
        margin: 0;
        padding: 8px 12px;
        white-space: nowrap;
        text-decoration: none;
        font-size: var(--text-sm);
        font-weight: 500;
        color: var(--text-muted);
        border-radius: var(--radius-sm);
        transition: color 0.2s ease, background 0.2s ease;
    }

        .navbar nav a:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.04);
        }

.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
    padding: 8px;
}

    .burger span {
        width: 25px;
        height: 3px;
        background: #fff;
        border-radius: 2px;
        transition: 0.3s;
    }

    .burger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .burger.active span:nth-child(2) {
        opacity: 0;
    }

    .burger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -7px);
    }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    z-index: 1000;
}

    .overlay.active {
        opacity: 1;
        pointer-events: all;
    }

.primary, .secondary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.primary {
    border: none;
    background: linear-gradient(135deg, #5b7cff 0%, #7a94ff 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(91, 124, 255, 0.25);
}

    .primary::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s ease;
    }

    .primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 26px rgba(91, 124, 255, 0.38);
    }

        .primary:hover::before {
            left: 100%;
        }

    .primary:active {
        transform: translateY(-1px);
    }

.secondary {
    background: transparent;
    border: 1px solid rgba(91, 124, 255, 0.6);
    color: #fff;
}

    .secondary:hover {
        transform: translateY(-2px);
        border-color: var(--brand);
        background: rgba(91, 124, 255, 0.1);
    }

    .primary span, .secondary span {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .primary svg, .secondary svg {
        width: 18px;
        height: 18px;
        transition: transform 0.3s ease;
    }

    .primary:hover svg, .secondary:hover svg {
        transform: translateX(4px);
    }

@media (max-width: 900px) {
    .navbar {
        padding: 12px 20px;
    }

    .burger {
        display: flex;
    }

    .navbar nav {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        height: 100dvh;
        width: min(300px, 84vw);
        flex-direction: column;
        gap: 0;
        padding-top: 96px;
        background: var(--bg);
        border-left: 1px solid var(--line);
        transition: right 0.3s ease;
        z-index: 1002;
        overflow-y: auto;
    }

        .navbar nav.active {
            right: 0;
        }

        .navbar nav a {
            padding: 16px 24px;
            font-size: var(--text-base);
            border-bottom: 1px solid #1c2338;
            border-radius: 0;
        }
}

@media (max-width: 768px) {
    .primary, .secondary {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .primary, .secondary, .navbar, .burger span, .overlay, .navbar nav {
        transition: none !important;
    }

        .primary::before {
            display: none;
        }

        .primary:hover, .secondary:hover {
            transform: none;
        }
}
