/* Ordstage developer docs. Brand: cobalt #315cff, tangerine #ff973b, graphite #15161a, ice #eef2ff. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8ff;
  --bg-code: #15161a;
  --fg: #15161a;
  --fg-soft: #4a4f5c;
  --fg-faint: #6b7080;
  --line: #e3e7f2;
  --accent: #2f55f0;
  --accent-soft: #eef2ff;
  --accent-fg: #ffffff;
  --warn-bg: #fff6ec;
  --warn-line: #ff973b;
  --code-fg: #e9ecf5;
  --inline-code-bg: #eef1f8;
  --shadow: 0 12px 32px rgba(21, 22, 26, 0.12);
  --header: 56px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  --bg: #111216;
  --bg-soft: #181a20;
  --bg-code: #0b0c0f;
  --fg: #eef0f6;
  --fg-soft: #b7bccb;
  --fg-faint: #8b91a3;
  --line: #2a2d36;
  --accent: #8aa4ff;
  --accent-soft: #1d2340;
  --accent-fg: #0b0c0f;
  --warn-bg: #2a2015;
  --warn-line: #ff973b;
  --inline-code-bg: #22252e;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--header); padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand-docs { color: var(--fg-faint); font-weight: 500; }
.env { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #7a3d00; background: #ffe2c4; padding: 2px 8px; border-radius: 99px; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); cursor: pointer;
}
.icon-button:hover { background: var(--bg-soft); }
.menu { display: none; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%; height: 40px; padding: 0 36px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--fg); font: inherit; font-size: 15px;
}
.search input::placeholder { color: var(--fg-faint); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 12px var(--mono); color: var(--fg-faint); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
#search-results {
  position: absolute; top: 46px; left: 0; right: 0; max-height: 70vh; overflow: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
#search-results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; }
#search-results [aria-selected="true"] a, #search-results a:hover { background: var(--accent-soft); }
#search-results strong { display: block; font-size: 14px; }
#search-results span { display: block; font-size: 13px; color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 10px; color: var(--fg-faint); font-size: 14px; }
.toplinks { display: flex; gap: 4px; }
.toplinks a { color: var(--fg-soft); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.toplinks a:hover, .toplinks a[aria-current="page"] { color: var(--fg); background: var(--bg-soft); }

/* Layout */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; max-width: 1360px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--header); align-self: start; height: calc(100vh - var(--header)); overflow-y: auto;
  padding: 24px 16px 40px; border-right: 1px solid var(--line);
}
.nav-section { margin: 20px 8px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-faint); }
.nav-section:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--fg-soft); text-decoration: none; font-size: 15px; }
.sidebar a:hover { background: var(--bg-soft); color: var(--fg); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { min-width: 0; padding: 40px 48px 64px; }
main:focus { outline: none; }
.toc { position: sticky; top: var(--header); align-self: start; padding: 40px 16px 24px 0; font-size: 14px; }
.toc-title { margin: 0 0 8px; font-weight: 700; font-size: 13px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .06em; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 3px 0 3px 12px; color: var(--fg-soft); text-decoration: none; }
.toc li.d3 a { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--accent); }

/* Prose */
.prose { max-width: 760px; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.prose h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -.02em; }
.lead { margin: 0 0 28px; font-size: 18px; color: var(--fg-soft); }
.prose h2 { margin: 44px 0 12px; font-size: 24px; line-height: 1.3; letter-spacing: -.01em; padding-top: 8px; border-top: 1px solid var(--line); }
.prose h3 { margin: 28px 0 8px; font-size: 19px; }
.prose h2, .prose h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; padding-right: .3em; color: var(--fg-faint); text-decoration: none; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose code { font: .9em var(--mono); background: var(--inline-code-bg); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
.prose strong { font-weight: 700; }
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; overflow-wrap: normal; }
th:empty { display: none; }
.callout { margin: 0 0 20px; padding: 14px 16px; border-left: 4px solid var(--warn-line); background: var(--warn-bg); border-radius: 0 10px 10px 0; }
.callout p:last-child { margin-bottom: 0; }

/* Code */
.code { position: relative; margin: 0 0 20px; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--bg-code); color: var(--code-fg); border-radius: 12px; font: 14px/1.6 var(--mono); tab-size: 2; }
.prose .code code { background: none; padding: 0; font: inherit; color: inherit; overflow-wrap: normal; }
.copy {
  position: absolute; top: 8px; right: 8px; padding: 4px 10px; font: 600 12px var(--font);
  color: #e9ecf5; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); border-radius: 7px; cursor: pointer;
}
.copy:hover { background: rgba(255, 255, 255, .2); }
.codegroup { margin: 0 0 20px; background: var(--bg-code); border-radius: 12px; overflow: hidden; }
.codegroup [role="tablist"] { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); overflow-x: auto; }
.codegroup [role="tab"] {
  padding: 8px 12px; border: 0; border-radius: 8px 8px 0 0; background: none; color: #a6adbf; font: 600 13px var(--font); cursor: pointer; white-space: nowrap;
}
.codegroup [role="tab"][aria-selected="true"] { color: #fff; box-shadow: inset 0 -2px 0 #ff973b; }
.codegroup .code { margin: 0; }
.codegroup .code pre { border-radius: 0; }

/* Cards and pager */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 28px; }
.card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--fg); text-decoration: none; background: var(--bg); }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card strong { display: block; margin-bottom: 4px; color: var(--accent); }
.card span { color: var(--fg-soft); font-size: 15px; }
.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 760px; margin-top: 48px; }
.pager a { flex: 1; max-width: 50%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-weight: 600; }
.pager a[rel="next"] { text-align: right; margin-left: auto; }
.pager span { display: block; font-size: 13px; font-weight: 500; color: var(--fg-faint); }

/* API reference */
.site-footer { border-top: 1px solid var(--line); padding: 20px 24px 28px; text-align: center; color: var(--fg-soft); font-size: 14px; }
.site-footer a { color: inherit; }
body.wide .layout { grid-template-columns: minmax(0, 1fr); max-width: none; }
body.wide .sidebar { display: none; }
body.wide main { padding: 0; }
.reference-note, .reference-offline { margin: 0; padding: 10px 16px; font-size: 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.reference-offline { background: var(--warn-bg); }
.reference-loading { padding: 40px 24px; color: var(--fg-faint); }
#reference { --scalar-custom-header-height: var(--header); min-height: 60vh; }
#reference .scalar-app, #reference .light-mode, #reference .dark-mode { --scalar-color-accent: var(--accent); --scalar-font: var(--font); --scalar-font-code: var(--mono); }

/* Narrow screens */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .menu { display: inline-grid; }
  .toplinks { display: none; }
  .brand-docs { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar, body.wide .sidebar {
    display: block; position: fixed; z-index: 30; top: var(--header); left: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    background: var(--bg); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .2s ease; visibility: hidden;
  }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  main { padding: 24px 16px 48px; }
  .anchor { display: none; }
  .search kbd { display: none; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand span:not(.brand-docs) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .sidebar, .toc, .pager, .copy { display: none !important; }
  .layout { display: block; }
}
