/* ---------------------------------------------------------------------------
   agensis docs — shared stylesheet.

   Deliberately the same palette, type scale and idiom as the marketing page
   (public/landing/index.html), which is a single hand-authored HTML file with
   an inline <style>. Docs are many pages rather than one, so the style is
   lifted out here instead of being repeated — but the authoring model is
   identical: plain HTML in public/, copied verbatim into dist/ by Vite, no
   build step and no framework.

   No JavaScript. Every page must read correctly with scripting off, because
   that is how crawlers and answer engines see it.
--------------------------------------------------------------------------- */

:root {
  --bg: #08090b;
  --bg-2: #0c0e12;
  --panel: #0f1218;
  --panel-2: #12161e;
  --line: rgba(232, 230, 225, 0.09);
  --line-soft: rgba(232, 230, 225, 0.05);
  --text: #e8e6e1;
  --muted: #8b909c;
  --dim: #5c6170;
  --accent: #4f9cf9;
  --accent-soft: rgba(79, 156, 249, 0.14);
  --online: #55e6a5;
  --warn: #f2b94b;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #06070a; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #06070a;
  padding: 10px 16px; border-radius: 0 0 6px 0; z-index: 100;
}
.skip:focus { left: 0; }

/* ================= NAV ================= */

nav.top {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 20px;
}
.wordmark {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 15px; font-weight: 500;
  color: var(--text); text-decoration: none; letter-spacing: -0.02em;
}
.wordmark:hover { text-decoration: none; }
.wordmark svg { display: block; }
.wordmark .tag {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim); padding-left: 10px; margin-left: 2px;
  border-left: 1px solid var(--line);
}
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav-links a {
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text); text-decoration: none;
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
}
.btn:hover { border-color: rgba(79,156,249,0.5); background: var(--accent-soft); text-decoration: none; }
.btn.primary { background: var(--accent); color: #06070a; border-color: var(--accent); }
.btn.primary:hover { background: #6cadfa; }

/* ================= LAYOUT ================= */

.shell {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.sidenav {
  position: sticky; top: 60px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 40px 0 60px;
  border-right: 1px solid var(--line-soft);
  padding-right: 20px;
}

/* Deliberately NOT a <details>: a closed <details> is hidden by a UA shadow
   slot in Chrome, not by a `display` rule on its children, so author CSS
   cannot force it open again at desktop widths. The mobile treatment below is
   a plain scroll box instead — no JavaScript, and no dependency on how a
   browser happens to implement a built-in element. */
.sidenav h2 {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
  margin: 26px 0 9px;
}
.sidenav h2:first-child { margin-top: 0; }
.sidenav ul { list-style: none; }
.sidenav li { margin: 0; }
.sidenav a {
  display: block;
  padding: 5px 10px;
  margin-left: -10px;
  border-radius: 5px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.sidenav a:hover { color: var(--text); background: rgba(232,230,225,0.04); text-decoration: none; }
.sidenav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

main {
  padding: 40px 0 100px;
  min-width: 0;
  max-width: 760px;
}

/* ================= CONTENT ================= */

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px;
}

main h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.1; letter-spacing: -0.02em;
  margin-bottom: 14px;
}
main h1 em { font-style: italic; color: var(--accent); }

.lede {
  font-size: 18px; line-height: 1.6; color: var(--muted);
  margin-bottom: 40px;
  max-width: 62ch;
}

main h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 27px; line-height: 1.2; letter-spacing: -0.01em;
  margin: 48px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
main h2:first-of-type { border-top: none; padding-top: 0; }

main h3 {
  font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em;
  margin: 30px 0 8px;
  color: var(--text);
}

main p { margin-bottom: 15px; color: var(--muted); max-width: 68ch; }
main p strong { color: var(--text); font-weight: 600; }

main ul, main ol { margin: 0 0 18px 20px; color: var(--muted); max-width: 66ch; }
main li { margin-bottom: 7px; }
main li strong { color: var(--text); font-weight: 600; }
main li > ul, main li > ol { margin-top: 7px; margin-bottom: 4px; }

code {
  font-family: var(--mono); font-size: 0.87em;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  color: #cfd4de;
  word-break: break-word;
}

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 0 0 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
pre code {
  background: none; border: none; padding: 0;
  font-size: 13px; color: #cfd4de; white-space: pre;
  word-break: normal;
}

.table-scroll { overflow-x: auto; margin-bottom: 22px; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 460px;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--muted);
}
th {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim);
  border-bottom-color: var(--line);
  white-space: nowrap;
}
td strong, td code { color: var(--text); }

.note {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--bg-2);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 0 0 22px;
}
.note p:last-child { margin-bottom: 0; }
.note .label {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}
.note.warn { border-left-color: var(--warn); }
.note.warn .label { color: var(--warn); }

/* Card grid, used on the docs index. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.card {
  display: block;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 9px;
  padding: 16px 18px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.card:hover { border-color: rgba(79,156,249,0.45); background: var(--panel); text-decoration: none; }
.card .t {
  display: block;
  font-size: 14.5px; font-weight: 600; color: var(--text);
  margin-bottom: 4px;
}
.card .d { display: block; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Previous / next footer links. */
.pager {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.pager a {
  flex: 1 1 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  text-decoration: none;
  background: var(--bg-2);
  transition: border-color 0.2s;
}
.pager a:hover { border-color: rgba(79,156,249,0.45); text-decoration: none; }
.pager .dir {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 3px;
}
.pager .t { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.pager a.next { text-align: right; }

footer.docs {
  border-top: 1px solid var(--line-soft);
  padding: 26px 0 60px;
}
.foot-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim);
}
.foot-inner .spacer { flex: 1; }
.foot-inner a { color: var(--dim); }
.foot-inner a:hover { color: var(--muted); }

/* ================= RESPONSIVE ================= */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 0; }
  .sidenav {
    position: static; max-height: none; overflow: visible;
    border-right: none; border-bottom: 1px solid var(--line-soft);
    padding: 18px 0 16px;
  }
  /* The nav becomes wrapping chips in a short scroll box, so the page content
     starts near the top of the screen instead of 16 links down. The section
     headings are dropped — they are orientation for a long sidebar, and noise
     in a two-line chip row. */
  .navgroups {
    max-height: 108px; overflow-y: auto;
    display: flex; flex-wrap: wrap; gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .sidenav h2 { display: none; }
  .sidenav ul { display: contents; }
  .sidenav a {
    margin-left: 0;
    padding: 5px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .sidenav a[aria-current="page"] { box-shadow: none; border-color: rgba(79,156,249,0.5); }
  main { padding-top: 28px; max-width: none; }
  .nav-links a.hide-m { display: none; }
  .wordmark .tag { display: none; }
}

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