/* =============================================================================
   NGA SDK docs, on "Signal". Loaded after /styles.css and reads its tokens
   (--paper, --ink, --body, --label, --line-soft, --signal, --signal-deep,
   --signal-ink, --shell, --gutter); nothing here redefines one. The --docs-*
   properties below are mixes of those tokens, for the surface step and lines.
   Light only, no shadows. Plus Jakarta Sans for text, IBM Plex Mono for code.
   ============================================================================= */

:root {
  --docs-surface: color-mix(in oklab, var(--line-soft) 55%, var(--paper));
  --docs-line: color-mix(in oklab, var(--label) 28%, var(--paper));
  --docs-wash: color-mix(in oklab, var(--signal) 13%, var(--paper));
  --docs-string: color-mix(in oklab, var(--signal-deep) 45%, var(--ink));
  --docs-sidebar: 236px;
  --docs-measure: 760px;
  --docs-header: 60px;
  --docs-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html { scroll-padding-top: calc(var(--docs-header) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body.docs {
  display: block;
  min-height: 0;
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
}
body.docs a { color: var(--signal-deep); }
body.docs a:hover { text-decoration: underline; }
body.docs :focus-visible { outline: 2px solid var(--signal-deep); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--paper); padding: 8px 12px; border: 1px solid var(--docs-line); border-radius: 8px; z-index: 30;
}
.skip-link:focus { left: 12px; }

/* ---------- Header ---------- */
.docs-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.docs-header-inner {
  max-width: var(--shell);
  margin: 0 auto;
  height: var(--docs-header);
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 14px;
}
body.docs .docs-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
body.docs .docs-brand:hover, body.docs .docs-home:hover { text-decoration: none; }
.docs-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--signal); color: var(--signal-ink);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
}
.docs-brand-text { font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.docs-version {
  margin-left: auto;
  font-family: var(--docs-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--label);
  border: 1px solid var(--docs-line); border-radius: 999px;
  padding: 4px 10px; white-space: nowrap;
}
/* The site's links and Sign up (/nav.css) sit right after the version, not spread from it. */
.docs-header-inner .site-nav { margin-left: 10px; }

/* ---------- Layout ---------- */
.docs-shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 28px var(--gutter) 72px;
  display: grid;
  grid-template-columns: var(--docs-sidebar) minmax(0, 1fr);
  gap: 52px;
}
.docs-sidebar {
  position: sticky; top: calc(var(--docs-header) + 20px);
  align-self: start;
  max-height: calc(100vh - var(--docs-header) - 40px);
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.4;
  padding-right: 4px;
}
.docs-main { min-width: 0; max-width: var(--docs-measure); }

.nav-group {
  margin: 20px 0 6px !important;
  font-family: var(--docs-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--label);
}
.docs-sidebar .nav-group:first-child { margin-top: 0 !important; }
.nav-list, .nav-sections { list-style: none; margin: 0; padding: 0; }
.nav-changelog { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
body.docs .nav-list a {
  display: block; padding: 5px 10px; border-radius: 7px; color: var(--body);
}
body.docs .nav-list a:hover { background: var(--docs-surface); color: var(--ink); text-decoration: none; }
body.docs .nav-list a[aria-current="page"] { background: var(--docs-wash); color: var(--ink); font-weight: 600; }
.nav-sections { margin: 2px 0 6px 10px; padding-left: 8px; border-left: 1px solid var(--line-soft); }
body.docs .nav-sections a { padding: 3px 8px; font-size: 13px; color: var(--label); font-weight: 400; }
body.docs .nav-sections a[aria-current="true"] { color: var(--ink); background: none; }
.nav-list code, .nav-sections code { font-family: var(--docs-mono); font-size: 0.92em; }

/* The sidebar is the desktop navigation; below 900px it folds into this. */
.docs-menu { display: none; margin: 0 0 18px; border: 1px solid var(--docs-line); border-radius: 10px; }
.docs-menu summary {
  cursor: pointer; list-style: none; padding: 10px 14px;
  display: flex; gap: 10px; align-items: baseline;
  font-family: var(--docs-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label);
}
.docs-menu summary::-webkit-details-marker { display: none; }
.docs-menu summary::after { content: "+"; margin-left: auto; font-size: 14px; color: var(--label); }
.docs-menu[open] summary::after { content: "−"; }
.docs-menu-current {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 14px; letter-spacing: 0; text-transform: none;
  color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.docs-menu nav { padding: 0 8px 10px; font-size: 14px; }
.docs-menu .nav-group:first-child { margin-top: 4px !important; }

/* ---------- Preview banner ---------- */
.preview-banner {
  margin: 0 0 26px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--docs-wash);
  border-left: 3px solid var(--signal);
  font-size: 14px; line-height: 1.5; color: var(--body);
}
.preview-banner strong { color: var(--ink); }

/* ---------- Article ---------- */
.eyebrow {
  font-family: var(--docs-mono);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--label);
  margin-bottom: 8px !important;
}
.docs-article h1 {
  font-size: clamp(30px, 4.2vw, 40px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  text-wrap: balance;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
/* The title and its Markdown actions: Copy as Markdown, View as Markdown. */
.title-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; column-gap: 18px; row-gap: 4px; }
.title-row h1 { flex: 1 1 320px; min-width: 0; }
.page-actions { display: flex; align-items: center; gap: 12px; padding-top: 8px; margin-bottom: 12px; }
.copy-md, .copy-prompt {
  appearance: none; cursor: pointer;
  font: 600 13px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--docs-line); border-radius: 8px;
  padding: 8px 11px; white-space: nowrap;
}
.copy-md:hover, .copy-prompt:hover { border-color: var(--ink); }
.copy-md[data-copied], .copy-prompt[data-copied] { border-color: var(--signal); background: var(--docs-wash); }
body.docs .md-link { font-size: 13px; color: var(--label); white-space: nowrap; }
.copy-source {
  display: block; width: 100%; height: 260px; margin: 0 0 22px; padding: 12px 14px;
  font: 12.5px/1.55 var(--docs-mono); color: var(--ink);
  background: var(--docs-surface); border: 1px solid var(--line-soft); border-radius: 10px; resize: vertical;
}
.copy-source[hidden] { display: none; }

/* The agents page's prompt: one button copies it whole. */
.agent-prompt { margin: 0 0 22px; border: 1px solid var(--docs-line); border-radius: 12px; overflow: hidden; }
.agent-prompt-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--docs-wash); border-bottom: 1px solid var(--line-soft);
}
.copy-prompt { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); padding: 10px 14px; font-size: 14px; }
.copy-prompt:hover { border-color: var(--signal-deep); }
.copy-prompt[data-copied] { background: var(--signal); }
.agent-prompt-text {
  margin: 0; padding: 14px 16px; max-height: 460px; overflow: auto;
  font: 12.5px/1.6 var(--docs-mono); color: var(--ink); background: var(--docs-surface);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.docs-article .lede { font-size: 18px; line-height: 1.55; color: var(--body); margin-bottom: 26px; text-wrap: pretty; }
.docs-article h2 {
  margin: 48px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 23px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25;
}
.docs-article h3 { margin: 30px 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; }
.docs-article h4 { margin: 22px 0 6px; font-size: 15px; font-weight: 700; }
.docs-article h2, .docs-article h3 { overflow-wrap: anywhere; }
.docs-article .header-anchor {
  margin-left: 8px; color: var(--docs-line); font-weight: 500; text-decoration: none; opacity: 0;
}
.docs-article h2:hover .header-anchor, .docs-article h3:hover .header-anchor,
.docs-article .header-anchor:focus { opacity: 1; }
body.docs .docs-article .header-anchor:hover { color: var(--signal-deep); text-decoration: none; }
.docs-article p { margin: 0 0 14px; }
.docs-article ul, .docs-article ol { margin: 0 0 14px; padding-left: 22px; }
.docs-article li { margin: 4px 0; }
.docs-article li > p { margin: 0 0 6px; }
.docs-article li::marker { color: var(--label); }
.docs-article strong { font-weight: 700; }
.docs-article hr { border: 0; border-top: 1px solid var(--line-soft); margin: 32px 0; }
.docs-article code {
  font-family: var(--docs-mono);
  font-size: 0.86em;
  background: var(--docs-surface);
  border-radius: 5px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}
.docs-article h1 code, .docs-article h2 code, .docs-article h3 code { background: none; padding: 0; font-size: 0.9em; font-weight: inherit; }

/* ---------- Code ---------- */
.code { margin: 0 0 18px; }
.code-title {
  font-family: var(--docs-mono);
  font-size: 12px; color: var(--label);
  padding: 7px 14px;
  border: 1px solid var(--line-soft); border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--paper);
  overflow-wrap: anywhere;   /* a long file path wraps rather than widening a 360px page */
}
.code-body { position: relative; }
.code pre {
  margin: 0;
  padding: 15px 16px;
  background: var(--docs-surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--docs-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  tab-size: 4;
}
.code-title + .code-body pre { border-radius: 0 0 10px 10px; }
.code pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; overflow-wrap: normal; }
.copy {
  position: absolute; top: 8px; right: 8px;
  font: 500 11px/1 var(--docs-mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--label); background: var(--paper);
  border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 6px 8px; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
}
.code-body:hover .copy, .copy:focus-visible, .copy[data-copied] { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }

/* Pygments tokens: one green for keywords, a green-ink for strings, label for comments. */
.code .k, .code .kd, .code .kn, .code .kr, .code .kt, .code .kc, .code .kp, .code .ow { color: var(--signal-deep); }
.code .s, .code .s1, .code .s2, .code .sb, .code .sc, .code .sd, .code .se, .code .sh, .code .si, .code .sx,
.code .sa, .code .dl, .code .nt + .s { color: var(--docs-string); }
.code .c, .code .c1, .code .cm, .code .cs, .code .cp, .code .cpf, .code .ch, .code .gp { color: var(--label); }
.code .c, .code .c1, .code .cm, .code .cs { font-style: italic; }
.code .nc, .code .nf, .code .fm, .code .nn, .code .nd, .code .na { color: var(--ink); font-weight: 500; }
.code .nt { color: var(--signal-deep); }
.code .m, .code .mi, .code .mf, .code .mh, .code .il { color: var(--ink); }
.code .p, .code .o { color: var(--body); }
.code .go { color: var(--body); }

/* ---------- Tabs ---------- */
.tabs { margin: 0 0 18px; }
.tab-list {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 12px;
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font: 600 13.5px/1 "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--label);
  padding: 9px 12px 10px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }
.tab-panel[data-hidden] { display: none; }
.tab-label { display: none; }
.tab-panel > .code:last-child, .tab-panel > p:last-child, .tab-panel > ul:last-child, .tab-panel > ol:last-child { margin-bottom: 0; }
/* The mediation switcher (Backfill): a second axis, drawn as pills so it reads apart from the engine tabs inside it. */
.tabs[data-tabs="mediation"] > .tab-list { border-bottom: 0; gap: 8px; margin-bottom: 14px; }
.tabs[data-tabs="mediation"] > .tab-list > .tab { border: 1px solid var(--line-soft); border-radius: 999px; padding: 7px 14px; margin-bottom: 0; }
.tabs[data-tabs="mediation"] > .tab-list > .tab[aria-selected="true"] { border-color: var(--signal); background: var(--docs-wash); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; -webkit-overflow-scrolling: touch; }
.docs-article table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.docs-article th, .docs-article td {
  text-align: left; vertical-align: top;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.docs-article th {
  font-family: var(--docs-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500;
  color: var(--label);
  border-bottom: 1px solid var(--docs-line);
  white-space: nowrap;
}
.docs-article td code { white-space: normal; overflow-wrap: break-word; }
.docs-article th code { background: none; padding: 0; font-size: inherit; color: inherit; }
/* Name-per-language tables (five columns) set smaller, so all five fit the reading column. */
.docs-article table[data-cols="5"], .docs-article table[data-cols="6"] { font-size: 13px; }
.docs-article table[data-cols="5"] td code, .docs-article table[data-cols="6"] td code { font-size: 0.84em; padding: 1px 3px; }

/* ---------- Callouts ---------- */
.callout {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--docs-surface);
  border-left: 3px solid var(--docs-line);
}
.callout-portal { background: var(--docs-wash); border-left-color: var(--signal); }
.callout-preview { border-left-color: var(--signal-deep); }
.callout-kicker a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.callout-warning { border-left-color: var(--ink); }
.callout-kicker {
  font-family: var(--docs-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--label);
  margin-bottom: 4px !important;
}
.callout > :last-child { margin-bottom: 0; }

/* ---------- Pager and footer ---------- */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--line-soft);
}
body.docs .pager a {
  display: block; padding: 13px 15px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  color: var(--ink); font-weight: 600;
}
body.docs .pager a:hover { border-color: var(--signal-deep); text-decoration: none; }
.pager span {
  display: block;
  font-family: var(--docs-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--label); font-weight: 400; margin-bottom: 2px;
}
.pager-next { grid-column: 2; text-align: right; }

/* The site's footer (styles.css .site-footer), with the docs' link colour turned back to the site's. */
body.docs .site-footer a { color: var(--label); }

/* ---------- Narrow screens ---------- */
@media (max-width: 899px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 18px; }
  .docs-sidebar { display: none; }
  .docs-menu { display: block; }
  .docs-main { max-width: none; }
}
@media (max-width: 599px) {
  :root { --gutter: 16px; }
  .docs-article h2 { margin-top: 40px; font-size: 21px; }
  .docs-article .lede { font-size: 17px; }
  .code pre { font-size: 12.5px; padding: 13px 13px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
  .docs-version { font-size: 10px; padding: 4px 8px; }
  /* Wide tables keep readable rows and scroll inside their wrapper. */
  .docs-article th { white-space: normal; overflow-wrap: normal; word-break: keep-all; }
  .docs-article table[data-cols="3"] { min-width: 520px; }
  .docs-article table[data-cols="4"] { min-width: 760px; }
  .docs-article table[data-cols="5"], .docs-article table[data-cols="6"], .docs-article table[data-cols="7"] { min-width: 860px; }
}
/* The site's Sign up (/nav.css) needs the room on a phone; the preview banner below names the version. */
@media (max-width: 439px) {
  .docs-version { display: none; }
  .docs-header-inner .site-nav { margin-left: auto; }
}

/* ---------- Print (tools/build_pdf.py) ---------- */
@media print {
  @page { margin: 16mm 14mm; }
  body.docs { font-size: 10.5pt; }
  .docs-header, .docs-sidebar, .docs-menu, .pager, .copy, .skip-link, .header-anchor, .site-footer, .nga-consent,
  .page-actions, .copy-source, .agent-prompt-bar { display: none !important; }
  .agent-prompt-text { max-height: none; overflow: visible; font-size: 8.5pt; }
  .docs-shell { display: block; padding: 0; max-width: none; }
  .docs-main { max-width: none; }
  .tab-list { display: none; }
  .tab-panel[data-hidden] { display: block; }
  .tab-label {
    display: block; margin: 10px 0 4px !important;
    font-family: var(--docs-mono); font-size: 8pt; letter-spacing: 0.08em; text-transform: uppercase; color: var(--label);
  }
  .code pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 8.5pt; }
  .code, .callout, tr { break-inside: avoid; }
  .docs-article h2, .docs-article h3 { break-after: avoid; }
  .table-wrap { overflow: visible; }
  .docs-article td code { white-space: normal; }
}
