/* ==========================================================================
   Nebulae — documentation layout
   Loads after frontend.css and reuses its design tokens (palette, fonts,
   radii). Only adds the docs shell (sidebar + content) and prose styling.
   ========================================================================== */

/* ---- Flat page ------------------------------------------------------- */
/* Docs drop the marketing starfield + nebula bloom (the #starfield div is
   omitted from the docs wrapper; the body::before glow is suppressed here) so
   the page sits on a calm, solid surface and reads like a plain reference. */

body.docs-body { background-color: var(--void); }
body.docs-body::before { display: none; }

.docs-shell {
    max-width: var(--maxw);
    margin-inline: auto;
    /* Top padding clears the fixed #site-header. */
    padding: clamp(7rem, 11vw, 9rem) var(--gutter) 5rem;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}

/* ---- Sidebar ---------------------------------------------------------- */

.docs-nav {
    position: sticky;
    top: 6rem;
    font-size: 0.95rem;
}

.docs-nav-title {
    font-family: var(--font-display);
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--haze-dim);
    margin-bottom: 0.9rem;
}

.docs-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.docs-nav a {
    display: block;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    color: var(--haze);
    border-left: 2px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.docs-nav a:hover { color: var(--star); background: var(--line-soft); }

.docs-nav a.active {
    color: var(--star);
    background: var(--accent-soft);
    border-left-color: var(--cyan);
}

/* ---- Content column --------------------------------------------------- */

.docs-main { max-width: 76ch; min-width: 0; }

/* Reference-scale headings. The marketing h1/h2 (clamp up to 4.7rem / 2.9rem)
   are display-poster sizes; docs want quieter, more uniform headings so the
   page reads as a technical reference rather than a landing page. */
.docs-main h1 {
    font-size: clamp(1.7rem, 2.6vw, 2.1rem);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}
.docs-main h2 {
    font-size: 1.3rem;
    line-height: 1.3;
    margin-top: 2.6rem;
}
.docs-main h3 {
    font-size: 1.05rem;
    margin-top: 1.8rem;
}
.docs-main strong { color: var(--star); }

.docs-lead {
    color: var(--haze);
    font-size: 1.12rem;
    margin-bottom: 2rem;
}

.docs-main ul, .docs-main ol {
    color: var(--haze);
    padding-left: 1.2rem;
    margin: 0 0 1rem;
}
.docs-main li { margin-bottom: 0.4rem; }

/* ---- Code ------------------------------------------------------------- */

.docs-main :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.12em 0.4em;
    color: var(--cyan-bright);
}

.docs-main pre {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.65;
    background: var(--void-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    margin: 0 0 1.4rem;
    color: var(--haze);
}

.docs-main pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Console accents inside code blocks. */
.docs-main pre .c { color: var(--haze-dim); } /* comment   */
.docs-main pre .p { color: var(--violet); }   /* prompt $  */
.docs-main pre .o { color: #5fcf8e; }          /* ok/output */
.docs-main pre .u { color: var(--cyan-bright); } /* url     */

/* ---- Callout ---------------------------------------------------------- */

.callout {
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin: 0 0 1.4rem;
    font-size: 0.97rem;
    color: var(--haze);
}
.callout strong { color: var(--star); }
.callout :last-child { margin-bottom: 0; }

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

.docs-main table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.4rem;
    font-size: 0.95rem;
}
.docs-main th, .docs-main td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--line);
    color: var(--haze);
    vertical-align: top;
}
.docs-main th {
    color: var(--star);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

/* ---- Prev / next pager ------------------------------------------------ */

.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}
.docs-pager a { display: inline-flex; flex-direction: column; gap: 0.2rem; }
.docs-pager .label {
    font-size: 0.74rem;
    color: var(--haze-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.docs-pager .next { text-align: right; margin-left: auto; }

/* ---- Mobile: sidebar becomes a wrapping chip row on top --------------- */

@media (max-width: 820px) {
    .docs-shell {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding-top: clamp(6rem, 18vw, 7rem);
    }
    .docs-nav { position: static; top: auto; }
    .docs-nav ul { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
    .docs-nav a { border-left: 0; border: 1px solid var(--line); }
    .docs-nav a.active { border-color: var(--cyan); }
}
