/* ── Design tokens ───────────────────────────────────── */
:root {
  --navy:         #0d1b2e;
  --navy-mid:     #162236;
  --navy-border:  #1e3050;
  --teal:         #0f6e56;
  --teal-mid:     #1d9e75;
  --teal-faint:   #e1f5ee;
  --sky:          #3a9fd6;   /* logo blue */
  --white:        #ffffff;
  --gray-50:      #f8f9fb;
  --gray-100:     #f1f3f6;
  --gray-200:     #e4e9f0;
  --gray-300:     #d4dce7;
  --gray-400:     #a0aab8;
  --gray-600:     #64748b;
  --gray-800:     #2d3748;
  --text:         #1a2535;
  --text-muted:   #56657a;
  --border:       #dde3ec;
  --sidebar-w:    268px;
  --header-h:     60px;
  --radius-sm:    4px;
  --radius:       6px;
  --radius-lg:    10px;
  --content-max:  780px;

  /* semantic surface tokens — overridden in dark mode */
  --surface:      var(--white);
  --surface-subtle: var(--gray-50);
  --surface-raised: var(--white);
  --code-bg:      var(--gray-100);
  --code-border:  var(--gray-200);
  --code-color:   var(--navy-mid);
}

/* ── Dark mode overrides ─────────────────────────────── */
[data-theme="dark"] {
  --white:        #0d1117;
  --gray-50:      #161b22;
  --gray-100:     #1c2128;
  --gray-200:     #2d333b;
  --gray-300:     #38414b;
  --gray-400:     #6e7681;
  --gray-600:     #8b949e;
  --gray-800:     #cdd9e5;
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --border:       #30363d;
  --teal-faint:   #112a22;
  --teal:         #3fd4a0;
  --teal-mid:     #3fd4a0;
  --sky:          #58a6ff;

  --surface:        #0d1117;
  --surface-subtle: #161b22;
  --surface-raised: #1c2128;
  --code-bg:        #161b22;
  --code-border:    #30363d;
  --code-color:     #cdd9e5;
}

/* ── Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
a { color: var(--teal-mid); text-decoration: none; }
a:hover { color: var(--teal); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
.site-logo img { height: 28px; width: auto; display: inline-block; }

/* ── Header ──────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  border-bottom: 1px solid var(--navy-border);
  z-index: 200;
}
.header-inner {
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-wordmark {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -.01em;
}
.logo-wordmark em {
  font-style: normal;
  font-weight: 400;
  color: rgba(255,255,255,.55);
}

/* ── Header search ───────────────────────────────────── */
.header-search {
  position: relative;
  flex: 1;
  max-width: 280px;
  margin-left: 1rem;
}
.header-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.35);
  pointer-events: none;
}
.header-search input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  font-size: 13px;
  font-family: inherit;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: rgba(255,255,255,.9);
  outline: none;
  transition: background .15s, border-color .15s;
}
.header-search input::placeholder { color: rgba(255,255,255,.35); }
.header-search input:focus {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.25);
}
.header-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 300;
  overflow: hidden;
}
.header-search-results a {
  display: flex;
  flex-direction: column;
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.header-search-results a:last-child { border-bottom: none; }
.header-search-results a:hover { background: var(--surface-subtle); }
.header-search-results .result-title { font-weight: 500; }

/* ── Header nav ──────────────────────────────────────── */
.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.header-nav a {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  transition: color .15s;
  text-decoration: none;
}
.header-nav a:hover { color: var(--white); }
.btn-github,
.btn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.75) !important;
  font-size: 13px !important;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-github:hover,
.btn-header:hover {
  background: rgba(255,255,255,.14) !important;
  border-color: rgba(255,255,255,.28) !important;
  text-decoration: none;
}

/* ── Theme toggle ────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  cursor: pointer;
  color: rgba(255,255,255,.65);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.theme-toggle:hover {
  background: rgba(255,255,255,.14);
  color: var(--white);
}
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ── Sidebar toggle (mobile) ─────────────────────────── */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.sidebar-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: rgba(255,255,255,.75);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ── Page wrapper ────────────────────────────────────── */
.page-wrapper {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h) - 60px);
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--surface) 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 150;
  display: flex;
  flex-direction: column;
}
.sidebar-inner {
  padding: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.sidebar-search {
  padding: 0 .875rem .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .65rem;
}
.sidebar-search-box {
  position: relative;
}
.search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-60%);
  color: var(--gray-400);
  pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  padding: 8px 10px 8px 36px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.sidebar-search input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal-mid) 14%, transparent);
}
.sidebar-search-results {
  margin-top: .5rem;
  max-height: 56vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
}
.sidebar-search-results a,
.header-search-results a {
  display: block;
  text-decoration: none;
}
.sidebar-search-results a {
  padding: .65rem .7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.sidebar-search-results a:last-child { border-bottom: none; }
.sidebar-search-results a:hover { background: var(--gray-100); }
.result-title {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.result-path {
  display: block;
  margin-top: .15rem;
  font-size: 11px;
  color: var(--teal-mid);
  overflow-wrap: anywhere;
}
.result-snippet {
  display: block;
  margin-top: .3rem;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-500);
}
.search-empty {
  padding: .75rem;
  font-size: 12.5px;
  color: var(--gray-500);
}
.sidebar-nav {
  padding: 0 .75rem;
  font-size: 13.5px;
}
.sidebar-home-link {
  margin: 0 0 .55rem;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-weight: 620;
}
.nav-tree {
  list-style: none;
}
.nav-tree-depth-0 {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.nav-item {
  min-width: 0;
}
.nav-item-depth-0.nav-item-section {
  margin-top: .35rem;
}
.nav-folder {
  border-radius: var(--radius);
}
.nav-tree-depth-0 > .nav-item > .nav-folder {
  padding: .2rem;
  border: 1px solid transparent;
}
.nav-folder[open] {
  background: color-mix(in srgb, var(--surface-raised) 88%, transparent);
  border-color: var(--border);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
}
[data-theme="dark"] .nav-folder[open] {
  box-shadow: none;
}
.nav-folder-summary {
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  width: 100%;
  padding: .48rem .62rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--gray-800);
  font-weight: 620;
  line-height: 1.35;
  transition: background .1s, color .1s;
}
.nav-folder-summary::-webkit-details-marker {
  display: none;
}
.nav-folder-summary::before {
  content: "▸";
  color: var(--gray-400);
  font-size: 10px;
  line-height: 1.4;
  margin-top: .18rem;
  transition: transform .15s ease, color .1s ease;
}
.nav-folder[open] > .nav-folder-summary::before {
  transform: rotate(90deg);
}
.nav-folder-summary:hover {
  background: color-mix(in srgb, var(--gray-100) 82%, transparent);
  color: var(--text);
}
.nav-folder-summary.active {
  color: var(--teal);
  background: color-mix(in srgb, var(--teal-faint) 78%, transparent);
}
.nav-folder-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.nav-tree-depth-0 > .nav-item > .nav-folder > .nav-folder-summary {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  padding-top: .42rem;
  padding-bottom: .42rem;
}
.nav-tree-depth-0 > .nav-item > .nav-folder > .nav-folder-summary:hover {
  color: var(--text);
}
.nav-tree-depth-0 > .nav-item.is-ancestor > .nav-folder > .nav-folder-summary {
  color: var(--teal);
  background: color-mix(in srgb, var(--teal-faint) 82%, transparent);
}
.nav-tree-depth-1,
.nav-tree-depth-2,
.nav-tree-depth-3,
.nav-tree-depth-4 {
  padding-left: .7rem;
  margin: .16rem 0 .28rem .35rem;
  border-left: 1px solid color-mix(in srgb, var(--gray-300) 70%, transparent);
}
.nav-page-link {
  display: block;
  padding: .42rem .68rem;
  border-radius: var(--radius);
  color: var(--gray-800);
  line-height: 1.42;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background .1s, color .1s;
}
.nav-page-link:hover {
  background: color-mix(in srgb, var(--gray-100) 84%, transparent);
  color: var(--text);
}
.nav-page-link.active {
  background: var(--teal-faint);
  color: var(--teal);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--teal);
}
.nav-item.is-active > .nav-page-link {
  position: relative;
}
.nav-item.is-active > .nav-page-link::after {
  content: "";
  position: absolute;
  top: 50%;
  right: .6rem;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
  opacity: .9;
}
[data-theme="dark"] .nav-page-link.active,
[data-theme="dark"] .nav-folder-summary.active,
[data-theme="dark"] .nav-tree-depth-0 > .nav-item.is-ancestor > .nav-folder > .nav-folder-summary {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal-mid) 24%, transparent);
}
.nav-item-depth-0 > .nav-page-link {
  margin-bottom: .45rem;
  padding: .58rem .8rem;
  font-weight: 600;
}
.sidebar-footer {
  margin-top: auto;
  padding: .875rem .875rem 0;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  font-size: 13px;
  font-weight: 500;
  color: var(--teal-mid);
  text-decoration: none;
}
.sidebar-footer a:hover { text-decoration: underline; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 90;
}

/* ── Main content ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3rem 4rem;
  min-width: 0;
}

/* ── Doc article ─────────────────────────────────────── */
.doc-content {
  max-width: 860px;
  margin: 0 auto;
}

.doc-header { margin-bottom: 1.5rem; }
.doc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}
.doc-header h1 {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -.02em;
}
.doc-last-updated {
  flex: 0 0 auto;
  margin-top: .45rem;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}
.doc-description {
  margin-top: .5rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.doc-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 2rem;
}

/* ── Typography in docs ──────────────────────────────── */
.doc-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin: 2.5rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.01em;
}
.doc-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 .5rem;
}
.doc-content h4 {
  font-size: .95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: 1.75rem 0 .5rem;
}
.doc-content p {
  margin-bottom: 1rem;
  max-width: 72ch;
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--text);
}
.doc-content ul, .doc-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  max-width: 72ch;
}
.doc-content li {
  margin-bottom: .38rem;
  line-height: 1.75;
}
.doc-content strong { font-weight: 600; }
.doc-content img {
  max-width: 100%;
  height: auto;
  margin: 1.6rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}
.doc-content figure {
  margin: 1.6rem auto;
}
.doc-content figure img {
  margin: 0;
}
.doc-image-fallback {
  margin: 1.4rem 0;
  padding: .85rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: .92rem;
}
.doc-image-fallback strong {
  color: var(--text);
}

/* ── Code ────────────────────────────────────────────── */
.doc-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .82em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: .1em .35em;
  color: var(--code-color);
}
.doc-content pre {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--navy-border);
}
.doc-content pre code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .84rem;
  background: none;
  border: none;
  padding: 0;
  color: #c9d8ed;
  line-height: 1.7;
}
.doc-code-block {
  position: relative;
  margin: 1.25rem 0;
}
.doc-code-block pre {
  margin: 0;
  padding-top: 3.2rem;
  padding-right: 3.9rem;
}
.doc-code-toolbar {
  position: absolute;
  top: .7rem;
  right: .75rem;
  display: inline-flex;
  align-items: center;
  z-index: 2;
}
.doc-code-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.82);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s ease;
}
.doc-code-button:hover,
.doc-code-button:focus-visible {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.24);
  color: #ffffff;
  outline: none;
}
.doc-code-button img {
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.doc-code-button .theme-icon-dark {
  display: none;
}
[data-theme="dark"] .doc-code-button .theme-icon-light {
  display: none;
}
[data-theme="dark"] .doc-code-button .theme-icon-dark {
  display: block;
}
.doc-code-button.copied {
  background: rgba(63, 212, 160, .18);
  border-color: rgba(63, 212, 160, .32);
  color: #8ff0cb;
}
.doc-code-button.copied::after,
.doc-code-button.failed::after {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  padding: .26rem .48rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
}
.doc-code-button.copied::after {
  content: "Copied";
  background: #0f6e56;
  color: #ffffff;
}
.doc-code-button.failed::after {
  content: "Failed";
  background: #7f1d1d;
  color: #ffffff;
}
/* Rouge syntax */
.highlight .k, .highlight .kd, .highlight .kn { color: #79c0ff; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #a5d6ff; }
.highlight .c, .highlight .cm, .highlight .c1 { color: #6e7f95; font-style: italic; }
.highlight .n { color: #c9d8ed; }
.highlight .nv { color: #ffa657; }
.highlight .o { color: #ff7b72; }
.highlight .m, .highlight .mi { color: #79c0ff; }

/* ── Tables ──────────────────────────────────────────── */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.doc-content thead tr { background: var(--gray-50); }
.doc-content th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.doc-content td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.doc-content tbody tr:last-child td { border-bottom: none; }
.doc-content tbody tr:hover { background: var(--gray-50); }

/* ── Callout boxes ───────────────────────────────────── */
.doc-content blockquote {
  border-left: 3px solid var(--sky);
  background: var(--surface-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .875rem 1.1rem;
  margin: 1.25rem 0;
  color: var(--gray-800);
  font-size: .95rem;
}
.doc-content blockquote p { margin: 0; }

/* ── Pagination ──────────────────────────────────────── */
.doc-pagination {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.pagination-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: .875rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  flex: 1;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.pagination-link:hover {
  border-color: var(--teal-mid);
  background: var(--teal-faint);
  text-decoration: none;
}
.pagination-link.next { text-align: right; }
.pagination-link .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  font-weight: 600;
}
.pagination-link .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--teal-mid);
}

/* ── Homepage ────────────────────────────────────────── */
.home-hero {
  max-width: 900px;
  padding: 2rem 0 3.5rem;
  margin: 0 auto;
  text-align: center;
}
.home-hero h1 {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.2;
  margin-bottom: .75rem;
}
.home-hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2rem;
}
.home-diagram {
  width: min(100%, 1120px);
  margin: -1.5rem auto 3.25rem;
}
.home-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 500px;
}
.home-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  width: min(100%, 1120px);
  margin: 1rem auto 0;
}
.home-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
  background: var(--surface);
  min-height: 188px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.home-card:hover {
  border-color: var(--teal-mid);
  box-shadow: 0 2px 8px rgba(29,158,117,.1);
  text-decoration: none;
}
.home-card-icon {
  width: 36px; height: 36px;
  background: var(--teal-faint);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .875rem;
  color: var(--teal);
  font-size: 18px;
}
.home-card h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}
.home-card p {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.home-contact {
  margin: 1.4rem auto 0;
  max-width: 720px;
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1.6;
  text-align: center;
}
.home-contact a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}
.home-contact a:hover {
  text-decoration: underline;
}
.not-found-shell {
  max-width: 980px;
  margin: 0 auto 2.25rem;
}
.not-found-hero {
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 94%, transparent), color-mix(in srgb, var(--surface-subtle) 88%, transparent));
  box-shadow: 0 16px 36px rgba(15, 23, 42, .06);
}
[data-theme="dark"] .not-found-hero {
  box-shadow: none;
}
.not-found-eyebrow {
  margin: 0 0 .45rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal);
}
.not-found-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.08;
}
.not-found-copy {
  margin: .85rem 0 0;
  max-width: 68ch;
  color: var(--text-muted);
  line-height: 1.8;
}
.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.2rem;
}
.not-found-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 .95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.not-found-button:hover {
  border-color: color-mix(in srgb, var(--teal-mid) 30%, var(--border));
  background: color-mix(in srgb, var(--teal-faint) 70%, var(--surface));
  color: var(--teal);
  text-decoration: none;
}
.not-found-button.primary {
  border-color: transparent;
  background: var(--teal);
  color: #ffffff;
}
.not-found-button.primary:hover {
  background: var(--teal-mid);
  color: #ffffff;
}
.not-found-suggestion {
  margin-top: 1rem;
  padding: .9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--teal-mid) 22%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--teal-faint) 70%, var(--surface));
}
.not-found-suggestion-label {
  display: block;
  margin-bottom: .2rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--teal);
}
.not-found-suggestion-link {
  display: inline-block;
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--text);
}
.not-found-suggestion-link:hover {
  color: var(--teal);
}
.not-found-suggestion-path {
  display: block;
  margin-top: .22rem;
  color: var(--text-muted);
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.not-found-home {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.not-found-home .home-hero {
  padding-top: .2rem;
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  margin-left: var(--sidebar-w);
  padding: 2rem 2.5rem;
}
.footer-inner {
  max-width: calc(var(--content-max) + var(--sidebar-w));
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.75);
}
.footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.footer-links a {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: color .15s;
}
.footer-links a:hover { color: var(--white); }
.footer-copy {
  width: 100%;
  font-size: 12px;
  color: rgba(255,255,255,.3);
  margin-top: .25rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,.1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: 2rem 1.25rem 3rem; }
  .site-footer { margin-left: 0; padding: 1.5rem 1.25rem; }
  .header-nav { display: none; }
  .sidebar-toggle { display: flex; }
  .header-search { max-width: 160px; }
  .home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .doc-header h1 { font-size: 1.75rem; }
  .doc-header-top { display: block; }
  .doc-last-updated {
    display: block;
    margin-top: .5rem;
  }
  .home-hero h1 { font-size: 1.75rem; }
  .home-hero { padding-top: 1rem; }
  .home-diagram { margin: -1rem auto 1.5rem; }
  .home-diagram svg { max-height: none; }
  .home-cards { grid-template-columns: 1fr; }
  .not-found-hero { padding: 1.2rem 1.15rem; }
  .not-found-actions { flex-direction: column; align-items: stretch; }
  .doc-pagination { flex-direction: column; }
  .header-search { display: none; }
}
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.section-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-card:hover {
  border-color: var(--accent-color, #3b82f6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.section-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}
.section-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}
.search-wrapper {
  position: relative;
  max-width: 480px;
  margin: 0.75rem 1rem;
}
#search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg-color, #fff);
  color: inherit;
}
#search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-color, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  z-index: 400;
  display: none;
}
#search-results.active { display: block; }
#search-results li a {
  display: block;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
#search-results li:last-child a { border-bottom: none; }
#search-results li a:hover { background: var(--hover-bg, #f8fafc); }
#search-results li a strong { display: block; font-weight: 600; }
#search-results li a span { color: var(--text-muted, #64748b); }
