/* docs.ormaos.com. The colours, fonts and mark of ormaos.com; the layout of
   a three-column reference site: navigation, text, "On this page". */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f5f5f5;
  --panel-2: #fafafa;
  --text: #171717;
  --text-soft: #525252;
  --text-dim: #737373;
  --line: rgba(0, 0, 0, 0.12);
  --line-soft: rgba(0, 0, 0, 0.07);
  --button: #171717;
  --button-text: #ffffff;
  --code-bg: #fafafa;
  --limit: #b7791f;
  --limit-bg: rgba(227, 179, 65, 0.1);
  --term-bg: #101010;
  --term-fg: #e5e5e5;
  --term-dim: #9a9a9a;
  --term-blue: #79c0ff;
  --term-green: #56d364;
  --term-red: #ff7b72;
  --term-yellow: #e3b341;
  --header-h: 64px;
  --tabs-h: 44px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #1a1a1a;
  --panel-2: #111111;
  --text: #f5f5f5;
  --text-soft: #b5b5b5;
  --text-dim: #a3a3a3;
  --line: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.08);
  --button: #f5f5f5;
  --button-text: #0a0a0a;
  --code-bg: #121212;
  --limit: #e3b341;
  --limit-bg: rgba(227, 179, 65, 0.08);
  --term-bg: #101010;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0a;
    --panel: #1a1a1a;
    --panel-2: #111111;
    --text: #f5f5f5;
    --text-soft: #b5b5b5;
    --text-dim: #a3a3a3;
    --line: rgba(255, 255, 255, 0.14);
    --line-soft: rgba(255, 255, 255, 0.08);
    --button: #f5f5f5;
    --button-text: #0a0a0a;
    --code-bg: #121212;
    --limit: #e3b341;
    --limit-bg: rgba(227, 179, 65, 0.08);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--tabs-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  padding: 8px 12px; border-radius: 6px; background: var(--button); color: var(--button-text);
}
.skip:focus { top: 8px; }

/* ------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  display: flex; align-items: center; gap: 16px;
  height: var(--header-h);
  max-width: 1480px; margin: 0 auto; padding: 0 24px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; white-space: nowrap; flex: none;
}
.logo { width: 24px; height: 24px; flex: none; }
.brand-name { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand-docs { font-size: 17px; color: var(--text-dim); letter-spacing: -0.02em; }

.search { position: relative; flex: 1 1 auto; max-width: 440px; margin: 0 auto; }
.search input {
  width: 100%; height: 38px; padding: 0 40px 0 36px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px 50% / 16px;
  color: var(--text); font: 14px var(--sans);
  -webkit-appearance: none; appearance: none;
}
.search input:focus { outline: none; border-color: var(--text-dim); background-color: var(--bg); }
.search input::-webkit-search-cancel-button { display: none; }
.search-key {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  min-width: 20px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px;
  color: var(--text-dim); font: 12px var(--mono); text-align: center; pointer-events: none;
}
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 50;
  max-height: min(70vh, 560px); overflow: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}
.search-results a {
  display: block; padding: 10px 12px; border-radius: 7px; text-decoration: none;
}
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--panel); }
.search-results .r-title { display: block; font-size: 14px; font-weight: 600; }
.search-results .r-path { display: block; font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.search-results .r-text { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--text-soft); }
.search-results mark { background: none; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--text-dim); }
.search-results .r-none { padding: 12px; font-size: 14px; color: var(--text-dim); }

.topbar-links { display: flex; align-items: center; gap: 18px; flex: none; font-size: 14px; color: var(--text-soft); }
.topbar-links a { text-decoration: none; }
.topbar-links a:hover { color: var(--text); }
.topbar-links .gh svg { width: 20px; height: 20px; display: block; }

.theme {
  display: flex; padding: 2px; border: 0; border-radius: 9999px; background: var(--panel);
  font: 13px var(--sans); cursor: pointer; color: var(--text-soft);
}
.theme span { padding: 3px 10px; border-radius: 9999px; }
:root:not([data-theme="dark"]) .theme .theme-light,
:root[data-theme="dark"] .theme .theme-dark {
  background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line);
}

.tabs {
  display: flex; gap: 28px; height: var(--tabs-h);
  max-width: 1480px; margin: 0 auto; padding: 0 24px;
  overflow-x: auto; scrollbar-width: none;
  font-size: 14px; font-weight: 500;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; white-space: nowrap;
  color: var(--text-soft); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="true"] { color: var(--text); border-bottom-color: var(--text); }

.menu-button, .scrim { display: none; }
.drawer-toggle { position: absolute; opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------- columns */

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 232px;
  max-width: 1480px; margin: 0 auto;
}

.sidebar {
  position: sticky; top: calc(var(--header-h) + var(--tabs-h) + 1px);
  height: calc(100vh - var(--header-h) - var(--tabs-h) - 1px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 16px 48px 24px;
  border-right: 1px solid var(--line-soft);
  scrollbar-width: thin;
}

.nav-group + .nav-group { margin-top: 22px; }
.nav-heading {
  margin: 0 0 6px; padding: 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
}
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a {
  display: block; padding: 5px 10px; border-radius: 6px;
  font-size: 14px; line-height: 1.45; color: var(--text-soft); text-decoration: none;
}
.sidenav a:hover { color: var(--text); background: var(--panel-2); }
.sidenav a[aria-current="page"] { color: var(--text); background: var(--panel); font-weight: 600; }

.main { min-width: 0; padding: 40px 56px 64px; }
.doc { max-width: 760px; margin: 0 auto; }
.pager, .footer { max-width: 760px; margin-left: auto; margin-right: auto; }

.toc {
  position: sticky; top: calc(var(--header-h) + var(--tabs-h) + 1px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - var(--tabs-h));
  overflow-y: auto; padding: 40px 24px 40px 8px;
  font-size: 13px;
}
.toc-heading { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 1px solid transparent; color: var(--text-soft); text-decoration: none; line-height: 1.4; }
.toc li.l3 a { padding-left: 24px; }
.toc li a:hover { color: var(--text); border-left-color: var(--text); }

/* ------------------------------------------------------------- text */

.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-dim); }

.doc h1 { margin: 0; font-size: 34px; line-height: 1.2; font-weight: 650; letter-spacing: -0.025em; }
.lead { margin: 12px 0 0; font-size: 19px; line-height: 1.5; color: var(--text-soft); }

.page-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 20px 0 32px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.page-actions a, .page-actions button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg);
  color: var(--text-soft); font: 500 13px var(--sans); text-decoration: none; cursor: pointer;
}
.page-actions a:hover, .page-actions button:hover { color: var(--text); border-color: var(--text-dim); }

.doc h2, .doc h3, .doc h4 { position: relative; scroll-margin-top: calc(var(--header-h) + var(--tabs-h) + 16px); }
.doc h2 { margin: 48px 0 12px; font-size: 24px; line-height: 1.3; font-weight: 650; letter-spacing: -0.02em; }
.doc h3 { margin: 32px 0 8px; font-size: 18px; line-height: 1.4; font-weight: 650; letter-spacing: -0.01em; }
.doc h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 650; }
.doc h2 code, .doc h3 code { font-size: 0.9em; }
.anchor { margin-left: 8px; color: var(--text-dim); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.doc p, .doc ul, .doc ol { margin: 0 0 16px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li > p { margin: 0 0 6px; }
.doc a { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; }
.doc a:hover { text-decoration-color: var(--text); }
.doc strong { font-weight: 650; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.doc :not(pre) > code {
  padding: 0.12em 0.36em; border-radius: 5px;
  background: var(--panel); font: 0.86em/1.4 var(--mono);
  overflow-wrap: anywhere;
}
.doc a code { text-decoration: inherit; }

.doc blockquote { margin: 0 0 16px; padding: 2px 16px; border-left: 3px solid var(--line); color: var(--text-soft); }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.doc th, .doc td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.doc th { background: var(--panel-2); font-weight: 600; font-size: 13px; color: var(--text-soft); }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }

/* ------------------------------------------------------------- callouts */

.callout {
  margin: 0 0 20px; padding: 14px 18px;
  border: 1px solid var(--line); border-left: 3px solid var(--text-dim); border-radius: 8px;
  background: var(--panel-2); font-size: 15px;
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 4px !important; font-size: 13px; font-weight: 650; letter-spacing: 0.02em; }
.callout.limit { border-left-color: var(--limit); background: var(--limit-bg); }
.callout.limit .callout-title { color: var(--limit); }

/* ------------------------------------------------------------- measured */

.measured { text-decoration: underline dotted var(--text-dim); text-underline-offset: 4px; }
.measured-src {
  margin-left: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--text-dim); vertical-align: 1px; text-decoration: none !important;
}
.measured-src::before { content: "↗ "; }
.measured-src:hover { color: var(--text); }

/* ------------------------------------------------------------- terminal */

.term {
  margin: 0 0 22px; border-radius: 10px; overflow: hidden;
  background: var(--term-bg); color: var(--term-fg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.term-bar {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font: 12px var(--mono); color: var(--term-dim);
}
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a3a3a; }
.term-title { flex: 1; }
.t-exit { padding: 1px 7px; border-radius: 4px; background: rgba(255, 123, 114, 0.14); color: var(--term-red); }
.term-body { margin: 0; padding: 14px 16px 16px; overflow-x: auto; font: 13px/1.6 var(--mono); tab-size: 4; }
.term-body code { font: inherit; white-space: pre; }
.t-prompt { color: var(--term-green); user-select: none; }
.t-cmd { color: #ffffff; font-weight: 600; }
.t-bold { font-weight: 700; color: #ffffff; }
.t-addr { color: var(--term-blue); }
.t-dim { color: var(--term-dim); }
.t-err { color: #c9c9c9; }

.copy {
  height: 26px; padding: 0 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14); background: transparent;
  color: var(--term-dim); font: 500 12px var(--sans);
}
.copy:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.copy.done { color: var(--term-green); }

/* ------------------------------------------------------------- code */

.code { margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.code-bar {
  display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line-soft); font: 12px var(--mono); color: var(--text-dim);
}
.code .copy { border-color: var(--line); color: var(--text-dim); }
.code .copy:hover { color: var(--text); border-color: var(--text-dim); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13px/1.6 var(--mono); background: transparent !important; }
.code pre code { font: inherit; }
.shiki span { color: var(--shiki-light); }
:root[data-theme="dark"] .shiki span { color: var(--shiki-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shiki span { color: var(--shiki-dark); }
}

.usage { margin: 0 0 16px; padding: 14px 16px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--line); overflow-x: auto; font: 13px/1.6 var(--mono); }
.usage code { font: inherit; white-space: pre; }
.schema-link { font-size: 14px; color: var(--text-soft); }

/* ------------------------------------------------------------- cards */

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.card {
  display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none !important; transition: border-color 0.12s;
}
.card:hover { border-color: var(--text-dim); }
.card-title { display: block; font-weight: 650; font-size: 15px; }
.card-title::after { content: " →"; color: var(--text-dim); }
.card-text { display: block; margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--text-soft); }

/* ------------------------------------------------------------- pager, footer */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.pager a:hover { border-color: var(--text-dim); }
.pager a span { display: block; font-size: 12px; font-weight: 500; color: var(--text-dim); margin-bottom: 2px; }
.pager .next { text-align: right; }
.footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-dim); }
.footer p { margin: 0 0 6px; }
.footer code { font: 12px var(--mono); }

/* ------------------------------------------------------------- narrow */

@media (max-width: 1180px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 36px 40px 56px; }
}

@media (max-width: 860px) {
  :root { --tabs-h: 0px; }
  .tabs { display: none; }
  .shell { display: block; }
  .main { padding: 28px 20px 48px; }
  .topbar-row { padding: 0 14px; gap: 12px; }
  .brand-docs, .hide-narrow { display: none; }
  .menu-button {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 36px; height: 36px; padding: 0 8px; margin-left: -6px; border-radius: 8px; cursor: pointer; flex: none;
  }
  .menu-button span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
  .sidebar {
    position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; height: 100vh; width: min(320px, 86vw);
    background: var(--bg); border-right: 1px solid var(--line);
    transform: translateX(-100%); transition: transform 0.2s ease; padding-top: 20px;
  }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.4); display: none; }
  .drawer-toggle:checked ~ .shell .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.3); }
  .drawer-toggle:checked ~ .shell .scrim { display: block; }
  .doc h1 { font-size: 28px; }
  .lead { font-size: 17px; }
  .cards { grid-template-columns: 1fr; }
  .search-key { display: none; }
  .search input { padding-right: 12px; }
}

@media (max-width: 480px) {
  .topbar-links { gap: 10px; }
  .topbar-links .gh { display: none; }
  .theme span { padding: 3px 8px; }
  .brand-name { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .page-actions, .copy { display: none !important; }
  .shell { display: block; }
}
