@font-face { font-family: 'Geist'; src: url('/fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f6f5f2;
  --ink: #1b1b1f;
  --body: #4a4a52;
  --muted: #5d5d66;
  --surface: #ffffff;
  --wash: #eeece7;
  --line: rgba(27, 27, 31, 0.09);
  --line2: rgba(27, 27, 31, 0.15);
  --font: Geist, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-w: 248px;
  --toc-w: 208px;
  --top-h: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: var(--ink); text-decoration-color: var(--line2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 20; background: var(--surface); padding: 6px 10px; }

/* ---------------------------------------------------------- top bar -- */
.top {
  position: sticky; top: 0; z-index: 10;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: rgba(246, 245, 242, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.mark-svg { width: 22px; height: 22px; display: block; }
.brand-docs { color: var(--muted); font-weight: 450; }
.top-link { margin-left: auto; font-size: 14px; line-height: 1.6; color: var(--body); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--surface); }
.top-link:hover { color: var(--ink); border-color: var(--ink); }
.nav-close { display: none; }
.menu { display: none; text-decoration: none; font: inherit; font-size: 14px; color: var(--ink); background: none; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 12px; line-height: 1.6; cursor: pointer; }

/* ----------------------------------------------------------- layout -- */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w); max-width: 1320px; margin: 0 auto; }
.nav { position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 28px 16px 40px 24px; border-right: 1px solid var(--line); }
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 10px; }
.nav ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.nav li a { display: block; padding: 5px 10px; border-radius: 7px; color: var(--body); text-decoration: none; font-size: 15px; line-height: 1.4; }
.nav li a:hover { color: var(--ink); background: rgba(27, 27, 31, 0.05); }
.nav li a[aria-current='page'] { color: var(--ink); background: var(--wash); font-weight: 550; }
.nav-foot { display: flex; flex-direction: column; gap: 2px; padding-left: 10px; font-family: var(--mono); font-size: 13px; }
.nav-foot a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.nav-foot a:hover { color: var(--ink); }

.main { min-width: 0; padding: 40px 56px 64px; }
.doc { max-width: 740px; }
.toc { position: sticky; top: var(--top-h); align-self: start; padding: 36px 24px 24px 8px; font-size: 14px; max-height: calc(100vh - var(--top-h)); overflow-y: auto; }
.toc .nav-title { margin-left: 0; }
.toc li a { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc li a:hover { color: var(--ink); }

/* ---------------------------------------------------------- content -- */
.doc h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 650; margin: 0 0 14px; }
.doc h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 620; margin: 48px 0 12px; padding-top: 4px; }
.doc h3 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 32px 0 8px; }
.doc h4 { font-size: 16px; font-weight: 600; margin: 24px 0 6px; }
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor { position: absolute; left: -0.9em; width: 0.9em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor, .anchor:focus { opacity: 1; }
.doc p, .doc ul, .doc ol { color: var(--body); margin: 0 0 16px; }
.doc > p:first-of-type { font-size: 18px; color: var(--body); }
.doc li { margin: 4px 0; }
.doc li > p { margin: 0 0 6px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.doc blockquote { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--line2); background: var(--surface); border-radius: 10px; color: var(--body); }
.doc blockquote p:last-child { margin-bottom: 0; }

.doc :not(pre) > code {
  font-family: var(--mono); font-size: 0.875em;
  background: var(--wash); color: var(--ink);
  padding: 0.12em 0.36em; border-radius: 5px;
  overflow-wrap: anywhere;
}

.code { margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line); background: rgba(27, 27, 31, 0.022); }
.code-lang { font-size: 12px; color: var(--muted); letter-spacing: 0.01em; }
.code pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--ink); tab-size: 2; }
.copy {
  font: 500 12px/1 var(--font); color: var(--body);
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 5px 8px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--line2); background: var(--surface); }
.copy.done { color: var(--ink); }

.table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); }
.table table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--body); }
.table th { color: var(--ink); font-weight: 600; background: rgba(27, 27, 31, 0.025); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td code { white-space: nowrap; }
.table td:first-child:has(> code:only-child) { width: 1%; white-space: nowrap; }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 740px; margin: 56px 0 0; }
.pager a { flex: 1; max-width: 50%; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 10px; text-decoration: none; background: var(--surface); font-weight: 550; }
.pager a span { font-size: 13px; font-weight: 400; color: var(--muted); }
.pager a:hover { border-color: var(--ink); }
.pager .next { text-align: right; margin-left: auto; }
.foot { max-width: 740px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.foot a { color: var(--muted); }

/* ------------------------------------------------------- responsive -- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 36px 40px 56px; }
}
@media (max-width: 820px) {
  .top { padding: 0 16px; }
  .menu { display: inline-block; margin-left: auto; }
  .top-link { margin-left: 0; }
  .shell { display: block; }
  .nav {
    display: none;
    position: fixed; top: var(--top-h); left: 0; right: 0; z-index: 9;
    height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); padding: 20px 16px 40px;
    background: var(--paper); border-right: 0;
  }
  .nav:target, .nav-open .nav { display: block; }
  body.nav-open { overflow: hidden; }
  .nav-close { display: block; margin: 0 0 16px 10px; font-size: 14px; color: var(--muted); }
  .main { padding: 28px 16px 48px; }
  .doc h1 { font-size: 30px; }
  .doc h2 { font-size: 22px; margin-top: 40px; }
  .doc > p:first-of-type { font-size: 17px; }
  .anchor { display: none; }
  .code { margin-left: -4px; margin-right: -4px; }
  .code pre { padding: 12px 14px 14px; font-size: 13px; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}
