/* ==========================================================================
   NexusForge Studio — base layer
   Reset, document defaults, container rules and accessibility primitives.
   ========================================================================== */

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

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 50% -10%, rgba(28, 33, 41, 0.55) 0%, transparent 55%),
        radial-gradient(circle at 92% 12%, rgba(20, 25, 32, 0.4) 0%, transparent 45%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: var(--leading-normal);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
}

[data-theme='light'] body {
    background-image: none;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    line-height: var(--leading-tight);
    letter-spacing: -0.015em;
    text-wrap: balance;
}

h1 {
    font-size: var(--step-5);
}

h2 {
    font-size: var(--step-4);
}

h3 {
    font-size: var(--step-3);
}

h4 {
    font-size: var(--step-2);
}

h5 {
    font-size: var(--step-1);
}

p,
ul,
ol,
dl,
table,
pre,
blockquote,
figure {
    margin-block: 0 var(--space-4);
}

ul,
ol {
    padding-left: 1.35em;
}

li + li {
    margin-top: var(--space-2);
}

li > ul,
li > ol {
    margin-block: var(--space-2) 0;
}

a {
    color: var(--text);
    text-decoration-color: var(--accent-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--dur-1) var(--ease), text-decoration-color var(--dur-1) var(--ease);
}

a:hover {
    color: var(--white);
    text-decoration-color: var(--accent-strong);
}

[data-theme='light'] a:hover {
    color: var(--accent-strong);
}

strong,
b {
    font-weight: 700;
    color: var(--white);
}

[data-theme='light'] strong,
[data-theme='light'] b {
    color: var(--accent-strong);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin-block: var(--space-6);
}

code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

:not(pre) > code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.12em 0.4em;
    color: var(--accent-strong);
    white-space: break-spaces;
    word-break: break-word;
}

kbd {
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    padding: 0.1em 0.4em;
    font-size: 0.8em;
    color: var(--text);
}

::selection {
    background: var(--accent-line);
    color: var(--white);
}

:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
    border-radius: var(--radius-sm);
}

/* Containers ------------------------------------------------------------- */

.wrap {
    width: 100%;
    max-width: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.wrap--narrow {
    max-width: 880px;
}

main {
    display: block;
}

/* Accessibility ---------------------------------------------------------- */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -60px;
    z-index: calc(var(--z-header) + 2);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    color: var(--text);
    text-decoration: none;
    transition: top var(--dur-2) var(--ease);
}

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

/* Motion preference: honour the OS setting rather than animating anyway. */
@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;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .site-header,
    .docs-sidebar,
    .docs-toc,
    .docs-pager,
    .site-footer,
    .search-root {
        display: none !important;
    }
}
