/*
  SOAP2 docs theme.

  This is a locally vendored, hand-edited fork of Markdeep's "slate.css"
  (https://casual-effects.com/markdeep/latest/slate.css), recolored to match
  the marketing site's palette (see website/index.html) and to remove the
  external CDN dependency so docs render identically offline.

  Only colors/fonts/spacing were changed from the original slate.css; the
  layout-critical rules (the fixed-position TOC sidebar, its width, the body
  offset that makes room for it) keep the same structure as upstream so the
  Markdeep-generated markup keeps working. The TOC width/body offset are now
  driven by the --toc-width custom property, which soap2-docs.js updates live
  while the user drags the .soap-toc-resizer handle it injects.
*/

:root {
  --toc-width: 200px;
  --bg: #0b0f14;
  --bg-alt: #11161d;
  --card: #161d26;
  --border: #232b36;
  --text: #e8edf3;
  --text-dim: #9fb0c3;
  --accent: #4fd1c5;
  --accent-2: #7c9cff;
  --danger: #ff6b6b;
  --warn: #f5a623;
}

body {
    font-weight: 400;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: left;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

@media screen and (max-width: 100em) {
    body {
        padding: 4px;
    }
}

/* reset heading/link fonts to that of body */
.md a,
.md div.title, contents, .md .tocHeader,
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6,
.md .nonumberh1, .md .nonumberh2, .md .nonumberh3, .md .nonumberh4, .md .nonumberh5, .md .nonumberh6,
.md .shortTOC, .md .mediumTOC, .md .longTOC {
    font-family: inherit;
}

.md .tocHeader {
    border: none;
    margin-top: 25px;
    font-size: 100%;
    font-family: inherit;
    font-weight: 600;
}

.md .longTOC .level1 {
    font-weight: 600;
    margin-bottom: 10px;
}

.md div.title, .md div.subtitle, .md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
    font-family: inherit;
    font-weight: 700;
}

.md div.title {
    font-size: 43px;
    text-align: left;
    margin-bottom: 0px;
}

.md div.subtitle {
    text-align: left;
    font-size: 115%;
    font-weight: 400;
}

.md div.afterTitles {
    margin-top: 20px;
    margin-left: -20px;
    margin-right: -20px;
    height: 0px;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}

.md div.afterTitles + p {
    margin-top: 30px;
}

.md h1 {
    font-size: 175%;
    margin-bottom: 25px;
    margin-left:-20px;
    margin-right:-20px;
    padding-left:20px;
    padding-top:25px;
    border-top: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.md h2 {
    font-size: 150%;
    border: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-top: 1.8em;
}

.md h3, .md h4, .md h5, .md h6 {
    font-size: 120%;
    color: var(--accent-2);
}

.md code {
    font-size: 90%;
    background: var(--card);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding-left: 4px;
    padding-right: 4px;
}

.md .longTOC {
    font-family: inherit;
    font-weight: 600;
}


.md pre.listing {
    font-size: 100%;
}

.md pre.listing code {
    font-weight: unset;
    background: none;
    border: none;
    color: unset;
}


/* wide screen: TOC on side */
@media screen and (min-width: 40em) {
    .md .longTOC {
        display: block;
        white-space: nowrap;
        width: var(--toc-width);
        border-right: 1px solid var(--border);
        overflow-y:scroll;
        font-family: inherit;
        background: var(--bg-alt);
        position: fixed;
        left: 0px;
        top: 0px;
        bottom:0px;
        margin: 0px;
        padding: 0px;
        padding-left:10px;
    }

    body {
        position: absolute;
        left: calc(var(--toc-width) + 30px);
        right:0px;
        margin: 0px;
        padding: 0px;
        max-width: unset;
        padding-right: 15px;
    }

    .soap-toc-resizer {
        position: fixed;
        top: 0; bottom: 0;
        left: var(--toc-width);
        width: 9px;
        margin-left: -4px;
        cursor: col-resize;
        z-index: 30;
        background: transparent;
        border-left: 1px solid transparent;
        border-right: 1px solid transparent;
    }
    .soap-toc-resizer:hover,
    .soap-toc-resizer.is-dragging {
        border-left: 1px solid var(--accent);
        border-right: 1px solid var(--accent);
        background: color-mix(in srgb, var(--accent) 12%, transparent);
    }
}

body.soap-toc-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}
body.soap-toc-resizing .md .longTOC {
    pointer-events: none;
}

@media screen {
    .md div.longTOC {
        font-size: 15px;
    }

    .md svg.diagram {
        stroke: var(--text-dim);
        fill: var(--text-dim);
    }

    .md svg.diagram .opendot {
        fill: var(--bg);
    }

    .md table.table {
        box-shadow: none;
        background-color: var(--card);
    }

    .md table.table tr:nth-child(even) {
        background-color: var(--bg-alt);
    }

    .md table.table td, .md table.table th {
        border: 1px solid var(--border);
    }

    .md table.table th {
        color: var(--text);
    }

    .md pre.listing {
        background: var(--bg-alt);
        border: 1px solid var(--border);
        border-radius: 10px;
        box-shadow: none;
    }

    .md code {
        color: var(--accent);
        background: var(--card);
    }

    .md .tocTop {
        display: inline;
    }

    .md div.afterTitles {
        border-bottom: 1px solid var(--border);
    }

    .md div.title, .md div.subtitle, .md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
        color: var(--text);
    }

    .hljs-comment,.hljs-quote{color:#a0f0aa}.hljs-variable,.hljs-template-variable,.hljs-tag,.hljs-name,.hljs-selector-id,.hljs-selector-class,.hljs-regexp,.hljs-deletion{color:#cc6666}.hljs-number,.hljs-built_in,.hljs-builtin-name,.hljs-literal,.hljs-type,.hljs-params,.hljs-meta,.hljs-link{color:#de935f}.hljs-attribute{color:#f0c674}.hljs-string,.hljs-symbol,.hljs-bullet,.hljs-addition{color:#b5bd68}.hljs-title,.hljs-section{color:#81a2be}.hljs-keyword,.hljs-selector-tag{color:#b294bb}.hljs{display:block;overflow-x:auto;background:#1d1f21;color:#c5c8c6;padding:.5em}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}
    .hljs-function .hljs-title { color:#81a2be}

    body {
        color: var(--text);
        background: var(--bg);
    }

    .md div.title, .md h1, .md h2, .md h3, .md h4, .md h5, .md h6, .md .longTOC a, .md .longTOC code, .md a:link, .md a:visited {
        text-shadow: none;
    }

    .md .admonition {
        position: unset;
        box-shadow: none;
        background: var(--card);
        border: 1px solid var(--accent-2);
        border-left: 2.5rem solid var(--accent-2);
    }

    .md .admonition-title {
        border-bottom: 1px solid var(--accent-2);
    }

    .md .admonition.warn, .md .admonition.warning {
        border: 1px solid var(--warn);
        border-left: 2.5rem solid var(--warn);
        background: var(--card);
    }

    .md .admonition.warn .admonition-title, .md .admonition.warning .admonition-title {
        border-bottom: 1px solid var(--warn);
    }

    .md .admonition.tip {
        border: 1px solid var(--accent-2);
        border-left: 2.5rem solid var(--accent-2);
        background: var(--card);
    }
    .md .admonition.tip .admonition-title {
        border-bottom: 1px solid var(--accent-2);
    }

    .md .admonition.error {
        border: 1px solid var(--danger);
        border-left: 2.5rem solid var(--danger);
        background: var(--card);
    }

    .md .admonition.error .admonition-title {
        border-bottom: 1px solid var(--danger);
    }

    .md .longTOC a, .md .longTOC code, .md a:link, .md a:visited, .md a:link code, .md a:visited code {
        color: var(--accent-2) !important;
    }

    .md .longTOC a:hover, .md a:hover {
        color: var(--accent) !important;
    }

}

/* ---- content images (not the top banner) ---- */
.md img {
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ---- docs top bar (static HTML injected right after <body>) ---- */
.soap-docsbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.soap-docsbar-brand {
    font-weight: 700; text-decoration: none; color: var(--text) !important;
    letter-spacing: 0.2px;
}
.soap-docsbar-brand span { color: var(--accent); }
.soap-docsbar-brand small { color: var(--text-dim); font-weight: 500; margin-left: 6px; }
.soap-docsbar-site {
    color: var(--text-dim) !important; text-decoration: none; font-size: 0.88rem;
}
.soap-docsbar-site:hover { color: var(--text) !important; }
