/* OpenBI Docs - the styles every docs page shares.
   Colours are tokens: light first, then dark (the system's, unless the toggle chose light), then dark by choice.
   The fonts are the site's own files (assets/fonts/fonts.css): nothing is loaded from another site. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --bg-hover: #eef0f3;
  --surface: #ffffff;
  --code-bg: #f7f8fa;
  --text: #1b1d21;
  --text-muted: #555c68;
  --text-faint: #6f7682;
  --border: #e4e7ec;
  --border-strong: #cdd2da;
  --brand: #2F6FDE;
  --brand-text: #2459c4;
  --brand-tint: #eef3fd;
  --brand-tint-border: #cad9f6;
  --tip: #1d7a3d;
  --tip-tint: #eef7f1;
  --tip-border: #c9e5d2;
  --warn: #965800;
  --warn-tint: #fdf6e8;
  --warn-border: #efd9ad;
  --code-opt: #2459c4;
  --code-str: #1d7a3d;
  --code-ph: #a0520a;
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --scrim: rgba(16, 20, 28, 0.32);
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101216;
    --bg-subtle: #16191e;
    --bg-hover: #1e2228;
    --surface: #14171c;
    --code-bg: #0c0e11;
    --text: #e6e8eb;
    --text-muted: #a8afba;
    --text-faint: #8a919c;
    --border: #262b32;
    --border-strong: #3a414b;
    --brand: #2F6FDE;
    --brand-text: #8db2f7;
    --brand-tint: rgba(47, 111, 222, 0.14);
    --brand-tint-border: rgba(118, 160, 240, 0.34);
    --tip: #63c58c;
    --tip-tint: rgba(56, 168, 98, 0.11);
    --tip-border: rgba(99, 197, 140, 0.3);
    --warn: #e4ab4c;
    --warn-tint: rgba(228, 171, 76, 0.1);
    --warn-border: rgba(228, 171, 76, 0.3);
    --code-opt: #93b7f8;
    --code-str: #82d2a0;
    --code-ph: #efb36c;
    --topbar-bg: rgba(16, 18, 22, 0.88);
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101216;
  --bg-subtle: #16191e;
  --bg-hover: #1e2228;
  --surface: #14171c;
  --code-bg: #0c0e11;
  --text: #e6e8eb;
  --text-muted: #a8afba;
  --text-faint: #8a919c;
  --border: #262b32;
  --border-strong: #3a414b;
  --brand: #2F6FDE;
  --brand-text: #8db2f7;
  --brand-tint: rgba(47, 111, 222, 0.14);
  --brand-tint-border: rgba(118, 160, 240, 0.34);
  --tip: #63c58c;
  --tip-tint: rgba(56, 168, 98, 0.11);
  --tip-border: rgba(99, 197, 140, 0.3);
  --warn: #e4ab4c;
  --warn-tint: rgba(228, 171, 76, 0.1);
  --warn-border: rgba(228, 171, 76, 0.3);
  --code-opt: #93b7f8;
  --code-str: #82d2a0;
  --code-ph: #efb36c;
  --topbar-bg: rgba(16, 18, 22, 0.88);
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
svg { flex: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 10px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 24px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  border-radius: 6px;
}

.mark {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: 700 11px/24px "Schibsted Grotesk", system-ui, sans-serif;
  letter-spacing: 0.03em;
  text-align: center;
}

.wordmark {
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-sep {
  width: 1px;
  height: 20px;
  margin: 0 4px 0 6px;
  background: var(--border-strong);
}

.brand-docs {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
}
.brand-docs:hover { color: var(--text); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.menu-btn { display: none; margin-left: -8px; }
.search-btn { display: none; }

/* openbi.no: Buy (OpenBI Server, sold by Querex AS) in every page's top bar */
.topbar-buy {
  flex: none;
  margin-left: 4px;
  padding: 6px 14px;
  border-radius: 980px;
  background: #0071e3;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.topbar-buy:hover { background: #0077ed; color: #fff; }

/* the theme button shows the theme it switches to */
.theme-btn .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* ---------- Search ---------- */

.search {
  position: relative;
  margin-left: auto;
  width: 300px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::placeholder { color: var(--text-faint); opacity: 1; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:hover { border-color: var(--border-strong); }
.search-input:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  background: var(--bg);
  border-color: transparent;
}

.search-key {
  position: absolute;
  right: 8px;
  top: 50%;
  margin-top: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-faint);
  font: 500 11.5px/18px "JetBrains Mono", ui-monospace, monospace;
  text-align: center;
  pointer-events: none;
}
.search-input:focus ~ .search-key,
.search.has-query .search-key { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: min(460px, calc(100vh - 90px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search-results[hidden] { display: none; }

.sr-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  line-height: 1.45;
}
.sr-item.is-active,
.sr-item:hover { background: var(--bg-hover); }
.sr-item.is-active { box-shadow: inset 2px 0 0 var(--brand); }
.sr-title { display: block; font-weight: 550; font-size: 14.5px; }
.sr-path { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.sr-item mark {
  background: none;
  color: var(--brand-text);
  font-weight: 650;
}
.sr-empty {
  margin: 0;
  padding: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px 18px 48px 24px;
  scrollbar-width: thin;
}

.main {
  min-width: 0;
  padding: 40px 48px 0;
}

.article {
  max-width: 41rem;
  margin: 0 auto;
}

.toc { display: none; }

@media (min-width: 1200px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr) 248px; }
  .toc {
    display: block;
    position: sticky;
    top: 60px;
    align-self: start;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 44px 28px 40px 4px;
    scrollbar-width: thin;
  }
}

/* ---------- Sidebar ---------- */

.nav-group + .nav-group { margin-top: 6px; }
.nav-group.is-open { margin-bottom: 14px; }

.nav-title {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
}

/* a section's title opens and closes its list */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 6px 10px 6px 4px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--bg-hover); }
.nav-toggle .chev { width: 14px; height: 14px; color: var(--text-faint); }
.nav-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-group.is-open .nav-toggle { margin-bottom: 2px; }
.nav-list[hidden] { display: none; }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
}
a.nav-link:hover { background: var(--bg-hover); color: var(--text); }
a.nav-link[aria-current="page"],
a.nav-link[aria-current="true"] {
  background: var(--brand-tint);
  color: var(--brand-text);
  font-weight: 550;
}

.nav-link.is-coming {
  color: var(--text-faint);
  cursor: default;
}

.soon {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 17px;
  font-weight: 500;
  color: var(--text-faint);
}

.scrim {
  display: none;
  position: fixed;
  inset: 60px 0 0 0;
  z-index: 45;
  background: var(--scrim);
}

/* ---------- Breadcrumbs ---------- */

.crumbs {
  min-height: 22px;
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 22px;
  color: var(--text-muted);
}
.article .crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.article .crumbs li { display: inline-flex; align-items: center; margin: 0; padding: 0; }
.crumbs li + li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 10px 0 8px;
  border-right: 1.5px solid var(--text-faint);
  border-top: 1.5px solid var(--text-faint);
  transform: rotate(45deg);
}
.crumbs a { color: var(--text-muted); text-decoration: none; border-radius: 4px; }
.crumbs a:hover { color: var(--brand-text); }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 500; }

/* ---------- Reading column ---------- */

.article h1 {
  margin: 0 0 14px;
  font-size: 2.125rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 30px;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.article h2 {
  margin: 56px 0 14px;
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 630;
  letter-spacing: -0.014em;
}

.article h3 {
  margin: 36px 0 10px;
  font-size: 1.125rem;
  line-height: 1.4;
  font-weight: 630;
  letter-spacing: -0.006em;
}

.article h2 + h3 { margin-top: 20px; }

.article p,
.article ul,
.article ol { margin: 0 0 18px; }

.article ul,
.article ol { padding-left: 1.4em; }
.article li { margin: 0 0 8px; padding-left: 0.2em; }
.article li::marker { color: var(--text-faint); }
.article ol > li::marker { font-weight: 600; color: var(--text-muted); }

.article strong { font-weight: 620; }

.article a:not([class]) {
  color: var(--brand-text);
  text-decoration: underline;
  text-decoration-color: var(--brand-tint-border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article a:not([class]):hover { text-decoration-color: currentColor; }

.anchor {
  margin-left: 8px;
  color: var(--text-faint);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}
h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--brand-text); }

/* code shows exactly the characters typed: no ligatures, no contextual alternates (JetBrains Mono's "://") */
code,
kbd,
pre,
.mono,
.addr,
.dg-host {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

.article :not(pre) > code {
  padding: 0.1em 0.36em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-subtle);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
.article code.nowrap { white-space: nowrap; }

/* a host name, kept on one line (the longest fits a 390 px phone) */
.addr {
  font-size: 0.9em;
  font-weight: 500;
  white-space: nowrap;
}
/* on the narrowest phones a long address (https://bi.<domain>/mcp) may break, rather than push the page sideways */
@media (max-width: 400px) {
  .addr { white-space: normal; overflow-wrap: anywhere; }
}

hr {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: var(--border);
}

/* ---------- Tables ---------- */

.table-wrap {
  margin: 0 0 26px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.table-wrap th {
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.table-wrap .addr { font-size: 0.86em; }

.table-wrap td {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.table-wrap tbody tr:first-child td { border-top: 0; }

@media (max-width: 639px) {
  .table-wrap.stack table,
  .table-wrap.stack tbody,
  .table-wrap.stack tr,
  .table-wrap.stack td { display: block; }
  .table-wrap.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .table-wrap.stack tr { padding: 14px 16px; border-top: 1px solid var(--border); }
  .table-wrap.stack tbody tr:first-child { border-top: 0; }
  .table-wrap.stack td { padding: 0; border: 0; }
  .table-wrap.stack td::before {
    content: attr(data-label);
    display: block;
    margin-top: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-muted);
  }
  .table-wrap.stack td:first-child { font-size: 1rem; }
  .table-wrap.stack td:first-child::before { display: none; }
}

/* ---------- Callouts: Note, Tip, Warning ---------- */

.callout {
  position: relative;
  margin: 24px 0 26px;
  padding: 14px 18px 14px 48px;
  border: 1px solid var(--brand-tint-border);
  border-radius: 10px;
  background: var(--brand-tint);
  font-size: 0.9375rem;
  line-height: 1.65;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.7'%3E%3Ccircle cx='10' cy='10' r='8'/%3E%3Cpath d='M10 9.2v5' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6.2' r='1' fill='black' stroke='none'/%3E%3C/svg%3E");
}
.callout::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 17px;
  width: 19px;
  height: 19px;
  background: var(--brand);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.callout-title {
  margin: 0 0 2px !important;
  font-weight: 650;
  color: var(--text);
}
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 10px; }
.callout .code { margin: 10px 0 4px; }

.callout.tip {
  border-color: var(--tip-border);
  background: var(--tip-tint);
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.6 14.6h4.8M8.3 17.4h3.4M10 2.4a5.4 5.4 0 0 0-3.3 9.7c.6.5.9 1.1.9 1.8v.7h4.8v-.7c0-.7.3-1.3.9-1.8A5.4 5.4 0 0 0 10 2.4Z'/%3E%3C/svg%3E");
}
.callout.tip::before { background: var(--tip); }

.callout.warning {
  border-color: var(--warn-border);
  background: var(--warn-tint);
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M10 2.6 1.7 17h16.6L10 2.6Z'/%3E%3Cpath d='M10 8v4.4' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='14.6' r='1' fill='black' stroke='none'/%3E%3C/svg%3E");
}
.callout.warning::before { background: var(--warn); }

/* ---------- Code blocks (docs.js adds the bar and its Copy button) ---------- */

.code {
  margin: 18px 0 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 4px 6px 4px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.code-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.copy:hover { background: var(--bg-hover); color: var(--text); }
.copy svg { width: 15px; height: 15px; }
.copy .icon-done { display: none; }
.copy.is-copied { color: var(--tip); }
.copy.is-copied .icon-done { display: block; }
.copy.is-copied .icon-copy { display: none; }

.article pre {
  margin: 0;
  padding: 14px 16px;
  font: 400 13.5px/1.65 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.article pre code { font: inherit; }

.ln {
  display: block;
  padding-left: 2ch;
  text-indent: -2ch;
}
.tk { white-space: nowrap; }
.tk.tk-str { white-space: pre-wrap; } /* a long "string" (a description in JSON or C#) wraps between its words */
.tk-cmd { font-weight: 600; }
.tk-opt { color: var(--code-opt); }
.tk-str { color: var(--code-str); }
.tk-ph { color: var(--code-ph); font-style: normal; }

/* ---------- OAX function pages (generate/fnpages) ---------- */

/* the OAX highlighter (docs.js highlightOax, <pre data-lang="oax">): the code tokens' colours, in both themes */
.tk-kw { color: var(--code-opt); font-weight: 600; }
.tk-fn { color: var(--code-opt); }
.tk-num { color: var(--code-ph); }
.tk-com { color: var(--text-muted); font-style: italic; } /* --text-faint on --code-bg was 4.3:1 in light mode, under AA */
/* a function's name has no place to break: SAMPLECARTESIANPOINTSBYCOVER fits a 320 px phone only so */
.article h1,
.pager .ttl { overflow-wrap: anywhere; }
.pager a { min-width: 0; }
/* a result table's numbers */
.table-wrap th.num,
.table-wrap td.num { text-align: right; }

/* ---------- Diagram ---------- */

.diagram {
  margin: 26px 0 30px;
  padding: 24px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  color: var(--text);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
}
.diagram .dg-narrow { display: none; }

.dg-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.25; }
.dg-box.is-accent { fill: var(--brand-tint); stroke: var(--brand); }
.dg-title { fill: currentColor; font-size: 15px; font-weight: 650; }
.dg-host {
  fill: currentColor;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13.5px;
  font-weight: 600;
}
.dg-sub { fill: var(--text-muted); font-size: 12.5px; }
.dg-key { fill: var(--brand-text); font-size: 12.5px; font-weight: 600; }
.dg-line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.dg-line.is-accent { stroke: var(--brand); }
.dg-head { fill: var(--text-muted); }
.dg-head.is-accent { fill: var(--brand); }
.dg-label { fill: var(--text-muted); font-size: 12.5px; }
.dg-label.is-accent { fill: var(--brand-text); font-weight: 600; }

.diagram figcaption {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.dg-wide .dg-sub,
.dg-wide .dg-key,
.dg-wide .dg-label { font-size: 13px; }

@media (max-width: 560px) {
  .diagram { padding: 18px 12px 14px; }
  .diagram .dg-wide { display: none; }
  .diagram .dg-narrow { display: block; max-width: 360px; }
  .diagram figcaption { padding: 12px 4px 0; }
}

/* ---------- Panels and cards ---------- */

.panel {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  background: var(--surface);
}
.panel > :last-child { margin-bottom: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
a.card:hover { border-color: var(--brand-tint-border); background: var(--bg-subtle); }

.card-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--brand-tint);
  color: var(--brand-text);
}
.card-icon svg { width: 20px; height: 20px; }

.card-name {
  margin: 8px 0 0;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.35;
}
.card p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.card-foot {
  margin-top: auto;
  padding-top: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-text);
}
.card-foot.is-coming { color: var(--text-faint); font-weight: 500; }

/* ---------- Screenshots, badges and reference lists ---------- */

/* a screenshot: <figure class="shot"><img src="…webp" width="…" height="…" alt="…" loading="lazy"><figcaption>…</figcaption></figure>
   (width and height are the file's own, so nothing moves while it loads) */
.shot {
  margin: 4px 0 26px;
}
.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
}
.shot img.zoomable { cursor: zoom-in; }
.shot img.zoomable:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* the enlarged picture (docs.js: buildLightbox) - always over a dark backdrop, in both themes */
html.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8, 10, 14, 0.96);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox-fig {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}
.lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 110px);
  border-radius: 8px;
  background: #16191e;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.lightbox-fig figcaption {
  display: flex;
  gap: 14px;
  max-width: 72ch;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #e6e8eb;
  text-align: center;
  cursor: auto;
}
.lightbox-count { color: #a8afba; white-space: nowrap; }
.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.shot figcaption {
  padding: 10px 2px 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* a small label beside a name: <span class="badge">OpenBI</span>, <span class="badge is-soon">Coming</span> */
.badge {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--brand-tint-border);
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-text);
  font-size: 11.5px;
  line-height: 19px;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge.is-soon {
  border-color: var(--border);
  background: none;
  color: var(--text-faint);
  font-weight: 500;
}

/* long reference lists (functions, tools, commands): <dl class="ref"><dt><code>NAME</code></dt><dd>one line</dd>…</dl> */
.article dl.ref {
  margin: 0 0 22px;
  border-top: 1px solid var(--border);
}
.article dl.ref dt {
  margin: 0;
  padding: 10px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.article dl.ref dd {
  margin: 2px 0 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---------- Page end: last updated, previous/next, footer ---------- */

.page-meta {
  margin: 56px 0 0 !important;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 22px 0 0;
}
.pager:empty { display: none; }

.pager a {
  display: block;
  padding: 13px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  line-height: 1.45;
}
.pager a:hover { border-color: var(--brand-tint-border); background: var(--bg-subtle); }
.pager .dir { display: block; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 2px; }
.pager .ttl { display: block; font-weight: 600; color: var(--brand-text); }
.pager .next { grid-column: 2; text-align: right; }

.site-footer {
  max-width: 41rem;
  margin: 56px auto 0;
  padding: 22px 0 40px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand-text); }

/* ---------- On this page ---------- */

.toc-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}
.toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 14px;
  border-left: 1px solid transparent;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
}
.toc .lvl3 a { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--brand-text); border-left-color: var(--brand); }

/* ---------- Narrower screens ---------- */

@media (max-width: 1099px) {
  .main { padding: 36px 36px 0; }
}

@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px 0 16px; gap: 6px; }

  .sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(320px, 86vw);
    height: auto;
    padding: 22px 16px 40px 18px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
  }
  .nav-open .scrim { display: block; }
  .nav-open { overflow: hidden; }

  .main { padding: 28px 24px 0; }
}

@media (max-width: 639px) {
  .search-btn { display: inline-flex; margin-left: auto; }
  .search { display: none; }
  .search-open .search {
    display: block;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    width: auto;
    margin: 0;
    padding: 10px 16px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .search-open .search-icon { left: 27px; top: 20px; margin-top: 0; }
  .search-open .search-key { display: none; }
  .search-open .search-results {
    position: static;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 140px);
    margin-top: 10px;
    box-shadow: none;
  }

  .main { padding: 22px 16px 0; }
  .article h1 { font-size: 1.8125rem; }
  .lead { font-size: 1.0938rem; margin-bottom: 26px; }
  .article h2 { margin-top: 46px; font-size: 1.3125rem; }
  .code-head { padding-left: 12px; }
  .article pre { padding: 12px 12px; font-size: 13px; }
  .callout { padding: 13px 14px 13px 42px; }
  .callout::before { left: 14px; top: 16px; width: 18px; height: 18px; }
  .wordmark { font-size: 16px; }
}

@media (max-width: 359px) {
  .brand-sep,
  .brand-docs { display: none; }
}

/* ---------- Open Graph reference (/docs/reference/open-graph/): its entries, their badges, the index's filter ---------- */

/* one function, type or macro: <section class="og-fn" id="og_name"> with its name, badges, summary, signature and facts */
.og-fn {
  margin: 0;
  padding: 22px 0 8px;
  border-top: 1px solid var(--border);
}
.og-fn-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 0 0 8px;
}
.article h3.og-fn-name {
  margin: 0;
  font-size: 1.0625rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.article h3.og-fn-name code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 1em;
  font-weight: 600;
}
.og-kind {
  margin-left: 8px;
  color: var(--text-faint);
  font-size: 0.8125rem;
  font-weight: 500;
}
.article .og-summary { margin: 0 0 12px; }
.og-fn .code { margin-bottom: 14px; }

/* how an entry is checked, and whether it uses threads or SIMD */
.og-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}
.og-badge {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 19px;
  font-weight: 600;
  white-space: nowrap;
}
.og-badge.is-exact { border-color: var(--tip-border); background: var(--tip-tint); color: var(--tip); }
.og-badge.is-tolerance { border-color: var(--brand-tint-border); background: var(--brand-tint); color: var(--brand-text); }
.og-badge.is-quality { background: none; color: var(--text); }
.og-badge.is-unit { border-color: var(--border); background: none; color: var(--text-faint); font-weight: 500; }
.og-badge.is-threads,
.og-badge.is-simd,
.og-badge.is-ext { border-color: var(--brand-tint-border); background: none; color: var(--brand-text); font-weight: 500; }
.og-badge.is-partial { border-color: var(--warn-border); background: var(--warn-tint); color: var(--warn); }

/* an entry's facts: parameters, returns, errors, complexity, how it is checked, threads, SIMD, igraph, see also */
.article dl.og-facts {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 8px 16px;
  margin: 4px 0 14px;
  font-size: 0.9375rem;
  line-height: 1.6;
}
.article dl.og-facts > dt {
  margin: 0;
  padding-top: 1px;
  color: var(--text-faint);
  font-size: 0.8125rem;
  font-weight: 600;
}
.article dl.og-facts > dd {
  margin: 0;
  min-width: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.article dl.og-facts p,
.article dl.og-facts ul { margin: 0 0 6px; }
.article dl.og-facts > dd > :last-child { margin-bottom: 0; }
.article ul.og-list {
  padding-left: 0;
  list-style: none;
}
.article ul.og-list > li { margin: 0 0 5px; padding: 0; }
.article ul.og-list > li > code:first-child { color: var(--text); }
.og-fn > p,
.og-fn > ul,
.og-fn > ol { overflow-wrap: anywhere; }

@media (max-width: 639px) {
  .article dl.og-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .article dl.og-facts > dd { margin-bottom: 10px; }
}

/* the index: <div id="og-filter"> (shown by docs.js) over <table id="og-table"> */
.og-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
}
.og-filter[hidden] { display: none; }
.og-filter input[type="search"],
.og-filter select {
  min-width: 0;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}
.og-filter input[type="search"] { flex: 1 1 240px; }
.og-filter select { flex: 0 1 auto; }
.og-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.article .og-count {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 0.875rem;
}
.og-index tr[hidden] { display: none !important; }
.og-index td { padding: 11px 14px; }
.og-page {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.8125rem;
}
/* the line's own code may break anywhere, so the name keeps its width */
.og-index td[data-label="What it does"] code { white-space: normal; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .copy, .scrim { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
}
