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

:root {
  --paper: #f8f6f1;
  --card: #ffffff;
  --ink: #2a251f;
  --ink-soft: #5c544a;
  --ink-faint: #8a8176;
  --hairline: #e6e1d7;
  --hairline-strong: #d6cfc2;
  --accent: #1f3a8a;
  --accent-soft: #e9edf7;
  --accent-ink: #ffffff;
  --code-paper: #f2efe8;
  --code-block: #23201b;
  --code-block-ink: #ece6da;
  --method-get: #2f6b4f;
  --method-post: #1f3a8a;
  --method-put: #8a5a12;
  --method-delete: #8f2f2a;
  --radius: 0.7rem;
  --radius-small: 0.45rem;
  --shadow-card: 0 1px 2px rgb(42 37 31 / 5%), 0 1px 4px rgb(42 37 31 / 4%);
  --shadow-lift: 0 2px 6px rgb(42 37 31 / 7%), 0 8px 24px rgb(42 37 31 / 6%);
  --sidebar-width: 264px;
  --font-ui: "Geist", ui-sans-serif, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1a17;
    --card: #24211d;
    --ink: #ece6da;
    --ink-soft: #b9b0a2;
    --ink-faint: #8c8478;
    --hairline: #34302a;
    --hairline-strong: #433e36;
    --accent: #9db2ec;
    --accent-soft: #252c40;
    --accent-ink: #141a2b;
    --code-paper: #2c2924;
    --code-block: #141311;
    --method-get: #7fc4a2;
    --method-post: #9db2ec;
    --method-put: #e0b56a;
    --method-delete: #e59b95;
    --shadow-card: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-lift: 0 2px 8px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: var(--radius-small); z-index: 10; }
.skip-link:focus { left: 8px; }

.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.shell > div, .content-area { min-width: 0; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 20px 24px;
  border-right: 1px solid var(--hairline);
  background: var(--paper);
}

.wordmark { display: block; text-decoration: none; color: var(--ink); margin: 0 8px 28px; }
.wordmark-name { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; font-variation-settings: "opsz" 72; }
.wordmark-sub { display: block; font-size: 0.82rem; color: var(--ink-faint); margin-top: 2px; }

.nav-group + .nav-group { margin-top: 22px; }
.nav-group-title { margin: 0 8px 6px; font-size: 0.78rem; font-weight: 500; color: var(--ink-faint); }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-small);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.93rem;
  line-height: 1.35;
}
.nav-list a:hover { background: var(--code-paper); color: var(--ink); }
.nav-list a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-foot { margin: 28px 8px 0; font-size: 0.8rem; color: var(--ink-faint); line-height: 1.5; }

.mobile-nav { display: none; }

.content-area { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; padding: 40px 48px 80px; max-width: 1240px; }
.content-area.no-toc { grid-template-columns: minmax(0, 1fr); }

.doc {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 48px 56px 56px;
  min-width: 0;
}

.doc > :first-child { margin-top: 0; }
.doc p, .doc li { max-width: 72ch; }

.doc h1, .doc h2, .doc h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.doc h1 { font-size: 2.35rem; line-height: 1.12; margin: 0 0 0.6em; font-variation-settings: "opsz" 96; }
.doc h2 { font-size: 1.55rem; line-height: 1.2; margin: 2.4em 0 0.6em; padding-top: 1.2em; border-top: 1px solid var(--hairline); font-variation-settings: "opsz" 48; }
.doc h3 { font-size: 1.18rem; line-height: 1.3; margin: 1.9em 0 0.4em; font-variation-settings: "opsz" 24; }
.doc h1 + p { font-size: 1.08rem; color: var(--ink-soft); }

.doc ul, .doc ol { padding-left: 1.3em; }
.doc li + li { margin-top: 0.35em; }
.doc strong { font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.5em 0; }

.doc blockquote { margin: 1.4em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-small) var(--radius-small) 0; }
.doc blockquote p { margin: 0.3em 0; }

code { font-family: var(--font-mono); font-size: 0.86em; }
:not(pre) > code { background: var(--code-paper); border: 1px solid var(--hairline); border-radius: 5px; padding: 0.08em 0.38em; overflow-wrap: anywhere; }

pre {
  background: var(--code-block);
  color: var(--code-block-ink);
  border-radius: var(--radius-small);
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.55;
  margin: 1.3em 0;
  font-size: 0.92rem;
}
pre code { font-size: 0.88em; background: none; border: 0; padding: 0; color: inherit; }

.endpoint { display: inline-flex; align-items: baseline; gap: 0.5em; background: var(--code-paper); border: 1px solid var(--hairline); border-radius: 6px; padding: 0.1em 0.45em 0.1em 0.2em; max-width: 100%; }
.endpoint > code { background: none; border: 0; padding: 0; }
.method { font-family: var(--font-mono); font-size: 0.72em; font-weight: 600; padding: 0.12em 0.45em; border-radius: 4px; color: var(--card); letter-spacing: 0.02em; }
.method-get { background: var(--method-get); }
.method-post { background: var(--method-post); }
.method-put, .method-patch { background: var(--method-put); }
.method-delete { background: var(--method-delete); }

.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--hairline); border-radius: var(--radius-small); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
th { background: var(--code-paper); font-weight: 600; color: var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.toc { position: sticky; top: 40px; align-self: start; max-height: calc(100vh - 80px); overflow-y: auto; font-size: 0.86rem; }
.toc-title { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--hairline); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--ink-soft); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 40px; align-items: center; margin-bottom: 8px; }
.doc .hero h1 { font-size: 2.9rem; line-height: 1.05; margin-bottom: 0.4em; }
.hero-lede { font-size: 1.1rem; color: var(--ink-soft); margin: 0 0 1.6em; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button { display: inline-block; padding: 10px 18px; border-radius: var(--radius-small); font-weight: 600; font-size: 0.95rem; text-decoration: none; border: 1px solid var(--accent); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { box-shadow: var(--shadow-lift); }
.button-secondary { color: var(--accent); background: transparent; }
.button-secondary:hover { background: var(--accent-soft); }

.receipt-panel {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px 4px 0 0;
  padding: 20px 22px 26px;
  box-shadow: var(--shadow-lift);
  transform: rotate(1.2deg);
  position: relative;
  max-width: 330px;
  width: 100%;
  justify-self: center;
}
.receipt-panel p { margin: 0; max-width: none; }
.receipt-heading { text-align: center; font-weight: 600; margin-bottom: 6px; }
.receipt-rule { border: 0; border-top: 1px dashed var(--hairline-strong); margin: 10px 0; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; }
.receipt-row span:last-child { text-align: right; }
.receipt-signed { color: var(--accent); font-weight: 600; }
.doc .receipt-caption { margin-top: 14px; font-family: var(--font-ui); font-size: 0.78rem; color: var(--ink-faint); text-align: center; }

.paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 40px 0 8px; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.path { padding: 20px 22px; text-decoration: none; color: var(--ink); display: block; }
.path + .path { border-left: 1px solid var(--hairline); }
.path:hover { background: var(--code-paper); }
.path-title { display: block; font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; margin-bottom: 4px; color: var(--accent); }
.path-text { display: block; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5; }

.page-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--hairline); font-size: 0.85rem; color: var(--ink-faint); }

@media (max-width: 1180px) {
  .content-area { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-nav { display: block; position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--hairline); padding: 12px 16px; }
  .mobile-nav summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav .wordmark { margin: 0; }
  .mobile-nav .wordmark-name { font-size: 1.25rem; }
  .mobile-nav-toggle { font-size: 0.9rem; font-weight: 600; color: var(--accent); }
  .mobile-nav[open] .nav-groups { padding: 14px 0 4px; }
  .content-area { padding: 20px 16px 56px; }
  .doc { padding: 28px 20px 36px; }
  .doc h1 { font-size: 1.9rem; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .doc .hero h1 { font-size: 2.2rem; }
  .receipt-panel { transform: none; }
  .paths { grid-template-columns: minmax(0, 1fr); }
  .path + .path { border-left: 0; border-top: 1px solid var(--hairline); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .sidebar, .mobile-nav, .toc, .hero-actions, .paths, .skip-link { display: none !important; }
  .shell, .content-area { display: block; padding: 0; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  pre { white-space: pre-wrap; background: #f2efe8; color: #2a251f; }
  h2 { break-after: avoid; }
  tr { break-inside: avoid; }
}
