/* =========================================================================
   Nexus documentation.

   Standalone on purpose: a buyer opens this from the ZIP, off a laptop, with
   no web server and often no internet. No CDN, no build step, no fonts to
   fetch — everything it needs is in this folder.

   Tokens mirror the installer and the product so all three read as one thing.
   ========================================================================= */

:root {
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.12);
    --accent-line: rgba(34, 197, 94, 0.34);

    --ink: #0b0f16;
    --surface: #131926;
    --surface-2: #0f1522;
    --field: #0d1320;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);

    --text: #e9edf5;
    --muted: rgba(233, 237, 245, 0.62);
    --faint: rgba(233, 237, 245, 0.42);

    --ok: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;

    --radius: 1rem;
    --radius-sm: 0.65rem;

    --rail: 19rem;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

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

.doc {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    min-height: 100vh;
}

.doc__rail {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 1rem 3rem;
    background: var(--surface-2);
    border-inline-end: 1px solid var(--line);
    scrollbar-width: thin;
}

.doc__main {
    min-width: 0;
    padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 3.5rem) 6rem;
    max-width: 62rem;
}

/* --- Brand ---------------------------------------------------------------- */

.doc__brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0 0.5rem 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.doc__brand svg { flex: none; }

.doc__brand-name {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.doc__brand small {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

/* --- Search --------------------------------------------------------------- */

.doc__search {
    position: relative;
    margin: 0 0.25rem 1.25rem;
}

.doc__search input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.1rem;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.doc__search input:focus {
    outline: none;
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.doc__search svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
}

/* --- Navigation ----------------------------------------------------------- */

.doc__nav { font-size: 0.875rem; }

.doc__nav-group {
    margin: 1.4rem 0 0.4rem;
    padding: 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.doc__nav a {
    display: block;
    padding: 0.4rem 0.75rem;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.doc__nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.doc__nav a.is-current {
    background: var(--accent-soft);
    border-left-color: var(--accent);
    color: var(--text);
    font-weight: 600;
}

.doc__nav a[hidden] { display: none; }

.doc__nav-empty {
    padding: 0.75rem;
    color: var(--faint);
    font-size: 0.8125rem;
}

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

.doc__eyebrow {
    margin: 0 0 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    font-weight: 800;
}

h2 {
    margin: 3.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    font-weight: 700;
    scroll-margin-top: 1.5rem;
}

h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 2.5rem; }

h3 {
    margin: 2rem 0 0.6rem;
    font-size: 1.09rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h4 {
    margin: 1.5rem 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted);
}

p { margin: 0 0 1rem; }

.doc__lede {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 46rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { font-weight: 700; color: var(--text); }

ul, ol { margin: 0 0 1rem; padding-inline-start: 1.35rem; }
li { margin-bottom: 0.4rem; }
li > ul, li > ol { margin-top: 0.4rem; }

code {
    font-family: var(--mono);
    font-size: 0.855em;
    padding: 0.12em 0.4em;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.07);
    color: #fdba74;
    word-break: break-word;
}

pre {
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.65;
}

pre code { padding: 0; background: none; color: #cbd5e1; }

/* --- Tables --------------------------------------------------------------- */

.doc__table-wrap { overflow-x: auto; margin-bottom: 1.25rem; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--faint);
    border-bottom-color: var(--line-strong);
    white-space: nowrap;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

td code { white-space: nowrap; }

/* --- Callouts ------------------------------------------------------------- */

.note {
    display: flex;
    gap: 0.7rem;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.9rem;
}

.note svg { flex: none; margin-top: 0.22rem; color: var(--faint); }
.note p:last-child { margin-bottom: 0; }

.note--tip { border-left-color: var(--accent); background: var(--accent-soft); }
.note--tip svg { color: var(--accent); }

.note--warn { border-left-color: var(--warn); background: rgba(251, 191, 36, 0.08); }
.note--warn svg { color: var(--warn); }

.note--bad { border-left-color: var(--bad); background: rgba(248, 113, 113, 0.08); }
.note--bad svg { color: var(--bad); }

/* --- Cards ---------------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.card {
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.card h4 { margin: 0 0 0.3rem; color: var(--text); font-size: 0.95rem; }
.card p { margin: 0; font-size: 0.855rem; color: var(--muted); }

/* --- Numbered steps ------------------------------------------------------- */

.steps { list-style: none; margin: 0 0 1.5rem; padding: 0; counter-reset: step; }

.steps > li {
    position: relative;
    counter-increment: step;
    padding: 0 0 1.1rem 2.6rem;
    margin: 0;
    border-left: 1px solid var(--line);
    margin-left: 0.9rem;
}

.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }

.steps > li::before {
    content: counter(step);
    position: absolute;
    left: -0.9rem;
    top: 0;
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--mono);
}

.steps h4 { margin: 0.15rem 0 0.3rem; color: var(--text); font-size: 1rem; }
.steps p:last-child { margin-bottom: 0; }

/* --- Pills ---------------------------------------------------------------- */

.pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.pill--get { background: rgba(52, 211, 153, 0.16); color: var(--ok); }
.pill--post { background: rgba(34, 197, 94, 0.16); color: var(--accent); }
.pill--patch { background: rgba(251, 191, 36, 0.16); color: var(--warn); }
.pill--soon { background: rgba(255, 255, 255, 0.08); color: var(--faint); }

/* --- Footer --------------------------------------------------------------- */

.doc__foot {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 0.82rem;
}

/* --- Mobile --------------------------------------------------------------- */

.doc__burger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 30;
    width: 2.6rem;
    height: 2.6rem;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

@media (max-width: 60rem) {
    .doc { grid-template-columns: minmax(0, 1fr); }

    .doc__burger { display: grid; }

    .doc__rail {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(20rem, 84vw);
        z-index: 25;
        transform: translateX(-102%);
        transition: transform 0.18s ease;
        box-shadow: 0 0 3rem rgba(0, 0, 0, 0.5);
    }

    .doc__rail.is-open { transform: none; }

    .doc__main { padding-top: 4.25rem; }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
    :root { --text: #000; --muted: #333; --faint: #666; }

    body { background: #fff; color: #000; font-size: 11pt; }
    .doc { display: block; }
    .doc__rail, .doc__burger, .doc__search { display: none !important; }
    .doc__main { max-width: none; padding: 0; }

    pre, .card, .note { background: #f6f6f6 !important; border-color: #ccc !important; }
    code { background: #f0f0f0 !important; color: #a3410a !important; }
    h2 { break-after: avoid; }
    table { break-inside: auto; }
    tr { break-inside: avoid; }
    a { color: #000; text-decoration: underline; }
}
