/* TAIL OS — tail-os.com
   Apple-style theme: light grey canvas, white surfaces, one blue for actions,
   Inter for text and IBM Plex Mono for commands. Dark mode follows the system. */

:root {
  --bg: #f5f5f7;
  --bg-soft: #ffffff;
  --bg-sunken: #ebebf0;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --text-dim: #424245;
  --text-mute: #6e6e73;
  --accent: #0066cc;
  --accent-soft: rgba(0, 102, 204, 0.08);
  --accent-line: rgba(0, 102, 204, 0.3);
  --code-fg: #8944ab;
  --code-soft: rgba(137, 68, 171, 0.08);
  --code-line: rgba(137, 68, 171, 0.22);
  --cite: #00733a;
  --cite-soft: rgba(0, 115, 58, 0.08);
  --cite-line: rgba(0, 115, 58, 0.28);
  --warn-bg: #fbf3e2;
  --warn-border: rgba(154, 84, 0, 0.22);
  --warn-text: #7a4300;
  --warn-bar: #b36b00;
  --kw-realtime: #0066cc;
  --kw-kernel: #8944ab;
  --kw-rust: #b35200;
  --kw-robot: #00733a;
  --kw-safety: #8a6200;
  --code-bg: #1d1d1f;
  --code-text: #f5f5f7;
  --code-dim: #86868b;
  --radius: 18px;
  --radius-sm: 12px;
  --side-w: 248px;
  --hdr-h: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-soft: #1c1c1e;
    --bg-sunken: #2c2c2e;
    --surface: #1c1c1e;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.22);
    --text: #f5f5f7;
    --text-dim: #d2d2d7;
    --text-mute: #98989d;
    --accent: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.14);
    --accent-line: rgba(41, 151, 255, 0.38);
    --code-fg: #d4a6f0;
    --code-soft: rgba(212, 166, 240, 0.14);
    --code-line: rgba(212, 166, 240, 0.3);
    --cite: #32d74b;
    --cite-soft: rgba(50, 215, 75, 0.14);
    --cite-line: rgba(50, 215, 75, 0.36);
    --warn-bg: #2b2212;
    --warn-border: rgba(255, 176, 60, 0.25);
    --warn-text: #ffd27a;
    --warn-bar: #ffb03c;
    --kw-realtime: #5ac8fa;
    --kw-kernel: #d4a6f0;
    --kw-rust: #ff9f5a;
    --kw-robot: #32d74b;
    --kw-safety: #ffd60a;
    --code-bg: #161617;
    --code-text: #f5f5f7;
    --code-dim: #98989d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-soft: #1c1c1e;
  --bg-sunken: #2c2c2e;
  --surface: #1c1c1e;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f5f7;
  --text-dim: #d2d2d7;
  --text-mute: #98989d;
  --accent: #2997ff;
  --accent-soft: rgba(41, 151, 255, 0.14);
  --accent-line: rgba(41, 151, 255, 0.38);
  --code-fg: #d4a6f0;
  --code-soft: rgba(212, 166, 240, 0.14);
  --code-line: rgba(212, 166, 240, 0.3);
  --cite: #32d74b;
  --cite-soft: rgba(50, 215, 75, 0.14);
  --cite-line: rgba(50, 215, 75, 0.36);
  --warn-bg: #2b2212;
  --warn-border: rgba(255, 176, 60, 0.25);
  --warn-text: #ffd27a;
  --warn-bar: #ffb03c;
  --kw-realtime: #5ac8fa;
  --kw-kernel: #d4a6f0;
  --kw-rust: #ff9f5a;
  --kw-robot: #32d74b;
  --kw-safety: #ffd60a;
  --code-bg: #161617;
  --code-text: #f5f5f7;
  --code-dim: #98989d;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); 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: 4px; }

.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) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  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(--text); }
.ver {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 500; color: var(--text-mute);
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
}
.hdr-search {
  display: flex; align-items: center; gap: 9px;
  flex: 1 1 auto; max-width: 440px;
  height: 36px; padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-mute);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}
.hdr-search:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.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; font-weight: 500;
}
.hdr-nav a { color: var(--text-dim); transition: color 0.15s; }
.hdr-nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- support menu ---------- */
.hdr-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.hdr-menu summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.hdr-menu summary::-webkit-details-marker {
  display: none;
}
.hdr-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.8;
  padding: 2px 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.hdr-menu-btn:hover,
.hdr-menu[open] .hdr-menu-btn {
  opacity: 1;
}
.hdr-menu-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-mute);
}
.hdr-menu[open] .hdr-menu-chevron {
  transform: rotate(180deg);
  color: var(--text);
}
.hdr-menu-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 250px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.14), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
  animation: menuFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hdr-menu-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}
.hdr-nav .hdr-menu-panel a.hdr-menu-action {
  background-image: none !important;
  background-size: 0 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.hdr-nav .hdr-menu-panel a.hdr-menu-action:hover {
  transform: translateY(-1px);
  opacity: 0.92;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  text-decoration: none;
}
.hdr-nav .hdr-menu-panel a.hdr-menu-action:active {
  transform: translateY(0);
}
.hdr-menu-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  text-align: center;
}
@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hdr-menu-panel {
    animation: none !important;
  }
  .hdr-menu-chevron {
    transition: none !important;
  }
}

/* ---------- home ---------- */
.page-home main { max-width: 960px; margin: 0 auto; padding: 0 24px 96px; }
.hero {
  padding: 88px 0 0; display: flex; flex-direction: column; align-items: center; gap: 20px;
  animation: enterUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero h1 {
  margin: 0; font-size: clamp(38px, 5.4vw, 56px); line-height: 1.05;
  letter-spacing: -0.035em; font-weight: 700; text-align: center; text-wrap: pretty;
  color: var(--text);
}
.lede {
  margin: 0; color: var(--text-dim); font-size: 18.5px; text-align: center; max-width: 580px;
  line-height: 1.55; letter-spacing: -0.015em; font-weight: 450;
}
.lede strong {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95em;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.lede strong:hover {
  transform: translateY(-1px);
}
.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: 14px;
  animation: enterUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}
.ask-field {
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text-mute);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.ask-field:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 12px 32px -4px rgba(0, 0, 0, 0.08);
}
.ask-field input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; 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(--text); color: var(--bg); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.ask-go:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}
.ask-go:active {
  transform: translateY(0);
}
.chips {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 4px;
}
.chip {
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 16px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  text-decoration: none;
}

.strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 72px;
  animation: enterUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.14s both;
}
.stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.06);
  border-color: var(--border-strong);
}
.stat-n {
  font-size: 28px; font-weight: 650; color: var(--text);
  letter-spacing: -0.03em; line-height: 1.1;
}
.stat-l {
  font-size: 13.5px; color: var(--text-mute); font-weight: 500;
}

.quick {
  margin-top: 48px; display: flex; flex-direction: column; gap: 12px;
  animation: enterUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}
.quick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.quick-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.quick-head a { font-size: 14px; font-weight: 500; color: var(--text-dim); transition: color 0.15s; }
.quick-head a:hover { color: var(--text); text-decoration: underline; }
.quick-note { margin: 0; font-size: 14px; color: var(--text-mute); }

.term {
  margin: 0; padding: 20px 22px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); font-size: 13.5px; line-height: 1.75;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.15);
}
.term .pr { color: var(--code-dim); user-select: none; }

.docs-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 48px;
  animation: enterUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}
.card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.07), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  border-color: var(--border-strong);
  text-decoration: none;
}
.card-t {
  font-weight: 600; font-size: 16px; color: var(--text); letter-spacing: -0.015em;
  display: flex; align-items: center; justify-content: space-between;
}
.card-t::after {
  content: "→";
  font-size: 15px; color: var(--text-mute);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
}
.card:hover .card-t::after {
  transform: translateX(4px);
  color: var(--text);
}
.card-d { font-size: 14px; color: var(--text-dim); line-height: 1.55; }

@keyframes enterUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero, .ask, .strip, .quick, .docs-cards, .card, .chip, .stat, .ask-go {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* ---------- 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; }
}

/* ---------- Apple layer: global nav, hero, cards, documentation headings ---------- */
.hdr {
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.hdr-in { max-width: 1040px; margin: 0 auto; gap: 28px; }
.brand { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.hdr-nav a { font-size: 14px; font-weight: 400; color: var(--text); opacity: 0.8; }
.hdr-nav a:hover { opacity: 1; text-decoration: none; }
.hdr-search input { background: var(--bg-sunken); border: 0; border-radius: 999px; font-size: 14px; }
.hdr-search input::placeholder { color: var(--text-mute); }
.hero { padding: 72px 0 0; gap: 14px; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.06; }
.lede { font-size: 21px; font-weight: 400; color: var(--text-dim); letter-spacing: -0.015em; }
.lede strong { font-weight: 600; background: none; border: 0; box-shadow: none; padding: 0; }
.lede strong:hover { transform: none; }
.ask-field { border-radius: 999px; border: 1px solid var(--border-strong); box-shadow: none; background: var(--surface); }
.ask-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ask-go { background: var(--accent); color: #fff; border-radius: 999px; box-shadow: none; }
.ask-go:hover { background: var(--accent); transform: none; box-shadow: none; }
.chip { border-radius: 999px; background: transparent; border-color: var(--border-strong); }
.docs-cards { gap: 16px; }
.card { border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: none; padding: 28px 28px 26px; }
.card:hover { transform: none; box-shadow: none; border-color: transparent; }
.card-t { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.card-t::after { color: var(--accent); }
.card:hover .card-t::after { transform: translateX(3px); color: var(--accent); }
.card-d { font-size: 16px; color: var(--text-dim); }
.quick { margin-top: 56px; }
.quick-head h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.quick-head a, .nav-link[aria-current="page"] { color: var(--accent); }
.side { font-size: 14px; }
.nav-link { border-radius: 8px; }
.content { padding: 44px 48px 110px; }
.doc h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.028em; line-height: 1.1; }
.doc h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 44px; }
.doc h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.doc a { color: var(--accent); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc p, .doc li { font-size: 17px; }
.doc pre { border-radius: var(--radius-sm); }
.idx-t { font-size: 19px; font-weight: 600; }
.idx-t a { color: var(--text); }
.robots-link { margin: 40px 0 0; text-align: center; font-size: 17px; }
.robots-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.robots-link a::after { content: " \203a"; }
.robots-link a:hover { text-decoration: underline; }

/* Robot store and motion, as apple.com uses it. */
.page-store {
  --s-bg: var(--bg); --s-surface: var(--surface); --s-ink: var(--text); --s-ink-2: var(--text-dim); --s-ink-3: var(--text-mute);
  --s-line: var(--border); --s-action: var(--accent); --s-action-ink: #ffffff;
  --s-safe-bg: var(--warn-bg); --s-safe-ink: var(--warn-text);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  background: var(--bg); color: var(--text); font-family: var(--sans);
}
.store { max-width: 1040px; margin: 0 auto; padding: 24px 20px 110px; display: grid; gap: 40px; }
.store-banner {
  position: relative; border-radius: 24px; overflow: hidden; color: #fff; min-height: 260px;
  padding: 32px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; text-decoration: none;
  background: linear-gradient(135deg, #1d1d1f 0%, #0066cc 60%, #2997ff 100%);
}
.store-banner .kicker { font: 500 13px/1 var(--mono); opacity: 0.85; letter-spacing: 0.04em; text-transform: uppercase; }
.store-banner strong { font-size: clamp(28px, 4vw, 38px); font-weight: 700; letter-spacing: -0.02em; max-width: 18ch; line-height: 1.1; }
.store-banner span:last-child { opacity: 0.9; max-width: 46ch; }
.robot-row h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 12px; }
.robot-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 240px); gap: 16px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.robot-card { scroll-snap-align: start; display: grid; gap: 4px; align-content: start; color: var(--s-ink); text-decoration: none; }
.robot-card:hover { text-decoration: none; }
.robot-card strong { font-size: 16px; font-weight: 600; margin-top: 8px; }
.robot-dev { color: var(--s-ink-3); font-size: 14px; }
.robot-note { color: var(--s-ink-2); font-size: 14px; }
.robot-get-sm { justify-self: start; margin-top: 8px; background: var(--s-action); color: var(--s-action-ink); font-weight: 600; font-size: 14px; border-radius: 999px; padding: 7px 18px; }
.robot-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; font: 600 22px/1 var(--mono); color: #fff; }
.robot-card .robot-icon, .robot-card .robot-picture { width: 100%; aspect-ratio: 1; height: auto; font-size: 34px; border-radius: 14px; }
.robot-picture { display: block; border-radius: 14px; object-fit: cover; }
.robot-icon-lg, .robot-picture.robot-icon-lg { width: 132px; height: 132px; border-radius: 30px; font-size: 46px; }
.icon-blue { background: #0066cc; }
.icon-brown { background: #7a4b00; }
.icon-green { background: #1d6b4f; }
.icon-violet { background: #5b3fa6; }
.robot-page { display: grid; gap: 28px; }
.robot-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
.robot-hero h1 { font-size: clamp(28px, 4vw, 36px); font-weight: 700; letter-spacing: -0.02em; }
.robot-hero .robot-dev { color: var(--s-action); font-weight: 500; margin-top: 4px; }
.robot-facts { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--s-ink-3); font-size: 14px; }
.robot-actions { margin-top: 16px; }
.robot-get { display: inline-block; background: var(--s-action); color: var(--s-action-ink); text-decoration: none; font-weight: 600; font-size: 16px; border-radius: 999px; padding: 11px 26px; }
.robot-get:hover { opacity: 0.92; text-decoration: none; }
.robot-photos { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 230px); gap: 12px; overflow-x: auto; }
.robot-photos img { width: 100%; height: auto; border-radius: 14px; }
.robot-block { display: grid; gap: 10px; }
.robot-block h2 { font-size: 20px; font-weight: 700; }
.robot-block > p { color: var(--s-ink-2); max-width: 66ch; }
.robot-safety { background: var(--s-safe-bg); border-radius: 14px; padding: 16px 18px; }
.robot-safety h2 { font-size: 16px; color: var(--s-safe-ink); }
.robot-safety ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; color: var(--s-safe-ink); }
.robot-needs ul { list-style: none; margin: 0; padding: 4px 18px; background: var(--s-surface); border-radius: 14px; }
.robot-needs li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--s-line); }
.robot-needs li:last-child { border-bottom: 0; }
.robot-needs b { font-weight: 500; color: var(--s-ink-2); }
.robot-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.robot-steps li { background: var(--s-surface); border-radius: 14px; padding: 14px 18px; display: grid; gap: 4px; }
.robot-steps h3 { font-size: 16px; font-weight: 600; }
.robot-steps p { color: var(--s-ink-2); font-size: 15px; }
.robot-reviewed { color: var(--s-ink-3); font-size: 13.5px; }
.store-empty { color: var(--s-ink-3); }
.store-tabs { display: none; }
@media (max-width: 720px) {
  .robot-hero { grid-template-columns: 1fr; justify-items: start; }
  .robot-icon-lg, .robot-picture.robot-icon-lg { width: 110px; height: 110px; font-size: 38px; }
  .store { padding-bottom: 96px; }
  .store-banner { min-height: 220px; }
  .store-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .store-tabs a { color: var(--text-mute); font-size: 13px; font-weight: 500; padding: 6px 10px; text-decoration: none; }
  .store-tabs a[aria-current="page"] { color: var(--accent); }
}

/* Motion, as apple.com uses it: content rises gently into place as it scrolls in,
   with a short stagger; the header gains a shadow once the page moves. Only applied
   when reveal.js has marked the page, so no-JS and reduced-motion readers see it all. */
.motion .reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0ms),
              transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0ms);
}
.motion .reveal.is-in { opacity: 1; transform: none; }
.hdr { transition: box-shadow 0.3s ease, background-color 0.3s ease; }
.hdr.is-scrolled { box-shadow: 0 1px 0 var(--border), 0 6px 20px -12px rgba(0, 0, 0, 0.18); }
.robot-card .robot-picture, .robot-card .robot-icon { transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.robot-card:hover .robot-picture, .robot-card:hover .robot-icon { transform: scale(1.03); }
.doc a, .hdr-nav a, .hdr-menu-btn > span { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.35s ease; }
.doc a:hover, .hdr-nav a:hover, .hdr-menu-btn:hover > span { background-size: 100% 1px; }
@media (prefers-reduced-motion: reduce) {
  .motion .reveal { opacity: 1; transform: none; transition: none; }
  .robot-card .robot-picture, .robot-card .robot-icon, .doc a, .hdr-nav a, .hdr-menu-btn > span { transition: none; }
}
