:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-code: #f3f4f6;
  --sidebar-bg: #fafbfc;
  --text: #24292f;
  --text-muted: #57606a;
  --heading: #1f2328;
  --border: #d0d7de;
  --border-light: #eaeef2;
  --accent: #5b7fff;
  --accent-hover: #4468e8;
  --accent-soft: #eef2ff;
  --green: #1a7f37;
  --green-bg: #dafbe1;
  --sidebar-width: 280px;
  --header-height: 56px;
  --content-max: 920px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(27, 31, 36, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --font-size-base: 18px;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

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

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0.15em 0.35em;
}

pre {
  margin: 0;
  overflow: auto;
}

pre code {
  display: block;
  padding: 16px 18px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

pre code:not(.hljs) {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

pre code.hljs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
}

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

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--heading);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}

.site-header__brand:hover {
  text-decoration: none;
  color: var(--heading);
}

.site-header__brand img {
  height: 40px;
  width: auto;
}

.site-header__version {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

.site-header__links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-header__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.site-header__links a:hover {
  color: var(--accent);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 24px 0 48px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

.sidebar__group {
  margin-bottom: 20px;
}

.sidebar__label {
  padding: 0 20px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar nav a {
  display: block;
  padding: 6px 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}

.sidebar nav a:hover {
  color: var(--text);
  background: rgba(91, 127, 255, 0.06);
}

.sidebar nav a.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.content {
  padding: 40px 48px 80px;
}

.content__inner {
  max-width: var(--content-max);
}

/* Typography */
.page-title {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--heading);
  line-height: 1.2;
}

.lead {
  margin: 0 0 32px;
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 720px;
}

.section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.section h2 {
  margin: 0 0 16px;
  padding-bottom: 8px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--heading);
  border-bottom: 1px solid var(--border-light);
}

.section h3 {
  margin: 28px 0 12px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--heading);
}

.section p {
  margin: 0 0 16px;
}

.section ul,
.section ol {
  margin: 0 0 16px;
  padding-left: 1.4rem;
}

.section li {
  margin-bottom: 6px;
}

.section li code {
  font-size: 0.8125em;
}

.callout {
  margin: 20px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid #aceebb;
  background: var(--green-bg);
  color: #116329;
  font-size: 0.9375rem;
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

.callout--warn {
  border-color: #ffe58f;
  background: #fffbe6;
  color: #7c5e00;
}

.code-block {
  position: relative;
  margin: 16px 0 24px;
}

.code-block__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Tables (API reference) */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

thead {
  background: var(--bg-subtle);
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(91, 127, 255, 0.03);
}

td code {
  font-size: 0.8125em;
}

.tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tag--event {
  background: #f0fdf4;
  color: var(--green);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 24px;
}

.card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer a {
  font-weight: 500;
}

/* Mobile */
@media (max-width: 960px) {
  .menu-toggle {
    display: inline-block;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: min(100%, 320px);
    z-index: 90;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  }

  .sidebar.open {
    display: block;
  }

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

  .site-header__links {
    display: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-subtle: #161b22;
    --bg-code: #1c2128;
    --sidebar-bg: #010409;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --heading: #f0f6fc;
    --border: #30363d;
    --border-light: #21262d;
    --accent-soft: rgba(91, 127, 255, 0.15);
    --green-bg: rgba(35, 134, 54, 0.15);
    --shadow: none;
  }

  .callout {
    border-color: #238636;
    color: #7ee787;
  }

  .callout--warn {
    border-color: #9e6a03;
    background: rgba(158, 106, 3, 0.15);
    color: #f0c14d;
  }

  .tag--event {
    background: rgba(35, 134, 54, 0.15);
    color: #7ee787;
  }
}
