/* Petrova site: docs, guides, pages and the dashboard, in the v12 "Crimson Current" language.
   Colours, type and shapes come from tokens.css (load it first). Dark only. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
body { margin: 0; background: var(--bg); color: var(--ink-2); font: 400 var(--t-body)/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { max-width: 100%; }
::selection { background: var(--rose-deep); color: var(--ink-hi); }
a { color: var(--rose); text-decoration: none; }
a:hover { color: var(--rose-soft); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 450; color: var(--ink); margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: var(--t-h1); line-height: 1.08; letter-spacing: -.035em; }
h2 { font-size: var(--t-h2); line-height: 1.15; letter-spacing: -.025em; }
h3 { font: 600 var(--t-h3)/1.35 var(--sans); letter-spacing: -.01em; }
h4 { font: 600 15px/1.4 var(--sans); }
p { margin: 0 0 1em; }
strong { color: var(--ink); font-weight: 600; }
code, kbd, pre, .mono { font-family: var(--mono); }
:not(pre) > code { font-size: max(.9em, 12px); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: .05em .35em; overflow-wrap: anywhere; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--rose-soft); }
.dim { color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: var(--t-small); }
.tiny { font-size: var(--t-small); color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lede { font-size: var(--t-lead); line-height: 1.7; color: var(--ink-2); max-width: 640px; }
.skip { position: absolute; left: 16px; top: 0; transform: translateY(-120%); background: var(--ivory); color: var(--ivory-ink); padding: 10px 14px; z-index: 100; border-radius: var(--r-btn); }
.skip:focus { transform: none; }
.wrap, .shell { max-width: 1280px; width: calc(100% - 96px); margin-inline: auto; }
@media (max-width: 1100px) { .wrap, .shell { width: calc(100% - 72px); } }
@media (max-width: 800px) { .wrap, .shell { width: calc(100% - 48px); } }
@media (max-width: 580px) { .wrap, .shell { width: calc(100% - 40px); } }
.stack > * + * { margin-top: 1rem; }

/* Mono labels */
.eyebrow, .code-label, .label { font: 500 var(--t-label)/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow { display: block; margin-bottom: 18px; }
.eyebrow b, .label b { color: var(--rose-deep); font-weight: 500; }
.code-label { margin: 0 0 8px; }

/* Header (same as the home page) */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: var(--header-bg); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 550 28px/1 var(--display); letter-spacing: -1.6px; color: var(--ink); text-decoration: none !important; }
.brand img { width: 30px; height: 30px; }
.brand:hover { color: var(--ink-hi); }
.nav { display: flex; gap: 28px; align-items: center; }
.nav a { color: var(--ink-2); font: 400 13px var(--sans); padding: 6px 0; text-decoration: none; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--rose); }
.header-right { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.header-right .signin { color: var(--ink-2); font-size: 13px; }
.preview-chip { display: inline-flex; align-items: center; gap: 8px; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; color: var(--ink-3); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 6px 9px; white-space: nowrap; text-decoration: none !important; }
.preview-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--crimson); box-shadow: var(--glow); }
.preview-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.menu-btn { display: none; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--sec-line); border-radius: var(--r-btn); padding: 11px 13px; background: transparent; cursor: pointer; min-height: 40px; }
@media (max-width: 1100px) { .header-right .preview-chip { display: none; } .nav { gap: 20px; } }
@media (max-width: 920px) {
  .menu-btn { display: inline-block; }
  .header-right .hide-sm, .header-right .signin { display: none; }
  .nav { display: none; position: fixed; inset: 72px 0 0 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--sheet-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 12px 24px 40px; overflow-y: auto; }
  .nav.open { display: flex; }
  .nav a { font: 450 var(--t-h2)/1.2 var(--display); letter-spacing: -.02em; color: var(--ink); padding: 14px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
  .nav a[aria-current="page"] { color: var(--rose); border-bottom-color: var(--line); }
  .nav .preview-chip { display: inline-flex; align-self: flex-start; margin-top: 20px; font-size: var(--t-label); padding: 8px 10px; min-height: 0; border-bottom: 1px solid var(--line); }
}
@media (min-width: 921px) { .nav .preview-chip { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 44px; padding: 0 18px; border-radius: var(--r-btn); border: 1px solid var(--sec-line); background: transparent; color: var(--ink); font: 550 13px/1 var(--sans); text-decoration: none !important; cursor: pointer; white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .25s var(--ease-ui), box-shadow .25s, border-color .15s, background .15s, color .15s; }
.btn:hover { background: var(--sec-hover-bg); border-color: var(--sec-hover-line); color: var(--ink-hi); transform: translateY(-2px); }
.btn:active { transform: translateY(0); transition-duration: 80ms; }
.btn.primary { background: var(--ivory); color: var(--ivory-ink); border-color: var(--ivory-line); padding: 0 14px 0 20px; }
.btn.primary::after { content: "↗"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-left: 1px solid var(--ivory-cell); padding-left: 8px; font-size: 17px; font-weight: 400; }
.btn.primary.no-arrow::after { display: none; }
.btn.primary:hover { background: var(--ivory-hover); border-color: var(--ivory-hover); color: var(--ivory-ink); box-shadow: 0 4px 32px rgba(239, 84, 115, .16); }
.btn.ghost { border-color: transparent; backdrop-filter: none; color: var(--ink-2); }
.btn.ghost:hover { background: transparent; border-color: transparent; color: var(--ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.primary.sm { padding: 0 10px 0 14px; }
.btn.primary.sm::after { width: 20px; height: 20px; font-size: 15px; padding-left: 6px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-wash); color: var(--danger); border-color: var(--danger); }
.btn.dark { background: var(--ivory); color: var(--ivory-ink); border-color: var(--ivory-line); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.text-action { display: inline-flex; align-items: center; gap: 24px; color: var(--rose-soft); border-bottom: 1px solid var(--rose-line); padding-bottom: 6px; font-size: 13px; text-decoration: none !important; }
.text-action:hover { color: var(--ink-hi); border-color: var(--rose); }

/* Status labels: dot + word, no fills */
.badge { display: inline-flex; align-items: center; gap: 7px; font: 500 var(--t-label)/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; vertical-align: middle; padding: 4px 0; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.built { color: var(--ok); }
.badge.fixture { color: var(--cat-models); }
.badge.planned { color: var(--warn); }
.badge.missing, .badge.bad { color: var(--danger); }
.badge.plain { color: var(--ink-3); }
.badge.plain::before { display: none; }
.badge.mock { color: var(--rose); }
.badge + .badge { margin-left: 14px; }

/* Sections (marketing pages) */
.section { padding-block: 96px 88px; }
.section.tight { padding-block: 56px; }
.section + .section { border-top: 1px solid var(--line); }
@media (max-width: 580px) { .section { padding-block: 64px; } .section.tight { padding-block: 40px; } }
.section-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.section-top .eyebrow { margin: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin: 24px 0 40px; flex-wrap: wrap; }
.section-head h2 { font-size: var(--t-h1); letter-spacing: -.035em; margin: 0; max-width: 18ch; }
.section-head p { margin: 0; max-width: 380px; font-size: var(--t-small); line-height: 1.8; color: var(--ink-3); }
.grid { display: grid; gap: 16px; align-items: start; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid.stretch { align-items: stretch; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px; min-width: 0; }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--ink-3); font-size: 14px; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; color: inherit; text-decoration: none !important; transition: background .15s, border-color .15s; }
a.card:hover { background: var(--panel-hover); border-color: var(--line-strong); }
.card .num-label { display: block; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; color: var(--rose-deep); margin-bottom: 12px; }
.raised { background: linear-gradient(130deg, var(--raised-1), var(--raised-2)); border: 1px solid var(--line-rose); border-radius: var(--r-stage); box-shadow: var(--shadow-raised); }
.stage { background: var(--stage-bg); border: 1px solid var(--stage-line); border-radius: var(--r-stage); box-shadow: var(--shadow); }

/* Page hero for inner marketing pages: a crimson glow and the thread, no artwork */
.hero, .lock-hero { position: relative; isolation: isolate; overflow: hidden; padding-block: 104px 64px; }
.hero::before { content: ""; position: absolute; inset: -30% -10% -20% 30%; background: radial-gradient(ellipse at 62% 42%, var(--glow-soft), transparent 62%); z-index: -1; pointer-events: none; }

.hero h1, .lock-hero h1 { font-size: var(--t-hero); line-height: 1.05; letter-spacing: -.045em; max-width: 15ch; margin-bottom: 24px; }
.hero h1 .grad, .lock-hero h1 .grad { background: linear-gradient(105deg, #edc5d1, #c97b92); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { margin-bottom: 28px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: start; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 580px) { .hero, .lock-hero { padding-block: 64px 40px; } }

/* Code blocks: header row with label, tabs and Copy; scroll with a fade */
pre { margin: 0; background: transparent; color: var(--ink-2); padding: 16px 20px; overflow-x: auto; font: 400 var(--t-code)/1.7 var(--mono); tab-size: 2; }
pre code { background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.code-box { position: relative; background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; margin: 0 0 1.4em; }
.code-head { display: flex; align-items: center; gap: 18px; min-height: 40px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.code-head .code-label { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-box .copy { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); background: transparent; border: 0; padding: 10px 4px; cursor: pointer; }
.code-box .copy:hover { color: var(--ink); }
.code-box .copy.done { color: var(--ok); }
.code-box.scrolls::after { content: ""; position: absolute; right: 0; bottom: 0; top: 41px; width: 32px; background: linear-gradient(90deg, transparent, var(--bg-sunk)); pointer-events: none; }
.code-box.scrolls.at-end::after { display: none; }
.code-tabs { display: flex; gap: 16px; overflow-x: auto; }
.code-tabs button { font: 500 12px var(--mono); color: var(--ink-3); background: none; border: 0; border-bottom: 1px solid transparent; padding: 11px 0 10px; cursor: pointer; white-space: nowrap; }
.code-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--rose); }
.tok-c { color: var(--ink-4); font-style: italic; }
.tok-s { color: var(--rose-soft); }
.tok-k { color: var(--ink); }
.tok-e { color: var(--cat-models); }
.tok-p { color: var(--rose); user-select: none; }

/* Tabs */
.tabs { display: flex; gap: 26px; flex-wrap: wrap; border-bottom: 1px solid var(--line-strong); margin-bottom: 20px; }
.tabs button { background: none; border: 0; border-bottom: 1px solid transparent; padding: 13px 0; margin-bottom: -1px; font: 400 14px var(--sans); color: var(--ink-3); cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--rose); }
.pill-tabs { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--r-btn); overflow: hidden; }
.pill-tabs button { background: transparent; border: 0; border-right: 1px solid var(--line-strong); color: var(--ink-3); font: 500 13px var(--sans); padding: 0 14px; min-height: 40px; cursor: pointer; }
.pill-tabs button:last-child { border-right: 0; }
.pill-tabs button[aria-selected="true"] { background: var(--panel-hover); color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 14px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 var(--t-label)/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); border-bottom-color: var(--line-strong); padding-block: 12px; white-space: nowrap; }
td { color: var(--ink-2); }
td.r, th.r { text-align: right; }
td.r { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--t-num); }
tbody tr:hover td { background: var(--rose-wash); }
tr.us td { background: var(--rose-wash); }
tr.us td:first-child { box-shadow: inset 2px 0 0 var(--rose); color: var(--ink); }
.cmp td { min-width: 150px; }
.cmp td:first-child { min-width: 180px; color: var(--ink); }
.win { color: var(--ok); }
.lose { color: var(--danger); }
.even { color: var(--ink-3); }

/* Notices: a rule on the left, no box */
.note { border-left: 2px solid var(--info); padding: 2px 0 2px 16px; margin: 0 0 1.4em; font-size: 14px; color: var(--ink-2); }
.note.warn { border-left-color: var(--warn); }
.note.bad { border-left-color: var(--danger); }
.note.good { border-left-color: var(--ok); }
.note > :last-child { margin-bottom: 0; }
.note strong:first-child { display: block; margin-bottom: 2px; }

/* Forms */
label { font: 500 13px var(--sans); color: var(--ink-2); display: block; margin-bottom: 8px; }
input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="search"], select, textarea { width: 100%; min-height: 44px; padding: 0 14px; border-radius: var(--r-btn); border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink); font: 400 15px var(--sans); }
textarea { padding: 12px 14px; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-wash-2); }
.field { margin-bottom: 16px; }
.field .hint { font-size: var(--t-small); color: var(--ink-4); margin-top: 6px; }
.inline-field { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-field > input, .inline-field > select { flex: 1 1 160px; width: auto; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 56px calc(32px + env(safe-area-inset-bottom, 0px)); color: var(--ink-3); font-size: 13px; }
.foot-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 32px; }
@media (max-width: 820px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-grid h4, .foot-grid .foot-h { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.foot-grid a { display: block; color: var(--ink-2); padding: 4px 0; font-size: 13px; }
.foot-grid a:hover { color: var(--ink); }
.foot-grid .brand { font-size: 26px; }
.foot-legal { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font: 500 var(--t-label) var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); }

/* Docs */
.docs { display: grid; grid-template-columns: 248px minmax(0, 720px) 200px; gap: 56px; padding-block: 40px 96px; justify-content: space-between; }
@media (max-width: 1180px) { .docs { grid-template-columns: 230px minmax(0, 1fr); gap: 40px; } .toc { display: none; } }
@media (max-width: 860px) { .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.docs-side { position: sticky; top: 96px; align-self: start; max-height: calc(100dvh - 116px); overflow-y: auto; font-size: 14px; }
@media (max-width: 860px) { .docs-side { position: static; max-height: none; } .docs-side nav { display: none; } .docs-side.open nav { display: block; } }
.docs-side .side-toggle { display: none; width: 100%; justify-content: space-between; }
@media (max-width: 860px) { .docs-side .side-toggle { display: inline-flex; } }
.docs-side h5 { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); margin: 24px 0 8px; }
.docs-side h5:first-child { margin-top: 0; }
.docs-side a { display: block; padding: 6px 12px; color: var(--ink-3); border-left: 1px solid var(--line); text-decoration: none; }
.docs-side a:hover { color: var(--ink); border-left-color: var(--line-strong); }
.docs-side a[aria-current="page"] { color: var(--ink); background: var(--rose-wash); border-left: 2px solid var(--rose); }
.docs-side details > summary { list-style: none; cursor: pointer; display: block; padding: 6px 12px; color: var(--ink-3); border-left: 1px solid var(--line); }
.docs-side details > summary::-webkit-details-marker { display: none; }
.docs-side details > summary::after { content: " +"; color: var(--ink-4); font-family: var(--mono); }
.docs-side details[open] > summary::after { content: " −"; }
.docs-side details a { padding-left: 24px; }
.doc-search { position: relative; margin-bottom: 18px; }
.doc-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 500 var(--t-label) var(--mono); color: var(--ink-4); border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; }
.prose { min-width: 0; color: var(--ink-2); font-size: 16px; line-height: 1.7; }
.prose h1 { font-size: var(--t-h1); margin-bottom: 14px; }
.prose h2 { font-size: var(--t-h2); margin-top: 2.2em; scroll-margin-top: 96px; position: relative; }
.prose h3 { margin-top: 1.8em; scroll-margin-top: 96px; }
.prose h2:hover::before { content: "#"; position: absolute; left: -22px; color: var(--rose-deep); font-family: var(--mono); font-weight: 400; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--rose-deep); }
.prose table { font-size: 14px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose blockquote { margin: 0 0 1.2em; padding: 2px 16px; border-left: 2px solid var(--line-strong); color: var(--ink-3); }
.status-line, .meta-row { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 24px; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.in-short { border-left: 2px solid var(--rose); padding: 2px 0 2px 18px; margin: 0 0 32px; }
.in-short h2 { font: 500 var(--t-label) var(--mono) !important; letter-spacing: .12em; text-transform: uppercase; color: var(--rose) !important; margin: 0 0 8px !important; }
.in-short ul { margin: 0; padding-left: 1.1em; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 13px; max-height: calc(100dvh - 116px); overflow-y: auto; }
.toc h5 { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); margin: 0 0 10px; }
.toc a { display: block; color: var(--ink-3); padding: 4px 0 4px 12px; border-left: 1px solid var(--line); text-decoration: none; }
.toc a:hover, .toc a.active { color: var(--ink); border-left: 1px solid var(--rose); }
.toc a.l3 { padding-left: 24px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a { flex: 1 1 220px; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 18px; background: var(--panel); text-decoration: none; }
.pager a:hover { background: var(--panel-hover); border-color: var(--line-strong); }
.pager a span { display: block; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 4px; }
.pager a.next { text-align: right; }

/* Steps: dots on a thread */
.steps { list-style: none; padding: 0; margin: 0 0 1.4em; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 28px 44px; }
.steps > li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 1px; font: 500 var(--t-label) var(--mono); letter-spacing: .08em; color: var(--rose-deep); width: 28px; }
.steps > li::after { content: ""; position: absolute; left: 30px; top: 6px; bottom: 0; width: 1px; background: linear-gradient(var(--rose-line), var(--line)); }
.steps > li:last-child::after { display: none; }
.steps h3 { margin: 0 0 .4em; }

/* Stats */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; min-width: 0; }
.stat .k { display: block; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.stat .v { display: block; font: 450 32px/1.1 var(--display); letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { display: block; font-size: var(--t-small); color: var(--ink-3); margin-top: 6px; }
.meter { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--rose); border-radius: 3px; transition: width .35s var(--ease-ui); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--danger); }
.meter.good > i { background: var(--rose); }


/* CTA band */
.cta-band { position: relative; overflow: hidden; background: var(--stage-bg); border: 1px solid var(--stage-line); border-radius: var(--r-stage); padding: clamp(32px, 5vw, 64px); display: grid; gap: 16px; }
.cta-band h2 { font-size: var(--t-h1); letter-spacing: -.035em; max-width: 18ch; margin: 0; }
.cta-band p { color: var(--ink-3); max-width: 60ch; margin: 0; }

/* FAQ */
details.faq { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 20px; padding: 20px 0; font-size: 15px; color: var(--ink); }
details.faq summary::after { content: "+"; color: var(--ink-4); font-size: 21px; line-height: 1; transition: transform .25s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq summary::-webkit-details-marker { display: none; }
details.faq > div { padding: 0 24px 20px 0; color: var(--ink-3); font-size: 14px; }

/* Toast, modal */
.toast-host { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; pointer-events: none; width: min(460px, calc(100vw - 32px)); }
.toast { pointer-events: auto; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-btn); padding: 12px 16px; font-size: 13px; box-shadow: var(--shadow); animation: toast-in .2s var(--ease-out); text-align: center; }
.toast.good { border-color: var(--ok); } .toast.bad { border-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; z-index: 150; padding: 16px; }
.modal { background: var(--panel-2); border: 1px solid var(--line-rose); border-radius: var(--r-stage); max-width: 540px; width: 100%; padding: 28px; box-shadow: var(--shadow-raised); max-height: calc(100dvh - 32px); overflow-y: auto; }

/* Misc blocks used by pages */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 820px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .flow { grid-template-columns: minmax(0, 1fr); } }
.logo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel); padding: 9px 14px; border-radius: var(--r-btn); font: 500 13px var(--mono); color: var(--ink-2); text-decoration: none !important; }
.chip:hover { border-color: var(--line-strong); background: var(--panel-hover); color: var(--ink); }
.journey { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; }
@media (max-width: 600px) { .journey { grid-template-columns: minmax(0, 1fr); } }
.journey .jn { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; color: var(--rose-deep); width: 34px; }
.journey ol { margin: 8px 0 0; padding-left: 1.1em; color: var(--ink-3); font-size: 14px; }
.kv { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 8px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-2); }
.addr { font: 400 13px var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line); margin: 24px 0; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .mt1 { margin-top: 1rem; } .mt2 { margin-top: 2rem; } .mb1 { margin-bottom: 1rem; } .mb2 { margin-bottom: 2rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { margin-left: auto; }
.center { text-align: center; }
.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; }

/* Sparkline */
.spark { display: block; width: 100%; height: 32px; margin-top: 10px; }
.spark path { fill: none; stroke: var(--rose); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .area { fill: var(--rose-wash); stroke: none; }

/* API reference: two columns per endpoint, request and response sticky on the right */
.docs.docs-api { grid-template-columns: 248px minmax(0, 1fr); }
@media (max-width: 860px) { .docs.docs-api { grid-template-columns: minmax(0, 1fr); } }
.api-prose { max-width: none; }
.api-prose > h2 { margin-top: 2.4em; padding-top: 1em; border-top: 1px solid var(--line); }
.ep { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 32px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 1200px) { .ep { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; } .ep-r { position: sticky; top: 96px; align-self: start; } }
.ep-l > p { font-size: 15px; }
.ep-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font: 500 17px var(--mono); margin: 0 0 10px; scroll-margin-top: 96px; }
.ep-h code { background: none !important; border: 0 !important; padding: 0 !important; font-size: 17px !important; color: var(--ink); }
.method { font: 500 var(--t-label)/1 var(--mono); letter-spacing: .1em; padding: 5px 7px; border: 1px solid currentColor; border-radius: 3px; }
.method.m-get { color: var(--info); } .method.m-post { color: var(--ok); } .method.m-delete { color: var(--danger); } .method.m-put, .method.m-patch { color: var(--warn); }
.ep .table-wrap { margin-bottom: 16px; }
.ep table { font-size: 13px; }
.ep td code { white-space: nowrap; }
.ep details.fields summary { cursor: pointer; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 8px 0; }
.ep-r .code-box { margin-bottom: 12px; }
.ep-r pre { max-height: 420px; }
.prose td code { white-space: nowrap; }
.api-prose > h2 { border-top: 0 !important; }
.ep-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 18px; }
.ep-meta dt { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); }
.ep-meta dd { margin: 0 14px 0 0; font: 400 13px var(--mono); color: var(--ink-2); }
.j-k { color: var(--ink); } .j-s { color: var(--rose-soft); } .j-n { color: var(--cat-tools); } .j-b { color: var(--cat-models); }

/* Docs search: a results sheet under the search box */
.doc-search { position: relative; }
.search-sheet { position: absolute; left: 0; top: calc(100% + 6px); width: min(560px, 86vw); max-height: min(70vh, 520px); overflow-y: auto; z-index: 60; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--r-card); box-shadow: var(--shadow-raised); padding: 6px; }
.search-sheet a { display: block; padding: 10px 12px; border-radius: 6px; border: 0 !important; color: var(--ink-2); text-decoration: none !important; }
.search-sheet a:hover, .search-sheet a.on { background: var(--rose-wash); }
.search-sheet .sp { display: block; font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); }
.search-sheet .sh { display: block; color: var(--ink); font-size: 14px; margin: 2px 0; }
.search-sheet .sx { display: block; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.search-sheet mark { background: transparent; color: var(--rose); }
.search-sheet .none { padding: 12px; color: var(--ink-3); font-size: 13px; }

/* Links inside running text are underlined as well as coloured (accessibility) */
p a:not(.btn):not(.text-action):not(.card), li a:not(.btn):not(.text-action), td a:not(.btn), .note a, .small a:not(.btn) { text-decoration: underline; text-decoration-color: var(--rose-line); text-underline-offset: 3px; }
button.text-action { background: none; border: 0; border-bottom: 1px solid var(--rose-line); padding: 0 0 4px; font: inherit; font-size: 13px; cursor: pointer; }

/* API error tables on phones: stacked rows (code, HTTP and retry on line 1; what to do on line 2) */
@media (max-width: 640px) {
  table.errs thead { display: none; }
  table.errs, table.errs tbody { display: block; }
  table.errs tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.errs td { border: 0; padding: 0; }
  table.errs td:nth-child(2)::before { content: "HTTP "; color: var(--ink-4); font-family: var(--mono); font-size: 11px; }
  table.errs td:nth-child(3)::before { content: "Retry "; color: var(--ink-4); font-family: var(--mono); font-size: 11px; }
  table.errs td:nth-child(4) { grid-column: 1 / -1; color: var(--ink-3); }
  table.errs td code { white-space: normal; overflow-wrap: anywhere; }
  .ep .table-wrap:has(table.errs) { overflow-x: visible; }
}
.section-coordinate { font: 500 var(--t-label) var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--rose-deep); text-decoration: none !important; }
a.section-coordinate:hover { color: var(--ink); }

/* "What we tested" box on docs pages */
.tested-box { margin: 0 0 2rem; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); font-size: 14px; }
.tested-box h2 { margin: 0 0 12px; font: 500 var(--t-label)/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); border: 0; padding: 0; }
.tested-box h3 { margin: 0 0 6px; font: 600 14px/1.4 var(--sans); color: var(--ink); }
.tested-box ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.tested-box li { margin: 4px 0; overflow-wrap: anywhere; }
.tested-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px 24px; }

/* The pet dog: the mark, the loader and the lost page. Pixel art, so it is never smoothed. */
.pet-mark, .pet-lost, .pet-load img { image-rendering: pixelated; }
.pet-lost { display: block; margin: 0 auto 18px; width: 128px; height: auto; animation: pet-bob 1.4s steps(2) infinite; }
.pet-load { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 0; color: var(--muted, #a4a0a7); font-size: 14px; }
.pet-load img { width: 64px; height: auto; animation: pet-bob .8s steps(2) infinite; }
@keyframes pet-bob { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .pet-lost, .pet-load img { animation: none; } }
