/* docs.opnexus.dev — one stylesheet, mobile first, no external requests (no web fonts, no CDN).
   Brand colours are the same as on opnexus.dev: network blue #0073A8 and flame orange #D94F00.
   Light/dark follows the system unless the visitor picked one with the header toggle (html[data-theme]). */
:root {
  --bg: #ffffff; --bg-soft: #f4f7fa; --surface: #ffffff; --text: #0b1220; --muted: #4a5568; --border: #dbe3ec;
  --brand: #005e89; --btn: #0073a8; --flame: #b34200; --wordmark-opn: #d94f00; --wordmark-exus: #0073a8;
  --code-bg: #0b1220; --code-text: #e2e8f0; --inline-code-bg: #eef2f6; --ring: #0073a8;
  --note: #0073a8; --note-bg: #eef6fb; --warn: #b34200; --warn-bg: #fdf3ec;
  --header-h: 56px; --sidebar-w: 280px; --toc-w: 230px; --radius: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #08090b; --bg-soft: #101216; --surface: #171a1f; --text: #f4f6f8; --muted: #a4adba; --border: #2a2f37;
  --brand: #66b9dd; --flame: #f0a06a; --wordmark-opn: #e8752f; --wordmark-exus: #4aa8d4;
  --code-bg: #04050a; --inline-code-bg: #1d2128; --ring: #7dbeeb;
  --note: #4aa8d4; --note-bg: #0f1d27; --warn: #f0a06a; --warn-bg: #261a11;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08090b; --bg-soft: #101216; --surface: #171a1f; --text: #f4f6f8; --muted: #a4adba; --border: #2a2f37;
    --brand: #66b9dd; --flame: #f0a06a; --wordmark-opn: #e8752f; --wordmark-exus: #4aa8d4;
    --code-bg: #04050a; --inline-code-bg: #1d2128; --ring: #7dbeeb;
    --note: #4aa8d4; --note-bg: #0f1d27; --warn: #f0a06a; --warn-bg: #261a11;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.wordmark { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; text-decoration: none; }
.wordmark .opn { color: var(--wordmark-opn); } .wordmark .exus { color: var(--wordmark-exus); }
.docs-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; background: none; color: var(--text); border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--bg-soft); border-color: var(--border); }
.menu-btn { display: inline-grid; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-links a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .92rem; }
.top-links a:hover { background: var(--bg-soft); }
.site-link { display: none; }
@media (max-width: 599px) { .docs-tag { display: none; } .top { gap: 6px; padding: 0 8px; } .search { margin-left: 0; min-width: 0; } .top-links { margin-left: 0; flex: none; } .top-links a { padding: 6px; } }
.search { position: relative; flex: 1 1 120px; max-width: 420px; margin-left: 8px; }
.search input {
  width: 100%; height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); color: var(--text); font: inherit; font-size: .95rem;
}
.search input:focus { background: var(--surface); }
.kbd { position: absolute; right: 9px; top: 8px; font: .75rem/1 ui-monospace, monospace; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; display: none; }
.results {
  position: absolute; left: 0; right: 0; top: 44px; max-height: min(70vh, 520px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 14px 40px rgb(0 0 0 / .25); padding: 6px; min-width: min(560px, 92vw);
}
.results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.results a:hover, .results a.active { background: var(--bg-soft); }
.results .r-title { font-weight: 600; } .results .r-chapter { font-size: .78rem; color: var(--muted); }
.results .r-snip { font-size: .86rem; color: var(--muted); display: block; margin-top: 2px; }
.results mark { background: color-mix(in srgb, var(--flame) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.results .none { padding: 12px; color: var(--muted); }

/* ---------- layout ---------- */
.layout { display: block; max-width: 1500px; margin: 0 auto; }
.sidebar {
  position: fixed; z-index: 40; top: var(--header-h); bottom: 0; left: 0; width: min(88vw, 320px); overflow-y: auto; padding: 16px 12px 40px;
  background: var(--bg); border-right: 1px solid var(--border); transform: translateX(-102%); transition: transform .18s ease;
}
body.menu-open .sidebar { transform: none; box-shadow: 0 0 60px rgb(0 0 0 / .4); }
.sidebar a { display: block; color: var(--text); text-decoration: none; padding: 5px 10px; border-radius: 7px; font-size: .92rem; line-height: 1.35; }
.sidebar a:hover { background: var(--bg-soft); }
.sidebar a.current { color: var(--brand); background: var(--note-bg); font-weight: 600; }
.sidebar summary { cursor: pointer; padding: 6px 10px; border-radius: 7px; font-weight: 600; font-size: .92rem; list-style: none; position: relative; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::after { content: "›"; position: absolute; right: 10px; transition: transform .15s; color: var(--muted); }
.sidebar details[open] > summary::after { transform: rotate(90deg); }
.sidebar summary:hover { background: var(--bg-soft); }
.sidebar ul { list-style: none; margin: 0 0 6px 8px; padding: 0 0 0 8px; border-left: 1px solid var(--border); }
.side-home, .side-single { font-weight: 600; }
.side-label { margin: 18px 10px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.side-flat { border: 0 !important; margin-left: 0 !important; padding: 0 !important; }
main { padding: 24px 20px 56px; min-width: 0; outline: none; }
.toc { display: none; }
@media (min-width: 1000px) {
  .menu-btn { display: none; }
  .sidebar { transform: none; width: var(--sidebar-w); }
  .layout { padding-left: var(--sidebar-w); }
  main { padding: 36px 40px 64px; max-width: 900px; }
  .kbd { display: block; }
  .site-link { display: inline; }
}
@media (min-width: 1280px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); padding-left: var(--sidebar-w); }
  main { margin: 0 auto; width: 100%; max-width: 860px; }
  .toc { display: block; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; padding: 0 16px 0 8px; font-size: .85rem; }
  .toc-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
  .toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
  .toc a { display: block; padding: 3px 0 3px 12px; color: var(--muted); text-decoration: none; line-height: 1.35; }
  .toc a:hover, .toc a.active { color: var(--brand); }
  .toc a.active { font-weight: 600; }
  .toc .l3 a { padding-left: 24px; }
}

/* ---------- article ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.doc h1 { font-size: clamp(1.7rem, 4vw, 2.25rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 20px; }
.doc h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.2em 0 .6em; padding-top: .4em; border-top: 1px solid var(--border); letter-spacing: -0.01em; }
.doc h3 { font-size: 1.15rem; margin: 1.8em 0 .5em; }
.doc h4, .doc h5 { font-size: 1rem; margin: 1.4em 0 .4em; }
.doc :is(h2,h3,h4,h5) .anchor { margin-left: .4em; opacity: 0; text-decoration: none; font-weight: 400; color: var(--muted); }
.doc :is(h2,h3,h4,h5):hover .anchor, .doc .anchor:focus { opacity: 1; }
.doc p, .doc ul, .doc ol { margin: 0 0 1em; }
.doc li { margin: .25em 0; }
.doc li > p { margin: .3em 0; }
.doc img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.doc code { font: .88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--inline-code-bg); padding: .12em .38em; border-radius: 5px; overflow-wrap: anywhere; }
.codeblock { position: relative; margin: 0 0 1.2em; }
.codeblock pre { margin: 0; padding: 14px 16px; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); overflow-x: auto; border: 1px solid var(--border); }
.codeblock pre code { background: none; padding: 0; color: inherit; font-size: .86rem; line-height: 1.55; overflow-wrap: normal; white-space: pre; }
.copy { position: absolute; top: 8px; right: 8px; font: inherit; font-size: .75rem; padding: 3px 9px; border-radius: 6px; border: 1px solid #3b4350; background: #1b2028; color: #cfd6df; cursor: pointer; opacity: 0; transition: opacity .12s; }
.codeblock:hover .copy, .copy:focus-visible { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }
.codelang { position: absolute; top: 8px; left: 12px; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8b95a3; pointer-events: none; display: none; }
.tablewrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.doc th, .doc td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }
.callout { margin: 0 0 1.2em; padding: 10px 16px; border-left: 4px solid var(--note); background: var(--note-bg); border-radius: 0 var(--radius) var(--radius) 0; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout > :last-child { margin-bottom: 0; }
.doc-meta { margin: 40px 0 8px; font-size: .86rem; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 600; }
.pager a:hover { border-color: var(--btn); }
.pager a span { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pager .next { text-align: right; grid-column: 2; }
.pager .prev { grid-column: 1; }

/* ---------- home ---------- */
.hero { padding: 12px 0 8px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 12px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.intro { margin-bottom: 8px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 16px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--btn); box-shadow: 0 6px 24px rgb(0 115 168 / .12); }
.card h3 { margin: 0; font-size: 1.05rem; color: var(--brand); }
.card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; flex: 1; }
.card .count { font-size: .75rem; color: var(--muted); }
.home h2 { border: 0; padding-top: 0; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--border); padding: 20px; color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; max-width: 1500px; margin: 0 auto; }
.foot a { color: var(--muted); }
@media (min-width: 1000px) { .foot { padding-left: calc(var(--sidebar-w) + 40px); } }
@media print {
  .top, .sidebar, .toc, .pager, .doc-meta, .foot, .copy { display: none !important; }
  .layout { padding: 0; display: block; } main { padding: 0; max-width: none; }
  .codeblock pre { white-space: pre-wrap; border: 1px solid #999; background: #fff; color: #000; }
}

.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.btn { display: inline-block; padding: 9px 18px; border-radius: 8px; background: var(--btn); color: #fff !important; font-weight: 600; text-decoration: none; }
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--brand) !important; border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--btn); }

/* ---------- API reference ---------- */
.op { margin: 0 0 2rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.op-h { font-size: 1.05rem; margin: 0 0 .3em; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.op-h code { font-size: .95rem; background: none; padding: 0; }
.op-h .anchor { opacity: 0; text-decoration: none; color: var(--muted); }
.op-h:hover .anchor { opacity: 1; }
.op-sum { margin: 0 0 .6em; color: var(--muted); }
.op h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1em 0 .4em; }
.m { display: inline-block; min-width: 4.2em; text-align: center; font: 700 .72rem/1 ui-monospace, monospace; padding: 4px 7px; border-radius: 5px; color: #fff; }
.m-get { background: #0b7a4b; } .m-post { background: #005e89; } .m-put, .m-patch { background: #8a5a00; } .m-delete { background: #a4262c; }
.req { color: var(--flame); font-weight: 700; }
table.fields td:first-child { white-space: nowrap; }

details.schema { margin: 0 0 .8em; }
details.schema > summary { cursor: pointer; font-size: .88rem; color: var(--brand); padding: 2px 0; }
details.schema[open] > summary { margin-bottom: .5em; }
.toc a { overflow-wrap: anywhere; }
.doc > .op:first-of-type { border-top: 0; padding-top: 0; }

.op-perm { margin: 0 0 .6em; font-size: .88rem; color: var(--muted); }
.op-perm code { font-size: .85em; }
