/* ASCILINE docs pages. Builds on the theme tokens in main.css. */

.docs-body {
    display: block;
    padding-top: 56px; /* fixed header */
}

.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 56px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ── SIDEBAR ── */
.docs-sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    padding-right: 8px;
}

.docs-menu-btn { display: none; }

.docs-nav-group { margin-bottom: 36px; }

.docs-nav-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.docs-nav-link {
    display: block;
    padding: 9px 12px;
    margin-left: -12px;
    border-left: 2px solid transparent;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.docs-nav-link:hover { color: var(--text-main); }

.docs-nav-link.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 600;
}

.docs-subnav {
    list-style: none;
    margin: 4px 0 14px;
    padding: 0 0 0 14px;
}

.docs-subnav a {
    display: block;
    padding: 6px 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-muted);
    text-decoration: none;
}

.docs-subnav a:hover { color: var(--text-main); }

/* ── ARTICLE ── */
.docs-content { min-width: 0; }

.docs-article {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text-main);
    overflow-wrap: break-word;
}

.docs-article h1 {
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.2;
    margin: 0 0 20px;
}

.docs-article h2 {
    font-size: 24px;
    margin: 48px 0 14px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.docs-article h3 { font-size: 18px; margin: 32px 0 10px; }

.docs-article h1, .docs-article h2, .docs-article h3 {
    position: relative;
    scroll-margin-top: 80px;
}

.docs-article .anchor {
    position: absolute;
    left: -1.1em;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0;
    font-weight: 400;
}

.docs-article h1:hover .anchor,
.docs-article h2:hover .anchor,
.docs-article h3:hover .anchor { opacity: 1; }

.docs-article p, .docs-article ul, .docs-article ol { margin: 0 0 16px; }
.docs-article li { margin-bottom: 6px; }

.docs-article a {
    color: var(--accent-primary);
    text-underline-offset: 3px;
}

.docs-article code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-recessed);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
}

.docs-article pre {
    position: relative;
    background: var(--bg-recessed);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px 18px;
    margin: 0 0 20px;
    /* main.css hides every scrollbar, so wrap long commands instead of scrolling them */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
    -webkit-user-select: text;
    user-select: text;
}

.docs-article pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 13px;
    color: var(--text-main);
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.docs-article pre:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } } /* touch screens have no hover to reveal it */
.copy-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); }

.docs-article blockquote {
    margin: 0 0 20px;
    padding: 12px 18px;
    border-left: 3px solid var(--accent-primary);
    background: var(--bg-panel);
    color: var(--text-muted);
    border-radius: 0 6px 6px 0;
}

.docs-article blockquote p:last-child { margin-bottom: 0; }

.table-wrap {
    overflow-x: auto;
    margin: 0 0 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
}

.docs-article th, .docs-article td {
    text-align: left;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.docs-article th {
    background: var(--bg-panel);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.docs-article tr:last-child td { border-bottom: 0; }

/* A row that belongs to the table but not to its "race": set apart by a dashed rule and a panel tint. */
.docs-article tr.detached td {
    border-top: 2px dashed var(--border-light);
    background: var(--bg-panel);
}

.docs-synced {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 28px;
}

.docs-synced a { color: var(--accent-primary); }

/* ── PAGER + FOOTER ── */
.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
}

.docs-pager a {
    display: block;
    min-width: 0;
    flex: 0 1 48%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.15s ease;
}

.docs-pager a:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.docs-pager a.next { text-align: right; margin-left: auto; }

.docs-pager span {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.docs-footer {
    margin-top: 40px;
    font-size: 13px;
    color: var(--text-muted);
}

.docs-footer a { color: var(--accent-primary); }

/* ── JUMP BUTTON (phones) ── */
.docs-jump {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-panel);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.docs-jump:active { background: var(--bg-recessed); }

/* ── NARROW SCREENS ── */
@media (max-width: 900px) {
    .docs-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        padding: 20px 16px 60px;
    }

    .docs-sidebar {
        position: static;
        max-height: none;
        padding-right: 0;
    }

    .docs-menu-btn {
        display: block;
        width: 100%;
        text-align: left;
        font-family: var(--font-mono);
        font-size: 13px;
        color: var(--text-main);
        background: var(--bg-panel);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        padding: 10px 14px;
        cursor: pointer;
    }

    .docs-jump { display: flex; align-items: center; justify-content: center; }

    /* keep the footer clear of the floating jump button */
    .docs-footer { padding-bottom: 76px; }

    .docs-nav { display: none; padding-top: 16px; }
    .docs-sidebar.open .docs-nav { display: block; }
    .docs-article .anchor { display: none; }
}
