/* railbed.io/docs. Values mirror design-system/tokens/tokens.css (DESIGN.md §3–5, §8 code window); copied to
   site/public by scripts/build-site.py. Reading first: one calm column, the §8 code window for every example, and
   hairline "rails" for navigation: the page you're on and the section you're reading sit on a 1px track, marked by
   a short ink segment that follows you down the page. */
:root {
  color-scheme: light;
  --paper: #F6F5F1;
  --surface: #FFFFFF;
  --stone: #EFEEE9;
  --wash: #FAF9F6;
  --ink: #0E0E0D;
  --ink-hover: #2A2A28;
  --text: #2E2D2A;
  --body: #4F4E4A;
  --muted: #6A6964;
  --faint: #8C8B85;
  --border: #E2E0DA;
  --border-subtle: #ECEBE5;
  --border-strong: #D6D4CD;
  --border-input: #8C8B85;
  --green: #1F7A4D;
  --amber: #9A6414;
  --red: #B4402F;
  --code-bg: #111111;
  --code-border: #242423;
  --code-text: #DAD8D2;
  --code-strong: #F2F0EA;
  --code-muted: #8A8983;
  --code-gutter: #4A4A47;
  --code-string: #A8D8B6;
  --code-literal: #E7C79A;
  --code-ok: #7FD6A0;
  --code-bad: #E8826F;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --top: 60px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --shadow-3: 0 1px 2px rgba(14, 14, 13, .05), 0 12px 32px rgba(14, 14, 13, .10);
  --touch-target: 48px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h, var(--top)) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--ink);
}
::selection { background: rgba(31, 122, 77, .16); color: var(--ink); }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--border-strong); transition: text-decoration-color .15s; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: 16px; top: -48px; padding: 8px 12px; background: var(--ink); color: #FFFFFF; border-radius: 4px; z-index: 30; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.dtop { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--border); }
.dtop__in { max-width: 1360px; margin: 0 auto; height: var(--top); padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.dtop__brand { display: inline-flex; align-items: baseline; gap: 12px; text-decoration: none; flex-shrink: 0; }
.dtop__word { font: 400 25px/1 var(--font-serif); letter-spacing: -0.02em; color: var(--ink); }
.dtop__docs { font: 500 14px/1 var(--font-sans); color: var(--muted); padding-left: 12px; border-left: 1px solid var(--border-strong); }
.dtop__links { display: flex; align-items: center; gap: 22px; margin-left: auto; font-size: 14px; }
.dtop__links a { text-decoration: none; color: var(--text); white-space: nowrap; }
.dtop__links a:hover { color: var(--ink); }
.dtop__cta { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 4px; background: var(--ink); color: #FFFFFF !important; font-weight: 500; }
.dtop__cta:hover { background: var(--ink-hover); }
.dtop__menu { display: none; margin-left: auto; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font: 500 14px var(--font-sans); color: var(--ink); cursor: pointer; }

/* Search */
.dsearch { position: relative; width: min(320px, 32vw); }
.dsearch__input {
  width: 100%; height: 36px; padding: 0 34px 0 12px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); font: 400 14px var(--font-sans); color: var(--ink); -webkit-appearance: none; appearance: none;
  transition: border-color .15s;
}
.dsearch__input::placeholder { color: var(--faint); }
.dsearch__input:hover { border-color: var(--border-input); }
.dsearch__input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 122, 77, .14); }
.dsearch__input::-webkit-search-cancel-button { display: none; }
.dsearch__key { position: absolute; right: 8px; top: 8px; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; font: 500 11.5px/18px var(--font-mono); color: var(--muted); text-align: center; background: var(--wash); pointer-events: none; }
.dsearch__input:focus + .dsearch__key { display: none; }
.dsearch__results { position: absolute; top: calc(100% + 8px); left: 0; width: min(520px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-3); }
.dsearch__results li a { display: block; padding: 10px 12px; border-radius: 6px; text-decoration: none; }
.dsearch__results li a[aria-selected='true'], .dsearch__results li a:hover { background: var(--stone); }
.dsearch__hit-title { display: block; font: 500 14px/1.35 var(--font-sans); color: var(--ink); }
.dsearch__hit-where { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.dsearch__hit-text { display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--body); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dsearch__empty { padding: 14px 12px; font-size: 14px; color: var(--muted); }

/* ---------- Layout ---------- */
.dshell { max-width: 1360px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 232px minmax(0, 1fr) 208px; gap: 56px; }
.dnav { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 36px 4px 56px 0; scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .2s; }
.dnav:hover, .dnav:focus-within, .dtoc:hover { scrollbar-color: var(--border-strong) transparent; }
.dnav__group + .dnav__group { margin-top: 26px; }
.dnav__label { margin: 0 0 8px; font: 500 13px/1.3 var(--font-sans); color: var(--ink); }
.dmain { min-width: 0; max-width: 736px; padding: 44px 0 96px; }
.dtoc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 44px 0 40px; scrollbar-width: thin; scrollbar-color: transparent transparent; }

/* The rail: a 1px track; the current item carries a short ink segment. In the page contents the segment glides to
   the section being read (docs.js); in the page list it marks the page you're on. */
.rail { position: relative; margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--border); }
.rail a { position: relative; display: block; padding: 5px 0 5px 14px; font-size: 14px; line-height: 1.4; color: var(--muted); text-decoration: none; transition: color .15s; }
.rail a:hover { color: var(--ink); }
.dnav .rail a[aria-current='page'] { color: var(--ink); font-weight: 500; }
.dnav .rail a[aria-current='page']::before { content: ''; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 1.5px; background: var(--ink); border-radius: 1px; }
.rail__marker { position: absolute; left: -1px; top: 0; width: 1.5px; height: 0; background: var(--ink); border-radius: 1px; opacity: 0; transition: transform .26s var(--ease-out), height .26s var(--ease-out), opacity .2s; pointer-events: none; }
.rail__marker.is-on { opacity: 1; }
.dtoc__label { margin: 0 0 10px; font: 500 13px/1.3 var(--font-sans); color: var(--ink); }
.dtoc .rail a { font-size: 13.5px; padding: 4px 0 4px 14px; }
.dtoc .toc__l3 a { padding-left: 26px; font-size: 13px; }
.dtoc .rail a.is-active { color: var(--ink); }
.dtoc__tools { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; }
.dtoc__tools a, .dtoc__copy { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.dtoc__tools a:hover, .dtoc__copy:hover { color: var(--ink); }

/* ---------- Article ---------- */
.crumbs { display: flex; gap: 8px; margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
h1 { margin: 0; font: 400 48px/1.06 var(--font-serif); letter-spacing: -0.028em; text-wrap: balance; }
.dlead { margin: 16px 0 0; max-width: 62ch; font-size: 19px; line-height: 1.55; color: var(--body); text-wrap: pretty; }
.prose { margin-top: 40px; }
.prose > :first-child { margin-top: 0; }
.prose h2 { position: relative; margin: 64px 0 16px; padding-top: 36px; border-top: 1px solid var(--border); font: 400 30px/1.15 var(--font-serif); letter-spacing: -0.022em; text-wrap: balance; }
.prose > h2:first-child { padding-top: 0; border-top: 0; }
.prose h3 { position: relative; margin: 40px 0 10px; font: 500 18.5px/1.35 var(--font-sans); letter-spacing: -0.012em; }
.prose h2 + h3 { margin-top: 24px; }
.anchor { position: absolute; left: -1em; width: 1em; color: var(--faint); text-decoration: none; font: 400 .7em/1 var(--font-mono); opacity: 0; transition: opacity .15s; top: 50%; transform: translateY(-50%); }
.prose h2 .anchor { top: calc(50% + 18px); }
.prose > h2:first-child .anchor { top: 50%; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose li { font-size: 16.5px; line-height: 1.7; color: var(--body); text-wrap: pretty; hanging-punctuation: first; }
.prose p { margin: 0 0 18px; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; }
.prose li { margin: 0 0 8px; padding-left: 4px; }
.prose li::marker { color: var(--faint); }
.prose ol li::marker { font-variant-numeric: tabular-nums; }
.prose .checklist { list-style: none; padding: 0; border-top: 1px solid var(--border-subtle); }
.prose .checklist li { display: flex; gap: 14px; align-items: baseline; margin: 0; padding: 11px 2px; border-bottom: 1px solid var(--border-subtle); }
.check { flex: none; width: 13px; height: 13px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--border-input); transform: translateY(1px); }
.prose strong { font-weight: 500; color: var(--text); }
.prose em { font-style: italic; }
.prose a { overflow-wrap: anywhere; }
.prose code { font: 400 .86em/1 var(--font-mono); padding: 2px 5px; border-radius: 4px; background: var(--stone); color: var(--text); overflow-wrap: anywhere; }
.prose a code { color: var(--ink); }
.dmeta { margin: 72px 0 0; font-size: 13.5px; color: var(--muted); }
.dmeta a { color: var(--muted); }

/* Endpoint line: method and path, the way it reads in a request log. */
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 18px !important; }
.method { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; font: 500 11.5px/1 var(--font-mono); letter-spacing: .04em; }
.method--post, .method--patch, .method--put { background: var(--ink); color: #FFFFFF; }
.method--get { box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); }
.method--delete { box-shadow: inset 0 0 0 1px var(--red); color: var(--red); }
.prose code.endpoint__path { padding: 0; background: none; font-size: 15px; color: var(--ink); }
.endpoint__param { color: var(--muted); }

/* ---------- Code window (§8) ---------- */
.code { margin: 24px 0 28px; border: 1px solid var(--code-border); border-radius: 10px; background: var(--code-bg); overflow: hidden; }
.prose p + .code, .prose .endpoint + .code { margin-top: 16px; }
.code__bar { display: flex; align-items: stretch; gap: 16px; min-height: 42px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--code-border); }
.code__title { display: flex; align-items: center; font: 400 12.5px var(--font-mono); color: var(--code-muted); }
.code__tabs { display: flex; gap: 20px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.code__tabs::-webkit-scrollbar { display: none; }
.code__tabs button { padding: 0; border: 0; background: none; font: 400 13px var(--font-sans); color: var(--code-muted); cursor: pointer; white-space: nowrap; transition: color .15s; }
.code__tabs button:hover { color: var(--code-text); }
.code__tabs button[aria-selected='true'] { color: var(--code-strong); box-shadow: inset 0 -1.5px 0 var(--code-strong); }
.code__tabs button:focus-visible, .code__copy:focus-visible { outline-offset: -2px; }
.code__copy { margin-left: auto; align-self: center; height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: none; font: 400 12.5px var(--font-sans); color: var(--code-muted); cursor: pointer; }
.code__copy:hover { color: var(--code-strong); background: #1C1C1B; }
.code__caption { margin: 0 !important; padding: 12px 20px 0; font: 400 12.5px var(--font-mono) !important; color: var(--code-muted) !important; }
.code pre { margin: 0; padding: 16px 20px 18px 8px; overflow-x: auto; font: 400 13.5px/1.78 var(--font-mono); color: var(--code-text); counter-reset: ln; tab-size: 2; scrollbar-width: thin; scrollbar-color: #2E2E2C transparent; }
.code pre::-webkit-scrollbar { height: 8px; }
.code pre::-webkit-scrollbar-thumb { background: #2E2E2C; border-radius: 4px; }
.code pre:focus-visible { outline-offset: -2px; }
.code code { font: inherit; background: none; padding: 0; color: inherit; }
.ln { white-space: pre; }
.ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.4em; margin-right: 14px; text-align: right; color: var(--code-gutter); user-select: none; -webkit-user-select: none; }
.c-string { color: var(--code-string); }
.c-literal { color: var(--code-literal); }
.c-key { color: var(--code-strong); }
.c-comment { color: var(--code-muted); }
.code ::selection { background: rgba(127, 214, 160, .22); color: var(--code-strong); }
/* The response's status line, as a request log shows it ("● 200 OK"). */
.code__foot { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 20px; border-top: 1px solid var(--code-border); font: 400 12px var(--font-mono); color: var(--code-text); }
.code__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--code-ok); }
.code__dot--warn { background: var(--code-literal); }
.code__dot--bad { background: var(--code-bad); }
html.js .code__panel[hidden] { display: none; }
html:not(.js) .code__panel[hidden] { display: block; border-top: 1px solid var(--code-border); }

/* ---------- Tables ---------- */
.table { margin: 20px 0 28px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.table table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.table th { padding: 10px 16px; text-align: left; font: 500 12.5px/1.3 var(--font-sans); color: var(--muted); border-bottom: 1px solid var(--border); background: var(--wash); white-space: nowrap; }
.table td { padding: 12px 16px; vertical-align: top; color: var(--body); border-bottom: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; text-wrap: pretty; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { color: var(--ink); }
.table td.nw { white-space: nowrap; }
.table td code { font-size: 13px; }
.table td:first-child code { background: none; padding: 0; color: var(--ink); font-weight: 500; }
.req { display: inline-block; margin-left: 4px; font: 500 11.5px/1 var(--font-sans); color: var(--amber); white-space: nowrap; }

/* ---------- Callouts ---------- */
.callout { margin: 24px 0; padding: 14px 18px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.callout p { margin: 0 !important; font-size: 15.5px !important; line-height: 1.6 !important; }
.callout__label { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; font-weight: 500; color: var(--ink) !important; }
.callout__label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.callout--tip .callout__label::before { background: var(--green); }
.callout--important, .callout--warning { box-shadow: inset 0 0 0 1px rgba(154, 100, 20, .45); }
.callout--important .callout__label::before, .callout--warning .callout__label::before { background: var(--amber); }

/* ---------- Cards and pager ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 32px !important; padding: 0 !important; list-style: none; }
.cards li { margin: 0 !important; padding: 0 !important; }
.card { position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px 44px 18px 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; transition: border-color .15s; }
.card:hover { border-color: var(--border-strong); }
.card__title { font: 500 16px/1.35 var(--font-sans); color: var(--ink); }
.card__text { font-size: 14.5px; line-height: 1.5; color: var(--body); }
.card__arrow { position: absolute; right: 18px; top: 18px; color: var(--faint); transition: transform .2s var(--ease-out), color .15s; }
.card:hover .card__arrow { color: var(--ink); transform: translateX(2px); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; transition: border-color .15s; }
.pager a:hover { border-color: var(--border-strong); }
.pager__next { grid-column: 2; text-align: right; }
.pager__dir { font-size: 13px; color: var(--muted); }
.pager__title { font: 400 20px/1.25 var(--font-serif); letter-spacing: -0.015em; color: var(--ink); }

/* ---------- Footer (the site's, restyled for the docs width) ---------- */
.foot { max-width: 1360px; margin: 48px auto 0; padding: 48px 32px 40px; border-top: 1px solid var(--border); }
.foot a { text-decoration: none; }
.brand { font: 400 26px/1 var(--font-serif); letter-spacing: -0.02em; color: var(--ink); }
.foot__top { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; }
.foot__brand p { margin: 12px 0 0; max-width: 280px; font-size: 14.5px; color: var(--muted); }
.foot__cols { display: flex; gap: 72px; flex-wrap: wrap; }
.foot__cols div { display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.foot__cols a:hover { opacity: .6; }
.foot__label { margin: 0 0 2px; color: var(--muted); }
.foot__legal { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dshell { grid-template-columns: 220px minmax(0, 1fr); gap: 48px; }
  .dtoc { display: none; }
}
@media (max-width: 900px) {
  .dtop { transition: transform .32s var(--ease-out); }
  .dtop.is-away { transform: translateY(-100%); }
  .dtop__in { height: auto; min-height: var(--top); flex-wrap: wrap; row-gap: 10px; padding: 12px 20px; }
  .dtop__links { display: none; }
  .dtop__menu { display: inline-flex; align-items: center; }
  .dsearch { order: 3; width: 100%; }
  .dsearch__key { display: none; }
  .dshell { display: block; padding: 0 20px; }
  .dnav { display: none; position: static; max-height: none; padding: 20px 0 28px; border-bottom: 1px solid var(--border); }
  /* The open menu covers the page under the header, wherever the reader is. */
  .dnav.is-open { display: block; position: fixed; align-self: auto; z-index: 19; top: var(--head-h, var(--top)); left: 0; right: 0; bottom: 0; padding: 20px 20px 40px; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-bottom: 0; }
  html.menu-open { overflow: hidden; }
  .dmain { padding-top: 28px; }
  h1 { font-size: 38px; line-height: 1.08; }
  .dlead { font-size: 17.5px; }
  .prose h2 { font-size: 26px; margin-top: 52px; padding-top: 30px; }
  .prose h2 .anchor { display: none; }
  .anchor { display: none; }
  .cards, .pager { grid-template-columns: minmax(0, 1fr); }
  .pager__next { grid-column: auto; }
  .code { margin-left: -4px; margin-right: -4px; }
  .foot { padding: 40px 20px; }
  .foot__cols { gap: 40px; }
}
/* Phones: each row becomes a small block. The first cells (a field and its type) share a line, the last cell (the
   description) runs full width beneath, so no column is squeezed to a word per line. */
@media (max-width: 640px) {
  .table { overflow: visible; }
  .table table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 4px; padding: 13px 16px; border-bottom: 1px solid var(--border-subtle); }
  .table tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; }
  .table td:not(:first-child):not(:last-child) { color: var(--muted); font-size: 13.5px; }
  .table td:last-child:not(:first-child) { flex-basis: 100%; }
}
@media (any-pointer: coarse) {
  .rail a { padding-top: 10px; padding-bottom: 10px; }
  .dsearch__input { font-size: 16px; height: 44px; }
  .dtop__menu { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .rail__marker, .card__arrow, a, .dtop { transition: none; }
}
