/* Copyright Aniston
 *
 * Aniston Nexus documentation site stylesheet.
 * Copied by docs/site/build_docs.py to build/assets/docs.css.
 * Hallmark brand: steel blue on cool off-white, system fonts, 4-8px radii,
 * no gradients, no glow, no tracked uppercase. Works offline (no external URLs).
 */

/* ------------------------------------------------------------ tokens */

:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --code-bg: #f3f5f7;
  --text: #1f2933;
  --text-soft: #323f4b;
  --muted: #52606d;
  --line: #d5dbe1;
  --line-strong: #aab4be;
  --accent: #305680;
  --accent-hover: #24476c;
  --accent-tint: rgba(48, 86, 128, 0.08);
  --accent-tint-strong: rgba(48, 86, 128, 0.16);
  --accent-line: rgba(48, 86, 128, 0.35);
  --hover: rgba(31, 41, 51, 0.06);
  --warn: #9a5b00;
  --warn-tint: #fdf5e6;
  --backdrop: rgba(15, 20, 25, 0.45);
  --shadow-soft: 0 1px 3px rgba(15, 23, 32, 0.08);
  --shadow-dialog: 0 8px 24px rgba(15, 23, 32, 0.16);
  --focus: #305680;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;

  --topbar-h: 56px;
  --sidebar-w: 260px;
  --toc-w: 220px;
  --content-max: 780px;
  --radius: 4px;
  --radius-lg: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14181c;
    --surface: #1d2329;
    --surface-2: #232a31;
    --code-bg: #161b20;
    --text: #e4e7eb;
    --text-soft: #cfd5dc;
    --muted: #9aa5b1;
    --line: #323b44;
    --line-strong: #4a5560;
    --accent: #8fb3dc;
    --accent-hover: #b0cbe8;
    --accent-tint: rgba(143, 179, 220, 0.12);
    --accent-tint-strong: rgba(143, 179, 220, 0.24);
    --accent-line: rgba(143, 179, 220, 0.45);
    --hover: rgba(228, 231, 235, 0.06);
    --warn: #d9a441;
    --warn-tint: rgba(217, 164, 65, 0.10);
    --backdrop: rgba(0, 0, 0, 0.55);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.30);
    --shadow-dialog: 0 8px 24px rgba(0, 0, 0, 0.40);
    --focus: #8fb3dc;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181c;
  --surface: #1d2329;
  --surface-2: #232a31;
  --code-bg: #161b20;
  --text: #e4e7eb;
  --text-soft: #cfd5dc;
  --muted: #9aa5b1;
  --line: #323b44;
  --line-strong: #4a5560;
  --accent: #8fb3dc;
  --accent-hover: #b0cbe8;
  --accent-tint: rgba(143, 179, 220, 0.12);
  --accent-tint-strong: rgba(143, 179, 220, 0.24);
  --accent-line: rgba(143, 179, 220, 0.45);
  --hover: rgba(228, 231, 235, 0.06);
  --warn: #d9a441;
  --warn-tint: rgba(217, 164, 65, 0.10);
  --backdrop: rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.30);
  --shadow-dialog: 0 8px 24px rgba(0, 0, 0, 0.40);
  --focus: #8fb3dc;
}

/* ------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

svg {
  flex-shrink: 0;
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--accent-tint-strong);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.content:focus,
.content:focus-visible {
  outline: none;
}

[id] {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.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;
}

body.search-open {
  overflow: hidden;
}

/* ------------------------------------------------------------ skip link */

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 8px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.nav-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-toggle:hover,
.theme-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

.theme-toggle {
  border-color: var(--line);
}

.nav-toggle svg,
.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.nav-toggle .icon-close,
body.nav-open .nav-toggle .icon-menu {
  display: none;
}

body.nav-open .nav-toggle .icon-close {
  display: block;
}

.nav-toggle {
  display: none;
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: calc(var(--sidebar-w) - 32px);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: 1;
}

.brand-logo {
  display: block;
  width: 24px;
  height: 24px;
}

.brand-name {
  font-weight: 600;
  white-space: nowrap;
}

.brand-tag {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

/* Logo and theme icon swap: light by default, dark when chosen or preferred. */
.brand-logo-dark,
.theme-toggle .icon-sun {
  display: none;
}

.brand-logo-light,
.theme-toggle .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-dark,
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .brand-logo-light,
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

:root[data-theme="dark"] .brand-logo-dark,
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .brand-logo-light,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Search trigger: looks like an input. */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 380px;
  min-width: 0;
  height: 36px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.search-trigger svg {
  width: 16px;
  height: 16px;
}

.search-trigger-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-kbd,
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.search-trigger .search-kbd {
  margin-left: auto;
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.topbar-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
}

.layout.no-toc {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar,
.content,
.toc {
  min-width: 0;
}

/* ------------------------------------------------------------ sidebar */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 12px 40px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sidebar-group + .sidebar-group {
  margin-top: 20px;
}

.sidebar-heading {
  margin: 0 0 6px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-list li + li {
  margin-top: 1px;
}

.sidebar-link {
  position: relative;
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: var(--hover);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.sidebar-backdrop {
  display: none;
}

/* ------------------------------------------------------------ content */

.content {
  min-height: calc(100vh - var(--topbar-h));
  padding: 32px 48px 0;
  background: var(--surface);
}

.content > * {
  max-width: var(--content-max);
  margin-left: 0;
  margin-right: auto;
}

.content-home > * {
  max-width: 1040px;
}

/* Home: hero and cards use the wide column, running text keeps the reading width. */
.content-home > .prose {
  max-width: var(--content-max);
}

/* ------------------------------------------------------------ breadcrumbs */

.breadcrumbs {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs li {
  min-width: 0;
  overflow-wrap: anywhere;
}

.breadcrumbs li + li::before {
  content: "\203A";
  margin: 0 8px;
  color: var(--line-strong);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumbs [aria-current="page"] {
  color: var(--text-soft);
}

/* ------------------------------------------------------------ prose */

.prose {
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.prose h1 {
  margin: 0 0 12px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.prose h2 {
  margin: 40px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 22px;
  line-height: 1.3;
}

.prose h3 {
  margin: 28px 0 8px;
  font-size: 17px;
  line-height: 1.4;
}

.prose h4 {
  margin: 24px 0 8px;
  font-size: 15px;
  line-height: 1.4;
}

.prose .lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.prose .page-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.prose p,
.prose ul,
.prose ol,
.prose dl {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li {
  margin: 4px 0;
}

.prose li > ul,
.prose li > ol {
  margin: 4px 0;
}

.prose li::marker {
  color: var(--muted);
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

.prose strong,
.prose b {
  font-weight: 600;
  color: var(--text);
}

.prose hr {
  height: 0;
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose img {
  height: auto;
  border-radius: var(--radius);
}

.prose > :last-child {
  margin-bottom: 0;
}

/* Heading anchors: hidden until the heading is hovered or the anchor focused. */
.heading-anchor {
  margin-left: 8px;
  padding: 0 2px;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none !important;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor,
.heading-anchor:focus,
.heading-anchor:focus-visible {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
}

@media (hover: none) {
  .heading-anchor {
    opacity: 0.5;
  }
}

/* ------------------------------------------------------------ tables */

.table {
  margin: 16px 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-width: thin;
}

.prose table {
  width: 100%;
  margin: 16px 0 20px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}

.table table {
  margin: 0;
  border: 0;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th + th,
.prose td + td {
  border-left: 1px solid var(--line);
}

.prose thead th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:hover td {
  background: var(--hover);
}

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

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
  background: var(--code-bg);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: var(--text);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.prose a code {
  color: inherit;
}

.prose pre {
  margin: 16px 0 20px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  scrollbar-width: thin;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

.code-block {
  position: relative;
  margin: 16px 0 20px;
}

.code-block pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.code-block:hover .copy-btn,
.code-block:focus-within .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
  }
}

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

.callout {
  margin: 16px 0 20px;
  padding: 12px 16px;
  border-left: 4px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
  color: var(--text);
}

.callout > :first-child {
  margin-top: 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-note {
  border-left-color: var(--accent);
  background: var(--accent-tint);
}

.callout-warning {
  border-left-color: var(--warn);
  background: var(--warn-tint);
}

.callout-warning strong:first-child {
  color: var(--warn);
}

.callout-note strong:first-child {
  color: var(--accent);
}

/* ------------------------------------------------------------ rule node reference */

.node {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.node h3 {
  margin-top: 0;
}

.node .muted {
  margin-bottom: 0;
}

/* ------------------------------------------------------------ table of contents */

.toc {
  display: block;
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 16px 32px 20px;
  font-size: 13px;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.toc-heading {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.toc-list a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-list .toc-h3 a {
  padding-left: 24px;
}

.toc-list a:hover {
  color: var(--text);
}

.toc-list a.is-active,
.toc-list li.is-active > a {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* ------------------------------------------------------------ pager */

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 48px;
}

.pager-prev,
.pager-next {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pager-prev {
  grid-column: 1;
}

.pager-next {
  grid-column: 2;
  text-align: right;
}

.pager-prev:hover,
.pager-next:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.pager-label {
  color: var(--muted);
  font-size: 12px;
}

.pager-prev .pager-label::before {
  content: "\2039\00a0";
}

.pager-next .pager-label::after {
  content: "\00a0\203A";
}

.pager-title {
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 56px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------ home page */

.hero {
  padding: 24px 0 8px;
}

.hero h1 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.hero .lead {
  max-width: 680px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.search-trigger-lg {
  width: 100%;
  max-width: 560px;
  height: 48px;
  padding: 0 10px 0 14px;
  gap: 10px;
  background: var(--surface);
  font-size: 15px;
}

.search-trigger-lg svg {
  width: 18px;
  height: 18px;
}

.card-section {
  margin-top: 40px;
}

.card-section-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Fill the last row: a single last card spans the row, two last cards share it. */
.card-grid > .card:last-child:nth-child(3n + 1) {
  grid-column: 1 / -1;
}

.card-grid > .card:last-child:nth-child(3n + 2) {
  grid-column: span 2;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.card-title {
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.card-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.content-home .prose {
  margin-top: 40px;
}

/* ------------------------------------------------------------ search dialog */

.search-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.search-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 76vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.search-field:focus-within {
  box-shadow: inset 0 -2px 0 var(--focus);
}

.search-field svg {
  width: 18px;
  height: 18px;
}

.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field input::-webkit-search-cancel-button,
.search-field input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-results {
  flex: 1 1 auto;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 8px;
  scrollbar-width: thin;
}

.search-results:empty {
  display: none;
}

.search-result {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.search-result:hover,
.search-results li.is-active .search-result,
.search-results li[aria-selected="true"] .search-result {
  background: var(--accent-tint);
}

.search-results li.is-active .search-result-title {
  color: var(--accent);
}

.search-result-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.search-result-path {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.search-result-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.search-result mark,
.search-results mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--accent-tint-strong);
  color: var(--text);
}

.search-empty {
  margin: 0;
  padding: 20px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.search-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

/* ------------------------------------------------------------ breakpoints */

/* 960-1199px: sidebar + content, table of contents hidden. */
@media (max-width: 1199px) {
  :root {
    --sidebar-w: 240px;
  }

  .layout,
  .layout.no-toc {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  .content {
    padding: 28px 32px 0;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid > .card:last-child:nth-child(3n + 1),
  .card-grid > .card:last-child:nth-child(3n + 2) {
    grid-column: auto;
  }

  .card-grid > .card:last-child:nth-child(2n + 1) {
    grid-column: 1 / -1;
  }
}

/* Below 960px: off-canvas sidebar drawer, icon-only search trigger. */
@media (max-width: 959px) {
  /* The bar stays above the drawer: its menu button turns into the close button. */
  .topbar {
    gap: 8px;
    z-index: 95;
  }

  .search-kbd {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: -6px;
  }

  .brand {
    min-width: 0;
  }

  .topbar .search-trigger {
    flex: 0 0 36px;
    width: 36px;
    margin-left: auto;
    padding: 0;
    justify-content: center;
    background: transparent;
    border-color: var(--line);
    color: var(--muted);
  }

  .topbar .search-trigger:hover {
    background: var(--hover);
    color: var(--text);
  }

  .topbar .search-trigger svg {
    width: 20px;
    height: 20px;
  }

  .topbar .search-trigger-text,
  .topbar .search-trigger .search-kbd {
    display: none;
  }

  .topbar-actions {
    margin-left: 0;
  }

  .layout,
  .layout.no-toc {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(300px, 86vw);
    height: auto;
    padding-top: 20px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar-backdrop {
    display: block !important;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 80;
    background: var(--backdrop);
  }

  .content {
    padding: 24px 16px 0;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero .lead {
    font-size: 17px;
  }
}

@media (max-width: 719px) {
  .topbar-link {
    display: none;
  }

  .prose h1 {
    font-size: 28px;
  }

  .prose h2 {
    font-size: 20px;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-prev,
  .pager-next {
    grid-column: auto;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-dialog {
    padding-top: 8vh;
  }
}

/* Touch screens: no keyboard shortcut hints. */
@media (hover: none) {
  .search-kbd {
    display: none;
  }
}

@media (max-width: 599px) {
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-grid > .card:last-child {
    grid-column: auto;
  }
}

@media (max-width: 399px) {
  .brand-tag {
    display: none;
  }

  .hero h1 {
    font-size: 28px;
  }
}

/* ------------------------------------------------------------ theme switch */

/* Set by docs.js for one frame while the theme changes, so colours do not fade in a staggered way. */
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------ print */

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 12pt;
  }

  .skip-link,
  .topbar,
  .sidebar,
  .sidebar-backdrop,
  .toc,
  .pager,
  .search-dialog,
  .search-trigger,
  .copy-btn,
  .heading-anchor {
    display: none !important;
  }

  .layout,
  .layout.no-toc {
    display: block;
    min-height: 0;
  }

  .content {
    min-height: 0;
    padding: 0;
    background: #ffffff;
  }

  .content > * {
    max-width: none;
  }

  .prose,
  .prose h1,
  .prose h2,
  .prose h3,
  .prose strong {
    color: #000000;
  }

  .prose a {
    color: #000000;
    text-decoration: underline;
  }

  .prose pre,
  .prose pre code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .table {
    overflow: visible;
  }

  .prose h2,
  .prose h3 {
    break-after: avoid;
  }

  .prose pre,
  .prose tr,
  .callout,
  .card {
    break-inside: avoid;
  }
}
