:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f6f8fa;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --link: #0969da;
  --active: #ddf4ff;
  --code: rgba(175, 184, 193, 0.2);
  --syntax-comment: #6e7781;
  --syntax-keyword: #cf222e;
  --syntax-string: #0a3069;
  --syntax-function: #8250df;
  --syntax-number: #0550ae;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0d1117;
    --panel: #161b22;
    --text: #e6edf3;
    --muted: #8d96a0;
    --border: #30363d;
    --link: #58a6ff;
    --active: rgba(56, 139, 253, 0.15);
    --code: rgba(110, 118, 129, 0.4);
    --syntax-comment: #8b949e;
    --syntax-keyword: #ff7b72;
    --syntax-string: #a5d6ff;
    --syntax-function: #d2a8ff;
    --syntax-number: #79c0ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #161b22;
  --text: #e6edf3;
  --muted: #8d96a0;
  --border: #30363d;
  --link: #58a6ff;
  --active: rgba(56, 139, 253, 0.15);
  --code: rgba(110, 118, 129, 0.4);
  --syntax-comment: #8b949e;
  --syntax-keyword: #ff7b72;
  --syntax-string: #a5d6ff;
  --syntax-function: #d2a8ff;
  --syntax-number: #79c0ff;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1440px;
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 11px; }
.butterfly-logo {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  transform-origin: 50% 52%;
  will-change: transform, opacity, filter;
}
.butterfly-logo.is-flying {
  animation: butterfly-fly-away 3.1s cubic-bezier(.42, 0, .2, 1) forwards;
  pointer-events: none;
}
@keyframes butterfly-fly-away {
  0% { opacity: 1; filter: drop-shadow(0 1px 0 rgba(15, 23, 42, 0)); transform: translate3d(0, 0, 0) rotate(0deg) scaleX(1) scaleY(1); }
  10% { transform: translate3d(.05rem, 0, 0) rotate(-1deg) scaleX(.32) scaleY(1.08); }
  20% { transform: translate3d(.12rem, -.04rem, 0) rotate(1deg) scaleX(1.18) scaleY(.94); }
  30% { transform: translate3d(.18rem, -.06rem, 0) rotate(-1deg) scaleX(.36) scaleY(1.07); }
  34% { transform: translate3d(.45rem, -.18rem, 0) rotate(2deg) scaleX(.72) scaleY(1); }
  38% { transform: translate3d(.95rem, -.42rem, 0) rotate(5deg) scaleX(1.12) scaleY(.95); }
  41% { transform: translate3d(2.3rem, -.9rem, 0) rotate(10deg) scaleX(.76) scaleY(1.02); }
  44% { filter: drop-shadow(0 8px 8px rgba(15, 23, 42, .18)); transform: translate3d(4.8rem, -1.55rem, 0) rotate(14deg) scaleX(.42) scaleY(1.06); }
  50% { transform: translate3d(9vw, -3.1rem, 0) rotate(22deg) scaleX(.8) scaleY(1); }
  56% { transform: translate3d(15vw, -4.8rem, 0) rotate(26deg) scaleX(1.12) scaleY(.95); }
  62% { transform: translate3d(22vw, -6.7rem, 0) rotate(20deg) scaleX(.62) scaleY(1.04); }
  68% { transform: translate3d(30vw, -8.8rem, 0) rotate(17deg) scaleX(.36) scaleY(1.07); }
  74% { transform: translate3d(40vw, -11.2rem, 0) rotate(24deg) scaleX(.78) scaleY(1); }
  80% { transform: translate3d(52vw, -14rem, 0) rotate(29deg) scaleX(1.08) scaleY(.96); }
  87% { transform: translate3d(66vw, -17.4rem, 0) rotate(22deg) scaleX(.44) scaleY(1.05); }
  94% { opacity: 1; transform: translate3d(84vw, -21.6rem, 0) rotate(31deg) scaleX(1.05) scaleY(.98); }
  100% { opacity: 0; filter: drop-shadow(0 16px 12px rgba(15, 23, 42, 0)); transform: translate3d(105vw, -27rem, 0) rotate(36deg) scaleX(.22) scaleY(1.12); }
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-link, .theme-toggle {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
}
.header-link:hover, .theme-toggle:hover { color: var(--text); background: var(--panel); }
.theme-toggle { width: 34px; padding: 7px; cursor: pointer; }
.theme-icon { display: block; width: 18px; height: 18px; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-sun { display: block; }
  :root:not([data-theme]) .theme-moon { display: none; }
}

.mobile-nav { display: none; }
.shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 220px minmax(0, 860px);
  gap: 54px;
}
.sidebar { padding: 28px 0; }
.sidebar nav { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow: auto; }
.nav-group { margin-bottom: 24px; }
.nav-group h2 {
  margin: 0 0 7px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-link, .section-links a {
  display: block;
  padding: 4px 9px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}
.nav-link:hover, .section-links a:hover { color: var(--text); background: var(--panel); }
.nav-link[aria-current="page"] { color: var(--link); background: var(--active); font-weight: 600; }
.section-links { margin: 4px 0 0 11px; padding-left: 8px; border-left: 1px solid var(--border); }
.section-links a { padding-top: 2px; padding-bottom: 2px; font-size: 12px; }
.external::after { content: " ↗"; }

.content { min-width: 0; padding: 38px 0 80px; }
.document-header { margin-bottom: 34px; }
.document-header h1 { margin: 0; font-size: 32px; line-height: 1.2; letter-spacing: -.02em; }
.document-header p { max-width: 680px; margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.document-header .eyebrow { margin: 0 0 4px; color: var(--link); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { scroll-margin-top: 82px; line-height: 1.25; }
.prose h1 { font-size: 2em; }
.prose h2 { margin: 1.7em 0 .55em; padding-bottom: .3em; border-bottom: 1px solid var(--border); font-size: 1.5em; }
.prose h3 { margin: 1.35em 0 .5em; font-size: 1.22em; }
.prose h4 { margin: 1.1em 0 .4em; font-size: 1em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: .85em 0; }
.prose ul, .prose ol { padding-left: 2em; }
.prose li { margin: .2em 0; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { margin-left: 0; padding: 0 1em; border-left: 4px solid var(--border); color: var(--muted); }
.prose hr { margin: 2em 0; border: 0; border-top: 1px solid var(--border); }
.prose code { font: 85% ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.prose :not(pre) > code { padding: .2em .4em; border-radius: 5px; background: var(--code); }
.prose pre { padding: 16px; overflow: auto; border-radius: 6px; background: var(--panel); font-size: 13px; line-height: 1.5; tab-size: 2; }
.prose pre code { font-size: inherit; }
.prose table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; }
.prose th, .prose td { padding: 6px 13px; border: 1px solid var(--border); }
.prose th { background: var(--panel); font-weight: 600; }
.prose details { margin: 1em 0; }
.prose summary { cursor: pointer; font-weight: 600; }

.highlight .c, .highlight .cm, .highlight .c1 { color: var(--syntax-comment); }
.highlight .k, .highlight .kd, .highlight .kn { color: var(--syntax-keyword); }
.highlight .s, .highlight .s1, .highlight .s2 { color: var(--syntax-string); }
.highlight .nf, .highlight .nx { color: var(--syntax-function); }
.highlight .mi, .highlight .mf { color: var(--syntax-number); }

@media (max-width: 820px) {
  .site-header { position: static; }
  .header-inner { padding: 8px 16px; }
  .brand small { display: none; }
  .header-link { display: none; }
  .mobile-nav {
    display: flex;
    gap: 16px;
    padding: 0 16px 9px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mobile-nav a { flex: none; color: var(--muted); font-size: 13px; text-decoration: none; }
  .mobile-nav a[aria-current="page"] { color: var(--link); font-weight: 600; }
  .shell { display: block; padding: 0 18px; }
  .sidebar { display: none; }
  .content { padding-top: 28px; }
  .document-header h1 { font-size: 28px; }
}
