/* The VoxelMon server docs: a floating sidebar with search and sections that fold, the page
   beside it with breadcrumbs and previous/next, and the page's outline at its right on a wide
   screen. Cool greys, near-black and cobalt. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
}

/* Every colour is written once as light-dark(light, dark). The page follows the reader's
   system unless they choose a theme at its top right (html data-theme, kept by search.js). */
:root {
  color-scheme: light dark;
  --text: light-dark(#16191d, #e5e8ec);
  --muted: light-dark(#5b6370, #949ba6);
  --bg: light-dark(#f3f4f6, #0b0d10);
  --surface: light-dark(#ffffff, #13161b);
  --sunk: light-dark(#eaecf0, #1b1f26);
  --rule: light-dark(#dcdfe5, #262b33);
  --accent: light-dark(#2456c9, #6f9ffa);
  --accent-soft: light-dark(#e2e9f8, #172338);
  --accent-ink: light-dark(#1a3f96, #a8c4ff);
  --on-accent: light-dark(#ffffff, #0b0d10);
  --type: light-dark(#3a63a8, #8fb0e8);
  --need-bg: light-dark(#dbe4f5, #1c2a44);
  --need-ink: light-dark(#23417e, #a8c4ff);
  --soon-bg: light-dark(#e6e8ec, #22262d);
  --soon-ink: light-dark(#5b6370, #a3aab4);
  --scroll: light-dark(#c3c8d1, #3c4452);
  --scroll-hover: light-dark(#2456c9, #6f9ffa);
  --shadow: 0 1px 2px light-dark(rgba(15, 20, 30, 0.05), rgba(0, 0, 0, 0.4)),
    0 6px 20px light-dark(rgba(15, 20, 30, 0.06), rgba(0, 0, 0, 0.35));
  --side: 288px;
  --gap: 14px;
  --radius: 10px;
  --radius-s: 7px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-padding-top: 20px; }
body {
  margin: 0;
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars in the site's own greys, cobalt under the pointer: the page's, the side menu's,
   and the ones under wide tables and code. Chromium and Safari draw the rounded thumb below;
   Firefox takes the two standard properties. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active {
  background: var(--scroll-hover);
  background-clip: padding-box;
}
html::-webkit-scrollbar { width: 14px; }
html::-webkit-scrollbar-track { background: var(--bg); }
nav::-webkit-scrollbar { width: 10px; }
nav::-webkit-scrollbar-track { margin: 14px 0 54px; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
  html { scrollbar-width: auto; scrollbar-color: var(--scroll) var(--bg); }
}

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); }
::selection { background: var(--accent-soft); }

/* Sidebar: a panel floating beside the page. */
nav {
  position: fixed;
  top: var(--gap);
  bottom: var(--gap);
  left: var(--gap);
  width: var(--side);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 0.93em;
  padding: 6px 10px 0;
  display: flex;
  flex-direction: column;
}
nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 12px;
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2em;
  letter-spacing: -0.01em;
  text-decoration: none;
}
nav .brand svg { flex-shrink: 0; }
.search { position: relative; padding: 0 2px 6px; }
.search input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--sunk);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search input:focus { border-color: var(--accent); background: var(--surface); }
#results:not(:empty) {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
}
#results a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
#results a:hover { background: var(--accent-soft); }
#results span { display: block; font-size: 0.8em; color: var(--muted); }
/* A section of the menu folds: the one the reader is in is open, and the reference (27
   pages) stays shut until wanted. search.js remembers what they opened for the visit. */
nav details { margin-top: 10px; }
nav summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.86em;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
nav summary::-webkit-details-marker { display: none; }
nav summary:hover { background: var(--sunk); color: var(--text); }
nav summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
nav details[open] > summary::after { transform: rotate(45deg); }
nav ul { list-style: none; margin: 0; padding: 0; }
nav li a {
  display: block;
  padding: 6px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
nav li a:hover { background: var(--sunk); color: var(--text); }
nav li.current > a { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
nav li.current > ul { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 2px solid var(--accent-soft); }
nav li.current > ul a { padding: 4px 10px; color: var(--muted); font-size: 0.94em; }
nav li.current > ul a:hover { color: var(--text); }
/* The page's own outline is at the page's right on a wide screen (.toc), in the menu below. */
@media (min-width: 1301px) { nav li.current > ul { display: none; } }

/* Page */
.page {
  margin-left: calc(var(--side) + var(--gap) * 2);
  padding: 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 900px) 200px;
  column-gap: 44px;
}
.toc {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 18px 0 24px;
  font-size: 0.88em;
}
.toc p { margin: 0 0 8px; font-weight: 650; color: var(--text); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}
.toc a:hover { color: var(--text); }
.toc a.here { color: var(--accent-ink); border-left-color: var(--accent); }
@media (max-width: 1300px) {
  .page { display: block; max-width: 980px; }
  .toc { display: none; }
}
/* The page's top row runs over both columns: where the reader is at its left, the theme
   (system, light or dark) at its right. */
header {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 16px 0 10px;
}
header .theme { margin-left: auto; font-size: 0.86em; }
.crumbs { color: var(--muted); font-size: 0.9em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.menu-button {
  display: none;
  font-size: 1.25em;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  padding: 7px 11px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--surface);
}
main { padding: 4px 0 32px; }
.pager { display: flex; justify-content: space-between; gap: 14px; padding: 20px 0; }
.pager a {
  padding: 12px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.15s, transform 0.15s;
}
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.pager .next { margin-left: auto; }
footer { padding: 10px 0 44px; color: var(--muted); font-size: 0.86em; }
footer a { color: var(--muted); }

/* Narrow screens: the sidebar slides over the page behind the menu button. */
@media (max-width: 900px) {
  nav { display: none; z-index: 3; width: min(320px, calc(100vw - 2 * var(--gap))); }
  #menu:checked ~ nav { display: block; }
  .page { margin-left: 0; padding: 0 16px; max-width: none; }
  .menu-button { display: inline-block; }
}

/* Content */
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: 2.3em; margin: 10px 0 10px; font-weight: 700; }
h2 { font-size: 1.45em; margin: 2.2em 0 0.6em; font-weight: 700; }
h3 { font-size: 1.12em; margin: 1.7em 0 0.4em; font-weight: 600; }
.lead { color: var(--muted); font-size: 1.1em; max-width: 46em; }
p, li { max-width: 46em; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--sunk); padding: 2px 6px; border-radius: 5px; }
pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 14px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; border-radius: 0; }

/* Tables sit in a rounded card (the build wraps each one), which scrolls sideways when the
   screen is narrower than the table. */
.table {
  margin: 14px 0;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.93em;
}
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
th {
  background: var(--sunk);
  font-size: 0.92em;
  font-weight: 650;
  color: var(--muted);
}
tbody tr:hover > td, table > tr:hover > td { background: color-mix(in srgb, var(--sunk) 45%, transparent); }
tr:target > td { background: var(--accent-soft); }
td code { white-space: nowrap; }
table.ref td.type { white-space: nowrap; font-family: var(--mono); font-size: 0.86em; color: var(--type); }
table.ref td.type a { color: var(--type); }
/* A signature keeps room to be read on one or two lines beside a long description. */
table.ref td.sig { width: 46%; min-width: 17em; }
td.sig code { white-space: pre-wrap; word-break: break-word; background: none; padding: 0; color: var(--text); }
td.sig code a { color: var(--type); text-decoration: none; }
td.sig code a:hover { text-decoration: underline; }

/* Small marks beside a call: what its manifest needs, and calls servers do not carry out yet. */
.need, .soon {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.74em;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.need { background: var(--need-bg); color: var(--need-ink); }
.soon { background: var(--soon-bg); color: var(--soon-ink); }

.note {
  background: var(--accent-soft);
  color: var(--text);
  padding: 13px 18px;
  border-radius: var(--radius);
  margin: 18px 0;
  max-width: 46em;
}
.note strong { color: var(--accent-ink); }
p.kind { color: var(--muted); font-size: 0.92em; margin-top: 0; }
p.kind code { font-size: 0.95em; }

/* The language code is shown in (html data-lang), at the foot of the side menu where it stays
   in view. search.js keeps it and the theme in localStorage. `.seg` is the switch they share
   with the tabs on a code window. */
nav .prefs {
  position: sticky;
  bottom: 0;
  margin: auto -10px 0;
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-radius: 0 0 14px 14px;
  color: var(--muted);
  font-size: 0.9em;
  font-weight: 600;
}
nav > * { flex-shrink: 0; }
nav > details:last-of-type { margin-bottom: 14px; }
.seg {
  justify-self: end;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}
.seg button {
  font: inherit;
  font-size: 0.92em;
  font-weight: 600;
  padding: 3px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
html[data-lang="rs"] .seg [data-set="rs"], html[data-lang="java"] .seg [data-set="java"],
html:not([data-theme]) .seg [data-theme-set="auto"],
html[data-theme="light"] .seg [data-theme-set="light"],
html[data-theme="dark"] .seg [data-theme-set="dark"] {
  background: var(--accent);
  color: var(--on-accent);
}
html[data-lang="java"] .rs, html:not([data-lang="java"]) .java { display: none; }

/* Code blocks as small terminal-style windows (search.js wraps each one): dark in both modes. */
.codebox {
  margin: 14px 0;
  border: 1px solid #2b2d30;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1f1f1f;
  box-shadow: var(--shadow);
}
.codebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 16px;
  background: #181818;
  border-bottom: 1px solid #2b2d30;
  font-size: 0.82em;
  font-weight: 600;
  color: #8a93a1;
}
/* A Rust or Java window names both languages: the other one is a press away. */
.codebar .seg { border-color: #2a323d; background: #1d232c; margin-left: -8px; }
.codebar .seg button { padding: 2px 10px; border: 0; background: transparent; color: #8a93a1; }
.codebar .seg button:hover { background: transparent; color: #e3e7ed; }
html[data-lang="rs"] .codebar .seg [data-set="rs"], html[data-lang="java"] .codebar .seg [data-set="java"] {
  background: #2456c9;
  color: #fff;
}
.codebar button {
  font: inherit;
  padding: 3px 11px;
  border: 1px solid #2a323d;
  border-radius: 6px;
  background: #1d232c;
  color: #c7cfdb;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.codebar button:hover { background: #2456c9; border-color: #2456c9; color: #fff; }
.codebar button.done { background: #1d3a73; border-color: #2c58b0; color: #cfe0ff; }
.codebox ::-webkit-scrollbar-thumb { background: #3a3f47; background-clip: padding-box; }
.codebox ::-webkit-scrollbar-thumb:hover { background: #6f9ffa; background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) {
  .codebox pre { scrollbar-color: #3a3f47 transparent; }
}
.codebox pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e3e7ed;
  padding: 14px 18px 16px;
}

/* Syntax colours (search.js `paint`) as each language's most used editor shows them by default:
   Rust in VS Code's Dark Modern with rust-analyzer, Java in IntelliJ IDEA's Dark, TOML as VS
   Code shows it, the terminal as VS Code's own. Each window takes its editor's background. */
.codebox[data-kind="Rust"], .codebox[data-kind="TOML"], .codebox[data-kind="Terminal"],
.codebox[data-kind="Files"], .codebox[data-kind="Code"] { background: #1f1f1f; }
.codebox[data-kind="Rust"] pre, .codebox[data-kind="TOML"] pre, .codebox[data-kind="Terminal"] pre,
.codebox[data-kind="Files"] pre, .codebox[data-kind="Code"] pre { color: #cccccc; }
.codebox[data-kind="Java"] { background: #1e1f22; }
.codebox[data-kind="Java"] pre { color: #bcbec4; }

.codebox[data-kind="Rust"] .tk-keyword { color: #569cd6; }
.codebox[data-kind="Rust"] .tk-control { color: #c586c0; }
.codebox[data-kind="Rust"] .tk-type { color: #4ec9b0; }
.codebox[data-kind="Rust"] .tk-call, .codebox[data-kind="Rust"] .tk-macro { color: #dcdcaa; }
.codebox[data-kind="Rust"] .tk-string { color: #ce9178; }
.codebox[data-kind="Rust"] .tk-number { color: #b5cea8; }
.codebox[data-kind="Rust"] .tk-comment { color: #6a9955; }
.codebox[data-kind="Rust"] .tk-attr { color: #9cdcfe; }

.codebox[data-kind="Java"] .tk-keyword { color: #cf8e6d; }
.codebox[data-kind="Java"] .tk-decl { color: #56a8f5; }
.codebox[data-kind="Java"] .tk-string { color: #6aab73; }
.codebox[data-kind="Java"] .tk-number { color: #2aacb8; }
.codebox[data-kind="Java"] .tk-comment { color: #7a7e85; }
.codebox[data-kind="Java"] .tk-attr { color: #b3ae60; }

.codebox[data-kind="TOML"] .tk-section { color: #4ec9b0; }
.codebox[data-kind="TOML"] .tk-key { color: #9cdcfe; }
.codebox[data-kind="TOML"] .tk-string { color: #ce9178; }
.codebox[data-kind="TOML"] .tk-number { color: #b5cea8; }
.codebox[data-kind="TOML"] .tk-keyword { color: #569cd6; }
.codebox[data-kind="TOML"] .tk-comment { color: #6a9955; }

.codebox[data-kind="Terminal"] .tk-command { color: #dcdcaa; }
.codebox[data-kind="Terminal"] .tk-flag { color: #9cdcfe; }
.codebox[data-kind="Terminal"] .tk-string { color: #ce9178; }
.codebox[data-kind="Terminal"] .tk-comment { color: #6a9955; }
