/* Adapted from the denext docs site's stylesheet (MIT; see THIRD_PARTY_NOTICES.md). */
:root {
  --bg: #0b0d10;
  --panel: #13161b;
  --line: #232833;
  --fg: #e8ebf1;
  --muted: #9aa4b4;
  --accent: #f2a65a;
  --accent2: #6cc4d9;
  --code-bg: #0e1119;
  --prose: #cdd3de; /* body/prose text (softer than --fg) */
  --code-fg: #dfe6f2; /* code inside a fenced block */
  --chip: #1b2029; /* inline `code` chip background */
  --warn: #f0b45b; /* warning accent */
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15.5px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--chip);
  padding: 1.5px 6px;
  border-radius: 6px;
}

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(11, 13, 16, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  white-space: nowrap;
  font-weight: 700;
  color: var(--fg);
  font-size: 17px;
}

.brand .logo {
  color: var(--accent);
}

.ver {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  line-height: 1.4;
}

.ver:hover {
  border-color: var(--accent2);
  text-decoration: none;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: 20px;
}

.topnav a {
  color: var(--muted);
  white-space: nowrap;
}

.topnav a:hover {
  color: var(--fg);
  text-decoration: none;
}

main {
  flex: 1;
}

.sitefoot {
  border-top: 1px solid var(--line);
  padding: 22px 28px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

/* ---------- Landing ---------- */

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 72px 28px 40px;
  text-align: center;
}

.badge {
  display: inline-block;
  font-size: 12.5px;
  color: var(--accent2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 26px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}

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

.tagline {
  color: var(--muted);
  font-size: 18px;
  max-width: 640px;
  margin: 0 auto 28px;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 40px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--fg);
  font-weight: 600;
  font-size: 14.5px;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  color: #071021;
  border-color: var(--accent);
}

.features {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 28px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.feature {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 16.5px;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.pillar {
  padding: 32px 0 8px;
  scroll-margin-top: 76px;
}

.pillar-head {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 28px;
  text-align: center;
}

.pillar-head h2 {
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}

.pillar-head p {
  color: var(--muted);
  margin: 0;
}

.pillar .features {
  padding-bottom: 12px;
}

.feature p.feature-link {
  margin-top: 10px;
  font-weight: 600;
  font-size: 14px;
}

.pillar-link {
  text-align: center;
  margin: 0 0 24px;
  font-weight: 600;
}

/* Two-column comparison blocks. */
.compare {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 28px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  text-align: left;
}

.compare-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  min-width: 0;
}

.compare-col.alt {
  border-color: var(--accent);
}

.compare-col h3 {
  margin: 0 0 12px;
  font-size: 16.5px;
}

.compare-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14.5px;
}

.compare-list li {
  margin: 3px 0;
}

.compare-col .code {
  margin: 0 0 12px;
}

.compare-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.features.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.features.compact .feature {
  padding: 18px;
}

.features.compact .feature h3 {
  font-size: 15.5px;
}

.features.compact .feature p {
  font-size: 14px;
}

.toolchain-agents {
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .compare {
    grid-template-columns: 1fr;
    padding-left: 16px;
    padding-right: 16px;
  }
}

.closing {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 28px 80px;
  text-align: center;
}

.closing p {
  color: var(--muted);
}

/* ---------- Docs ---------- */

.docs {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 44px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 76px;
  /* Bound the sticky sidebar to the viewport and let it scroll internally — without this a
     nav taller than the screen has its bottom items stuck off-screen and unreachable. */
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px 0;
}

.navgroup {
  margin-bottom: 22px;
}

.navgroup-title {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.sidebar li {
  margin: 2px 0;
}

.sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14.5px;
}

.sidebar a:hover {
  color: var(--fg);
  background: var(--panel);
  text-decoration: none;
}

.sidebar a.active {
  color: var(--fg);
  background: var(--panel);
  box-shadow: inset 2px 0 0 var(--accent);
}

.article {
  padding: 34px 0 80px;
  min-width: 0;
  max-width: 760px;
}

.article-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.article-head h1 {
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  margin: 0;
}

.article h2 {
  font-size: 21px;
  margin: 36px 0 12px;
  letter-spacing: -0.01em;
}

.article p {
  color: var(--prose);
}

.article ul {
  color: var(--prose);
  padding-left: 20px;
}

.article li {
  margin: 6px 0;
}

/* ---------- Code & callouts ---------- */

.code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

.code code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--code-fg);
  white-space: pre;
}

.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero .code {
  text-align: left;
  margin-top: 36px;
}

.callout {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 13px 16px;
  margin: 18px 0;
  font-size: 14.5px;
  color: var(--prose);
  background: var(--panel);
}

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

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

/* ---------- Markdown-authored docs (.md content) ---------- */

.md h3 {
  font-size: 17px;
  margin: 28px 0 10px;
  letter-spacing: -0.01em;
}

.md a {
  color: var(--accent);
  text-decoration: none;
}

.md a:hover {
  text-decoration: underline;
}

.md blockquote {
  margin: 18px 0;
  padding: 2px 16px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

/* Multi-paragraph quotes and callouts (the Markdown renderer wraps each in a <p>). */
.md blockquote p,
.md .callout p {
  margin: 0 0 10px;
}

.md blockquote p:last-child,
.md .callout p:last-child {
  margin-bottom: 0;
}

.md img {
  max-width: 100%;
  height: auto;
}

/* Below the 3-column breakpoint the right-rail TOC doesn't fit — fall back to 2 columns. */
/* (`.site` raises specificity above the 3-column `.docs.has-toc` rule declared later.) */
@media (max-width: 1000px) {
  .site .docs.has-toc {
    grid-template-columns: 220px 1fr;
    max-width: 1120px;
  }
  .toc {
    display: none;
  }
}

@media (max-width: 780px) {
  .site .docs,
  .site .docs.has-toc {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 760px;
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 14px 0 0;
  }
  /* 0-JS mobile menu: show the toggle, hide the groups until the checkbox is checked.
     (`.site` again out-ranks the base `.nav-toggle { display: none }` declared later.) */
  .site .nav-toggle {
    display: inline-flex;
  }
  .site .navgroups {
    display: none;
    margin-top: 12px;
  }
  .site .nav-check:checked ~ .navgroups {
    display: block;
  }
  .toc {
    display: none;
  }
}

/* Docs tables (e.g. Rendering strategies) */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
}
.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
.table-wrap th,
.table-wrap td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.table-wrap thead th {
  background: var(--panel);
  color: var(--fg);
  font-weight: 600;
}
.table-wrap td code {
  white-space: nowrap;
}

/* GFM table alignment (classes emitted by the Markdown renderer). */
.table-wrap th.align-center,
.table-wrap td.align-center {
  text-align: center;
}
.table-wrap th.align-right,
.table-wrap td.align-right {
  text-align: right;
}
.table-wrap th.align-left,
.table-wrap td.align-left {
  text-align: left;
}

/* Wide reference tables rendered from Markdown: let long code cells wrap, so a
   123-row table doesn't become a multi-screen horizontal scroll. */
.md .table-wrap td code {
  white-space: normal;
}

/* API reference: entry-point index cards + per-module nav + symbols */
.api-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.api-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, transform 0.15s;
}
.api-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.api-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.api-card-head code {
  color: var(--accent);
  font-size: 15px;
}
.api-card-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
}
.api-card-blurb {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.api-modnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 0 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.api-modnav a {
  color: var(--muted);
  text-decoration: none;
}
.api-modnav a:hover {
  color: var(--accent);
}
.api-modnav a.active {
  font-weight: 600;
}
.api-modnav a.active code {
  color: var(--accent2);
}
.api-symbol {
  border-top: 1px solid var(--line);
  margin-top: 18px;
}
.api-symbol h3 {
  margin: 16px 0 8px;
}
.api-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
}

/* A highlighted marker. */
.api-only {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 45%, var(--line));
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
}

.callout.only-note {
  border-left-color: var(--accent2);
}

/* Module page: symbols grouped by kind. */
.api-section {
  margin-top: 32px;
}
.api-section h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.api-section-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
}
.api-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.api-list-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.api-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.api-list-name {
  text-decoration: none;
}
.api-list-name code {
  color: var(--accent);
  font-size: 14px;
}
.api-list-name:hover code {
  text-decoration: underline;
}
.api-list-doc {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* Per-symbol detail page. */
.api-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.api-crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.api-crumbs a:hover {
  color: var(--accent);
}
.api-crumbs code {
  font-size: 12.5px;
}
.api-crumb-current {
  color: var(--fg);
}
.api-detail-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}
.api-detail-import code {
  font-size: 12.5px;
  color: var(--muted);
}
.api-params {
  margin: 12px 0;
}
.api-param {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 4px 16px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.api-param dt {
  margin: 0;
}
.api-param dd {
  margin: 0;
  color: var(--prose);
  line-height: 1.6;
}
.api-param-nodoc {
  color: var(--muted);
}
.api-parents {
  margin: 12px 0;
}
.api-members {
  margin: 12px 0;
}
.api-member {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.api-member dt {
  margin: 0;
  overflow-wrap: anywhere;
}
.api-member dd {
  margin: 6px 0 0;
  color: var(--prose);
  line-height: 1.6;
}
.api-member dd > :first-child {
  margin-top: 0;
}
.api-member dd > :last-child {
  margin-bottom: 0;
}
.api-detail-back {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.api-detail-back a {
  color: var(--accent);
  text-decoration: none;
}
.api-detail-back a:hover {
  text-decoration: underline;
}

/* MCP server reference (generated from the tool registry) */
.mcp-tool {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
.mcp-tool h3 {
  margin: 14px 0 8px;
}
.mcp-tool h3 code {
  color: var(--accent);
  font-size: 15px;
}
.mcp-params {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}
.mcp-params li {
  padding: 5px 0;
  color: var(--prose);
  font-size: 14px;
}
.mcp-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}
.mcp-noparams {
  color: var(--muted);
  font-size: 13.5px;
}
.mcp-resources code {
  color: var(--accent2);
}

@media (max-width: 560px) {
  .api-param {
    grid-template-columns: 1fr;
  }
}

/* ---------- On-this-page TOC + 3-column layout ---------- */
.docs.has-toc {
  max-width: 1240px;
  grid-template-columns: 210px minmax(0, 1fr) 190px;
  gap: 40px;
}
.toc {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 0 34px;
}
.toc-title {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li {
  margin: 1px 0;
}
.toc a {
  display: block;
  padding: 3px 10px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc a:hover {
  color: var(--fg);
  border-left-color: var(--muted); /* subtle: distinct from the accent current-section bar */
  text-decoration: none;
}
.toc-l3 a {
  padding-left: 22px;
  font-size: 12.5px;
}

/* ----- Nested API TOC: kind sections + their exports (0-JS, :target-driven) ----- */
/* Each export sub-list is collapsed; only the CURRENT section's is revealed (below). */
.toc-sublist {
  list-style: none;
  margin: 1px 0 6px;
  padding: 0;
  display: none;
}
.toc-subitem {
  margin: 0;
}
.toc-sublink {
  padding-left: 22px;
  font-size: 12.5px;
}

/*
 * A kind section is "current" — its sub-links show, and its own entry becomes a bold
 * accent label instead of a link — when the URL points into it (its header or one of its
 * exports is :target), or, when nothing is targeted, for the first section by default.
 * The id set is fixed (lib/api.ts KIND_ORDER), so each is enumerated explicitly. Use
 * `#kind-x:target` (header) and `#kind-x :target` (an export inside it) as TWO separate
 * :has() args — a :has() may not contain another :has(), so `:has(#kind-x:has(...))` would
 * silently invalidate the whole rule.
 */
:is(:root:not(:has(:target)) .toc-sec:first-child, :root:has(#kind-functions:target) .toc-sec[data-sec="functions"], :root:has(#kind-functions :target) .toc-sec[data-sec="functions"], :root:has(#kind-classes:target) .toc-sec[data-sec="classes"], :root:has(#kind-classes :target) .toc-sec[data-sec="classes"], :root:has(#kind-interfaces:target) .toc-sec[data-sec="interfaces"], :root:has(#kind-interfaces :target) .toc-sec[data-sec="interfaces"], :root:has(#kind-type-aliases:target) .toc-sec[data-sec="type-aliases"], :root:has(#kind-type-aliases :target) .toc-sec[data-sec="type-aliases"], :root:has(#kind-enums:target) .toc-sec[data-sec="enums"], :root:has(#kind-enums :target) .toc-sec[data-sec="enums"], :root:has(#kind-values:target) .toc-sec[data-sec="values"], :root:has(#kind-values :target) .toc-sec[data-sec="values"], :root:has(#kind-namespaces:target) .toc-sec[data-sec="namespaces"], :root:has(#kind-namespaces :target) .toc-sec[data-sec="namespaces"], :root:has(#kind-other:target) .toc-sec[data-sec="other"], :root:has(#kind-other :target) .toc-sec[data-sec="other"]) {
  & > .toc-sublist {
    display: block;
  }
  & > .toc-seclink {
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
    pointer-events: none; /* the current section's entry is a label, not a link */
    cursor: default;
  }
}

/* Anchor jumps clear the sticky topbar. */
.article h2,
.article h3,
.article [id] {
  scroll-margin-top: 76px;
}

/* ---------- Mobile nav (0-JS checkbox toggle; hidden on desktop) ---------- */
.nav-check {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.nav-toggle::after {
  content: "▾";
  color: var(--muted);
}
.nav-check:checked ~ .nav-toggle::after {
  content: "▴";
}

/* ---------- Accessibility: visible keyboard focus ---------- */
a:focus-visible,
button:focus-visible,
.nav-toggle:focus-visible,
.toc a:focus-visible,
.sidebar a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.nav-check:focus-visible ~ .nav-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Site search (header form; 0 JS on every docs page) ---------- */
.search {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: 8px;
}
.search-icon {
  position: absolute;
  left: 10px;
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}
.search-input {
  width: 220px;
  padding: 7px 34px 7px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: width 0.15s ease, border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.search-input::placeholder {
  color: var(--muted);
}
.search-input:focus {
  border-color: var(--accent);
  width: 280px;
}
.search-clear {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.search-clear:hover {
  color: var(--fg);
  background: var(--chip);
}
/* The ✕ only shows once there is something to clear. */
.search-input:placeholder-shown ~ .search-clear {
  display: none;
}
/* The magnifier BUTTON is the narrow-viewport affordance only. */
.search-open {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.search-open:hover {
  color: var(--fg);
}

@media (max-width: 780px) {
  .topbar {
    gap: 14px;
    padding: 12px 16px;
  }
  .topnav {
    gap: 14px;
  }
  .search {
    margin-left: 0;
  }
  .search-input {
    width: 150px;
  }
  .search-input:focus {
    width: 180px;
  }
}

/* Narrow viewports, when the browser can react to focus from the header (`:has`):
   collapse the form to the magnifier button; focusing the input (the button is its
   <label>) takes over the whole header until the search is submitted or cancelled. */
@supports selector(:has(a)) {
  @media (max-width: 560px) {
    .search-open {
      display: inline-flex;
    }
    .search {
      margin-left: auto;
    }
    .topbar:not(:has(.search-input:focus)) .search-icon,
    .topbar:not(:has(.search-input:focus)) .search-clear {
      display: none;
    }
    .topbar:not(:has(.search-input:focus)) .search-input {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      opacity: 0;
      pointer-events: none;
    }
    .topbar:has(.search-input:focus) .brand,
    .topbar:has(.search-input:focus) .ver,
    .topbar:has(.search-input:focus) .topnav,
    .topbar:has(.search-input:focus) .search-open {
      display: none;
    }
    .topbar:has(.search-input:focus) .search {
      flex: 1;
    }
    .topbar:has(.search-input:focus) .search-input,
    .topbar:has(.search-input:focus) .search-input:focus {
      width: 100%;
    }
    .topbar:has(.search-input:focus) .search-clear {
      display: inline-flex;
    }
  }
}
@media (max-width: 560px) {
  .topbar {
    gap: 10px;
  }
  .ver {
    display: none; /* the version badge is the first thing to go on a phone */
  }
  .topnav {
    gap: 10px;
    font-size: 14px;
  }
}

/* ---------- /search — the results page (the one interactive route) ---------- */
.searchpage {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 28px 60px;
}
.searchpage h1 {
  margin: 0 0 18px;
  font-size: 28px;
}
.searchpage .search-input {
  width: 100%;
  font-size: 16px;
  padding: 11px 40px 11px 40px;
}
.searchpage .search-input:focus {
  width: 100%;
}
.searchpage .search {
  margin: 0 0 14px;
}
.search-status {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 18px;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.search-results li {
  border-top: 1px solid var(--line);
}
.search-results li:last-child {
  border-bottom: 1px solid var(--line);
}
.search-hit {
  display: block;
  padding: 12px 10px;
  border-radius: 8px;
  color: inherit;
}
.search-hit:hover,
.search-hit:focus-visible {
  background: var(--panel);
  text-decoration: none;
}
.search-hit-page {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}
.search-hit-title {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 15.5px;
  margin: 1px 0 3px;
}
.search-hit-kind {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  vertical-align: 2px;
}
.search-hit-snippet {
  display: block;
  color: var(--prose);
  font-size: 13.5px;
  line-height: 1.5;
}
.search-hit mark {
  background: rgba(242, 166, 90, 0.22);
  color: var(--fg);
  border-radius: 3px;
  padding: 0 1px;
}
.search-tips {
  color: var(--muted);
  font-size: 13.5px;
}
.search-tips kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
}

/* ---------- examples: nested sidebar links + an example page's header block ---------- */
.sidebar .navsub {
  margin: 2px 0 6px 10px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.sidebar .navsub a {
  font-size: 13.5px;
  padding: 3px 10px;
}
.example-meta {
  margin-bottom: 28px;
}
.example-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 14px;
}
.example-run-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 6px;
}
.example-related ul {
  padding-left: 20px;
}
.example-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.example-pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.example-pager a[rel="next"] {
  text-align: right;
  margin-left: auto;
}
.example-pager-dir {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- rtci site additions ---- */
.codefig {
  margin: 0 0 18px;
}
.codefig .code {
  margin-bottom: 4px;
}
.code-source,
.md p > em:only-child {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
  font-style: normal;
}
.code-source {
  margin: 0 0 4px;
}
.diagram code {
  white-space: pre;
  font-size: 0.82em;
}
.feature-kicker {
  display: block;
  color: var(--accent2);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.feature-extra {
  color: var(--muted);
}
.feature-links {
  display: flex;
  gap: 14px;
}
.features.stats .feature h3 {
  font-size: 1.35em;
  color: var(--accent);
}
.enables {
  color: var(--muted);
  font-size: 0.9em;
}
td.hash code {
  font-size: 0.72em;
  word-break: break-all;
}
.nowrap {
  white-space: nowrap;
}
.crate-links {
  color: var(--muted);
}
.crate-install h3 {
  margin-top: 28px;
}
.callout {
  border-left: 3px solid var(--warn);
  background: var(--panel);
  padding: 4px 14px;
  margin: 12px 0 20px;
}
.generated-note {
  color: var(--muted);
  font-size: 0.88em;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}
blockquote.quoted {
  border-left: 3px solid var(--accent);
  margin: 0 0 8px;
  padding: 2px 0 2px 16px;
}
.group-index {
  line-height: 2;
}
table.profiles td.val {
  white-space: nowrap;
}
table.profiles td.val code {
  font-size: 0.8em;
}
table.profiles td.differs {
  background: rgba(242, 166, 90, 0.12);
}
table.profiles .beh code {
  color: var(--fg);
  font-weight: 600;
}
table.profiles .setting,
table.profiles .clause {
  color: var(--muted);
  font-size: 0.86em;
}
details.chrome-src {
  font-size: 0.82em;
  color: var(--muted);
  margin-top: 4px;
}
details.chrome-src summary {
  cursor: pointer;
  color: var(--accent2);
}
details.perfile summary {
  cursor: pointer;
  color: var(--accent);
  margin: 8px 0;
}
table.small td,
table.small th {
  font-size: 0.82em;
  padding: 3px 8px;
}
.api-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.api-entry {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 80px;
}
.api-entry .api-kind {
  display: inline-block;
  min-width: 52px;
  font-size: 0.72em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  margin-right: 8px;
  text-align: center;
}
.api-entry .k-struct,
.api-entry .k-enum {
  color: var(--accent2);
}
.api-entry .k-fn,
.api-entry .k-trait {
  color: var(--accent);
}
.api-entry .api-doc {
  display: block;
  color: var(--prose);
  font-size: 0.92em;
  margin: 3px 0 0 62px;
}
.api-entry .api-from,
.api-flag {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 8px;
}
.api-moddoc {
  color: var(--prose);
}
.ffi-sig {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 4px 0 0 62px;
  font-size: 0.82em;
  color: var(--muted);
}
.releases li {
  margin-bottom: 10px;
}
.rel-date {
  color: var(--muted);
}
.rel-sum {
  color: var(--muted);
  margin: 2px 0 0;
  font-size: 0.9em;
}
@media (max-width: 560px) {
  .api-entry .api-doc,
  .ffi-sig {
    margin-left: 0;
  }
}
.sep {
  display: none;
}
