/* =========================================================
   SERVERGUARD — SHARED DESIGN SYSTEM
   Design tokens, reset, base typography and icon system.

   Loaded by every page (landing + documentation) BEFORE the
   page-specific stylesheet. Keep this file framework-free and
   limited to genuinely shared primitives.

   Visual direction: deep near-black / dark-purple surfaces with
   bright violet + magenta accents, thin low-contrast borders and
   consistent rounded corners.
   ========================================================= */

/* =========================================================
   DESIGN TOKENS
   ========================================================= */

:root {
    color-scheme: dark;

    /* ---- Backgrounds & surfaces ------------------------ */

    --bg: #08060f;
    --bg-deep: #040309;
    --bg-elevated: #0b0917;
    --surface: #0d0b18;
    --surface-2: #131022;
    --surface-3: #1a1530;
    --surface-hover: #221b3d;

    /* ---- Text ------------------------------------------ */

    --text: #f1eefb;
    --text-primary: #f1eefb;
    --text-secondary: #b8b0ce;
    --text-muted: #8a80a3;
    --text-faint: #5c5473;

    /* ---- Borders --------------------------------------- */

    --border: rgba(255, 255, 255, 0.065);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(139, 92, 246, 0.38);
    --border-accent-strong: rgba(168, 85, 247, 0.55);
    --surface-nav-active: #21152f;
    --focus-ring: #d88aff;

    /* ---- Accent (violet primary, magenta secondary) ------ */

    --accent: #8b5cf6;
    --accent-strong: #a78bfa;
    --accent-deep: #6d28d9;
    --accent-2: #d946ef;
    --accent-3: #e879f9;
    --accent-text: #bda8ff;
    --accent-soft: rgba(139, 92, 246, 0.12);
    --accent-soft-strong: rgba(139, 92, 246, 0.22);
    --accent-glow: rgba(139, 92, 246, 0.30);
    --magenta-soft: rgba(217, 70, 239, 0.12);

    --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #a855f7 46%, #d946ef 100%);
    --gradient-accent-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(217, 70, 239, 0.12));
    --gradient-text: linear-gradient(100deg, #c4b5fd 0%, #d8b4fe 44%, #f0abfc 100%);

    /* ---- Semantic -------------------------------------- */

    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.10);
    --warning: #e6b45a;
    --warning-soft: rgba(230, 180, 90, 0.10);
    --danger: #f0736e;
    --danger-soft: rgba(240, 115, 110, 0.10);
    --info: #a78bfa;
    --info-soft: rgba(167, 139, 250, 0.10);

    /* ---- Typography ------------------------------------ */

    --font-sans:
        "Inter",
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    --font-mono:
        "SFMono-Regular",
        ui-monospace,
        "SF Mono",
        Menlo,
        Consolas,
        "Liberation Mono",
        monospace;

    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 15px;
    --fs-md: 16px;
    --fs-lg: 18px;
    --fs-xl: clamp(22px, 2.2vw, 28px);
    --fs-2xl: clamp(28px, 3.4vw, 40px);
    --fs-3xl: clamp(34px, 4.6vw, 54px);

    --lh-tight: 1.12;
    --lh-snug: 1.3;
    --lh-normal: 1.65;
    --lh-relaxed: 1.8;

    /* ---- Spacing scale (4px base) ---------------------- */

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
    --sp-9: 48px;
    --sp-10: 64px;
    --sp-11: 80px;
    --sp-12: 110px;

    /* ---- Radii ----------------------------------------- */

    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 10px;
    --r-xl: 14px;
    --r-2xl: 18px;
    --r-full: 999px;

    /* ---- Shadows --------------------------------------- */

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 14px 40px rgba(3, 2, 8, 0.5);
    --shadow-lg: 0 30px 80px rgba(3, 2, 8, 0.6);
    --shadow-glow: 0 0 0 1px rgba(139, 92, 246, 0.16), 0 12px 40px rgba(109, 40, 217, 0.28);

    /* ---- Transitions ----------------------------------- */

    --ease-out: cubic-bezier(0.22, 0.8, 0.28, 1);
    --t-fast: 140ms var(--ease-out);
    --t: 180ms var(--ease-out);
    --t-slow: 220ms var(--ease-out);

    /* ---- Layout ---------------------------------------- */

    --content-max: 1460px;
    --docs-max: 1380px;
    --header-h: 68px;
    --sidebar-w: 248px;
    --toc-w: 220px;
    --gutter: 24px;
    --page-gutter: clamp(24px, 3.2vw, 56px);
}


/* =========================================================
   RESET
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scrollbar-color: var(--surface-3) var(--bg-deep);
    scrollbar-width: thin;
}

body {
    margin: 0;

    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);

    background: var(--bg);
    color: var(--text);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    color: var(--text);
}

p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
}

img,
svg,
canvas {
    max-width: 100%;
}

ul,
ol {
    margin: 0;
}

code,
pre,
kbd {
    font-family: var(--font-mono);
}

::selection {
    background: var(--accent-soft-strong);
    color: #fff;
}


/* =========================================================
   FOCUS & ACCESSIBILITY
   ========================================================= */

:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);

    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;

    top: -60px;
    left: var(--sp-3);

    z-index: 2000;

    padding: 10px 16px;

    border-radius: var(--r-md);

    background: var(--accent);
    color: #fff;

    font-size: var(--fs-sm);
    font-weight: 600;

    transition: top var(--t);
}

.skip-link:focus {
    top: var(--sp-3);
}


/* =========================================================
   ICON SYSTEM
   Consistent line icons from a single inline SVG sprite.
   ========================================================= */

.icon {
    display: inline-block;

    width: 1em;
    height: 1em;

    flex: none;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;

    vertical-align: -0.125em;
}

.icon-fill {
    fill: currentColor;
    stroke: none;
}


/* =========================================================
   SHARED BUTTON PRIMITIVE
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);

    min-height: 40px;

    padding: 0 var(--sp-5);

    border: 1px solid transparent;
    border-radius: var(--r-md);

    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;

    white-space: nowrap;

    cursor: pointer;

    transition:
        background var(--t),
        border-color var(--t),
        color var(--t),
        box-shadow var(--t),
        transform var(--t-fast);
}

.btn .icon {
    font-size: 17px;
}

.btn-primary {
    background: var(--gradient-accent);
    color: #fff;

    box-shadow: 0 8px 22px rgba(109, 40, 217, 0.34);
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.44);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--border-accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-2);
}

.btn[disabled],
.btn[aria-disabled="true"] {
    opacity: 0.5;
    pointer-events: none;
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

}
