/*
 * hd-lang site styles, the "Refined" design: Inter and JetBrains Mono, the
 * violet brand on quiet neutrals, hairline borders, and full-width chrome.
 * Colors are tokens on :root. Each holds a light and a dark value through
 * light-dark(), so the page follows prefers-color-scheme until the theme
 * toggle sets data-theme on <html>.
 */

:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #111318);
  --bg-soft: light-dark(#f5f5f8, #191c23);
  --bg-raised: light-dark(#ffffff, #181b22);
  --sidebar-bg: light-dark(#fbfbfd, #111318);
  --topbar-bg: light-dark(rgb(255 255 255 / 0.9), rgb(17 19 24 / 0.9));
  /* Code blocks sit on their own panel, a clear step from the page in both themes. */
  --bg-code: light-dark(#f6f6f9, #1b1e27);
  --code-border: light-dark(#e8e8ef, #2b303b);
  --bg-inline-code: light-dark(#f0eff6, #252a35);
  --inline-code: light-dark(#3a2f7a, #d5ccff);
  --border: light-dark(#e7e7ee, #242832);
  --border-strong: light-dark(#d2d2dd, #353a46);
  --text: light-dark(#1c1c24, #e6e7ec);
  --heading: light-dark(#121218, #f4f4f7);
  --text-soft: light-dark(#5f6271, #9ba1ae);
  --accent: light-dark(#5a3fd1, #a594ff);
  --accent-strong: light-dark(#4a30bd, #bcb0ff);
  --accent-contrast: light-dark(#ffffff, #14102c);
  --accent-soft: light-dark(#f0edff, #221d3d);
  --link: light-dark(#4d34c4, #b3a6ff);
  --mark-bg: light-dark(rgb(90 63 209 / 0.08), rgb(165 148 255 / 0.12));
  --hl-keyword: light-dark(#7b2fb0, #cf9bff);
  --hl-literal: light-dark(#a8530a, #f5b56f);
  --hl-type: light-dark(#0a6b7c, #67d0e0);
  --hl-function: light-dark(#2156b8, #86b4ff);
  --hl-number: light-dark(#a8530a, #f5b56f);
  --hl-string: light-dark(#2a7322, #96d486);
  --hl-interpolation: light-dark(#14561a, #c0f0b0);
  --hl-comment: light-dark(#737987, #838b9a);
  --hl-operator: light-dark(#525866, #aab1bd);
  --repl-error: light-dark(#c4302b, #ff7b72);
  --repl-warning: light-dark(#9a6700, #d29922);
  --ok: light-dark(#1f7a3a, #5fcf80);
  --shadow: light-dark(rgb(20 20 50 / 0.1), rgb(0 0 0 / 0.45));
  --repl-height: min(45vh, 420px);
  --topbar-height: 56px;
  --sidebar-width: 272px;
  --toc-width: 240px;
  --measure: 46rem;
  --edge: 20px;
  --radius: 10px;
  --control-radius: 8px;
  --code-pad-x: 18px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

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

html {
  scroll-padding-top: calc(var(--topbar-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 6px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
}

/* Top bar: the full window width on every page. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 var(--edge);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-right: 18px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.topnav {
  display: flex;
  gap: 2px;
}

.topnav a {
  padding: 6px 11px;
  color: var(--text-soft);
  font-weight: 500;
  border-radius: 6px;
}

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

.topnav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle,
.github-link {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-soft);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.theme-toggle:hover,
.github-link:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-moon {
  display: inline;
}

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

  :root:not([data-theme="light"]) .icon-moon {
    display: inline;
  }
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(300px, 30vw);
  margin-left: auto;
}

.search > svg {
  position: absolute;
  left: 10px;
  color: var(--text-soft);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 32px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--text-soft);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

.search-key {
  position: absolute;
  right: 8px;
  padding: 0 6px;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  line-height: 18px;
  pointer-events: none;
}

.search input:focus ~ .search-key {
  display: none;
}

#search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(440px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px var(--shadow);
}

#search-results a {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text);
  line-height: 1.4;
}

#search-results a:hover,
#search-results a.active {
  background: var(--accent-soft);
  text-decoration: none;
}

#search-results small {
  display: block;
  color: var(--text-soft);
}

.menu-button {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0 8px;
  background: none;
  border: 0;
  cursor: pointer;
}

.menu-button span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/*
 * Layout: the sidebar at the window's left edge, the outline at its right
 * edge, and the prose centered between them at the reading measure.
 */

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

.layout-wide,
.layout-split {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.layout-home,
.layout-app {
  display: block;
}

/* Home and the playground keep the sidebar only as the phone menu. */
.layout-home .sidebar,
.layout-app .sidebar {
  display: none;
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 12px 48px var(--edge);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}

.sidebar-primary {
  display: none;
}

.nav-section + .nav-section {
  margin-top: 12px;
}

.nav-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-soft);
  border-bottom: 1.5px solid var(--text-soft);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.nav-section[open] summary::after {
  transform: rotate(45deg);
}

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

/* Items hang off a thin rule; the current page gets an accent bar. */
.sidebar li a {
  display: block;
  margin-left: 8px;
  padding: 3px 8px 3px 12px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.5;
  border-left: 1px solid var(--border);
}

.sidebar li a:hover {
  color: var(--text);
  text-decoration: none;
  border-left-color: var(--text-soft);
}

.sidebar li a[aria-current="page"] {
  padding-left: 11px;
  color: var(--accent);
  font-weight: 600;
  border-left: 2px solid var(--accent);
}

.sidebar code {
  font-size: 0.92em;
}

.content {
  min-width: 0;
  padding: 40px clamp(24px, 4vw, 72px) 96px;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
}

/* The outline. Its scroll box ends above the REPL button, so the button never covers an entry. */
.toc {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height) - 64px);
  overflow-y: auto;
  padding: 40px var(--edge) 24px 8px;
  font-size: 13.5px;
  scrollbar-width: thin;
}

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

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

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 3px 0 3px 12px;
  color: var(--text-soft);
  line-height: 1.45;
  border-left: 1px solid var(--border);
}

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

.toc a.active {
  padding-left: 11px;
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

.toc .toc-3 a {
  padding-left: 24px;
  font-size: 13px;
}

.toc .toc-3 a.active {
  padding-left: 23px;
}

/* Prose */

.prose {
  font-size: 16px;
  line-height: 1.72;
}

.breadcrumb {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  color: var(--heading);
  font-weight: 650;
  line-height: 1.2;
  text-wrap: balance;
}

.prose h1 {
  margin: 0 0 18px;
  font-size: 2.4rem;
  letter-spacing: -0.022em;
}

.prose h2 {
  margin: 2.4em 0 0.7em;
  padding-top: 0.2em;
  font-size: 1.55rem;
  letter-spacing: -0.022em;
}

.prose h3 {
  margin: 1.9em 0 0.5em;
  font-size: 1.18rem;
}

.prose h4 {
  margin: 1.6em 0 0.5em;
  font-size: 1.02rem;
}

.heading-anchor {
  position: absolute;
  left: -1.1em;
  width: 1.1em;
  color: var(--text-soft);
  font-weight: 400;
  text-align: center;
  opacity: 0;
  transition: opacity 0.12s;
}

h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
  color: var(--accent);
  text-decoration: none;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.1em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.3em;
}

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

.prose strong {
  color: var(--heading);
  font-weight: 600;
}

.prose code {
  font-size: 0.86em;
}

.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  color: var(--inline-code);
  background: var(--bg-inline-code);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.prose a code {
  color: inherit;
}

.prose blockquote {
  margin: 0 0 1.2em;
  padding: 2px 0 2px 16px;
  color: var(--text-soft);
  border-left: 3px solid var(--border-strong);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}

.table-wrap {
  margin: 0 0 1.4em;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  line-height: 1.55;
}

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

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

.prose th {
  background: var(--bg-soft);
  font-weight: 600;
}

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

/* Specification rules (spec/STYLE.md): rule ID anchors, callouts, rule tables. */

.rule-id {
  float: right;
  margin: 0.25em 0 0.1em 1em;
  padding: 0 0.45em;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.7;
  color: color-mix(in srgb, var(--text-soft) 80%, transparent);
  border: 1px solid transparent;
  border-radius: 4px;
  white-space: nowrap;
  /* A long ID must not widen a phone-width page. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prose li:hover > .rule-id,
.prose p:hover > .rule-id,
.prose td:hover > .rule-id {
  color: var(--text-soft);
  border-color: var(--border);
}

.rule-id:hover,
.rule-id:focus {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.rule-id:target {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.prose li:has(> .rule-id:target),
.prose p:has(> .rule-id:target) {
  background: var(--accent-soft);
  border-radius: 4px;
}

.prose li:has(> .rule-id)::after,
.prose p:has(> .rule-id)::after {
  content: "";
  display: block;
  clear: both;
}

.prose table.rule-table .rule-id {
  float: none;
  display: block;
  width: max-content;
  margin: 0 0 0.25em;
}

.prose table.rule-table code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.prose blockquote.callout {
  padding: 0.6em 1em;
  color: var(--text);
  background: var(--bg-soft);
  border-left-color: var(--accent);
  border-radius: 0 8px 8px 0;
}

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

.prose blockquote.callout-why > p:first-child > strong:first-child {
  color: var(--accent);
}

.prose blockquote.callout-note {
  border-left-color: var(--text-soft);
}

/* Footnotes: a small muted reference number, and the notes at the page's end. */

.prose sup.footnote-ref {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
}

.prose sup.footnote-ref a {
  padding: 0 0.15em;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
}

.prose sup.footnote-ref a:hover,
.prose sup.footnote-ref a:focus,
.prose .footnote-backref:hover,
.prose .footnote-backref:focus {
  color: var(--accent);
  text-decoration: none;
}

.prose sup.footnote-ref a:target {
  color: var(--accent);
  background: var(--accent-soft);
}

.prose section.footnotes {
  margin-top: 3em;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-soft);
}

.prose section.footnotes::before {
  content: "";
  display: block;
  width: 4rem;
  margin-bottom: 0.9em;
  border-top: 1px solid var(--border);
}

.prose .footnotes-list {
  margin: 0;
  padding-left: 1.4em;
}

.prose .footnote-item::marker {
  font-variant-numeric: tabular-nums;
}

.prose .footnote-item > p {
  margin: 0;
}

.prose .footnote-item:target {
  color: var(--text);
  background: var(--bg-soft);
  border-radius: 4px;
}

.prose .footnote-backref {
  color: var(--text-soft);
}

@media (max-width: 600px) {
  .rule-id {
    float: none;
    display: inline-block;
    margin: 0 0.5em 0 0;
  }

  /* A rule table becomes one card per rule, each cell labeled by its column. */
  .prose table.rule-table,
  .prose table.rule-table tbody,
  .prose table.rule-table tr,
  .prose table.rule-table td {
    display: block;
  }

  .prose table.rule-table thead {
    display: none;
  }

  .prose table.rule-table tr {
    margin: 0 0 0.75em;
    padding: 0.5em 0.8em;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .prose table.rule-table td {
    padding: 0.1em 0;
    border: 0;
  }

  .prose table.rule-table td:first-child {
    font-weight: 600;
  }

  .prose table.rule-table td[data-label]:not(:first-child)::before {
    content: attr(data-label) ": ";
    color: var(--text-soft);
    font-weight: 600;
  }

  .prose table.rule-table code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Code */

pre.code {
  margin: 0 0 1.4em;
  padding: 16px var(--code-pad-x);
  overflow-x: auto;
  color: var(--text);
  background: var(--bg-code);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 4;
  scrollbar-width: thin;
}

pre.code code {
  font-size: inherit;
}

.code-block {
  position: relative;
  margin: 0 0 1.4em;
}

.code-block pre.code {
  margin: 0;
}

/* The buttons over a code block: Try in REPL or Open in playground, and Copy. */

.code-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}

.error-example .code-actions {
  top: 32px;
}

.code-block:hover .code-actions,
.code-block:focus-within .code-actions {
  opacity: 1;
}

.try-link,
.copy-button {
  padding: 2px 9px;
  font: 500 12px/1.6 var(--font-body);
  color: var(--text-soft);
  background: var(--bg-code);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
}

.try-link:hover,
.copy-button:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.copy-button[data-copied] {
  color: var(--hl-string);
  border-color: currentColor;
}

/* Before site.js moves a try link into the action row, it sits at the top right. */
.code-block > .try-link {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
}

.code-block:hover > .try-link,
.code-block > .try-link:focus {
  opacity: 1;
}

.error-example > .try-link {
  top: 32px;
}

/* Error examples: every line marked `# error` is tinted, under an "Error example" tab. */

.example-label {
  display: inline-block;
  padding: 1px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--repl-error);
  background: color-mix(in srgb, var(--repl-error) 10%, var(--bg-code));
  border: 1px solid color-mix(in srgb, var(--repl-error) 40%, var(--border));
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.error-example pre.code {
  border-color: color-mix(in srgb, var(--repl-error) 40%, var(--border));
  border-top-left-radius: 0;
}

.line-error {
  display: inline-block;
  min-width: calc(100% + 2 * var(--code-pad-x));
  margin: 0 calc(-1 * var(--code-pad-x));
  padding: 0 var(--code-pad-x);
  background: color-mix(in srgb, var(--repl-error) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--repl-error);
}

.hl-comment.hl-error-marker {
  color: var(--repl-error);
  font-style: normal;
  font-weight: 600;
}

@media (hover: none) {
  .code-actions {
    position: static;
    justify-content: flex-end;
    margin-top: 6px;
    opacity: 1;
  }

  .code-block > .try-link {
    position: static;
    display: inline-block;
    margin-top: 6px;
    opacity: 1;
  }
}

.hl-keyword {
  color: var(--hl-keyword);
}

.hl-literal {
  color: var(--hl-literal);
}

.hl-type {
  color: var(--hl-type);
}

.hl-function {
  color: var(--hl-function);
}

.hl-number {
  color: var(--hl-number);
}

.hl-string {
  color: var(--hl-string);
}

.hl-interpolation {
  color: var(--hl-interpolation);
}

.hl-comment {
  color: var(--hl-comment);
  font-style: italic;
}

.hl-operator {
  color: var(--hl-operator);
}

/* A punchline line: tinted across the block, with an accent bar. */
.line-mark {
  display: inline-block;
  min-width: calc(100% + 2 * var(--code-pad-x));
  margin: 0 calc(-1 * var(--code-pad-x));
  padding: 0 var(--code-pad-x);
  background: var(--mark-bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* EBNF grammar blocks: rule names link to their definitions. */

.eb-definition {
  color: var(--hl-function);
  font-weight: 600;
}

.eb-reference {
  color: var(--hl-type);
}

.eb-token {
  color: var(--hl-keyword);
}

.eb-terminal {
  color: var(--hl-string);
}

.eb-operator {
  color: var(--hl-operator);
}

.eb-comment {
  color: var(--hl-comment);
  font-style: italic;
}

.eb-special {
  color: var(--hl-literal);
  font-style: italic;
}

pre.ebnf a {
  text-decoration: none;
  border-radius: 3px;
}

pre.ebnf a:hover,
pre.ebnf a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

pre.ebnf a:hover {
  background: var(--accent-soft);
}

pre.ebnf .eb-definition:target {
  background: var(--accent-soft);
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--control-radius);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.button:hover {
  border-color: var(--text-soft);
  text-decoration: none;
}

.button-primary {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button-quiet {
  padding: 0 12px;
  color: var(--link);
  background: transparent;
  border-color: transparent;
}

/* Home */

.content-home {
  padding: 0 clamp(16px, 4vw, 64px) 96px;
}

.hero,
.features,
.home-readme {
  max-width: 1240px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding: clamp(48px, 9vh, 112px) 0 clamp(48px, 8vh, 96px);
}

.hero h1 {
  margin: 0 0 18px;
  color: var(--heading);
  font-size: clamp(2.4rem, 4.4vw, 3.9rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-pitch {
  max-width: 32rem;
  margin: 0 0 28px;
  color: var(--text-soft);
  font-size: 1.16rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 18px 0 0;
  font-size: 14.5px;
  font-weight: 500;
}

.hero-links a::after {
  content: " →";
}

.hero-code {
  min-width: 0;
}

.code-window {
  --code-pad-x: 20px;
  margin: 0;
  overflow: hidden;
  background: var(--bg-code);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  box-shadow: 0 24px 48px -24px var(--shadow);
}

.code-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 40px;
  padding: 0 8px 0 18px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--code-border);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.code-window-title {
  min-width: 0;
}

.code-window-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  color: var(--accent);
  border-radius: 6px;
  font-family: var(--font-body);
  font-weight: 600;
}

.code-window-action:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.code-window pre.code {
  margin: 0;
  padding: 18px var(--code-pad-x) 20px;
  border: 0;
  border-radius: 0;
  font-size: 13.5px;
}

.features {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.features > h2,
.home-readme > h2 {
  margin: 48px 0 8px;
  color: var(--heading);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.section-lead {
  margin: 0 0 32px;
  color: var(--text-soft);
  font-size: 1.05rem;
}

/*
 * Claims (website/src/claim.ts): a headline, a short snippet whose punchline
 * lines are marked, an optional output pane, and a run link. On the home page
 * each claim is one full-width row, text on the left and code on the right,
 * so no code line is cut.
 */

.claim-grid {
  display: grid;
  border-top: 1px solid var(--border);
}

.claim {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  grid-template-areas:
    "title code"
    "blurb code"
    "contrast code"
    "run code";
  grid-template-rows: auto auto auto 1fr;
  column-gap: 40px;
  min-width: 0;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.claim-title {
  grid-area: title;
  margin: 0 0 4px;
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.25;
}

.claim-blurb {
  grid-area: blurb;
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 15px;
}

.claim > pre.claim-code,
.claim > .claim-output {
  grid-column: 2;
}

.claim > pre.claim-code {
  grid-row: 1 / span 3;
  align-self: start;
  margin: 0;
  font-size: 13px;
}

.claim > .claim-output {
  grid-row: 4;
  align-self: start;
}

.claim-output {
  margin: 10px 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.claim-output figcaption {
  padding: 4px 12px;
  color: var(--text-soft);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.claim-output pre {
  margin: 0;
  padding: 8px 12px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.claim-output-error {
  border-color: color-mix(in srgb, var(--repl-error) 40%, var(--border));
}

.claim-output-error figcaption {
  color: var(--repl-error);
  background: color-mix(in srgb, var(--repl-error) 8%, var(--bg-soft));
  border-bottom-color: color-mix(in srgb, var(--repl-error) 30%, var(--border));
}

.claim-output-error pre {
  color: var(--repl-error);
}

.claim-contrast {
  grid-area: contrast;
  align-self: start;
  margin: 12px 0 0;
  padding-left: 10px;
  color: var(--text-soft);
  border-left: 2px solid var(--border-strong);
  font-size: 14px;
}

.claim-blurb code,
.claim-contrast code {
  padding: 0.05em 0.3em;
  background: var(--bg-inline-code);
  border-radius: 4px;
  font-size: 0.88em;
}

.claim-run {
  grid-area: run;
  align-self: end;
  margin: 14px 0 0;
  font-size: 14.5px;
  font-weight: 600;
}

.home-readme {
  padding-bottom: 32px;
}

.home-readme > * {
  max-width: var(--measure);
}

.home-readme > .code-block {
  max-width: 52rem;
}

/* The three pillars, the first numbered list on the page, read as cards. */
.home-readme > h2:first-child + ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: none;
  margin: 20px 0 24px;
  padding: 0;
  list-style: none;
  counter-reset: pillar;
}

.home-readme > h2:first-child + ol > li {
  margin: 0;
  padding: 20px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  font-size: 15px;
  counter-increment: pillar;
}

.home-readme > h2:first-child + ol > li > strong:first-child {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

/* Page footer */

.source-link {
  max-width: var(--measure);
  margin: 40px auto 0;
  font-size: 14px;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: var(--measure);
  margin: 16px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.split-prose .pager {
  margin-top: 40px;
}

.pager a {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 18px;
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

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

.pager span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 400;
}

.pager code {
  font-size: 0.9em;
}

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

/* Playground: the framed app fills the window under the top bar. */

.content.content-app {
  height: calc(100dvh - var(--topbar-height));
  padding: 10px 12px 12px;
}

.playground-frame {
  display: flex;
  height: 100%;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.playground-frame iframe {
  flex: 1;
  width: 100%;
  border: 0;
  color-scheme: inherit;
}

/* The playground page when the build has no playground. */
.wide {
  max-width: var(--measure);
}

.notice {
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

/*
 * Split pages: prose on the left, a sticky aside on the right (such as a live
 * editor). They stack on narrow screens, the aside after the prose.
 */

.content-split {
  padding-right: 24px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.split-prose {
  max-width: 40rem;
  margin: 0 0 0 auto;
}

.split-aside {
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - var(--topbar-height) - 32px);
  overflow: hidden;
  border: 1px solid var(--code-border);
  border-radius: 12px;
  background: var(--bg-code);
}

.split-aside > iframe {
  flex: 1;
  width: 100%;
  border: 0;
}

/*
 * Tour pages (website/src/tour.ts, website/client/tour.ts): the editor fills
 * the split page's aside, with the output below it. The editor and output
 * panel come from the playground, so their color names map to the site's.
 */

.tour-editor {
  --editor-bg: var(--bg-code);
  --panel-bg: var(--bg-raised);
  --fg: var(--text);
  --muted: var(--text-soft);
  --mono: var(--font-mono);
  --active-line: light-dark(#eeeef6, #22262f);
  --selection: light-dark(#ddd3ff, #3a2f6b);
  --error: var(--repl-error);
  --warning: var(--repl-warning);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.tour-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--code-border);
  background: var(--bg-soft);
}

.tour-toolbar .button {
  height: 32px;
  padding: 0 14px;
  font-size: 14px;
}

.tour-file {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-soft);
}

.tour-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--text-soft);
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tour-code {
  flex: 3 1 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg-code);
}

.tour-code .cm-editor,
.tour-output {
  font-variant-ligatures: none;
}

.tour-code .cm-editor {
  height: 100%;
  font-size: 13.5px;
}

.tour-code .cm-editor.cm-focused {
  outline: none;
}

/*
 * A wrapped line hangs under its own indentation plus one step: each line
 * carries its hang in --hang (website/client/tour.ts). The padding keeps
 * CodeMirror's 6px, and the negative indent puts the first row back.
 */
.tour-code .cm-content .cm-line {
  padding-left: calc(6px + var(--hang, 0ch));
  text-indent: calc(-1 * var(--hang, 0ch));
}

.tour-static {
  white-space: pre-wrap;
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* The static listing hangs wrapped lines the same way (website/src/tour.ts). */
.tour-static .tour-line {
  display: block;
  padding-left: var(--hang, 0ch);
  text-indent: calc(-1 * var(--hang, 0ch));
}

.tour-static .tour-line:empty::before {
  content: " ";
}

/* A page with several files: one tab per file in the toolbar. */
.tour-tabs {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
}

.tour-tab {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.tour-tab:hover {
  color: var(--text);
}

.tour-tab[aria-selected="true"] {
  border-color: var(--border);
  background: var(--bg-code);
  color: var(--text);
}

.tour-file-heading {
  margin: 0;
  padding: 8px 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-soft);
}

.tour-output {
  flex: 2 1 0;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--code-border);
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 13px;
}

.tour-offline .tour-output {
  font-family: var(--font-body);
}

.tour-hint {
  margin: 0;
  color: var(--text-soft);
  font-family: var(--font-body);
}

.tour-output .outcome {
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-weight: 600;
}

.tour-output .outcome.running {
  color: var(--text-soft);
  font-weight: 400;
}

.tour-output .outcome.passed {
  color: var(--ok);
}

.tour-output .outcome.failed,
.tour-output .outcome.panic {
  color: var(--error);
}

.tour-output .stdout {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
}

.tour-output .empty {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-style: italic;
}

.tour-output .diagnostics {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tour-output .diagnostic .jump {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 6px 8px;
  border: 0;
  border-left: 3px solid var(--error);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tour-output .diagnostic.warning .jump {
  border-left-color: var(--warning);
}

.tour-output .diagnostic .location {
  margin-right: 8px;
  color: var(--link);
  text-decoration: underline;
}

.tour-output .diagnostic .severity {
  margin-right: 6px;
  color: var(--error);
}

.tour-output .diagnostic.warning .severity {
  color: var(--warning);
}

.tour-output .diagnostic .code {
  margin-right: 8px;
  color: var(--text-soft);
}

.tour-output .diagnostic .message {
  font-family: var(--font-body);
}

.tour-output .diagnostic .note {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
}

.tour-editor .hd-keyword {
  color: var(--hl-keyword);
}

.tour-editor .hd-literal {
  color: var(--hl-literal);
}

.tour-editor .hd-type {
  color: var(--hl-type);
}

.tour-editor .hd-function {
  color: var(--hl-function);
}

.tour-editor .hd-number {
  color: var(--hl-number);
}

.tour-editor .hd-string {
  color: var(--hl-string);
}

.tour-editor .hd-interpolation {
  color: var(--hl-interpolation);
}

.tour-editor .hd-comment {
  color: var(--hl-comment);
  font-style: italic;
}

.tour-editor .hd-operator {
  color: var(--hl-operator);
}

.tour-step {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--text-soft);
}

.tour-keys {
  font-size: 13px;
  color: var(--text-soft);
}

.tour-number {
  display: inline-block;
  min-width: 1.6em;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.tour-index li {
  margin-bottom: 10px;
}

.tour-index a {
  font-weight: 600;
}

.tour-claim {
  display: block;
  color: var(--text-soft);
}

@media (hover: none), (max-width: 900px) {
  .tour-keys {
    display: none;
  }
}

/* REPL panel (website/client/repl.ts) */

.try-repl {
  display: none;
  cursor: pointer;
}

.repl-ready .try-repl {
  display: inline-block;
}

.try-link.try-playground {
  font-size: 11px;
}

.repl-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font: 600 13px/1.4 var(--font-body);
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: 0 4px 16px var(--shadow);
  cursor: pointer;
}

.repl-toggle:hover,
.repl-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.repl-toggle-mark {
  font-family: var(--font-mono);
}

body.repl-open {
  padding-bottom: var(--repl-height);
}

body.repl-open .repl-toggle {
  display: none;
}

.repl-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: var(--repl-height);
  background: var(--bg-code);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -8px 32px var(--shadow);
}

.repl-panel[hidden] {
  display: none;
}

.repl-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px var(--edge);
  border-bottom: 1px solid var(--code-border);
  background: var(--bg-soft);
  font-size: 13px;
}

.repl-title {
  font-family: var(--font-mono);
  font-weight: 600;
}

.repl-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repl-actions {
  display: flex;
  gap: 6px;
}

.repl-actions button {
  padding: 2px 10px;
  font: 12px/1.5 var(--font-body);
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.repl-actions button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.repl-log,
.repl-input-row {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-ligatures: none;
  line-height: 1.5;
  tab-size: 4;
}

.repl-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px var(--edge) 0;
}

.repl-log pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.repl {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.repl-log .repl-echo {
  margin-top: 6px;
}

.repl-echo-prompt,
.repl-prompt,
.repl-number,
.repl-note,
.repl-debug {
  color: var(--text-soft);
}

.repl-number {
  float: right;
  padding-left: 12px;
  font-size: 11px;
  user-select: none;
}

.repl-error {
  color: var(--repl-error);
}

.repl-warning {
  color: var(--repl-warning);
}

.repl-input-row {
  display: flex;
  gap: 8px;
  padding: 8px var(--edge) 12px;
}

.repl-prompt {
  margin: 0;
  font: inherit;
  user-select: none;
}

.repl-editor {
  position: relative;
  flex: 1;
  min-width: 0;
}

.repl-highlight,
.repl-input {
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 0;
}

.repl-highlight {
  pointer-events: none;
  color: var(--text);
}

.repl-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  resize: none;
  color: transparent;
  caret-color: var(--text);
  background: transparent;
  outline: none;
}

.repl-input::placeholder {
  color: var(--text-soft);
  opacity: 0.6;
}

.repl-input::selection {
  color: transparent;
  background: var(--accent-soft);
}

@media (max-width: 520px) {
  .repl-toggle {
    right: 12px;
    bottom: 12px;
  }

  .repl-header {
    padding-left: 12px;
  }

  .repl-log,
  .repl-input-row {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Responsive */

@media (min-width: 2000px) {
  :root {
    --sidebar-width: 320px;
    --toc-width: 300px;
  }

  .prose {
    font-size: 17px;
  }
}

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

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

  .split-prose {
    margin: 0 auto;
  }

  .split-aside {
    position: static;
    height: min(70vh, 560px);
  }
}

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

  .claim {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
    grid-template-rows: none;
  }

  .claim > *,
  .claim > pre.claim-code,
  .claim > .claim-output {
    grid-area: auto;
    grid-column: 1;
    grid-row: auto;
  }

  .claim > pre.claim-code {
    margin: 4px 0 0;
  }

  .home-readme > h2:first-child + ol {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .layout,
  .layout-wide,
  .layout-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .menu-button {
    display: flex;
  }

  .topbar-inner {
    gap: 4px;
    padding: 0 12px;
  }

  .topnav,
  .github-link,
  .search-key {
    display: none;
  }

  .brand {
    margin-right: 6px;
  }

  .brand-name {
    display: none;
  }

  .search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .search input {
    padding-right: 10px;
  }

  #search-results {
    position: fixed;
    top: calc(var(--topbar-height) + 4px);
    left: 12px;
    right: 12px;
    width: auto;
  }

  .sidebar,
  .layout-home .sidebar,
  .layout-app .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 25;
    display: block;
    width: min(320px, 86vw);
    height: auto;
    padding-left: 16px;
    background: var(--bg);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 0.2s ease,
      visibility 0.2s;
  }

  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 40px var(--shadow);
  }

  .sidebar-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin: 0 0 16px 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
  }

  .sidebar-primary a {
    color: var(--text);
  }

  .sidebar-primary a[aria-current="page"] {
    color: var(--accent);
  }

  .content {
    padding: 28px 16px 80px;
  }

  .content-home {
    padding: 0 16px 80px;
  }

  .content.content-app {
    padding: 0;
  }

  .playground-frame {
    min-height: 0;
    border-width: 0;
    border-radius: 0;
  }

  .heading-anchor {
    display: none;
  }

  .prose h1 {
    font-size: 2rem;
  }

  .prose h2 {
    font-size: 1.4rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .table-wrap:has(> table.rule-table) {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .prose table.rule-table td + td {
    border-left: 0;
  }

  .hero {
    padding-top: 36px;
  }

  .hero-pitch {
    font-size: 1.08rem;
  }

  .hero-actions .button {
    flex: 1;
    padding: 0 12px;
  }

  .code-window {
    --code-pad-x: 14px;
  }

  .code-window pre.code {
    font-size: 12.5px;
  }
}

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

/* Daily Metrics page (website/src/metrics.ts). Pillar colours are slots 1-4
   of the dataviz reference palette; status keeps --ok / --repl-error. */
:root {
  --metric-c1: light-dark(#2a78d6, #3987e5);
  --metric-c2: light-dark(#eb6834, #d95926);
  --metric-c3: light-dark(#1baf7a, #199e70);
  --metric-c4: light-dark(#8a8d99, #9ba1ae);
}
.metric-c1 {
  --metric-colour: var(--metric-c1);
}
.metric-c2 {
  --metric-colour: var(--metric-c2);
}
.metric-c3 {
  --metric-colour: var(--metric-c3);
}
.metric-c4 {
  --metric-colour: var(--metric-c4);
}
.metric-pillars {
  display: grid;
  gap: 10px;
  margin: 12px 0 24px;
}
.metric-pillar {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.metric-pillar dt {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--heading);
  font-weight: 600;
}
.metric-pillar dd {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.metric-pillar dd strong {
  color: var(--text);
  font-weight: 600;
}
.metric-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--metric-colour);
}
.metric-count {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.metric-explain {
  color: var(--text-soft);
  font-size: 0.92rem;
}
.metric-trend,
.metric-goals {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0 28px;
  overflow: visible;
}
.metric-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}
.metric-tick,
.metric-row-label,
.metric-row-note,
.metric-label {
  fill: var(--text-soft);
  font-size: 12px;
  font-family: var(--font-body);
}
.metric-row-label,
.metric-label {
  fill: var(--text);
}
.metric-row-note.is-pass {
  fill: var(--ok);
}
.metric-row-note.is-fail {
  fill: var(--repl-error);
}
.metric-series {
  fill: none;
  stroke: var(--metric-colour);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.metric-point circle {
  fill: var(--metric-colour);
  stroke: var(--bg);
  stroke-width: 2;
}
.metric-point circle.metric-hit {
  fill: transparent;
  stroke: none;
}
.metric-goal {
  stroke: var(--text-soft);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.metric-bar.is-pass {
  fill: var(--ok);
}
.metric-bar.is-fail {
  fill: var(--repl-error);
}
.metric-bar.is-na {
  fill: var(--text-soft);
}
