/* The documentation site's one stylesheet. Same colours as the console, so the two feel like one product.
   System fonts only: nothing is fetched from anywhere but this folder. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --raised: #f9fafc; --line: #dde2ea; --line-strong: #c3cbd7;
  --fg: #141a24; --muted: #5b6676; --faint: #8792a3; --accent: #3f51d9; --accent-fg: #ffffff; --accent-soft: #e8ebfc;
  --ok: #17794a; --ok-soft: #e1f4ea; --warn: #8a5a00; --warn-soft: #fbf0d4; --code-bg: #f1f3f7;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 8px 24px rgb(16 24 40 / 0.08);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1218; --surface: #151b24; --raised: #1b222d; --line: #283140; --line-strong: #3a4557;
    --fg: #e7ebf2; --muted: #9aa5b6; --faint: #6f7b8d; --accent: #8795f5; --accent-fg: #0e1218; --accent-soft: #232a4d;
    --ok: #5fd39a; --ok-soft: #153325; --warn: #e9be62; --warn-soft: #3a2e12; --code-bg: #1b222d;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.45);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1218; --surface: #151b24; --raised: #1b222d; --line: #283140; --line-strong: #3a4557;
  --fg: #e7ebf2; --muted: #9aa5b6; --faint: #6f7b8d; --accent: #8795f5; --accent-fg: #0e1218; --accent-soft: #232a4d;
  --ok: #5fd39a; --ok-soft: #153325; --warn: #e9be62; --warn-soft: #3a2e12; --code-bg: #1b222d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 0.5rem; z-index: 50; background: var(--surface); padding: 0.4rem 0.7rem; border-radius: 6px; }

/* ---- header */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem; height: 3.5rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
/* The brand is the word "Nullgap.dev" with no symbol, set like the console's: semibold and slightly tight. */
.brand { display: flex; align-items: baseline; gap: 0.45rem; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.03em; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: -0.01em; }
.search { position: relative; flex: 1; max-width: 30rem; margin-left: auto; }
.search input { width: 100%; height: 2.25rem; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--raised); color: var(--fg); font: inherit; font-size: 0.9rem; }
.results { position: absolute; left: 0; right: 0; top: 2.6rem; max-height: 70vh; overflow: auto; margin: 0; padding: 0.3rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.results[hidden] { display: none; }
.results a { display: block; padding: 0.45rem 0.6rem; border-radius: 6px; color: var(--fg); }
.results a:hover, .results a.active { background: var(--accent-soft); text-decoration: none; }
.results .where { display: block; font-size: 0.75rem; color: var(--muted); }
.results .snip { display: block; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .none { padding: 0.6rem; color: var(--muted); font-size: 0.9rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; height: 2.25rem; min-width: 2.25rem; padding: 0 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: 0.8rem; cursor: pointer; }
.icon-btn:hover { background: var(--raised); }
.menu-btn { display: none; }

/* ---- three columns: navigation, page, on-page contents */
.layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr) 14rem; max-width: 90rem; margin: 0 auto; }
/* The page comes first in the HTML (so it is read first without styles and on a phone); the grid puts the navigation to its left. */
.layout > .nav { grid-column: 1; grid-row: 1; }
.layout > main { grid-column: 2; grid-row: 1; }
.layout > .toc { grid-column: 3; grid-row: 1; }
.nav { position: sticky; top: 3.5rem; align-self: start; height: calc(100vh - 3.5rem); overflow: auto; padding: 1.25rem 0.75rem 3rem 1rem; border-right: 1px solid var(--line); font-size: 0.9rem; }
.nav h2 { margin: 1.1rem 0 0.3rem 0.5rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.nav h2:first-child { margin-top: 0; }
.nav ul { margin: 0; padding: 0; list-style: none; }
.nav a { display: block; padding: 0.25rem 0.5rem; border-radius: 6px; color: var(--muted); }
.nav a:hover { color: var(--fg); background: var(--raised); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.badge { display: inline-block; margin-left: 0.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.68rem; font-weight: 600; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.04em; }
main { min-width: 0; padding: 2rem 2.5rem 4rem; }
article { max-width: 46rem; }
.toc { position: sticky; top: 3.5rem; align-self: start; max-height: calc(100vh - 3.5rem); overflow: auto; padding: 2rem 1rem 2rem 0; font-size: 0.82rem; }
.toc h2 { margin: 0 0 0.4rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc a { display: block; padding: 0.15rem 0; color: var(--muted); }
.toc .l3 a { padding-left: 0.8rem; }

/* ---- the page itself */
.crumb { margin: 0 0 0.3rem; font-size: 0.8rem; color: var(--muted); }
h1 { margin: 0 0 0.5rem; font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; }
.lead { margin: 0 0 2rem; font-size: 1.1rem; color: var(--muted); }
h2 { margin: 2.5rem 0 0.75rem; padding-top: 0.25rem; font-size: 1.4rem; line-height: 1.3; letter-spacing: -0.01em; }
h3 { margin: 1.8rem 0 0.5rem; font-size: 1.1rem; }
h4 { margin: 1.4rem 0 0.4rem; font-size: 1rem; }
h2, h3, h4 { position: relative; }
.anchor { position: absolute; left: -1.1em; width: 1em; color: var(--faint); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; text-decoration: none; }
p, ul, ol { margin: 0 0 1rem; }
li { margin: 0.25rem 0; }
li > p { margin: 0 0 0.5rem; }
code { font: 0.875em var(--mono); background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
.code { position: relative; margin: 0 0 1.25rem; }
pre { position: relative; margin: 0; padding: 0.9rem 1rem; overflow: auto; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; font: 0.82rem/1.55 var(--mono); tab-size: 2; }
pre code { background: none; padding: 0; font: inherit; overflow-wrap: normal; }
pre[data-lang] { padding-top: 1.7rem; }
pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 0.35rem; left: 1rem; font: 0.68rem var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.copy { position: absolute; top: 0.4rem; right: 0.4rem; height: 1.7rem; padding: 0 0.55rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font: 0.72rem var(--sans); cursor: pointer; }
.copy:hover { color: var(--fg); }
.table-wrap { margin: 0 0 1.25rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--raised); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
blockquote { margin: 0 0 1rem; padding: 0.1rem 1rem; border-left: 3px solid var(--line-strong); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.callout { margin: 0 0 1.25rem; padding: 0.75rem 1rem 0.1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--surface); }
.callout-label { margin: 0 0 0.25rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.callout-warning, .callout-new { border-left-color: var(--warn); }
.callout-warning .callout-label, .callout-new .callout-label { color: var(--warn); }
.callout-tip { border-left-color: var(--ok); }
.callout-tip .callout-label { color: var(--ok); }
.method { display: inline-block; min-width: 3.6rem; margin-right: 0.5rem; padding: 0.05rem 0.4rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font: 600 0.75rem var(--mono); text-align: center; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.92rem; }
.pager small { display: block; color: var(--muted); }
.pager .next { margin-left: auto; text-align: right; }
.foot { margin-top: 2rem; font-size: 0.8rem; color: var(--faint); }

/* ---- narrower screens: the contents column goes first, then the navigation folds behind a button */
@media (max-width: 72rem) {
  .layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 52rem) {
  .layout { display: block; }
  .menu-btn { display: inline-flex; }
  .brand span { display: none; }
  main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.6rem; }
  .anchor { display: none; }
  /* Without scripts the navigation simply follows the page. With them it opens over the page from the button. */
  .nav { position: static; height: auto; border-right: 0; border-top: 1px solid var(--line); padding: 1.25rem 1rem 2rem; }
  .js .nav { display: none; position: fixed; inset: 3.5rem 0 0 0; z-index: 20; height: auto; background: var(--bg); border-top: 0; }
  .js .nav.open { display: block; }
}
@media print {
  .top, .nav, .toc, .copy, .pager { display: none; }
  .layout { display: block; }
}
td:first-child code { white-space: nowrap; }
