/* Manual: three-column docs layout (sections · content · on this page) */
.docs {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 200px;
    gap: 40px;
    max-width: 1440px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 32px) 24px 0;
}

/* Left: sections */
.docs-side, .docs-toc {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--nav-h) - 48px);
    overflow-y: auto;
    font-size: .9rem;
    scrollbar-width: thin;
}
.docs-side ul, .docs-toc ul { list-style: none; margin: 0; padding: 0; }
.side-group {
    margin: 22px 0 8px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text);
}
.docs-side a {
    display: block;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}
.docs-side a:hover { color: var(--text); background: var(--surface); }
.docs-side a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.side-pdf {
    border: 1px solid var(--border);
    text-align: center;
}

/* Right: on this page */
.toc-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.docs-toc ul { border-left: 1px solid var(--border); }
.docs-toc a {
    display: block;
    margin-left: -1px;
    padding: 5px 0 5px 14px;
    border-left: 1px solid transparent;
    color: var(--muted);
    text-decoration: none;
    line-height: 1.4;
}
.docs-toc a:hover { color: var(--text); }
.docs-toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* Centre: content */
.docs-content { max-width: 880px; padding-bottom: 80px; }
.docs-content .eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: .9rem; }
.docs-content h1 { margin-top: 0; }
.docs-content h1 + p { font-size: 1.1rem; color: var(--muted); }
.docs-content h2 { scroll-margin-top: calc(var(--nav-h) + 24px); font-size: 1.6rem; }
.docs-content h3 { scroll-margin-top: calc(var(--nav-h) + 24px); margin-top: 2em; font-size: 1.15rem; }
.docs-content h2 a.anchor, .docs-content h3 a.anchor { margin-left: 8px; color: var(--muted); opacity: 0; text-decoration: none; }
.docs-content h2:hover a.anchor, .docs-content h3:hover a.anchor { opacity: 1; }
.docs-content table { border-radius: 10px; }
.docs-end { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; }

/* Code blocks with a title bar */
.code-block { margin: 1.2em 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.code-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px 6px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    color: var(--muted);
}
.code-copy {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--muted);
    font: inherit;
    padding: 3px 10px;
    cursor: pointer;
}
.code-copy:hover { color: var(--text); }
.doc .code-block pre { margin: 0; border: 0; border-radius: 0; background: none; font-size: .88rem; line-height: 1.6; }
.tok-k { color: #c792ea; }
.tok-t { color: #82aaff; }
.tok-s { color: #c3e88d; }
.tok-c { color: #697098; font-style: italic; }
.tok-n { color: #f78c6c; }

/* Mobile bar that opens the sections */
.docs-bar { display: none; }

@media (max-width: 1100px) {
    .docs { grid-template-columns: 220px minmax(0, 1fr); }
    .docs-toc { display: none; }
}
@media (max-width: 820px) {
    .docs { display: block; padding-top: calc(var(--nav-h) + 56px); }
    .docs-bar {
        display: block;
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        z-index: 40;
        padding: 8px 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
    }
    .docs-menu { border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
    .docs-side {
        display: none;
        position: fixed;
        top: calc(var(--nav-h) + 44px);
        left: 0;
        right: 0;
        bottom: 0;
        max-height: none;
        z-index: 39;
        padding: 0 16px 24px;
        background: var(--bg);
    }
    .docs-side.open { display: block; }
    .docs-content h2, .docs-content h3 { scroll-margin-top: calc(var(--nav-h) + 60px); }
}
.docs-content th, .docs-content td { overflow-wrap: normal; min-width: 90px; }
.docs-content td code { white-space: nowrap; }
@media (max-width: 820px) { .docs-content td:last-child { min-width: 200px; } }
/* The manual is wider than the rest of the site; keep the header lined up with it */
body:has(.docs) .site-header .container { width: min(1392px, 100% - 48px); }
