/* Generated by tools/docs.mn from frontend/src/styles. Edit those files. */
/*
 * moon brand primitives — the single source of colour, type, and shape for
 * every surface the project ships: the marketing homepage, the /docs site and
 * reference, and the /tour application.
 *
 * Layer 1 of the token hierarchy that variables.css documents:
 *
 *   Element token -> Semantic token -> Primitive (this file)
 *
 * Nothing else in the repository is allowed to name a raw colour. A rebrand
 * is an edit to the scales below:
 *
 *   - src/styles/variables.css maps the retained --tk-* element tokens onto them.
 *   - uno.config.ts hands the same scales to the utility classes.
 *   - tools/docs.mn inlines this file verbatim at the top of the generated
 *     site.css, so the homepage and the API reference share it too.
 *
 * The scales run light (50) to dark (950/1000) so the same ramp serves both
 * themes: a light surface reads down the scale, a dark surface reads up it.
 */

:root {
  /* Brand accent — moon violet. */
  --moon-accent-50: #f5f2ff;
  --moon-accent-100: #ede8ff;
  --moon-accent-200: #ded9ff;
  --moon-accent-300: #c9beff;
  --moon-accent-400: #bd9cff;
  --moon-accent-500: #9d8cff;
  --moon-accent-600: #715be5;
  --moon-accent-700: #5b45cc;
  --moon-accent-800: #4a37a8;
  --moon-accent-900: #33267f;
  --moon-accent-950: #1e1747;

  /* Neutrals, carrying a trace of the accent hue so greys sit beside it. */
  --moon-gray-0: #ffffff;
  --moon-gray-50: #f7f5ff;
  --moon-gray-100: #edebf4;
  --moon-gray-200: #e4e2ee;
  --moon-gray-300: #d6d2e4;
  --moon-gray-400: #bcb8cb;
  --moon-gray-500: #918ca6;
  --moon-gray-600: #6b6683;
  --moon-gray-700: #4c4960;
  --moon-gray-800: #2a2833;
  --moon-gray-900: #211f2a;
  --moon-gray-950: #15141b;
  --moon-gray-1000: #0d0d12;

  /* Status scales. */
  --moon-positive-50: #edfcf6;
  --moon-positive-100: #cefdeb;
  --moon-positive-200: #a1f9dc;
  --moon-positive-300: #64f1cb;
  --moon-positive-400: #24e0b3;
  --moon-positive-500: #02c79f;
  --moon-positive-600: #00a282;
  --moon-positive-700: #00826b;
  --moon-positive-800: #006656;
  --moon-positive-900: #005449;
  --moon-positive-950: #223533;

  --moon-negative-50: #fef2f3;
  --moon-negative-100: #fde6e7;
  --moon-negative-200: #fbd0d4;
  --moon-negative-300: #f7aab1;
  --moon-negative-400: #f06a78;
  --moon-negative-500: #e84b60;
  --moon-negative-600: #d42a48;
  --moon-negative-700: #b21e3c;
  --moon-negative-800: #951c38;
  --moon-negative-900: #801b36;
  --moon-negative-950: #45212a;

  --moon-warning-50: #fefaec;
  --moon-warning-100: #fcf4d9;
  --moon-warning-200: #f9e08e;
  --moon-warning-300: #f6ca53;
  --moon-warning-400: #ed9413;
  --moon-warning-500: #d2700d;
  --moon-warning-600: #ae4e0f;
  --moon-warning-700: #ae4e0f;
  --moon-warning-800: #8e3d12;
  --moon-warning-900: #753212;
  --moon-warning-950: #402c22;

  --moon-info-50: #eff9ff;
  --moon-info-100: #e5f6ff;
  --moon-info-200: #b6e9ff;
  --moon-info-300: #75daff;
  --moon-info-400: #2cc8ff;
  --moon-info-500: #00aef2;
  --moon-info-600: #008ed4;
  --moon-info-700: #0071ab;
  --moon-info-800: #005f8d;
  --moon-info-900: #064f74;
  --moon-info-950: #17374a;

  --moon-tip-50: #fcf5ff;
  --moon-tip-100: #f8ecfe;
  --moon-tip-200: #f0d3fd;
  --moon-tip-300: #e7bbfc;
  --moon-tip-400: #dd9efa;
  --moon-tip-500: #d17cf8;
  --moon-tip-600: #bb3df5;
  --moon-tip-700: #aa0cf3;
  --moon-tip-800: #8b0ac7;
  --moon-tip-900: #660792;
  --moon-tip-950: #3f254b;

  /*
   * Syntax roles, light surfaces. One hue per role, shared by the tour's
   * highlighted lesson sources and the signatures the API reference renders,
   * so a `fn` keyword is the same colour wherever the reader meets it. The
   * rules that consume them live in syntax.css.
   */
  --moon-code-keyword: #78208e;
  --moon-code-type: #2675c9;
  --moon-code-string: #14845f;
  --moon-code-number: #b65a16;
  --moon-code-comment: #68717d;
  --moon-code-function: #6657d8;
  --moon-code-module: #4c4960;
  --moon-code-parameter: #4c4960;
  --moon-code-punctuation: #918ca6;

  /* Type. */
  --moon-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --moon-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  /* Shape and depth. */
  --moon-radius-sm: 0.35rem;
  --moon-radius-md: 0.6rem;
  --moon-radius-lg: 0.9rem;
  --moon-radius-pill: 999px;
  --moon-shadow-panel: 0 1rem 3rem rgb(0 0 0 / 25%);
  --moon-shadow-raised: 0 0.35rem 1.5rem rgb(0 0 0 / 30%);

  /*
   * The page-top glow both dark surfaces wear. Kept here because it is a
   * brand mark rather than a layout choice.
   */
  --moon-glow: radial-gradient(circle at 50% -8rem, rgb(113 91 229 / 18%), transparent 28rem);
  --moon-glow-hero: radial-gradient(circle at 50% 15%, rgb(113 91 229 / 22%), transparent 32rem);
}

/*
 * Syntax roles, dark surfaces. `data-theme` is what the tour's theme switch
 * sets; `.moon-dark` is what a permanently dark page (the homepage, the API
 * reference) declares on <html>.
 */
:root[data-theme='dark'],
:root.moon-dark {
  --moon-code-keyword: #d899f0;
  --moon-code-type: #75b7ff;
  --moon-code-string: #6ed7ad;
  --moon-code-number: #ffad68;
  --moon-code-comment: #98a2b3;
  --moon-code-function: #aaa1ff;
  --moon-code-module: #bcb8cb;
  --moon-code-parameter: #d6d2e4;
  --moon-code-punctuation: #918ca6;
}

/*
 * moon syntax highlighting, shared by every surface that shows moon code.
 *
 * Static blocks use class names from the generated Tree-sitter captures
 * (src/lib/moon-highlighter.ts, `moon-hl-<capture with dots as dashes>`);
 * tools/docs.mn emits the same names for signatures. The live Monaco editor
 * consumes the Monarch tokenizer generated from the same Monogram grammar.
 * Colours come from tokens.css, so the surfaces stay aligned.
 *
 * The :root prefix is intentional. Expressive Code protects its blocks with
 * `.expressive-code *:not(path) { all: revert; }`; without the extra class-like
 * specificity, that reset wins over these token classes and erases their
 * colours after the client-side highlighter adds them.
 */

:root .moon-hl-keyword,
:root .moon-hl-keyword-function,
:root .moon-hl-keyword-operator,
:root .moon-hl-keyword-return {
  color: var(--moon-code-keyword);
  font-weight: 600;
}

:root .moon-hl-type,
:root .moon-hl-type-builtin {
  color: var(--moon-code-type);
}

:root .moon-hl-string,
:root .moon-hl-string-special {
  color: var(--moon-code-string);
}

:root .moon-hl-number,
:root .moon-hl-boolean,
:root .moon-hl-constant,
:root .moon-hl-constant-builtin {
  color: var(--moon-code-number);
}

:root .moon-hl-comment,
:root .moon-hl-comment-doc {
  color: var(--moon-code-comment);
  font-style: italic;
}

:root .moon-hl-function,
:root .moon-hl-function-method {
  color: var(--moon-code-function);
}

:root .moon-hl-module {
  color: var(--moon-code-module);
}

:root .moon-hl-variable-parameter,
:root .moon-hl-variable-member {
  color: var(--moon-code-parameter);
}

:root .moon-hl-punctuation,
:root .moon-hl-operator {
  color: var(--moon-code-punctuation);
}

/*
 * The dark marketing surfaces: the homepage at / and the documentation under
 * /docs. tools/docs.mn concatenates tokens.css + syntax.css + this file into
 * the site.css it writes beside the generated pages, so these three files are
 * the whole story for anything outside the tour application.
 *
 * Semantic tokens first; every value below resolves to a primitive.
 */

:root {
  --page-bg: var(--moon-gray-1000);
  --panel-bg: var(--moon-gray-950);
  --panel-bg-raised: var(--moon-gray-900);
  --border: var(--moon-gray-800);
  --border-strong: var(--moon-gray-700);
  --text: var(--moon-gray-50);
  --text-body: var(--moon-gray-300);
  --text-muted: var(--moon-gray-400);
  --text-dim: var(--moon-gray-500);
  --link: var(--moon-accent-400);
  --link-hover: var(--moon-accent-200);
  --focus: var(--moon-accent-500);

  color-scheme: dark;
  font-family: var(--moon-font-sans);
  background: var(--page-bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--moon-glow), var(--page-bg);
  background-repeat: no-repeat;
  color: var(--text-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--moon-radius-sm);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--moon-radius-md) 0;
  background: var(--moon-accent-600);
  color: var(--moon-gray-0);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* ── Shared chrome ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: rgb(13 13 18 / 82%);
  backdrop-filter: blur(12px);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-header .brand img {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
}

.site-header .brand .brand-sub {
  color: var(--text-dim);
  font-weight: 500;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.92rem;
}

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

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--text);
}

.site-nav a[aria-current='page'] {
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem clamp(1rem, 3vw, 2rem);
  color: var(--text-dim);
  font-size: 0.85rem;
}

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

/* ── Homepage ──────────────────────────────────────────────────── */

.hero {
  display: grid;
  place-items: center;
  min-height: calc(100svh - 4rem);
  padding: 3rem clamp(1rem, 4vw, 2rem) 4rem;
  background: var(--moon-glow-hero);
  background-repeat: no-repeat;
}

.hero>div {
  width: min(100%, 42rem);
}

.hero .mark {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  margin-right: 1rem;
  object-fit: contain;
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(3.75rem, 14vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.hero .lede {
  max-width: 34rem;
  margin: 1.5rem 0 2.5rem;
  color: var(--text-muted);
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  line-height: 1.55;
}

.hero pre {
  margin: 0 0 2rem;
  overflow-x: auto;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-lg);
  background: var(--panel-bg);
  box-shadow: var(--moon-shadow-panel);
  color: var(--moon-gray-200);
  font-size: 0.95rem;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: var(--moon-radius-pill);
  padding: 0.8rem 1.1rem;
  background: var(--text);
  color: var(--moon-gray-1000);
  font-weight: 700;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-2px);
  background: var(--moon-accent-200);
  color: var(--moon-gray-1000);
}

.button.secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.button.secondary:hover {
  background: var(--panel-bg);
  color: var(--text);
}

/* ── Reference layout ──────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr) 14rem;
  grid-template-areas:
    'sidebar head toc'
    'sidebar main toc';
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 0 clamp(1.5rem, 3vw, 3.5rem);
  width: min(100%, 96rem);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding: 2rem 0.5rem 2rem 0;
  border-right: 1px solid var(--border);
  font-size: 0.88rem;
  scrollbar-width: thin;
}

.sidebar .nav-group {
  margin: 1.5rem 0 0.5rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar .nav-group:first-child {
  margin-top: 0;
}

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

.sidebar li a {
  display: block;
  padding: 0.22rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 0 var(--moon-radius-sm) var(--moon-radius-sm) 0;
  color: var(--text-muted);
  font-family: var(--moon-font-mono);
  font-size: 0.84rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.sidebar li a:hover {
  background: var(--panel-bg);
  color: var(--text);
}

.sidebar li a[aria-current='page'] {
  border-left-color: var(--moon-accent-500);
  background: var(--panel-bg);
  color: var(--text);
  font-weight: 600;
}

.nav-filter {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-md);
  background: var(--panel-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

.nav-filter::placeholder {
  color: var(--text-dim);
}

.nav-empty {
  padding: 0.4rem 0.6rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.page-head {
  grid-area: head;
  padding-top: 2.5rem;
}

.breadcrumb {
  margin: 0 0 0.75rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text-muted);
}

.breadcrumb .sep {
  padding: 0 0.4rem;
  opacity: 0.6;
}

.page-head h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.page-head h1 .qualifier {
  color: var(--text-dim);
  font-weight: 500;
}

.page-head .summary {
  max-width: 46rem;
  margin: 0.7rem 0 0;
  color: var(--text-muted);
  font-size: 1.08rem;
}

.page-head .summary p {
  margin: 0;
}

.page-head .summary p+p {
  margin-top: 0.6rem;
}

.page-head .summary code,
.index-page .card .desc code {
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-sm);
  background: var(--panel-bg);
  font-size: 0.86em;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.import-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-md);
  background: var(--panel-bg);
  font-family: var(--moon-font-mono);
  font-size: 0.85rem;
}

.import-line .label {
  color: var(--text-dim);
  font-family: var(--moon-font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reference {
  grid-area: main;
  min-width: 0;
  padding: 2rem 0 1rem;
}

.toc {
  grid-area: toc;
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding: 2.75rem 0 2rem;
  font-size: 0.82rem;
  scrollbar-width: thin;
}

.toc .nav-group {
  margin: 0 0 0.6rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

.toc li a {
  display: block;
  padding: 0.16rem 0.7rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--moon-font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.toc li a:hover {
  border-left-color: var(--moon-accent-500);
  color: var(--text);
}

.toc li.toc-section>a {
  color: var(--text-muted);
  font-family: var(--moon-font-sans);
  font-weight: 600;
}

.toc li.toc-child>a {
  padding-left: 1.4rem;
}

/* ── Reference content ─────────────────────────────────────────── */

.reference h2 {
  margin: 2.75rem 0 0.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.reference h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.reference h2.module {
  font-family: var(--moon-font-mono);
  font-size: 1.1rem;
  letter-spacing: 0;
}

.reference h3 {
  margin: 2rem 0 0.5rem;
  color: var(--text);
  font-size: 1rem;
}

.reference h4,
.reference h5,
.reference h6 {
  margin: 1.5rem 0 0.45rem;
  color: var(--text);
  font-size: 0.95rem;
}

.reference h2,
.reference h3,
.reference h4,
.reference h5,
.reference h6 {
  scroll-margin-top: 5rem;
}

.reference p {
  margin: 0.7rem 0;
}

.reference .section-intro {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.reference ul,
.reference ol {
  margin: 0.7rem 0;
  padding-left: 1.3rem;
}

.reference li {
  margin: 0.3rem 0;
}

.reference code {
  padding: 0.08rem 0.32rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-sm);
  background: var(--panel-bg);
  color: var(--moon-gray-200);
  font-size: 0.87em;
  overflow-wrap: anywhere;
}

.reference pre.moon-example {
  margin: 0.8rem 0;
  overflow-x: auto;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-md);
  background: var(--panel-bg);
  color: var(--moon-gray-200);
  font-size: 0.87rem;
  line-height: 1.6;
}

.reference pre.moon-example code {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
  overflow-wrap: normal;
}

.reference a code {
  border-color: transparent;
  background: transparent;
  color: inherit;
  padding: 0;
}

.reference table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.reference th,
.reference td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.reference th {
  color: var(--text);
  font-weight: 600;
}

.guide {
  max-width: 52rem;
}

.guide>p:first-child {
  margin-top: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.docs-overview,
.reference-index,
.symbol-index {
  padding-top: 1.5rem;
}

.docs-overview .card-grid,
.reference-index .card-grid {
  padding-left: 0;
}

/* Definition blocks: one per documented symbol. */

.symbol {
  scroll-margin-top: 5rem;
  margin: 1.25rem 0 1.75rem;
}

.symbol>.signatures {
  border: 1px solid var(--border);
  border-left: 3px solid var(--moon-accent-700);
  border-radius: var(--moon-radius-md);
  background: var(--panel-bg);
}

.symbol:target>.signatures {
  border-left-color: var(--moon-accent-400);
  box-shadow: 0 0 0 1px var(--moon-accent-700);
}

.signature {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  overflow-x: auto;
  font-family: var(--moon-font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre;
}

.signature+.signature {
  border-top: 1px dashed var(--border);
}

.signature .sig-text {
  flex: 1;
  min-width: 0;
}

.anchor {
  flex: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.signature:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.symbol>.body {
  padding: 0.15rem 0 0 0.9rem;
  border-left: 1px solid var(--border);
  margin-left: 0.15rem;
  color: var(--text-body);
}

.symbol>.body> :first-child {
  margin-top: 0.6rem;
}

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

.symbol .members {
  margin-top: 1rem;
}

/* Badges describing how a member behaves. */

.badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  vertical-align: middle;
}

.badge {
  border: 1px solid var(--border-strong);
  border-radius: var(--moon-radius-pill);
  padding: 0.02rem 0.5rem;
  background: var(--panel-bg-raised);
  color: var(--text-muted);
  font-family: var(--moon-font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-native {
  border-color: var(--moon-warning-900);
  color: var(--moon-warning-300);
}

.badge-async {
  border-color: var(--moon-accent-800);
  color: var(--moon-accent-300);
}

.badge-mutating {
  border-color: var(--moon-negative-900);
  color: var(--moon-negative-300);
}

.badge-query,
.badge-adapter,
.badge-terminal {
  border-color: var(--moon-positive-900);
  color: var(--moon-positive-300);
}

/* Field and variant tables inside a type block. */

.fields {
  width: 100%;
  display: table;
  margin: 0.9rem 0 0.2rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.fields th {
  width: 1%;
  white-space: nowrap;
}

.fields th,
.fields td {
  border-top: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  text-align: left;
  vertical-align: top;
}

.fields tr:first-child>* {
  border-top: 0;
}

.fields tr:last-child>* {
  border-bottom: 0;
}

.fields tr>*:first-child {
  border-left: 0;
}

.fields tr>*:last-child {
  border-right: 0;
}

.fields th code {
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.9rem;
}

.fields td {
  color: var(--text-muted);
}

.variants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0.2rem;
  padding: 0;
  list-style: none;
}

.variants li {
  margin: 0;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-sm);
  background: var(--panel-bg);
  font-family: var(--moon-font-mono);
  font-size: 0.85rem;
}

/* ── Reference index ───────────────────────────────────────────── */

.index-page {
  width: min(100%, 72rem);
  margin: 0 auto;
  padding: 3rem clamp(1rem, 3vw, 2rem) 1rem;
}

.index-page h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.index-page .lede {
  max-width: 44rem;
  margin: 0.85rem 0 0;
  color: var(--text-muted);
  font-size: 1.08rem;
}

.index-page h2 {
  margin: 3rem 0 0.35rem;
  color: var(--text);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.index-page h2+p {
  margin: 0 0 1.25rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  margin: 0;
}

.card a {
  display: block;
  height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-md);
  background: var(--panel-bg);
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}

.card a:hover {
  border-color: var(--moon-accent-700);
  transform: translateY(-1px);
}

.card .name {
  display: block;
  color: var(--text);
  font-family: var(--moon-font-mono);
  font-size: 0.95rem;
  font-weight: 600;
}

.card .desc {
  display: block;
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.card .count {
  display: block;
  margin-top: 0.45rem;
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Symbol index ──────────────────────────────────────────────── */

.alphabet {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.alphabet a {
  display: block;
  min-width: 1.9rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-sm);
  background: var(--panel-bg);
  font-family: var(--moon-font-mono);
  font-size: 0.85rem;
  text-align: center;
  text-decoration: none;
}

.symbol-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.15rem 1.5rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.symbol-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: 0.88rem;
}

.symbol-list a {
  font-family: var(--moon-font-mono);
  text-decoration: none;
}

.symbol-list a:hover {
  text-decoration: underline;
}

.symbol-list .owner {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Pager ─────────────────────────────────────────────────────── */

.pager {
  display: flex;
  gap: 0.75rem;
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager a {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--moon-radius-md);
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--moon-accent-700);
}

.pager .dir {
  display: block;
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pager .name {
  display: block;
  margin-top: 0.15rem;
  color: var(--text);
  font-family: var(--moon-font-mono);
  font-size: 0.9rem;
}

.pager .next {
  text-align: right;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    grid-template-areas:
      'sidebar head'
      'sidebar main';
  }

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .layout {
    display: block;
    padding-bottom: 1rem;
  }

  .sidebar {
    display: none;
  }

  .page-head {
    padding-top: 1.75rem;
  }

  .toc {
    display: block;
    position: static;
    max-height: none;
    padding: 1.5rem 0 0;
  }

  /* Bound the jump list so it cannot push the page itself off-screen. */
  .toc ul {
    max-height: 14rem;
    overflow-y: auto;
  }

  .signature {
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  .button,
  .card a,
  .anchor {
    transition: none;
  }

  .button:hover,
  .card a:hover {
    transform: none;
  }
}
