/* oklm-docs.css: stylesheet of the bundled HTML documentation built by
   tools/docs/make-html.sh. The palette is the one of the presentation deck
   (presentation/css/oklm-deck.css): dark by default like the application, with
   a light variant chosen by the system preference or the top-bar toggle. */

:root {
    --bg: #0f1318;
    --panel: #171c24;
    --panel2: #1f2631;
    --fg: #d7dbe4;
    --mut: #8b93a4;
    --acc: #34c79b;
    --acc-soft: rgba(52, 199, 155, 0.14);
    --ok: #3fb950;
    --warn: #d29922;
    --crit: #f85149;
    --brd: #28303d;
    --code-bg: #131820;
    --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --top-h: 54px;
    --side-w: 280px;
    --toc-w: 250px;
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f6f7f9;
        --panel: #ffffff;
        --panel2: #eef1f5;
        --fg: #1d2330;
        --mut: #5b6475;
        --acc: #0b7d5d;
        --acc-soft: rgba(11, 125, 93, 0.10);
        --ok: #1a7f37;
        --warn: #9a6700;
        --crit: #cf222e;
        --brd: #d8dde6;
        --code-bg: #f0f2f6;
        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel2: #eef1f5;
    --fg: #1d2330;
    --mut: #5b6475;
    --acc: #0b7d5d;
    --acc-soft: rgba(11, 125, 93, 0.10);
    --ok: #1a7f37;
    --warn: #9a6700;
    --crit: #cf222e;
    --brd: #d8dde6;
    --code-bg: #f0f2f6;
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--top-h) + 16px); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.od-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--top-h);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--brd);
}
.od-brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.od-brand:hover { text-decoration: none; }
.od-name { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.od-sub { color: var(--mut); font-size: 14px; }
.od-version {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--acc);
    background: var(--acc-soft);
    border: 1px solid var(--brd);
    border-radius: 999px;
    padding: 1px 9px;
}
.od-spacer { flex: 1; }
.od-search {
    width: min(340px, 40vw);
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--brd);
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit;
    font-size: 14px;
}
.od-search:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.od-theme, .od-burger {
    background: transparent;
    color: var(--mut);
    border: 1px solid var(--brd);
    border-radius: 8px;
    width: 36px; height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.od-theme:hover, .od-burger:hover { color: var(--fg); border-color: var(--acc); }
.od-top .od-burger { display: none; }

.od-results {
    position: absolute;
    top: calc(var(--top-h) - 6px);
    right: 60px;
    width: min(520px, calc(100vw - 32px));
    max-height: 70vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    padding: 6px;
}
.od-results a {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--fg);
}
.od-results a:hover, .od-results a.od-sel { background: var(--acc-soft); text-decoration: none; }
.od-results small { display: block; color: var(--mut); font-size: 12px; }
.od-results .od-none { padding: 8px 10px; color: var(--mut); }

/* Three-column layout: page list, article, table of contents */
.od-layout {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    padding-top: var(--top-h);
    min-height: 100vh;
}
.od-layout.od-has-toc { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); }

.od-side {
    position: sticky;
    top: var(--top-h);
    height: calc(100vh - var(--top-h));
    overflow-y: auto;
    background: var(--panel);
    border-right: 1px solid var(--brd);
    padding: 18px 12px 40px;
    font-size: 14px;
}
.od-group { margin-bottom: 18px; }
.od-group-title {
    color: var(--mut);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 0 10px 6px;
}
.od-side ul { list-style: none; margin: 0; padding: 0; }
.od-side li a {
    display: block;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--fg);
    border-left: 2px solid transparent;
}
.od-side li a:hover { background: var(--panel2); text-decoration: none; }
.od-side li a.od-current {
    background: var(--acc-soft);
    color: var(--acc);
    border-left-color: var(--acc);
    font-weight: 600;
}

.od-main { min-width: 0; padding: 32px 48px 64px; }
/* The article uses the whole middle column: prose reflows to the window width
   instead of stopping at a fixed measure and leaving a dead band on the right. */
.od-article { max-width: none; }

.od-toc {
    position: sticky;
    top: var(--top-h);
    height: calc(100vh - var(--top-h));
    overflow-y: auto;
    padding: 28px 16px 40px 8px;
    font-size: 13px;
    border-left: 1px solid var(--brd);
}
.od-toc-title, .od-toc-inline summary {
    color: var(--mut);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 8px;
}
.od-toc ul, .od-toc-inline ul { list-style: none; margin: 0; padding-left: 0; }
.od-toc ul ul, .od-toc-inline ul ul { padding-left: 12px; }
.od-toc a, .od-toc-inline a {
    display: block;
    padding: 3px 8px;
    color: var(--mut);
    border-left: 2px solid transparent;
    line-height: 1.4;
}
.od-toc a:hover, .od-toc-inline a:hover { color: var(--fg); text-decoration: none; }
.od-toc a.od-active { color: var(--acc); border-left-color: var(--acc); }
.od-toc-inline {
    display: none;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 24px;
}
.od-toc-inline summary { cursor: pointer; margin: 0; }

/* Article typography */
.od-article h1, .od-article h2, .od-article h3, .od-article h4 {
    line-height: 1.25;
    position: relative;
    scroll-margin-top: calc(var(--top-h) + 16px);
}
.od-article h1 {
    font-size: 2.1rem;
    margin: 0 0 0.8em;
    padding-bottom: 0.4em;
    border-bottom: 2px solid var(--acc);
}
.od-article h2 {
    font-size: 1.5rem;
    margin: 2.2em 0 0.7em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--brd);
}
.od-article h3 { font-size: 1.2rem; margin: 1.8em 0 0.5em; }
.od-article h4 { font-size: 1.05rem; margin: 1.5em 0 0.4em; color: var(--mut); }
.od-anchor {
    position: absolute;
    left: -1.1em;
    padding-right: 0.3em;
    color: var(--mut);
    opacity: 0;
    font-weight: 400;
}
.od-article :is(h1, h2, h3, h4):hover .od-anchor { opacity: 1; }
.od-anchor:hover { color: var(--acc); text-decoration: none; }

.od-article li { margin: 0.25em 0; }
.od-article li > p { margin: 0.3em 0; }
.od-article strong { color: var(--fg); }
.od-article hr { border: 0; border-top: 1px solid var(--brd); margin: 2.5em 0; }
.od-article img { max-width: 100%; border-radius: 8px; border: 1px solid var(--brd); }

.od-article blockquote {
    margin: 1.2em 0;
    padding: 0.6em 1.1em;
    background: var(--panel);
    border-left: 3px solid var(--acc);
    border-radius: 0 8px 8px 0;
    color: var(--fg);
}
.od-article blockquote p { margin: 0.4em 0; }

/* Code */
code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--panel2);
    border: 1px solid var(--brd);
    border-radius: 5px;
    padding: 0.08em 0.38em;
    overflow-wrap: anywhere;
}
pre {
    position: relative;
    background: var(--code-bg);
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    line-height: 1.5;
    font-size: 14px;
    /* Code wraps to the block width so no line is cut at the edge; an overlay
       scrollbar that only appears on hover hid the rest of a long command. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; white-space: inherit; overflow-wrap: inherit; }
/* ASCII diagrams (marked by oklm-docs.js) keep their columns and scroll
   sideways instead, with a scrollbar that is always drawn. */
pre.od-nowrap { white-space: pre; overflow-wrap: normal; scrollbar-width: thin; scrollbar-color: var(--brd) transparent; }
pre.od-nowrap::-webkit-scrollbar { height: 10px; }
pre.od-nowrap::-webkit-scrollbar-thumb { background: var(--brd); border-radius: 5px; }
pre.od-nowrap::-webkit-scrollbar-track { background: transparent; }
div.sourceCode { margin: 1em 0; }
div.sourceCode pre { margin: 0; }
pre > code.sourceCode > span { display: inline-block; min-width: 100%; }
.od-tools {
    position: absolute;
    top: 8px; right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
pre:hover .od-tools, .od-tools:focus-within { opacity: 1; }
.od-copy {
    background: var(--panel2);
    color: var(--mut);
    border: 1px solid var(--brd);
    border-radius: 6px;
    padding: 2px 9px;
    font: 12px var(--sans);
    cursor: pointer;
}
.od-copy:hover { color: var(--fg); border-color: var(--acc); }

/* Syntax highlighting (pandoc token classes), tuned to the palette */
code span.kw, code span.cf { color: #c678dd; }
code span.dt { color: #e5c07b; }
code span.dv, code span.bn, code span.fl, code span.cn { color: #d19a66; }
code span.st, code span.ch, code span.vs, code span.ss { color: #98c379; }
code span.co, code span.cv, code span.do, code span.an { color: var(--mut); font-style: italic; }
code span.fu { color: #61afef; }
code span.pp, code span.im { color: #56b6c2; }
code span.op { color: #abb2bf; }
code span.va, code span.at { color: #e06c75; }
code span.bu, code span.ex { color: #56b6c2; }
code span.al, code span.er { color: var(--crit); font-weight: 700; }
code span.wa { color: var(--warn); }
:root[data-theme="light"] code span.kw, :root[data-theme="light"] code span.cf { color: #8250df; }
:root[data-theme="light"] code span.dt { color: #953800; }
:root[data-theme="light"] code span.st, :root[data-theme="light"] code span.ch { color: #0a7d2c; }
:root[data-theme="light"] code span.fu { color: #0550ae; }
:root[data-theme="light"] code span.op { color: #57606a; }
:root[data-theme="light"] code span.dv, :root[data-theme="light"] code span.cn { color: #b35900; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) code span.kw, :root:not([data-theme="dark"]) code span.cf { color: #8250df; }
    :root:not([data-theme="dark"]) code span.dt { color: #953800; }
    :root:not([data-theme="dark"]) code span.st, :root:not([data-theme="dark"]) code span.ch { color: #0a7d2c; }
    :root:not([data-theme="dark"]) code span.fu { color: #0550ae; }
    :root:not([data-theme="dark"]) code span.op { color: #57606a; }
    :root:not([data-theme="dark"]) code span.dv, :root:not([data-theme="dark"]) code span.cn { color: #b35900; }
}

/* Tables: full width of the pane, scroll sideways when wider */
.od-table-wrap {
    overflow-x: auto;
    margin: 1.2em 0;
    border: 1px solid var(--brd);
    border-radius: 10px;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
/* break-word (not anywhere) keeps each column at least as wide as its longest
   word: "anywhere" lowers a column's minimum to one character, so the automatic
   table layout crushed the short columns and wrapped them letter by letter. Long
   unbroken tokens (JSON shapes, URLs) get break points from oklm-docs.js. */
th, td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--brd); overflow-wrap: break-word; }
/* A short token oklm-docs.js keeps on one line (see the table note there). */
.od-nobr { white-space: nowrap; }
/* Inline code elsewhere may break anywhere; in a cell that would lower the
   column's minimum width the same way, so cells break code only at the
   separators oklm-docs.js marks. */
td code, th code { overflow-wrap: normal; }
th {
    background: var(--panel2);
    color: var(--fg);
    font-weight: 600;
    position: sticky;
    top: 0;
}
tbody tr:nth-child(even) { background: var(--panel); }
tbody tr:hover { background: var(--acc-soft); }
tbody tr:last-child td { border-bottom: 0; }

/* Previous / next page */
.od-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--brd);
}
.od-pager a {
    display: block;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--fg);
}
.od-pager a:hover { border-color: var(--acc); text-decoration: none; }
.od-pager small { display: block; color: var(--mut); font-size: 12px; }
.od-pager .od-next { text-align: right; grid-column: 2; }

/* Index page cards */
.od-hero { margin-bottom: 32px; }
.od-hero h1 { border: 0; margin-bottom: 0.2em; }
.od-hero p { color: var(--mut); font-size: 1.1rem; margin: 0; }
.od-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin: 0 0 36px;
}
.od-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--fg);
    transition: border-color 0.15s, transform 0.15s;
}
.od-card:hover { border-color: var(--acc); transform: translateY(-1px); text-decoration: none; }
.od-card strong { display: block; color: var(--acc); margin-bottom: 2px; }
.od-card span { display: block; color: var(--mut); font-size: 13px; line-height: 1.45; }

/* Narrower screens: drop the right column, then turn the page list into a drawer */
@media (max-width: 1280px) {
    .od-layout.od-has-toc { grid-template-columns: var(--side-w) minmax(0, 1fr); }
    .od-toc { display: none; }
    .od-toc-inline { display: block; }
}
@media (max-width: 900px) {
    .od-layout, .od-layout.od-has-toc { grid-template-columns: minmax(0, 1fr); }
    .od-top .od-burger { display: inline-flex; }
    .od-side {
        position: fixed;
        left: 0;
        width: min(var(--side-w), 85vw);
        z-index: 25;
        transform: translateX(-100%);
        transition: transform 0.2s;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.3);
    }
    body.od-side-open .od-side { transform: none; }
    .od-main { padding: 24px 16px 48px; }
    .od-sub, .od-version { display: none; }
    .od-search { width: 100%; min-width: 0; flex: 1; }
    .od-spacer { display: none; }
    .od-anchor { display: none; }
}

@media print {
    .od-top, .od-side, .od-toc, .od-toc-inline, .od-pager, .od-tools { display: none !important; }
    .od-layout { display: block; padding: 0; }
    body { background: #fff; color: #000; }
}
