:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --text: #1f2328;
  --text-muted: #656d76;
  --border: #d0d7de;
  --brand: #6f42c1;
  --brand-strong: #5a32a3;
  --link: #0969da;
  --code-bg: #f6f8fa;
  --hl-comment: #6e7781;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-number: #0550ae;
  --hl-title: #8250df;
  --hl-attr: #0550ae;
  --hl-type: #953800;
  --hl-meta: #116329;
  --json-key: #d1b7ff;
  --json-string: #e4d0aa;
  --json-number: #21c65a;
  --json-bool: #b496e9;
  --json-null: #b496e9;
  --json-punct: #d0d7de;
  --sidebar-width: 300px;
  --topbar-height: 60px;
  --code-min-width: 600px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-alt: #161b22;
    --text: #e6edf3;
    --text-muted: #8d96a0;
    --border: #30363d;
    --brand: #a371f7;
    --brand-strong: #bc8cff;
    --link: #4493f8;
    --code-bg: #161b22;
    --hl-comment: #8b949e;
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-number: #79c0ff;
    --hl-title: #d2a8ff;
    --hl-attr: #79c0ff;
    --hl-type: #ffa657;
    --hl-meta: #7ee787;
    --json-key: #d1b7ff;
    --json-string: #e4d0aa;
    --json-number: #21c65a;
    --json-bool: #b496e9;
    --json-null: #b496e9;
    --json-punct: #d0d7de;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  display: flex;
  align-items: center;
}

.topbar .brand img {
  height: 46px;
  width: auto;
  display: block;
}

.topnav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.topnav a {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.topnav a:hover {
  color: var(--brand);
  text-decoration: none;
}

/* ---------- Home hero ---------- */
.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px 24px 40px;
  text-align: center;
}

.hero-logo {
  width: 100%;
  max-width: 460px;
  height: auto;
  margin-bottom: 24px;
}

.tagline {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 12px;
}

.hero-features {
  font-size: 20px;
  font-weight: 700;
  color: #e4d0aa;
  margin: 0 0 16px;
  white-space: nowrap;
  text-align: center;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.hero-features .sep {
  color: var(--brand);
  font-weight: 700;
  margin: 0 6px;
}

.subtagline {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0 auto 32px;
  max-width: 620px;
}

.cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  background: var(--bg-alt);
}

.btn:hover {
  text-decoration: none;
  border-color: var(--brand);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn.success {
  background: #1f9d4d;
  border-color: #1f9d4d;
  color: #ffffff;
}

.btn.success:hover {
  background: #197f3f;
  border-color: #197f3f;
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 24px;
  font-size: 14px;
}

/* ---------- Docs layout ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 24px 20px 48px;
  border-right: 1px solid var(--border);
}

.sidebar-title,
.toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.sidebar ul {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.sidebar .pages a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
}

.sidebar .pages a:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

.sidebar .pages a.active {
  background: var(--brand);
  color: #ffffff;
}

.toc ul {
  border-left: 1px solid var(--border);
}

.toc a {
  display: block;
  padding: 4px 12px;
  color: var(--text-muted);
  font-size: 14px;
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc a.active {
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 600;
}

.toc-h3 a {
  padding-left: 26px;
  font-size: 13px;
}

/* ---------- Markdown content ---------- */
.content {
  padding: 32px 48px 96px;
  min-width: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  position: relative;
  line-height: 1.25;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  scroll-margin-top: calc(var(--topbar-height) + 16px);
}

.markdown-body h1 {
  font-size: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

.markdown-body h2 {
  font-size: 1.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

.markdown-body h3 {
  font-size: 1.25em;
}

.markdown-body .anchor {
  position: absolute;
  left: -1em;
  opacity: 0;
  color: var(--text-muted);
  font-weight: 400;
  text-decoration: none;
  padding-right: 0.2em;
}

.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor {
  opacity: 1;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1em;
}

.markdown-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 6px;
}

.markdown-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
  line-height: 1.45;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

.code-wrapper {
  position: relative;
  margin: 0 0 1em;
  width: fit-content;
  min-width: min(var(--code-min-width), 100%);
  max-width: 100%;
}

.code-wrapper pre {
  margin: 0;
  width: 100%;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease-in-out, color 0.12s, border-color 0.12s;
}

.code-wrapper:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--brand);
}

.copy-btn.copied {
  opacity: 1;
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
  }
}

.markdown-body blockquote {
  margin: 0 0 1em;
  padding: 0 1em;
  color: var(--text-muted);
  border-left: 4px solid var(--border);
}

.markdown-body table {
  border-collapse: collapse;
  display: block;
  overflow: auto;
  margin: 0 0 1em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 6px 13px;
}

.markdown-body tr:nth-child(2n) {
  background: var(--bg-alt);
}

.markdown-body img {
  max-width: 100%;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 24px 20px 64px;
  }

  .toc {
    display: none;
  }
}

/* ---------- Syntax highlighting (highlight.js, build-time) ---------- */
.markdown-body pre code.hljs {
  display: block;
  color: var(--text);
}

.hljs-comment,
.hljs-quote {
  color: var(--hl-comment);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag,
.hljs-name {
  color: var(--hl-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition {
  color: var(--hl-string);
}

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-link {
  color: var(--hl-number);
}

.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: var(--hl-title);
}

.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable,
.hljs-selector-attr,
.hljs-selector-pseudo {
  color: var(--hl-attr);
}

.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_,
.hljs-built_in,
.hljs-builtin-name,
.hljs-params {
  color: var(--hl-type);
}

.hljs-meta,
.hljs-tag,
.hljs-selector-id,
.hljs-selector-class {
  color: var(--hl-meta);
}

.hljs-meta .hljs-string {
  color: var(--hl-string);
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.hljs-deletion {
  color: var(--hl-keyword);
}
