/* Copyright (c) 2026 Castagnier Mickael (gullradriel). All rights reserved.
   SPDX-License-Identifier: LicenseRef-Proprietary
   fissure-docs.css: stylesheet of the bundled HTML documentation built by
   packaging/make-docs-html.sh. The palette is the one of the presentation deck
   (presentation/css/fissure-deck.css): dark by default like the application, with
   a light variant chosen by the system preference or the top-bar toggle. */

:root {
    --bg: #12151b;
    --panel: #1b1f28;
    --panel2: #232836;
    --fg: #d7dbe4;
    --mut: #8b93a4;
    --acc: #4c8bf5;
    --acc-soft: rgba(76, 139, 245, 0.14);
    --ok: #3fb950;
    --warn: #d29922;
    --crit: #f85149;
    --brd: #2a3040;
    --code-bg: #161a22;
    --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: #2563d9;
        --acc-soft: rgba(37, 99, 217, 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: #2563d9;
    --acc-soft: rgba(37, 99, 217, 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 */
.fd-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);
}
.fd-brand { display: flex; align-items: center; gap: 10px; color: var(--fg); }
.fd-brand:hover { text-decoration: none; }
.fd-name { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.fd-sub { color: var(--mut); font-size: 14px; }
.fd-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;
}
.fd-spacer { flex: 1; }
.fd-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;
}
.fd-search:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.fd-theme, .fd-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;
}
.fd-theme:hover, .fd-burger:hover { color: var(--fg); border-color: var(--acc); }
.fd-top .fd-burger { display: none; }

.fd-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;
}
.fd-results a {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--fg);
}
.fd-results a:hover, .fd-results a.fd-sel { background: var(--acc-soft); text-decoration: none; }
.fd-results small { display: block; color: var(--mut); font-size: 12px; }
.fd-results .fd-none { padding: 8px 10px; color: var(--mut); }

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

.fd-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;
}
.fd-group { margin-bottom: 18px; }
.fd-group-title {
    color: var(--mut);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 0 10px 6px;
}
.fd-side ul { list-style: none; margin: 0; padding: 0; }
.fd-side li a {
    display: block;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--fg);
    border-left: 2px solid transparent;
}
.fd-side li a:hover { background: var(--panel2); text-decoration: none; }
.fd-side li a.fd-current {
    background: var(--acc-soft);
    color: var(--acc);
    border-left-color: var(--acc);
    font-weight: 600;
}

.fd-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. */
.fd-article { max-width: none; }

.fd-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);
}
.fd-toc-title, .fd-toc-inline summary {
    color: var(--mut);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 8px;
}
.fd-toc ul, .fd-toc-inline ul { list-style: none; margin: 0; padding-left: 0; }
.fd-toc ul ul, .fd-toc-inline ul ul { padding-left: 12px; }
.fd-toc a, .fd-toc-inline a {
    display: block;
    padding: 3px 8px;
    color: var(--mut);
    border-left: 2px solid transparent;
    line-height: 1.4;
}
.fd-toc a:hover, .fd-toc-inline a:hover { color: var(--fg); text-decoration: none; }
.fd-toc a.fd-active { color: var(--acc); border-left-color: var(--acc); }
.fd-toc-inline {
    display: none;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 24px;
}
.fd-toc-inline summary { cursor: pointer; margin: 0; }

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

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

.fd-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);
}
.fd-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 fissure-docs.js) keep their columns and scroll
   sideways instead, with a scrollbar that is always drawn. */
pre.fd-nowrap { white-space: pre; overflow-wrap: normal; scrollbar-width: thin; scrollbar-color: var(--brd) transparent; }
pre.fd-nowrap::-webkit-scrollbar { height: 10px; }
pre.fd-nowrap::-webkit-scrollbar-thumb { background: var(--brd); border-radius: 5px; }
pre.fd-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%; }
.fd-tools {
    position: absolute;
    top: 8px; right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
pre:hover .fd-tools, .fd-tools:focus-within { opacity: 1; }
.fd-copy {
    background: var(--panel2);
    color: var(--mut);
    border: 1px solid var(--brd);
    border-radius: 6px;
    padding: 2px 9px;
    font: 12px var(--sans);
    cursor: pointer;
}
.fd-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 */
.fd-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 fissure-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 fissure-docs.js keeps on one line (see the table note there). */
.fd-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 fissure-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 */
.fd-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--brd);
}
.fd-pager a {
    display: block;
    background: var(--panel);
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--fg);
}
.fd-pager a:hover { border-color: var(--acc); text-decoration: none; }
.fd-pager small { display: block; color: var(--mut); font-size: 12px; }
.fd-pager .fd-next { text-align: right; grid-column: 2; }

/* Index page cards */
.fd-hero { margin-bottom: 32px; }
.fd-hero h1 { border: 0; margin-bottom: 0.2em; }
.fd-hero p { color: var(--mut); font-size: 1.1rem; margin: 0; }
.fd-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin: 0 0 36px;
}
.fd-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;
}
.fd-card:hover { border-color: var(--acc); transform: translateY(-1px); text-decoration: none; }
.fd-card strong { display: block; color: var(--acc); margin-bottom: 2px; }
.fd-card span { color: var(--mut); font-size: 13px; }

/* Narrower screens: drop the right column, then turn the page list into a drawer */
@media (max-width: 1280px) {
    .fd-layout.fd-has-toc { grid-template-columns: var(--side-w) minmax(0, 1fr); }
    .fd-toc { display: none; }
    .fd-toc-inline { display: block; }
}
@media (max-width: 900px) {
    .fd-layout, .fd-layout.fd-has-toc { grid-template-columns: minmax(0, 1fr); }
    .fd-top .fd-burger { display: inline-flex; }
    .fd-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.fd-side-open .fd-side { transform: none; }
    .fd-main { padding: 24px 16px 48px; }
    .fd-sub, .fd-version { display: none; }
    .fd-search { width: 100%; min-width: 0; flex: 1; }
    .fd-spacer { display: none; }
    .fd-anchor { display: none; }
}

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