/* Shared header & layout — use with :root (--text, --text-muted, --accent, --border, --bg) */
.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1rem, 4vw, 2rem);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.navbar .logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}
.navbar .logo:hover {
    color: var(--text);
}
.navbar .logo .accent { color: var(--accent); }
.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links .primary-link {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(34, 211, 238, 0.4);
    color: var(--accent);
}

/* Mobile: prevent header from overflowing horizontally */
@media (max-width: 600px) {
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem 0.75rem;
        justify-content: flex-start;
        width: 100%;
    }
    .nav-links a {
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .nav-links .primary-link {
        padding: 0.35rem 0.75rem;
    }
    /* Safety: never allow the whole page to scroll sideways due to header overflow */
    .site {
        overflow-x: hidden;
    }

    /* Avoid long inline <code> causing horizontal overflow */
    code {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    pre {
        max-width: 100%;
        overflow-x: auto;
    }
}
