/* Concept documentation — shares the explorer's palette. */
:root {
    --bg-editor: #1e1e1e;
    --bg-sidebar: #252526;
    --bg-inactive: #2d2d2d;
    --bg-hover: #2a2d2e;
    --text-primary: #d4d4d4;
    --text-secondary: #abb2bf;
    --text-muted: #858585;
    --border: #3e3e3e;
    --accent: #4ea1ff;
    /* The Explorer and the Ontology map both paint their status bar in this blue. */
    --accent-bar: #0078d4;
    --code: #9cdcfe;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-editor);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}
#titlebar {
    height: 34px;
    background: #323233;
    border-bottom: 1px solid #111;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 16px;
    font-size: 13px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
#titlebar .app-name { color: var(--text-primary); font-weight: 600; }
/* Five items do not fit a phone: the nav shrinks and scrolls inside the bar rather than
   being clipped or pushing the page sideways. */
#surfaces { display: flex; gap: 14px; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#surfaces::-webkit-scrollbar { display: none; }
@media (max-width: 700px) { #surfaces { gap: 10px; } }
#surfaces a { color: var(--text-muted); text-decoration: none; }
#surfaces a:hover { color: var(--text-primary); }
#surfaces a.current { color: var(--text-primary); border-bottom: 2px solid var(--accent); }
#titlebar-tagline { margin-left: auto; color: var(--text-muted); white-space: nowrap; }
@media (max-width: 900px) { #titlebar-tagline { display: none; } }
#workspace { display: flex; flex: 1; }
/*
 * Two boxes, two jobs. The panel (#docs-nav) stretches for the full height of the
 * workspace, so its background and border run the length of the page instead of stopping
 * where the link list ends. The inner box is what sticks.
 *
 * Sticking the panel itself does not work: an element can only stick while it is shorter
 * than the space it sticks within, so a full-height panel has no slack to hold a position
 * in. Sizing the panel to its own content instead (align-self: flex-start) restores the
 * sticking but leaves the panel visibly cut off part-way down the page. Separating the
 * two concerns gets both.
 */
#docs-nav {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
}
.docs-nav-inner {
    position: sticky;
    top: 34px;
    padding: 16px 0;
    /* If the list ever outgrows the viewport it scrolls itself rather than being clipped. */
    max-height: calc(100vh - 34px);
    overflow-y: auto;
}
.nav-title {
    padding: 0 16px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
#docs-nav nav { display: flex; flex-direction: column; }
#docs-nav a {
    padding: 6px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    border-left: 2px solid transparent;
}
#docs-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
#docs-nav a.current {
    background: var(--bg-inactive);
    color: var(--text-primary);
    border-left-color: var(--accent);
}
#docs-content { flex: 1; min-width: 0; padding: 32px 40px 80px; }
/* A fixed measure, centred: on a wide screen the text should not hug the sidebar. */
article { max-width: 68ch; margin: 0 auto; }
article h1 { font-size: 27px; font-weight: 600; margin-bottom: 18px; text-wrap: balance; }
article h2 {
    font-size: 19px;
    font-weight: 600;
    margin: 30px 0 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    text-wrap: balance;
}
article h3 { font-size: 15px; font-weight: 600; margin: 20px 0 6px; }
article p, article ul, article ol { margin-bottom: 13px; }
article ul, article ol { padding-left: 22px; }
article li { margin-bottom: 4px; }
article a { color: var(--accent); text-decoration: none; }
article a:hover { text-decoration: underline; }
article code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.87em;
    background: var(--bg-inactive);
    color: var(--code);
    padding: 1px 5px;
    border-radius: 3px;
}
article pre {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 14px;
    overflow-x: auto;
    margin-bottom: 14px;
}
article pre code { background: none; padding: 0; color: var(--text-primary); font-size: 12.5px; }
article blockquote {
    border-left: 3px solid var(--accent);
    padding: 2px 0 2px 14px;
    margin-bottom: 14px;
    color: var(--text-secondary);
}
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
article table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
article th, article td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}
article th { background: var(--bg-sidebar); font-weight: 600; }
article td:not(:first-child) { font-variant-numeric: tabular-nums; }
article hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* In-page contents. Mirrors the concept nav opposite it, one weight lighter. */
#docs-toc {
    width: 220px;
    flex-shrink: 0;
    padding: 16px 0;
    position: sticky;
    top: 34px;
    align-self: flex-start;
    max-height: calc(100vh - 34px);
    overflow-y: auto;
}
#docs-toc nav { display: flex; flex-direction: column; }
#docs-toc a {
    padding: 4px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    line-height: 1.4;
    border-left: 2px solid transparent;
}
#docs-toc a:hover { color: var(--text-primary); border-left-color: var(--border); }
#docs-toc a.toc-h3 { padding-left: 28px; font-size: 11.5px; }

/* The pages are written as a sequence; give the reader a way to follow it. */
.page-nav {
    display: flex;
    gap: 12px;
    max-width: 68ch;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.page-nav > * { flex: 1 1 0; min-width: 0; }
.page-nav a {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 3px;
    text-decoration: none;
    color: var(--text-primary);
}
.page-nav a:hover { background: var(--bg-hover); border-color: var(--accent); }
.page-nav-next { text-align: right; }
.page-nav-label { font-size: 11px; color: var(--text-muted); }
.page-nav-title { font-size: 13px; }

/* Matches the Explorer's and the map's, so the three surfaces end the same way. */
#statusbar {
    height: 22px;
    background: var(--accent-bar);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 12px;
    flex-shrink: 0;
    gap: 16px;
    position: sticky;
    bottom: 0;
}
#status-page { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The contents column is the first thing to go when it stops earning its width. */
@media (max-width: 1100px) { #docs-toc { display: none; } }
@media (max-width: 760px) {
    #workspace { flex-direction: column; }
    #docs-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .docs-nav-inner {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    #docs-content { padding: 20px; }
    .page-nav { flex-direction: column; }
    .page-nav-next { text-align: left; }
}
