/* OpenSAI Documentation — Paper & Ink Design System (matches website/assets/css/site.css) */
@font-face{font-family:"Inter";font-style:normal;font-weight:100 900;font-display:swap;src:url("../../assets/fonts/inter-latin-wght-normal.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:100 900;font-display:swap;src:url("../../assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+20A0-20AB}
@font-face{font-family:"Newsreader";font-style:normal;font-weight:200 800;font-display:swap;src:url("../../assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2")}
@font-face{font-family:"Newsreader";font-style:italic;font-weight:200 800;font-display:swap;src:url("../../assets/fonts/newsreader-latin-opsz-italic.woff2") format("woff2")}
@font-face{font-family:"Geist Mono";font-style:normal;font-weight:100 900;font-display:swap;src:url("../../assets/fonts/geist-mono-latin-wght-normal.woff2") format("woff2")}

:root {
  --paper: #faf9f5;
  --paper-2: #f4f1e8;
  --paper-3: #ebe7dc;
  --ink: #1f1e1d;
  --ink-2: #57554f;
  --ink-3: #87847c;
  --line: rgba(31, 30, 29, 0.11);
  --line-2: rgba(31, 30, 29, 0.22);
  --clay: #c96442;
  --clay-soft: rgba(201, 100, 66, 0.11);
  --sky: #3d729e;
  --code-bg: #161514;
  --code-fg: #f0ede6;
  --display: "Newsreader", Georgia, "Songti SC", serif;
  --sans: "Inter", system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: "Geist Mono", "SF Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --paper: #11100f;
  --paper-2: #191816;
  --paper-3: #23211f;
  --ink: #f2efe8;
  --ink-2: #b8b4aa;
  --ink-3: #858178;
  --line: rgba(242, 239, 232, 0.11);
  --line-2: rgba(242, 239, 232, 0.22);
  --clay: #d97757;
  --clay-soft: rgba(217, 119, 87, 0.14);
  --sky: #7fafd9;
  --code-bg: #1b1a18;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 78px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--clay); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Topbar */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.docs-header-in {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand-link:hover { text-decoration: none; }
.brand-link svg { width: 22px; height: 22px; }
.brand-link .dot-a { fill: var(--clay); }
.brand-link .dot-b { fill: var(--sky); }
.brand-sep { width: 1px; height: 16px; background: var(--line-2); }
.brand-sub { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }

.top-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.pill-btn:hover { background: var(--paper-2); text-decoration: none; }
.pill-btn.solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.pill-btn.solid:hover { opacity: 0.9; }

/* 3-Column Layout */
.docs-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 224px;
  gap: 44px;
  align-items: start;
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 76px;
  padding: 20px 0 40px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.side-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px 10px;
}
.side-nav {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav a {
  display: block;
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.side-nav a:hover { background: var(--paper-2); color: var(--ink); }
.side-nav a.active {
  background: var(--clay-soft);
  color: var(--clay);
  font-weight: 600;
}
.side-meta {
  margin: 16px 10px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.55;
}

/* Article */
.docs-main {
  padding: 34px 0 88px;
  min-width: 0;
  max-width: 820px;
}
.doc-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--clay);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.doc-h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 3.2vw, 2.65rem);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
}
.doc-lead {
  font-size: 17px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0 0 20px;
}
.doc-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.docs-main h2 {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 520;
  letter-spacing: -0.015em;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.docs-main h3 {
  font-size: 1.12rem;
  font-weight: 650;
  margin: 26px 0 10px;
  color: var(--ink);
}
.docs-main h4 {
  font-size: 1rem;
  font-weight: 650;
  margin: 18px 0 8px;
}
.h-anchor { color: inherit; text-decoration: none; }
.h-anchor:hover { color: var(--clay); text-decoration: none; }
.docs-main p { margin: 0 0 14px; }
.doc-list { margin: 0 0 16px; padding-left: 22px; }
.doc-list li { margin-bottom: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

code.inline {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 1.5px 5.5px;
  border-radius: 5px;
}
.code-block {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 12px;
  margin: 14px 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 11.5px;
  color: #a39f95;
}
.copy-code {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e6e2d8;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
}
.copy-code:hover { background: rgba(255, 255, 255, 0.1); }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.58;
}

/* Tables */
.table-scroll { overflow-x: auto; margin: 14px 0 22px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--line);
}
th {
  text-align: left;
  background: var(--paper-2);
  padding: 9px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--line-2);
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* Callouts & Figures */
.callout {
  border-radius: 10px;
  padding: 13px 16px;
  margin: 16px 0 20px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--clay);
  font-size: 14.5px;
}
.callout.warning { border-left-color: #c87d28; }
.callout.tip { border-left-color: var(--sky); }
.callout-title {
  font-weight: 650;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: var(--ink);
}
.callout p:last-child { margin-bottom: 0; }
blockquote {
  margin: 14px 0 18px;
  padding: 10px 16px;
  background: var(--paper-2);
  border-left: 3px solid var(--line-2);
  border-radius: 6px;
  color: var(--ink-2);
}
blockquote p:last-child { margin-bottom: 0; }

.doc-fig {
  margin: 20px 0 24px;
  padding: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.doc-fig img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0 auto;
}
.doc-fig figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* Prev / Next Pagination */
.doc-pager {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.pager-card {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 180px;
  text-decoration: none;
}
.pager-card:hover { border-color: var(--clay); text-decoration: none; }
.pager-card small { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.pager-card strong { color: var(--ink); font-size: 14px; }

/* Right On-Page TOC */
.docs-toc {
  position: sticky;
  top: 76px;
  padding: 24px 0;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  font-size: 13px;
}
.toc-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
}
.toc-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.toc-ul a {
  display: block;
  padding: 4.5px 0 4.5px 12px;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.4;
}
.toc-ul a:hover { color: var(--clay); }

@media (max-width: 1120px) {
  .docs-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 780px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-sidebar {
    position: static;
    max-height: none;
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--line);
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .side-meta { display: none; }
}
