:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f7f6;
  --surface-strong: #eeeeec;
  --text: #181817;
  --muted: #666662;
  --border: #dededb;
  --accent: #405c45;
  --accent-strong: #2d4532;
  --accent-soft: #edf3ee;
  --code: #f5f5f3;
  --header-height: 64px;
  --sidebar-width: 264px;
  --toc-width: 220px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #131412;
  --surface: #191b18;
  --surface-strong: #242722;
  --text: #eeeeea;
  --muted: #a3a69f;
  --border: #30342e;
  --accent: #9fc8a6;
  --accent-strong: #c0ddc4;
  --accent-soft: #1f2b21;
  --code: #1b1d1a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  width: 100%;
  height: var(--header-height);
  align-items: center;
  gap: 32px;
  padding: 0 28px;
}

.brand-group,
.brand {
  display: inline-flex;
  align-items: center;
}

.brand-group {
  gap: 9px;
  white-space: nowrap;
}

.brand {
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.brand-logo {
  display: inline-flex;
  height: 28px;
  align-items: center;
}

.brand-logo svg {
  width: auto;
  height: 28px;
}

.brand-suffix {
  border-left: 1px solid var(--border);
  padding-left: 10px;
  color: var(--muted);
  font-weight: 500;
}

.brand-attribution {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.brand-attribution:hover {
  color: var(--text);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
}

.desktop-nav a,
.mobile-nav a {
  color: var(--muted);
  text-decoration: none;
}

.desktop-nav a:hover,
.mobile-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  min-width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface);
}

.search-button {
  min-width: 190px;
  justify-content: flex-start;
  border-color: var(--border);
  padding: 0 9px;
  color: var(--muted);
}

.search-button kbd,
.home-search kbd {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.theme-moon,
:root[data-theme='dark'] .theme-sun {
  display: none;
}

:root[data-theme='dark'] .theme-moon {
  display: inline-flex;
}

.nav-action {
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.nav-action-button {
  background: var(--text);
  color: var(--bg);
}

.nav-action-button-ghost {
  border: 1px solid var(--border);
}

.mobile-menu-button,
.mobile-nav {
  display: none;
}

.mobile-menu-button .menu-close-icon {
  display: none;
}

.mobile-menu-button[aria-expanded='true'] .menu-open-icon {
  display: none;
}

.mobile-menu-button[aria-expanded='true'] .menu-close-icon {
  display: inline-flex;
}

.docs-shell {
  display: grid;
  min-height: calc(100vh - var(--header-height));
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
}

.docs-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 28px 20px 56px;
}

.docs-nav-section + .docs-nav-section {
  margin-top: 28px;
}

.docs-nav-section h2 {
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav-section a {
  display: block;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}

.docs-nav-section a:hover {
  background: var(--surface);
  color: var(--text);
}

.docs-nav-section a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.docs-main {
  min-width: 0;
}

.docs-article {
  width: min(100% - 48px, 800px);
  margin: 0 auto;
  padding: 56px 0 80px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.article-heading h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.article-description {
  max-width: 680px;
  margin: 20px 0 36px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.page-actions {
  position: relative;
  display: flex;
  flex: none;
  gap: 6px;
}

.page-actions button,
.page-actions a {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.page-actions button:hover,
.page-actions a:hover {
  background: var(--surface);
  color: var(--text);
}

.prose {
  font-size: 16px;
  line-height: 1.75;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.prose h2 {
  margin: 48px 0 16px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
  font-size: 28px;
}

.prose h3 {
  margin: 32px 0 12px;
  font-size: 21px;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose pre,
.prose blockquote {
  margin: 16px 0;
}

.prose a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}

.anchor-link {
  color: inherit !important;
  text-decoration: none;
}

.prose code {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.12em 0.35em;
  background: var(--code);
  font-size: 0.875em;
}

.prose pre {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  background: var(--code);
  line-height: 1.6;
}

.prose pre code {
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 13px;
}

.prose blockquote {
  margin-left: 0;
  border-left: 3px solid var(--border);
  padding-left: 18px;
  color: var(--muted);
}

.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

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

.prose th {
  background: var(--surface);
  font-size: 13px;
}

.callout {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 14px 18px;
  background: var(--surface);
}

.callout-info {
  border-left-color: #5a7cad;
}

.callout-warning {
  border-left-color: #ba862b;
}

.callout-tip {
  border-left-color: #4f8c5b;
}

.callout-danger {
  border-left-color: #b74b4b;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.callout > p {
  margin: 8px 0 0;
}

.callout > .callout-title {
  margin: 0;
}

.cta {
  display: flex;
  margin: 28px 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  background: var(--accent-soft);
}

.cta-column {
  align-items: flex-start;
  flex-direction: column;
}

.cta > p {
  margin: 0;
}

.cta-button {
  display: inline-flex;
  border-radius: 7px;
  padding: 8px 13px;
  background: var(--accent-strong);
  color: var(--bg) !important;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
}

.embed iframe {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.code-tabs {
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.code-tabs-header {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.code-tab.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.code-tab-panel {
  display: none;
}

.code-tab-panel.active {
  display: block;
}

.code-tab-panel pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.mermaid-container {
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  background: var(--surface);
  text-align: center;
}

.mermaid-container figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.docs-toc {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 44px 22px;
}

.docs-toc h2 {
  margin: 0 0 12px;
  font-size: 12px;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 7px 0;
}

.toc .toc-level-3 {
  padding-left: 12px;
}

.toc a {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

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

.page-pagination {
  display: grid;
  margin-top: 56px;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.page-pagination a {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 14px;
  text-decoration: none;
}

.page-pagination a:hover {
  border-color: var(--accent);
}

.page-pagination small {
  margin-bottom: 4px;
  color: var(--muted);
}

.page-pagination span {
  color: var(--accent-strong);
  font-weight: 700;
}

.page-next {
  text-align: right;
}

.mobile-sidebar-button,
.mobile-sidebar,
.mobile-sidebar-backdrop {
  display: none;
}

.home-main {
  width: min(100% - 40px, 1040px);
  margin: 0 auto;
  flex: 1;
  padding: 96px 0;
}

.home-hero {
  max-width: 720px;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(46px, 8vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.home-hero > p:not(.eyebrow) {
  max-width: 620px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.6;
}

.home-search {
  display: flex;
  width: min(100%, 420px);
  height: 48px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.home-search:hover {
  border-color: var(--accent);
}

.home-grid {
  display: grid;
  margin-top: 72px;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.home-grid a {
  min-height: 180px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px;
  text-decoration: none;
}

.home-grid a:hover {
  background: var(--surface);
}

.home-grid h2 {
  display: flex;
  margin: 0;
  justify-content: space-between;
  font-size: 20px;
}

.home-grid h2 span {
  color: var(--accent);
}

.home-grid p {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.6;
}

.home-empty {
  margin-top: 64px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  color: var(--muted);
}

.not-found-main {
  width: min(100% - 40px, 720px);
  margin: 0 auto;
  flex: 1;
  padding: 120px 0;
}

.not-found-main h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 68px);
  letter-spacing: -0.05em;
}

.not-found-main > p:not(.eyebrow) {
  margin: 20px 0 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.not-found-primary,
.not-found-search {
  display: inline-flex;
  height: 40px;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
}

.not-found-primary {
  background: var(--accent);
  color: var(--bg);
}

.not-found-search {
  background: transparent;
  color: var(--accent-strong);
}

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  width: min(100% - 40px, 1040px);
  min-height: 180px;
  margin: 0 auto;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 0;
}

.footer-brand {
  margin: 0 0 8px;
  font-weight: 700;
}

.footer-attribution {
  max-width: 320px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.footer-attribution a {
  color: var(--text);
  text-underline-offset: 3px;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-column {
  display: flex;
  min-width: 140px;
  flex-direction: column;
  gap: 8px;
}

.footer-column p {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.footer-column a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.search-dialog {
  width: min(92vw, 680px);
  margin-top: 12vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.28);
}

.search-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
}

.search-input-wrap {
  display: flex;
  height: 56px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 0 10px 0 16px;
}

.search-input-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-results {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 8px;
}

.search-results a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
}

.search-results a:hover {
  background: var(--surface);
}

.search-results small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-results span,
.search-empty {
  color: var(--muted);
  font-size: 13px;
}

.search-empty {
  margin: 0;
  padding: 24px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  opacity: 0;
  transform: translateY(8px);
  transition: 160ms ease;
  pointer-events: none;
  font-size: 13px;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 800px) {
  .header-inner {
    padding: 0 16px;
  }

  .desktop-nav,
  .brand-attribution,
  .search-button .search-label,
  .search-button kbd,
  .nav-action {
    display: none;
  }

  .search-button {
    min-width: 36px;
    justify-content: center;
    border-color: transparent;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .mobile-nav {
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding: 10px 16px 16px;
  }

  .mobile-nav:not([hidden]) {
    display: flex;
  }

  .mobile-nav a {
    padding: 9px 4px;
  }

  .docs-shell {
    display: block;
  }

  .docs-shell > .docs-sidebar {
    display: none;
  }

  .docs-article {
    width: min(100% - 32px, 760px);
    padding-top: 36px;
  }

  .article-heading {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

  .mobile-sidebar-button {
    position: fixed;
    z-index: 35;
    right: 16px;
    bottom: 16px;
    display: flex;
    height: 42px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 0 15px;
    background: var(--text);
    color: var(--bg);
    box-shadow: 0 6px 24px rgb(0 0 0 / 0.2);
    font-weight: 700;
  }

  .mobile-sidebar-backdrop:not([hidden]) {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: block;
    background: rgb(0 0 0 / 0.45);
  }

  .mobile-sidebar:not([hidden]) {
    position: fixed;
    z-index: 70;
    inset: 0 0 0 auto;
    display: block;
    width: min(88vw, 340px);
    overflow-y: auto;
    background: var(--bg);
    box-shadow: -10px 0 40px rgb(0 0 0 / 0.2);
  }

  .mobile-sidebar-header {
    position: sticky;
    top: 0;
    display: flex;
    height: var(--header-height);
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    background: var(--bg);
    font-weight: 700;
  }

  .mobile-sidebar .docs-nav {
    padding: 22px 14px 50px;
  }

  .sidebar-open {
    overflow: hidden;
  }

  .home-main {
    padding: 64px 0;
  }

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

  .home-grid a {
    min-height: 150px;
  }

  .footer-inner {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .brand-suffix {
    display: none;
  }

  .article-heading h1 {
    font-size: 34px;
  }

  .page-actions span {
    display: none;
  }

  .page-pagination {
    grid-template-columns: 1fr;
  }

  .home-hero h1 {
    font-size: 48px;
  }
}
