/* TAIL OS — tail-os.com
   Light-first, theme-aware. IBM Plex Sans for text, IBM Plex Mono for code. */

:root {
  --bg: #ffffff;
  --bg-soft: #fbfcfd;
  --bg-sunken: #f5f7f9;
  --surface: #ffffff;
  --border: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #16202e;
  --text-dim: #3b4a5c;
  --text-mute: #64748b;
  --accent: #0b5fd0;
  --accent-soft: rgba(11, 95, 208, 0.09);
  --accent-line: rgba(11, 95, 208, 0.32);
  /* Identifiers. The subject of this site is an API, so the names of its
     things get a colour of their own rather than a grey box. */
  --code-fg: #7c2fd4;
  --code-soft: rgba(124, 47, 212, 0.09);
  --code-line: rgba(124, 47, 212, 0.24);
  /* Sourced: a citation, a healthy state. */
  --cite: #047857;
  --cite-soft: rgba(4, 120, 87, 0.11);
  --cite-line: rgba(4, 120, 87, 0.32);
  --warn-bg: #fffaeb;
  --warn-border: rgba(180, 83, 9, 0.26);
  --warn-text: #7c4310;
  --warn-bar: #d97706;
  /* The tagline names five things TAIL OS is. These are the only decorative
     colours on the site: everywhere else a hue means one thing, so they are
     kept to this one element and named for the word they mark. */
  --kw-realtime: #0e7490;
  --kw-kernel: #7c2fd4;
  --kw-rust: #c2410c;
  --kw-robot: #047857;
  --kw-safety: #a16207;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-dim: #64748b;
  --radius: 8px;
  --radius-sm: 6px;
  --side-w: 268px;
  --hdr-h: 57px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-soft: #0e1626;
    --bg-sunken: #131c2e;
    --surface: #101a2b;
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text: #e7edf5;
    --text-dim: #ccd8e8;
    --text-mute: #8fa0b5;
    --accent: #62b8ff;
    --accent-soft: rgba(98, 184, 255, 0.14);
    --accent-line: rgba(98, 184, 255, 0.38);
    --code-fg: #d0a9ff;
    --code-soft: rgba(167, 139, 250, 0.16);
    --code-line: rgba(167, 139, 250, 0.32);
    --cite: #3ddc97;
    --cite-soft: rgba(61, 220, 151, 0.15);
    --cite-line: rgba(61, 220, 151, 0.36);
    --warn-bg: #2a2010;
    --warn-border: rgba(245, 190, 90, 0.30);
    --warn-text: #f0cf9a;
    --warn-bar: #f5be5a;
    --kw-realtime: #22d3ee;
    --kw-kernel: #c78bff;
    --kw-rust: #ff9e64;
    --kw-robot: #4ade80;
    --kw-safety: #fbbf24;
    --code-bg: #060c17;
    --code-text: #dbe6f3;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.mono, code, pre, kbd {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 40;
  height: var(--hdr-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.hdr-in {
  display: flex; align-items: center; gap: 24px;
  height: 100%; padding: 0 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--accent); }
.ver {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 400; color: var(--text-mute);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 6px;
}
.hdr-search {
  display: flex; align-items: center; gap: 9px;
  flex: 1 1 auto; max-width: 440px;
  height: 34px; padding: 0 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-mute);
}
.hdr-search input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; outline: none;
}
.hdr-search input::placeholder { color: var(--text-mute); }
.hdr-nav {
  display: flex; align-items: center; gap: 20px;
  margin-left: auto; font-size: 14px;
}
.hdr-nav a { color: var(--text-dim); }

/* ---------- home ---------- */
.page-home main { max-width: 940px; margin: 0 auto; padding: 0 24px 96px; }
.hero { padding: 92px 0 0; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.hero h1 {
  margin: 0; font-size: clamp(32px, 4.6vw, 50px); line-height: 1.08;
  letter-spacing: -0.03em; font-weight: 600; text-align: center; text-wrap: pretty;
}
.lede { margin: 0; color: var(--text-dim); font-size: 17px; text-align: center; max-width: 560px; }
.lede strong { font-weight: 650; }
.kw-realtime { color: var(--kw-realtime); }
.kw-kernel { color: var(--kw-kernel); }
.kw-rust { color: var(--kw-rust); }
.kw-robot { color: var(--kw-robot); }
.kw-safety { color: var(--kw-safety); }

.ask { width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
.ask-field {
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 18px;
  background: var(--surface);
  border: 1.5px solid var(--accent-line); border-radius: var(--radius);
  color: var(--text-mute);
  box-shadow: 0 10px 30px -18px rgba(3, 105, 161, 0.5);
}
.ask-field:focus-within { border-color: var(--accent); }
.ask-field input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16.5px; outline: none;
}
.ask-field input::placeholder { color: var(--text-mute); }
.ask-go {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer;
}
.chips {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.chip {
  font: inherit; font-size: 13.5px; color: var(--text-dim);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 15px; cursor: pointer;
}
.chip { color: var(--text-dim); border-color: var(--accent-line); }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 72px; }
.stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 18px 20px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.stat-n { font-size: 25px; font-weight: 500; color: var(--cite); letter-spacing: -0.02em; }
.stat { border-color: var(--border-strong); border-left: 3px solid var(--cite-line); }
.stat-l { font-size: 13.5px; color: var(--text-mute); }

.quick { margin-top: 44px; display: flex; flex-direction: column; gap: 12px; }
.quick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.quick-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.quick-head a { font-size: 14px; }
.quick-note { margin: 0; font-size: 14px; color: var(--text-mute); }

.term {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); font-size: 13px; line-height: 1.75;
}
.term .pr { color: var(--code-dim); user-select: none; }

.docs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 44px; }
.card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 18px 20px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
}
.card { border-color: var(--border-strong); border-top: 3px solid var(--accent-line); }
.card:hover { border-top-color: var(--accent); border-color: var(--accent-line); text-decoration: none; }
.card-t { font-weight: 600; font-size: 15px; color: var(--accent); }
.card-d { font-size: 13.5px; color: var(--text-mute); line-height: 1.5; }

/* ---------- documentation shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }
.side {
  position: sticky; top: var(--hdr-h);
  height: calc(100vh - var(--hdr-h)); overflow-y: auto;
  padding: 26px 14px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
}
.nav-docs, .nav-list, .nav-sections { list-style: none; margin: 0; padding: 0; }
.nav-docs { display: flex; flex-direction: column; gap: 16px; }
.nav-list { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }

/* A top-level group: the parts of the documentation a reader chooses between. */
.nav-label {
  display: block; padding: 5px 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
/* A group within a group is one step down, not a second top-level heading. */
.nav-list .nav-label {
  margin-top: 6px; padding: 3px 10px;
  font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--text-dim);
}
.nav-list .nav-list { margin: 2px 0 0 10px; padding-left: 8px; border-left: 1px solid var(--border); }

.nav-link {
  display: block; padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-dim);
}
/* A page standing at the top level is a destination in its own right. */
.nav-docs > .nav-page > .nav-link { font-weight: 600; color: var(--text); }
.nav-link:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-sections {
  display: flex; flex-direction: column; gap: 1px;
  margin: 2px 0 6px 10px; padding-left: 8px; border-left: 2px solid var(--accent-line);
}
.nav-sections a {
  display: block; padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-dim);
}
.nav-sections a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }

.content { min-width: 0; padding: 36px 40px 96px; }
/* Bounded so the table of contents sits beside the prose rather than adrift
   at the far edge of a wide window. */
.doc-wrap { display: grid; grid-template-columns: minmax(0, 760px) 200px; gap: 44px; align-items: start; max-width: 1004px; }
.doc { max-width: 760px; min-width: 0; }

.toc { position: sticky; top: calc(var(--hdr-h) + 36px); }
.toc-h {
  display: block; margin-bottom: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.toc a { font-size: 13.5px; color: var(--text-dim); }

/* ---------- document typography ---------- */
.doc h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 18px; }
.doc h2 {
  font-size: 23px; letter-spacing: -0.02em; font-weight: 600;
  margin: 46px 0 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.doc h3 {
  font-size: 17.5px; font-weight: 600; margin: 34px 0 10px;
  padding-left: 12px; border-left: 3px solid var(--code-line);
}
.doc h4 { font-size: 15.5px; font-weight: 600; margin: 24px 0 8px; }
.doc p, .doc li { color: var(--text-dim); }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc a { text-decoration: underline; text-underline-offset: 2px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

.doc blockquote {
  margin: 0 0 18px; padding: 14px 18px;
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn-bar);
  border-radius: var(--radius); color: var(--warn-text);
}
.doc blockquote code { background: none; border: 0; color: inherit; }
.doc blockquote p:last-child { margin-bottom: 0; }

.doc :not(pre) > code {
  font-size: 0.88em; padding: 1.5px 5px;
  background: var(--code-soft); border: 1px solid var(--code-line);
  border-radius: 4px; color: var(--code-fg);
}
/* A heading that names an identifier keeps the identifier's colour, so the
   entry for `on_overrun` and the mention of it in prose read as one thing. */
.doc h2 > code, .doc h3 > code { background: none; border: 0; padding: 0; font-size: 0.92em; }
.doc pre {
  margin: 0 0 18px; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-left: 3px solid var(--code-fg);
  border-radius: var(--radius); font-size: 13px; line-height: 1.7;
}
.doc pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* Copy buttons, added by copy.js. The wrapper rather than the <pre> positions the
   button, so it stays in the corner while a wide block scrolls sideways. Code blocks
   are dark in both themes, so the button is drawn for a dark ground in both. */
.code-block { position: relative; }
div.code-block > pre { padding-right: 52px; }
.copy {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  color: var(--code-text); background: var(--code-bg);
  border: 1px solid rgba(148, 163, 184, 0.3); border-radius: var(--radius-sm);
  cursor: pointer; opacity: 0.75;
}
.copy:hover, .copy:focus-visible, .copy[data-state="done"] { opacity: 1; border-color: rgba(148, 163, 184, 0.6); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.doc table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14.5px; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.doc th {
  font-weight: 600; color: var(--accent); background: var(--accent-soft);
  border-bottom: 2px solid var(--accent-line);
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em;
}
.doc td { color: var(--text-dim); }

.doc-src {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-mute);
}

.idx { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.idx-t { font-size: 17px; font-weight: 600; }
.idx-d { margin: 4px 0 0; font-size: 14.5px; color: var(--text-mute); }
.idx-group { list-style: none; }
.doc .idx-g { margin: 12px 0 0; }
/* The index's subgroup heads a list of pages; it is not an API entry, so it
   does not take the violet bar document h3s carry. */
.doc h3.idx-g { border-left: 0; padding-left: 0; font-size: 16px; color: var(--text-dim); }
.idx .idx { margin-top: 14px; padding-left: 14px; border-left: 1px solid var(--border); }

/* ---------- answer view ---------- */
.ask-root { max-width: 940px; }
.ask-empty { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; }
.ask-empty h1 { margin: 0; font-size: 30px; letter-spacing: -0.025em; font-weight: 600; }
.ask-empty .lede, .ask-empty .chips { text-align: left; justify-content: flex-start; max-width: none; }

.q { margin: 0 0 26px; font-size: 25px; font-weight: 600; letter-spacing: -0.022em; }
.ans-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.ans-label {
  display: flex; align-items: center; gap: 9px; margin-bottom: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex: none; }
.dot.is-wait { background: var(--text-mute); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot.is-wait { animation: none; } }

.ans p { margin: 0 0 15px; color: var(--text-dim); font-size: 16.5px; line-height: 1.68; }
.ans pre { margin: 0 0 16px; padding: 15px 18px; overflow-x: auto; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); font-size: 12.5px; line-height: 1.7; white-space: pre; }
.ans :not(pre) > code { font-size: 0.88em; padding: 1.5px 5px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 4px; color: var(--text); }
.cite {
  display: inline-block; min-width: 17px; margin: 0 1px; padding: 0 4px;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px;
  font-weight: 600; text-align: center; vertical-align: 1.5px;
  color: var(--cite); background: var(--cite-soft);
  border: 1px solid var(--cite-line); border-radius: 4px;
}
.cite:hover { text-decoration: none; background: var(--cite); color: var(--bg); }
.ans-note { display: flex; align-items: center; gap: 9px; margin-top: 20px; font-size: 13px; color: var(--text-mute); }

.srcs { display: flex; flex-direction: column; gap: 11px; }
.srcs-h { font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-mute); }
.src {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.src:hover { border-color: var(--cite-line); text-decoration: none; }
.src-top { display: flex; align-items: center; gap: 8px; }
.src-n { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; color: var(--cite); background: var(--cite-soft); border-radius: 4px; padding: 1px 5px; }
.src-t { font-size: 13.5px; font-weight: 600; }
.src-p { font-size: 12.5px; color: var(--text-mute); line-height: 1.45; }

.notice {
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px 26px; margin: 0 0 26px;
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: var(--radius); color: var(--warn-text);
}
.notice-h { display: flex; align-items: center; gap: 10px; font-size: 16.5px; font-weight: 600; }
.notice p { margin: 0; color: inherit; font-size: 15px; line-height: 1.6; }

.covers { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ---------- footer ---------- */
.ftr {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 24px 40px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-mute);
}
.page-shell .ftr { border-top: 0; }
.ftr-sep { color: var(--border-strong); }

/* ---------- narrow ---------- */
@media (max-width: 1080px) {
  .doc-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .ans-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static; height: auto; border-right: 0;
    border-bottom: 1px solid var(--border); padding: 18px 16px;
  }
  .content { padding: 26px 20px 72px; }
  .hdr-in { gap: 14px; }
  .hdr-nav { gap: 14px; }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 56px; }
}
