/* docs-kit theme. Every color comes from these tokens; --accent is set per project. */
:root {
  color-scheme: light;
  --accent: #3a6df0;
  --bg: #fcfcfb;
  --surface: #f4f4f2;
  --raised: #ffffff;
  --ink: #141416;
  --ink-2: #3d3d44;
  --muted: #6b6b74;
  --line: #e6e6e2;
  --line-strong: #d4d4cf;
  --code-bg: #f5f5f3;
  --note: #3a6df0;
  --tip: #1f8a5b;
  --warning: #b86e00;
  --danger: #c93a3a;
  --shadow: 0 12px 40px rgb(20 20 22 / 0.14);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --top-h: 56px;
  --tabs-h: 42px;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0b;
    --surface: #131315;
    --raised: #161618;
    --ink: #ececee;
    --ink-2: #c4c4ca;
    --muted: #93939c;
    --line: #232326;
    --line-strong: #2f2f33;
    --code-bg: #111113;
    --note: #7c9ef7;
    --tip: #4cc38a;
    --warning: #e9a23b;
    --danger: #f07171;
    --shadow: 0 12px 40px rgb(0 0 0 / 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #131315;
  --raised: #161618;
  --ink: #ececee;
  --ink-2: #c4c4ca;
  --muted: #93939c;
  --line: #232326;
  --line-strong: #2f2f33;
  --code-bg: #111113;
  --note: #7c9ef7;
  --tip: #4cc38a;
  --warning: #e9a23b;
  --danger: #f07171;
  --shadow: 0 12px 40px rgb(0 0 0 / 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + var(--tabs-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
  background: var(--bg);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--raised); padding: 6px 10px; }
svg { width: 18px; height: 18px; flex: none; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-row {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding-inline: 20px;
  max-width: 1440px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 6px;
}
.logo { height: 24px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  width: min(320px, 40vw);
  height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.search-btn span { flex: 1; text-align: left; }
.search-btn:hover { border-color: var(--line-strong); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.top-link { font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.top-link:hover { color: var(--ink); background: var(--surface); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.menu-btn { display: none; margin-left: -8px; }
.tabs-row {
  height: var(--tabs-h);
  display: flex;
  gap: 24px;
  padding-inline: 20px;
  max-width: 1440px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* Three columns */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: calc(var(--top-h) + var(--tabs-h));
  height: calc(100vh - var(--top-h) - var(--tabs-h));
  overflow-y: auto;
  padding: 28px 16px 40px 20px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.drawer-tabs { display: none; }
.nav-group + .nav-group { margin-top: 22px; }
.nav-group-title {
  margin: 0 0 6px;
  padding-left: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar li a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
}
.sidebar li a:hover { background: var(--surface); color: var(--ink); }
.sidebar li a.is-active {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.content { min-width: 0; padding: 40px 48px 80px; }
.page { max-width: 740px; margin: 0 auto; }
.toc {
  position: sticky;
  top: calc(var(--top-h) + var(--tabs-h));
  height: calc(100vh - var(--top-h) - var(--tabs-h));
  overflow-y: auto;
  padding: 40px 20px 40px 8px;
  font-size: 13.5px;
}
.toc-title { margin: 0 0 8px; font-weight: 600; font-size: 13px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.toc li.toc-3 a { padding-left: 24px; }
.toc li a:hover { color: var(--ink); }
.toc li a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* Page header */
.page-head { margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
.page-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.lead { margin: 12px 0 0; font-size: 18px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.page-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
}
.page-action:hover { border-color: var(--line-strong); color: var(--ink); }
.page-action svg { width: 15px; height: 15px; }

/* Prose */
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { position: relative; line-height: 1.3; text-wrap: balance; scroll-margin-top: calc(var(--top-h) + var(--tabs-h) + 16px); }
.prose h2 { margin: 48px 0 14px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.prose h3 { margin: 32px 0 10px; font-size: 1.15rem; font-weight: 600; }
.prose h4 { margin: 24px 0 8px; font-size: 1rem; font-weight: 600; }
.anchor {
  position: absolute;
  left: -1.1em;
  padding-right: 0.3em;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
}
.prose :is(h2, h3, h4):hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; color: var(--ink-2); }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose blockquote { margin: 0 0 16px; padding: 2px 0 2px 16px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); }
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  color: var(--ink);
}
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.prose th, .prose td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; background: var(--surface); color: var(--ink); }
.prose tr:last-child td { border-bottom: 0; }

/* Code */
.code { position: relative; margin: 0 0 20px; }
.code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 2;
}
.shiki, .shiki span { color: var(--shiki-light); background-color: var(--shiki-light-bg); }
.shiki { background-color: var(--code-bg) !important; }
:root[data-theme="dark"] .shiki, :root[data-theme="dark"] .shiki span { color: var(--shiki-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shiki, :root:not([data-theme="light"]) .shiki span { color: var(--shiki-dark); }
}
.shiki span { background-color: transparent; }
.code-lang {
  position: absolute;
  top: 8px;
  right: 64px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
}
.code:hover .code-copy, .code-copy:focus { opacity: 1; }
@media (hover: none) { .code-copy { opacity: 1; } }

/* Callouts */
.callout {
  --tone: var(--note);
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
  background: color-mix(in srgb, var(--tone) 7%, transparent);
}
.callout-tip { --tone: var(--tip); }
.callout-warning { --tone: var(--warning); }
.callout-danger { --tone: var(--danger); }
.callout-title { margin: 0 0 4px !important; font-size: 14px; font-weight: 600; color: var(--tone) !important; }
.callout > :last-child { margin-bottom: 0; }
.callout p { color: var(--ink-2); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 0 0 24px; }
.card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 0.15s, transform 0.15s;
}
a.card:hover { border-color: var(--accent); }
.card-title { margin: 0 0 4px !important; font-weight: 600; color: var(--ink) !important; }
.card p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

/* Steps */
.steps { counter-reset: step; margin: 0 0 24px; padding-left: 44px; position: relative; }
.steps::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.steps > h3 { counter-increment: step; margin-top: 28px; }
.steps > h3:first-child { margin-top: 0; }
.steps > h3::before {
  content: counter(step);
  position: absolute;
  left: -44px;
  top: -1px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.steps > h3 .anchor { display: none; }

/* Tabs (the component inside pages) */
.tabs { margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tab-list { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.tab-list button {
  padding: 10px 10px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab-list button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { padding: 16px 18px 2px; }
.tab-panel .code pre { border-radius: 6px; }
.tabs:not(.is-ready) .tab-panel::before { content: attr(data-label); display: block; font-weight: 600; margin-bottom: 8px; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover { border-color: var(--accent); }
.pager span { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.pager-next { text-align: right; grid-column: 2; }

/* Search */
.search[hidden] { display: none; }
.search { position: fixed; inset: 0; z-index: 50; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgb(10 10 12 / 0.45); }
.search-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-field input { flex: 1; height: 52px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); }
.search-field kbd { cursor: pointer; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.search-results a.is-active, .search-results a:hover { background: var(--surface); }
.search-results .r-title { display: block; font-weight: 600; font-size: 14.5px; }
.search-results .r-path { display: block; font-size: 12.5px; color: var(--muted); }
.search-results .r-text { display: block; font-size: 13.5px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }
.search-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* 404 */
.not-found { max-width: 560px; margin: 0 auto; padding: 96px 20px; }
.not-found h1 { margin: 0; font-size: 2.2rem; letter-spacing: -0.02em; }
.button { display: inline-block; margin-top: 12px; padding: 9px 16px; border-radius: var(--radius); background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }

/* Narrower screens */
.scrim { display: none; }
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  :root { --tabs-h: 0px; }
  .tabs-row { display: none; }
  .menu-btn { display: inline-grid; }
  .topbar-row { padding-inline: 16px; gap: 10px; }
  .search-btn { width: 36px; padding: 0; justify-content: center; margin-left: auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .top-link { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    height: 100%;
    width: min(300px, 86vw);
    background: var(--bg);
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    padding-top: 20px;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow); }
  .scrim.is-open { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(10 10 12 / 0.4); }
  .drawer-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
  .drawer-tab { font-size: 14px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); }
  .drawer-tab.is-active { border-color: var(--accent); color: var(--accent); }
  .content { padding: 28px 16px 64px; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
