body:has(.docs-layout) {
    max-width: 100vw;
    padding: 1rem 2rem;
    overflow: hidden;
    height: 100vh;
}

.docs-layout {
    display: flex;
    gap: 2rem;
    height: calc(100vh - 3.5rem);
}

.docs-sidebar {
    width: 200px;
    flex-shrink: 0;
    overflow-y: auto;
}

.docs-sidebar h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 1.25rem 0 0.25rem;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-sidebar h3:first-child {
    margin-top: 0;
}

.docs-sidebar button {
    display: block;
    width: 100%;
    text-align: left;
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.8rem;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    color: var(--text-dim);
    padding: 0.2rem 0.5rem;
    cursor: pointer;
}

.docs-sidebar button:hover {
    color: var(--text);
}

.docs-sidebar button.active {
    color: var(--text);
    border-left-color: var(--text);
}

.docs-content {
    flex: 1;
    min-width: 0;
    max-width: none;
    overflow-wrap: break-word;
    overflow-y: auto;
}

.docs-content article {
    display: none;
}

.docs-content article.visible {
    display: block;
}

.docs-content h1 {
    font-size: 1.3rem;
    margin: 0 0 1rem;
    border-bottom: 1px solid var(--text-muted);
    padding-bottom: 0.5rem;
}

.docs-content h2,
.docs-content h3,
.docs-content h4,
.docs-content h5 {
    background: var(--surface);
    margin: 1.5rem 0 0.5rem;
    padding: 0.3rem 0.5rem;
}

.docs-content h2 {
    font-size: 1.1rem;
}

.docs-content h3 {
    font-size: 1rem;
}

.docs-content h4 {
    font-size: 0.95rem;
}

.docs-content h5 {
    font-size: 0.9rem;
}

.docs-content p {
    margin: 0.5rem 0;
    text-align: left;
    line-height: 1.5;
}

.docs-content pre {
    background: var(--surface);
    border-left: 2px solid var(--text-muted);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-size: 0.85em;
    line-height: 1.4;
}

.docs-content code {
    font-family: 'VCR OSD Mono', monospace;
}

.docs-content p code,
.docs-content li code,
.docs-content td code {
    background: var(--surface);
    padding: 0.1rem 0.3rem;
    font-size: 0.9em;
}

.docs-content table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
    table-layout: auto;
    overflow-x: auto;
    display: block;
}

.docs-content th,
.docs-content td {
    padding: 0.25rem 0.75rem;
    text-align: left;
}

.docs-content th {
    color: var(--text);
}

.docs-content td:first-child {
    color: var(--text-muted);
}

.docs-content tr:nth-child(even) {
    background: var(--surface);
}

.docs-content ul,
.docs-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.docs-content ul {
    list-style-type: "- ";
}

.docs-content ol {
    list-style-type: decimal;
}

.docs-content ul ul {
    list-style-type: none;
    border-left: 1px solid var(--text-muted);
    padding-left: 1rem;
    margin: 0.15rem 0;
}

.docs-content li {
    margin: 0.3rem 0;
    line-height: 1.5;
    text-align: left;
}

.docs-content ul ul li {
    color: var(--text-dim);
    margin: 0.15rem 0;
}

.docs-content a {
    color: var(--text-dim);
}

.docs-content strong {
    color: var(--text);
}

.docs-content em {
    font-style: italic;
    color: var(--text-dim);
}

.docs-content del {
    opacity: 0.5;
}

.docs-content blockquote {
    border-left: 2px solid var(--text-muted);
    padding: 0.25rem 1rem;
    margin: 1rem 0;
    color: var(--text-dim);
}

.docs-content blockquote p {
    margin: 0.25rem 0;
}

.docs-content hr {
    border: none;
    border-top: 1px solid var(--text-muted);
    margin: 1.5rem 0;
}

.docs-topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.docs-back {
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.docs-back:hover {
    color: var(--text);
}

.docs-notice {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.docs-notice.hidden {
    display: none;
}

.docs-notice button {
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.75rem;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text);
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.docs-notice button:hover {
    border-color: var(--text);
}

/* Forth syntax highlighting — monochrome via weight/opacity */
.f-emit { font-weight: bold; }
.f-com { opacity: 0.5; font-style: italic; }
.f-num { opacity: 0.6; }
.f-note { font-weight: bold; }
.f-snd { text-decoration: underline; }
.f-par { opacity: 0.6; font-style: italic; }
.f-stack { opacity: 0.6; }
.f-prob { opacity: 0.6; }
.f-ctx { opacity: 0.5; }
.f-var { opacity: 0.6; }

@media (max-width: 768px) {
    body:has(.docs-layout) {
        height: auto;
        overflow: visible;
    }

    .docs-layout {
        flex-direction: column;
        height: auto;
    }

    .docs-sidebar {
        width: 100%;
        overflow-y: visible;
        border-bottom: 1px solid var(--text-muted);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .docs-content {
        overflow-y: visible;
    }
}
