/* Stable docs: cream + gold (trystable.co brand), dark follows the system. */
:root {
  --bg: #f0e8db; --raised: #e9dfc9; --sidebar: #ebe2d0; --border: #dbc9a8;
  --fg: #2a2010; --body: #4a3b24; --muted: #6f624c;
  --gold: #8a6425; --gold-fill: #b38533; --gold-soft: rgba(179, 133, 51, .14);
  --code-bg: #e6dbc4;
  --info: #3d5a80; --info-bg: rgba(61, 90, 128, .09);
  --success: #2e6b31; --success-bg: rgba(46, 125, 50, .10);
  --warning: #8a5a12; --warning-bg: rgba(179, 133, 51, .16);
  --danger: #9d3624; --danger-bg: rgba(179, 64, 44, .10);
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --head: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130e; --raised: #201b14; --sidebar: #1b1711; --border: #3a3226;
    --fg: #f3ecdf; --body: #d6ccba; --muted: #a59a86;
    --gold: #e9cc86; --gold-fill: #e9cc86; --gold-soft: rgba(233, 204, 134, .12);
    --code-bg: #262017;
    --info: #9cb8de; --info-bg: rgba(156, 184, 222, .10);
    --success: #8fcf92; --success-bg: rgba(143, 207, 146, .10);
    --warning: #e9cc86; --warning-bg: rgba(233, 204, 134, .12);
    --danger: #f0a493; --danger-bg: rgba(240, 164, 147, .10);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--body); font: 400 16px/1.7 var(--sans); }
a { color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* header */
.top { position: sticky; top: 0; z-index: 30; height: var(--head); display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { font: 400 28px/1 var(--serif); color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
.brand-docs { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 5px 7px; border: 1px solid var(--border); margin-left: -4px; }
.brand:hover, .brand-docs:hover { color: var(--gold); }
.links { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 14px; }
.links a { color: var(--body); text-decoration: none; }
.links a:hover { color: var(--gold); }
.links a.app { color: var(--bg); background: var(--fg); padding: 8px 14px; font-weight: 500; }
.links a.app:hover { background: var(--gold-fill); color: #1b1408; }
.menu { display: none; width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; cursor: pointer; padding: 10px 9px; flex-direction: column; justify-content: space-between; }
.menu span { display: block; height: 2px; background: var(--fg); }

/* search */
.search { position: relative; flex: 0 1 340px; margin-left: 18px; }
.search input { width: 100%; height: 38px; padding: 0 34px 0 12px; font: 400 15px var(--sans); color: var(--fg); background: var(--raised); border: 1px solid var(--border); border-radius: 0; outline: none; -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--gold-fill); }
.search kbd { position: absolute; right: 9px; top: 9px; font: 500 11px/18px var(--mono); padding: 0 6px; color: var(--muted); border: 1px solid var(--border); pointer-events: none; }
.search input:focus + kbd { display: none; }
.results { position: absolute; top: 44px; left: 0; width: min(520px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto; background: var(--bg); border: 1px solid var(--border); box-shadow: 0 18px 50px rgba(30, 20, 5, .18); }
.results a { display: block; padding: 11px 14px; text-decoration: none; color: var(--body); border-bottom: 1px solid var(--border); }
.results a:last-child { border-bottom: 0; }
.results a[aria-selected="true"], .results a:hover { background: var(--gold-soft); }
.results .r-title { display: block; font-weight: 600; color: var(--fg); }
.results .r-where { display: block; font: 500 11px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.results .r-snip { display: block; font-size: 14px; line-height: 1.5; color: var(--body); }
.results mark { background: var(--gold-soft); color: var(--fg); padding: 0 1px; }
.results .empty { padding: 14px; color: var(--muted); font-size: 14px; }

/* shell */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr) 230px; max-width: 1440px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--head); height: calc(100vh - var(--head)); overflow-y: auto; padding: 26px 16px 40px 20px; border-right: 1px solid var(--border); background: var(--sidebar); }
.nav-group + .nav-group { margin-top: 24px; }
.nav-label { margin: 0 0 8px; font: 500 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar ul ul { margin-left: 12px; padding-left: 10px; border-left: 1px solid var(--border); }
.sidebar a { display: block; padding: 5px 8px; font-size: 14.5px; line-height: 1.4; color: var(--body); text-decoration: none; }
.sidebar a:hover { color: var(--gold); }
.sidebar a[aria-current="page"] { color: var(--fg); font-weight: 600; background: var(--gold-soft); box-shadow: inset 2px 0 0 var(--gold-fill); }
.sidebar details > summary { list-style: none; display: flex; align-items: center; cursor: pointer; }
.sidebar details > summary::-webkit-details-marker { display: none; }
.sidebar details > summary a { flex: 1; }
.sidebar details > summary::after { content: ""; width: 7px; height: 7px; margin: 0 8px 0 4px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.sidebar details[open] > summary::after { transform: rotate(45deg); }
.sidebar-links { display: none; }
.scrim { display: none; }

/* content */
.content { min-width: 0; padding: 40px 56px 60px; }
.content > * { max-width: 760px; }
.crumb { margin: 0 0 6px; font: 500 12px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
article h1 { margin: 0 0 10px; font: 600 40px/1.15 var(--sans); letter-spacing: -.02em; color: var(--fg); }
article .lede { margin: 0 0 30px; font-size: 19px; line-height: 1.55; color: var(--muted); }
article h2 { margin: 44px 0 12px; font: 600 26px/1.25 var(--sans); letter-spacing: -.01em; color: var(--fg); }
article h3 { margin: 32px 0 8px; font: 600 20px/1.3 var(--sans); color: var(--fg); }
article h4, article h5 { margin: 26px 0 6px; font: 600 17px/1.35 var(--sans); color: var(--fg); }
article h2, article h3, article h4 { position: relative; }
.anchor { position: absolute; left: -22px; padding-right: 6px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
article p, article ul, article ol { margin: 0 0 16px; }
article li { margin: 4px 0; }
article li > p { margin: 0 0 6px; }
article strong { color: var(--fg); font-weight: 600; }
article hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
article blockquote { margin: 0 0 18px; padding: 4px 0 4px 18px; border-left: 3px solid var(--gold-fill); color: var(--body); font-style: italic; }
article blockquote p:last-child { margin: 0; }
article code { font: 400 .88em var(--mono); background: var(--code-bg); padding: 1px 5px; overflow-wrap: anywhere; }
article pre { margin: 0 0 18px; padding: 16px 18px; background: var(--code-bg); overflow-x: auto; border: 1px solid var(--border); }
article pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; overflow-wrap: normal; }
article img { max-width: 100%; height: auto; display: block; }
article figure { margin: 8px 0 24px; }
article figure img { margin: 0 auto; background: #fff; padding: 10px; border: 1px solid var(--border); }
article figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center; }
article figcaption p { margin: 0; }
.table-wrap { margin: 0 0 22px; overflow-x: auto; border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
article table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
article th { text-align: left; font-weight: 600; color: var(--fg); background: var(--raised); }
article th, article td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
article tr:last-child td { border-bottom: 0; }
article td code { overflow-wrap: normal; white-space: nowrap; }

/* GitBook blocks */
.hint { margin: 0 0 20px; padding: 14px 18px; border-left: 3px solid var(--info); background: var(--info-bg); }
.hint > :last-child { margin-bottom: 0; }
.hint-success { border-color: var(--success); background: var(--success-bg); }
.hint-warning { border-color: var(--warning); background: var(--warning-bg); }
.hint-danger { border-color: var(--danger); background: var(--danger-bg); }
.stepper { counter-reset: step; margin: 6px 0 24px; }
.step { position: relative; counter-increment: step; padding: 0 0 18px 50px; }
.step::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; display: grid; place-items: center; font: 600 14px var(--mono); color: var(--bg); background: var(--fg); }
.step:not(:last-child)::after { content: ""; position: absolute; left: 15.5px; top: 38px; bottom: 6px; width: 1px; background: var(--border); }
.step > :first-child { margin-top: 2px; }
.step h2, .step h3, .step h4 { margin-top: 0; font-size: 19px; }
.step > :last-child { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 26px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--border); background: var(--raised); color: var(--body); text-decoration: none; font-size: 14.5px; line-height: 1.5; transition: border-color .15s, transform .15s; }
.cards-even { grid-template-columns: repeat(2, 1fr); }
a.card:hover { border-color: var(--gold-fill); transform: translateY(-1px); }
.card-title { color: var(--fg); font-weight: 600; font-size: 16px; }
.card-title strong { font-weight: 600; }
a.button { display: inline-block; margin: 0 8px 10px 0; padding: 10px 18px; font-weight: 500; font-size: 15px; text-decoration: none; border: 1px solid var(--fg); }
a.button.primary { background: var(--fg); color: var(--bg); }
a.button.secondary { color: var(--fg); }
a.button:hover { background: var(--gold-fill); border-color: var(--gold-fill); color: #1b1408; }

.updated { margin: 40px 0 0; font-size: 13px; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); text-decoration: none; color: var(--fg); font-weight: 500; line-height: 1.35; }
.pager a:hover { border-color: var(--gold-fill); }
.pager span { display: block; font: 500 11px/1.6 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pager .next { text-align: right; grid-column: 2; }
.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); }

/* on this page */
.toc { position: sticky; top: var(--head); align-self: start; max-height: calc(100vh - var(--head)); overflow-y: auto; padding: 40px 20px 40px 0; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-decoration: none; border-left: 1px solid transparent; }
.toc .d3 a { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--fg); }
.toc a.on { color: var(--gold); border-left-color: var(--gold-fill); }

@media (max-width: 1200px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1000px) {
  .links { display: none; }
  .search { margin-left: auto; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .menu { display: flex; }
  .sidebar { position: fixed; z-index: 40; top: var(--head); left: 0; bottom: 0; height: auto; width: min(320px, 86vw); transform: translateX(-100%); transition: transform .2s ease; border-right: 1px solid var(--border); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .scrim { display: block; position: fixed; z-index: 35; inset: var(--head) 0 0 0; background: rgba(20, 14, 4, .4); }
  .scrim[hidden] { display: none; }
  .sidebar-links { display: flex; flex-direction: column; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); }
  .content { padding: 26px 20px 48px; }
  .anchor { display: none; }
}
@media (max-width: 560px) {
  .top { gap: 10px; padding: 0 14px; }
  .search { flex: 1 1 auto; margin-left: 4px; }
  .search kbd { display: none; }
  .search input { padding-right: 10px; }
  .results { position: fixed; top: calc(var(--head) - 1px); left: 0; width: 100vw; max-height: calc(100vh - var(--head)); border-left: 0; border-right: 0; }
  .brand { font-size: 25px; }
  .brand-docs { display: none; }
  article h1 { font-size: 31px; }
  article .lede { font-size: 17px; }
  article h2 { font-size: 22px; margin-top: 36px; }
  article h3 { font-size: 18px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .cards { grid-template-columns: 1fr; }
  article table { font-size: 14px; width: max-content; min-width: 100%; }
  article th, article td { min-width: 8.5em; max-width: 17em; padding: 8px 10px; }
  article th:first-child, article td:first-child { min-width: 5.5em; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
