/* SipLLM documentation portal — self-contained, offline, no external fonts/CDNs. */

:root {
  --bg: #ffffff; --bg-soft: #f6f8fa; --bg-sunken: #eef1f5; --surface: #ffffff;
  --text: #1c2128; --text-soft: #57606a; --text-faint: #8b949e;
  --border: #e4e8ee; --border-strong: #d0d7de;
  --accent: #0d9488; --accent-strong: #0f766e; --accent-soft: #e6f5f3;
  --accent-2: #2563eb; --warn: #b45309; --warn-soft: #fef3e2; --ok: #15803d;
  --code-bg: #f6f8fa; --code-text: #24292f;
  --chrome: #0b1220; --chrome-text: #e6edf3;
  --shadow: 0 1px 2px rgba(27,33,40,.06), 0 8px 24px rgba(27,33,40,.06);
  --radius: 10px; --sidebar-w: 272px; --toc-w: 210px; --maxw: 860px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --bg-soft: #12181f; --bg-sunken: #0a0e14; --surface: #12181f;
    --text: #e6edf3; --text-soft: #9aa5b1; --text-faint: #6b7681;
    --border: #232b35; --border-strong: #303a46;
    --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #0c2b28;
    --accent-2: #60a5fa; --warn: #f59e0b; --warn-soft: #2a1e08; --ok: #4ade80;
    --code-bg: #0a0e14; --code-text: #d6dee8; --chrome: #06090f; --chrome-text: #e6edf3;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.65;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 1000; background: var(--accent); color: #fff; padding: 10px 16px; }
.skip-link:focus { left: 0; }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px; background: var(--chrome); color: var(--chrome-text);
  border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; flex: none; }
.brand-mark { width: 18px; height: 18px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 0 0 3px rgba(45,212,191,.15); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-sub { color: #8b98a9; font-size: 13px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.version-badge { font-family: var(--mono); font-size: 12px; background: rgba(45,212,191,.14);
  border: 1px solid rgba(45,212,191,.3); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.repo-link { color: var(--chrome-text); text-decoration: none; font-size: 14px; font-weight: 600; opacity: .85; }
.repo-link:hover { opacity: 1; }
.menu-toggle { display: none; background: none; border: 0; color: var(--chrome-text); font-size: 22px; cursor: pointer; padding: 4px 8px; }

/* search */
.search { position: relative; flex: 1 1 auto; max-width: 520px; }
.search input { width: 100%; height: 38px; padding: 0 14px; font-size: 14px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 9px;
  background: rgba(255,255,255,.06); color: var(--chrome-text); }
.search input::placeholder { color: #8b98a9; }
.search input:focus { outline: 2px solid var(--accent); border-color: transparent; background: rgba(255,255,255,.1); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; z-index: 80;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow); max-height: 66vh; overflow-y: auto; padding: 6px; }
.search-results a { display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search-results a:hover, .search-results a.active { background: var(--accent-soft); }
.search-results .sr-title { font-weight: 600; font-size: 14.5px; }
.search-results .sr-title mark { background: color-mix(in srgb, var(--accent) 34%, transparent); color: inherit; padding: 0 1px; border-radius: 3px; }
.search-results .sr-meta { font-size: 12px; color: var(--text-faint); }
.search-results .sr-snip { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-results .sr-empty { padding: 14px; color: var(--text-faint); font-size: 14px; }

/* layout */
.layout { display: flex; align-items: flex-start; }
.sidebar { position: sticky; top: 60px; align-self: flex-start; width: var(--sidebar-w); flex: none;
  height: calc(100vh - 60px); overflow-y: auto; padding: 18px 12px 40px;
  background: var(--bg-soft); border-right: 1px solid var(--border); }
.nav-group { margin-bottom: 18px; }
.nav-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); padding: 4px 12px; margin-bottom: 2px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li a { display: block; padding: 6px 12px; margin: 1px 0; border-radius: 7px;
  color: var(--text-soft); text-decoration: none; font-size: 14.5px; line-height: 1.4; border-left: 2px solid transparent; }
.sidebar-nav li a:hover { background: var(--bg-sunken); color: var(--text); }
.sidebar-nav li a.active { color: var(--accent-strong); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.sidebar-scrim { display: none; }

.content { flex: 1; min-width: 0; display: flex; gap: 36px; padding: 34px 40px 80px; justify-content: center; }
.page { max-width: var(--maxw); width: 100%; min-width: 0; }
.breadcrumb { font-size: 13px; color: var(--text-faint); margin-bottom: 6px; }
.breadcrumb span { margin: 0 6px; }

/* typography */
.page h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.02em; margin: 4px 0 18px; font-weight: 800; }
.page h2 { font-size: 23px; letter-spacing: -.01em; margin: 44px 0 14px; padding-top: 12px; border-top: 1px solid var(--border); font-weight: 700; }
.page h3 { font-size: 18px; margin: 30px 0 10px; font-weight: 700; }
.page h4 { font-size: 14px; margin: 22px 0 8px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.page p { margin: 14px 0; }
.page a { color: var(--accent-2); text-decoration: none; }
.page a:hover { text-decoration: underline; }
.page ul, .page ol { padding-left: 24px; margin: 14px 0; }
.page li { margin: 6px 0; }
.page li > ul, .page li > ol { margin: 6px 0; }
.lead { font-size: 19px; line-height: 1.6; color: var(--text-soft); }
.page blockquote { margin: 18px 0; padding: 2px 18px; border-left: 3px solid var(--border-strong); color: var(--text-soft); }

/* code */
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); color: var(--code-text);
  padding: .15em .4em; border-radius: 5px; border: 1px solid var(--border); }
pre { background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; margin: 18px 0;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }

/* tables */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th.a-right, td.a-right { text-align: right; font-variant-numeric: tabular-nums; }
th.a-center, td.a-center { text-align: center; }
thead th { background: var(--bg-soft); font-weight: 700; border-bottom: 2px solid var(--border-strong); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--bg-soft); }
.ok { color: var(--ok); font-weight: 700; }

/* callouts */
.callout { border: 1px solid var(--border); border-left: 4px solid var(--accent); background: var(--surface);
  border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; box-shadow: var(--shadow); }
.callout .callout-title { font-weight: 700; margin: 0 0 6px; }
.callout > :nth-child(2) { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout.note { border-left-color: var(--accent-2); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.measured { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.key { border-left-color: var(--accent-2); }

/* hero / homepage */
.hero { margin: 6px 0 10px; padding: 36px 34px 30px; border-radius: 16px;
  background: radial-gradient(1200px 300px at 15% -20%, rgba(45,212,191,.16), transparent 60%),
              radial-gradient(900px 260px at 90% -10%, rgba(37,99,235,.14), transparent 55%), var(--bg-soft);
  border: 1px solid var(--border); }
.hero .lead { max-width: 64ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 9px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid transparent; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }

/* flow chips (homepage nav flow) */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0; }
.flow a { display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.flow a:hover { border-color: var(--accent); color: var(--accent-strong); text-decoration: none; }
.flow .arrow { color: var(--text-faint); }

/* stat + card grids */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 22px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--accent-strong); font-family: var(--mono); }
.stat .stat-label { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.stat .stat-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 22px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 16px; padding: 0; border: 0; }
.card p { margin: 0; font-size: 14.5px; color: var(--text-soft); }
.card a { font-weight: 600; }

/* badges */
.badge { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text-soft); margin: 2px 4px 2px 0; }
.badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge.exp { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.badge.no { color: var(--text-faint); }

/* diagrams */
.diagram { margin: 22px 0; text-align: center; overflow-x: auto; }
.diagram svg { max-width: 100%; height: auto; }
figure { margin: 22px 0; } figcaption { font-size: 13px; color: var(--text-faint); text-align: center; margin-top: 8px; }

/* toc */
.toc { position: sticky; top: 84px; align-self: flex-start; width: var(--toc-w); flex: none; font-size: 13.5px; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; color: var(--text-soft); text-decoration: none; border-left: 2px solid transparent; }
.toc li.toc-h3 a { padding-left: 26px; font-size: 13px; color: var(--text-faint); }
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }

/* prev/next */
.page-footer-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--border); }
.pn { flex: 1; }
a.pn { display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--surface); }
a.pn:hover { border-color: var(--accent); text-decoration: none; }
a.pn.next { text-align: right; }
a.pn span { display: block; font-size: 12px; color: var(--text-faint); margin-bottom: 3px; }

/* footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 26px 40px; font-size: 13.5px;
  color: var(--text-soft); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.site-footer code { font-size: 12px; }
.footer-meta { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

/* responsive */
@media (max-width: 1080px) { .toc { display: none; } .content { padding: 30px 28px 70px; } }
@media (max-width: 820px) {
  .menu-toggle { display: inline-block; }
  .brand-sub { display: none; }
  .search { max-width: none; }
  .sidebar { position: fixed; top: 60px; left: 0; z-index: 50; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow); width: 82%; max-width: 320px; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 60px 0 0 0; z-index: 40; background: rgba(4,8,15,.45); }
  .content { padding: 24px 18px 60px; }
  .page h1 { font-size: 28px; } .hero { padding: 24px 20px; }
}
