:root {
  --bg: #fdfcf9;
  --bg-alt: #f6f3ec;
  --fg: #1d1b17;
  --muted: #6b665c;
  --line: #e6e1d6;
  --accent: #c7861a;
  --accent-ink: #8a5a08;
  --yolk: #f4c15d;
  --code-bg: #1e1d1a;
  --code-fg: #e8e4da;
  --c-comment: #8b8577;
  --c-string: #a6d189;
  --c-number: #ef9f76;
  --c-keyword: #e5a650;
  --c-type: #85c1dc;
  --c-fn: #f2d5a0;
  --c-builtin: #ca9ee6;
  --err: #e78284;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --bg-alt: #1c1b16;
    --fg: #ece8df;
    --muted: #a39d90;
    --line: #2e2c25;
    --accent: #f0b54a;
    --accent-ink: #f4c15d;
    --code-bg: #0f0e0b;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; }
p code, li code, h3 code, td code {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 .3em;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.9rem; margin: 0 0 .4rem; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
h3 small { color: var(--muted); font-weight: 400; font-size: .85rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
section.wrap { padding-top: 72px; padding-bottom: 8px; }
.sub { color: var(--muted); margin: 0 0 28px; font-size: 1.05rem; }
.note { color: var(--muted); font-size: .88rem; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
.nav nav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; margin-left: 16px; }
.nav nav a { white-space: nowrap; }
.nav nav a { color: var(--muted); font-size: .95rem; }
.nav nav a:hover { color: var(--fg); text-decoration: none; }

/* hero */
.hero {
  padding: 72px 0 40px;
  background: radial-gradient(ellipse 60% 70% at 85% 20%, color-mix(in srgb, var(--yolk) 22%, transparent), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.4rem); margin: 14px 0 18px; letter-spacing: -.025em; }
.lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 28px; max-width: 34em; }
.pill {
  display: inline-block; font-size: .82rem; font-weight: 600;
  padding: 3px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--yolk) 18%, transparent);
}

.install { margin-bottom: 26px; }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tabs button {
  font: inherit; font-size: .85rem; cursor: pointer;
  border: 0; background: none; color: var(--muted);
  padding: 4px 10px; border-radius: 6px;
}
.tabs button[aria-selected="true"] { background: var(--bg-alt); color: var(--fg); font-weight: 600; }
.cmd {
  display: flex; align-items: center; gap: 12px;
  background: var(--code-bg); color: var(--code-fg);
  border-radius: var(--radius); padding: 12px 12px 12px 16px;
}
.cmd[hidden] { display: none; }
.cmd code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: .86rem; scrollbar-width: none; }
.cmd code::before { content: "$ "; color: var(--c-comment); }
.copy {
  font: inherit; font-size: .78rem; cursor: pointer; flex-shrink: 0;
  color: var(--code-fg); background: #ffffff14; border: 1px solid #ffffff22;
  border-radius: 6px; padding: 3px 10px;
}
.copy:hover { background: #ffffff26; }
.install .note { margin: 8px 0 0; }

.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 600;
  border: 1px solid var(--line); color: var(--fg); background: var(--bg);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--yolk); border-color: var(--yolk); color: #2a1e05; }
.btn.primary:hover { background: #f0b040; }

/* code */
.window {
  background: var(--code-bg); border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 50px -20px #0005, 0 0 0 1px #0000000d;
}
.window-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid #ffffff10; }
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ffffff22; }
.window-bar em { margin-left: 8px; color: var(--c-comment); font: .8rem var(--mono); font-style: normal; }
.window-out {
  border-top: 1px solid #ffffff10; padding: 12px 18px;
  color: var(--code-fg); font: .85rem/1.6 var(--mono);
}
.prompt { color: var(--c-comment); }
pre { margin: 0; }
pre.code, pre.diag {
  background: var(--code-bg); color: var(--code-fg);
  padding: 16px 18px; overflow-x: auto;
  font: .85rem/1.6 var(--mono);
}
.window pre.code { padding: 16px 18px; border-radius: 0; }
pre.code:not(.window pre) , pre.diag { border-radius: var(--radius); }
pre code { font-size: inherit; }
.c { color: var(--c-comment); font-style: italic; }
.s { color: var(--c-string); }
.n { color: var(--c-number); }
.k { color: var(--c-keyword); }
.t { color: var(--c-type); }
.f { color: var(--c-fn); }
.b { color: var(--c-builtin); }
pre.diag { white-space: pre-wrap; }
.diag .loc { color: var(--c-comment); }
.diag .err { color: var(--err); font-weight: 600; }

/* features */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.cards article {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.cards article p { margin: 0; color: var(--muted); font-size: .95rem; }
.cards article p code { background: var(--bg); }

/* catches */
.catches { display: grid; gap: 22px; }
.catch h3 { font-weight: 600; margin-bottom: 10px; }
.catch pre + pre { margin-top: 8px; }
.catch .note { margin: 8px 0 0; }

/* split */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 40px; align-items: start; }
.split > div > p { color: var(--muted); }
.split > div > p a { font-weight: 600; }
pre.code.shell { margin: 18px 0; }

/* performance */
.perf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.hi { font-weight: 700; color: var(--accent-ink); }
.bars { display: grid; gap: 9px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 8.5em 1fr 3em; gap: 12px; align-items: center; font-size: .88rem; }
.route { color: var(--muted); }
.track { display: grid; gap: 3px; }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--line); }
.bar.egg { background: var(--yolk); }
.ratio { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 12px 0 0; }
.key { display: inline-block; width: 12px; height: 8px; border-radius: 3px; background: var(--line); }
.key.egg { background: var(--yolk); margin-left: 10px; }

/* packages */
.pkgs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pkgs li { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; background: var(--bg-alt); }
.pkgs strong { font-family: var(--mono); font-size: 1rem; }
.pkgs .ver { margin-left: 8px; font: .8rem var(--mono); color: var(--muted); }
.pkgs p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

.status { text-align: center; max-width: 760px; }
.status p { color: var(--muted); }
.status .cta { justify-content: center; margin-top: 22px; }

footer { margin-top: 80px; border-top: 1px solid var(--line); }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 24px; color: var(--muted); font-size: .9rem; }

/* nav: current page */
.nav nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }

/* home: explore tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.tiles a {
  display: block; padding: 20px 22px; border-radius: var(--radius);
  border: 1px solid var(--line); color: var(--fg);
}
.tiles a:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-alt); }
.tiles strong { display: block; margin-bottom: 4px; }
.tiles strong::after { content: " \2192"; color: var(--accent-ink); }
.tiles span { color: var(--muted); font-size: .93rem; }
.cards article p + p { margin-top: .5em; }

/* inner pages */
.page-head { padding-top: 56px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.7rem); margin: 0 0 8px; letter-spacing: -.02em; }
.page-head > h3 { margin-top: 28px; }
.page-head .install { max-width: 640px; margin-top: 8px; }
.page-head > pre.code { max-width: 640px; }
.page-head h2 { font-size: 1.4rem; margin-top: 40px; }

.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: start; }
.doc > article { max-width: 780px; }
.toc, .side { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: .9rem; }
.toc p, .side summary { margin: 0 0 8px; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.side summary { cursor: pointer; list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.toc ul, .side ul { list-style: none; margin: 0; padding: 0; }
.toc li a, .side li a { display: block; padding: 4px 10px; border-left: 2px solid var(--line); color: var(--muted); }
.toc li a:hover, .side li a:hover { color: var(--fg); text-decoration: none; border-color: var(--accent); }
.side li a[aria-current="page"] { color: var(--fg); font-weight: 600; border-color: var(--accent); }

/* Markdown */
.prose h1 { font-size: 2.1rem; margin: 56px 0 16px; letter-spacing: -.02em; }
.prose h2 { font-size: 1.5rem; margin: 48px 0 12px; }
.prose h3 { font-size: 1.15rem; margin: 32px 0 8px; }
.prose h4 { font-size: 1rem; margin: 24px 0 6px; }
.prose > :first-child { margin-top: 0; }
.prose :is(h1, h2, h3, h4)[id] { scroll-margin-top: 80px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .25em; }
.prose pre { margin: 16px 0; }
.prose pre.code, .prose pre.diag { border-radius: var(--radius); }
.prose blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--yolk); color: var(--muted); }
.prose img { max-width: 100%; }
.table { overflow-x: auto; margin: 16px 0; }
.prose table { font-size: .9rem; }
.prose th, .prose td { text-align: left; vertical-align: top; }
.prose td[style*="right"], .prose th[style*="right"] { text-align: right; }
.prose a code { color: inherit; }

.chapters { columns: 2; column-gap: 32px; }
.chapters li { break-inside: avoid; }
.chapters .extra { list-style: none; margin-left: -1.4em; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { font-weight: 600; }
.pager .next { margin-left: auto; text-align: right; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .doc { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toc { display: none; }
  .side { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
  .side:not([open]) summary { margin: 0; }
  .hero-grid, .split, .perf { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 40px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .cards, .tiles { grid-template-columns: minmax(0, 1fr); }
  .chapters { columns: 1; }
  section.wrap { padding-top: 52px; }
  .bar-row { grid-template-columns: 7em 1fr 2.8em; }
  th, td { padding: 7px 5px; }
  table { font-size: .82rem; }
}
