/* moonctl site — one stylesheet for the home page and the docs.
 *
 * The palette is built around rgb(159, 160, 255): a periwinkle that reads as a
 * light violet on the dark ground and as a fill (not as text) on the light one,
 * where links use a darkened mix of it instead so the contrast holds up.
 */

:root {
  color-scheme: dark;

  --bg: #08080d;
  --bg-soft: #0b0b12;
  --panel: #0f0f17;
  --panel-2: #14141e;
  --line: #23232f;
  --line-2: #1a1a24;

  --ink: #eceaf6;
  --ink-2: #b9b6cd;
  --muted: #86849c;

  --accent: #9fa0ff;
  --accent-strong: #b9baff;
  --link: #b0b1ff;
  --accent-wash: rgba(159, 160, 255, 0.1);
  --accent-line: rgba(159, 160, 255, 0.26);

  --ok: #79d6a8;
  --warn: #f0c674;
  --err: #ff8f9e;

  --code-bg: #0b0b12;
  --code-head: #101018;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px -32px rgba(0, 0, 0, 0.9);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;

  --max: 1180px;
  --radius: 10px;
  --header: 62px;
}

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

  --bg: #fbfbfe;
  --bg-soft: #f4f4fa;
  --panel: #ffffff;
  --panel-2: #f7f7fc;
  --line: #e3e3ef;
  --line-2: #ededf6;

  --ink: #14141c;
  --ink-2: #3b3b4d;
  --muted: #61617a;

  --accent: #9fa0ff;
  --accent-strong: #4a4dc6;
  --link: #4a4dc6;
  --accent-wash: rgba(159, 160, 255, 0.16);
  --accent-line: rgba(110, 112, 220, 0.28);

  --ok: #1d7f5c;
  --warn: #8a6400;
  --err: #b3243c;

  --code-bg: #f7f7fc;
  --code-head: #f1f1f9;
  --shadow: 0 1px 2px rgba(20, 20, 31, 0.05), 0 24px 60px -36px rgba(20, 20, 31, 0.28);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 18px);
  font-variant-ligatures: no-contextual;
}

button,
input,
textarea,
select {
  font-variant-ligatures: no-contextual;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

::selection {
  background: var(--accent-wash);
  color: var(--ink);
}

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

code,
pre,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

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

/* Scrollbars. Chrome ignores ::-webkit-scrollbar once scrollbar-color is set,
 * so the standard properties live behind a support query that Chrome fails. */
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
  border: 3px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
}

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--panel);
  border: 1px solid var(--accent-line);
  padding: 8px 14px;
  border-radius: 8px;
}

.skip:focus {
  left: 12px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.site-header.stuck {
  border-bottom-color: var(--line-2);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  padding-block: 6px;
}

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

.brand .mark {
  display: grid;
  place-items: center;
  color: var(--accent);
}

.brand .mark svg {
  display: block;
}

.brand .sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  padding-left: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: auto;
}

.nav a {
  color: var(--ink-2);
  font-size: 0.9rem;
  padding: 7px 11px;
  border-radius: 7px;
  line-height: 1;
}

.nav a:hover {
  color: var(--ink);
  background: var(--panel-2);
  text-decoration: none;
}

.nav a[aria-current="true"] {
  color: var(--ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.icon-btn svg {
  display: block;
}

.icon-btn .i-sun {
  display: none;
}

:root[data-theme="light"] .icon-btn .i-moon {
  display: none;
}

:root[data-theme="light"] .icon-btn .i-sun {
  display: block;
}

.nav-toggle {
  display: none;
}

.note-line {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---------- home: hero ---------- */

.hero {
  position: relative;
  overflow: clip;
  border-bottom: 1px solid var(--line-2);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% 0 auto;
  height: 780px;
  background:
    radial-gradient(60% 55% at 50% 0%, var(--accent-wash), transparent 70%),
    linear-gradient(to bottom, transparent, var(--bg) 78%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(70% 60% at 50% 0%, #000 0%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding-block: clamp(56px, 8vw, 104px) clamp(56px, 7vw, 92px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(2.35rem, 5.1vw, 3.5rem);
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-strong);
}

.hero .lead {
  color: var(--ink-2);
  font-size: 1.06rem;
  max-width: 46ch;
  margin-bottom: 30px;
}

.lead code,
.prose code,
.card p code,
.callout code {
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.85em;
  white-space: nowrap;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  line-height: 1;
}

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

.btn svg {
  display: block;
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #14142a;
  font-weight: 600;
}

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

.btn-primary svg {
  opacity: 0.85;
}

.hero-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-meta i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  font-style: normal;
}

/* hero card: a spec on the left, what it produced on the right */

.spec-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
}

.spec-card .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 0.72rem;
}

.spec-card .bar .dots {
  display: flex;
  gap: 5px;
  margin-right: 4px;
}

.spec-card .bar .dots i,
.term-bar .dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  display: block;
}

.term-bar .dots {
  display: flex;
  gap: 5px;
  margin-right: 3px;
}

.spec-card .bar .name {
  color: var(--ink-2);
}

.spec-card .bar .tag {
  margin-left: auto;
  color: var(--accent);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 0.68rem;
}

.spec-src {
  padding: 14px 16px 16px;
  white-space: pre;
  overflow-x: auto;
  color: var(--ink-2);
}

.tok-key {
  color: var(--accent-strong);
}

.tok-str {
  color: var(--ok);
}

.tok-dim {
  color: var(--muted);
}

.spec-card .run {
  padding: 10px 16px;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  background: var(--code-bg);
  color: var(--ink-2);
}

.spec-card .run .p {
  color: var(--accent);
  margin-right: 8px;
}

.tree {
  padding: 10px 16px 16px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-2);
  opacity: 0;
  animation: row-in 0.4s ease forwards;
}

.tree-row .ok {
  color: var(--ok);
  font-size: 0.72rem;
  width: 12px;
}

.tree-row .path {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-row .kind {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.68rem;
  padding-left: 12px;
  white-space: nowrap;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.tree-row:nth-child(1) { animation-delay: 0.15s; }
.tree-row:nth-child(2) { animation-delay: 0.22s; }
.tree-row:nth-child(3) { animation-delay: 0.29s; }
.tree-row:nth-child(4) { animation-delay: 0.36s; }
.tree-row:nth-child(5) { animation-delay: 0.43s; }
.tree-row:nth-child(6) { animation-delay: 0.5s; }
.tree-row:nth-child(7) { animation-delay: 0.57s; }

/* ---------- sections ---------- */

.section {
  padding-block: clamp(56px, 7vw, 88px);
  border-bottom: 1px solid var(--line-2);
}

.section:last-of-type {
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 36px;
}

.section-head h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

.section-head .kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 3px;
}

.section-head p {
  color: var(--muted);
  max-width: 46ch;
  font-size: 0.94rem;
  margin-left: auto;
}

/* ---------- the four cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.card {
  background: var(--bg-soft);
  padding: 22px 20px 24px;
  position: relative;
  transition: background 0.18s ease;
}

.card:hover {
  background: var(--panel-2);
}

.card .num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

@media (width >= 981px) {
  /* a one-line and a two-line heading should not push their paragraphs apart */
  .card h3 {
    min-height: 2.3em;
  }
}

.card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ---------- tabs + code blocks ---------- */

.tabs {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.tab-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab-bar button {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 11px 18px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

.tab-bar button:hover {
  color: var(--ink);
  background: var(--panel);
}

.tab-bar button[aria-selected="true"] {
  color: var(--accent);
  background: var(--panel);
}

.tab-bar button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel[data-active="true"] {
  display: block;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--code-head);
}

.panel-head .file {
  color: var(--ink-2);
}

.panel-head .lines {
  margin-left: auto;
}

.panel-head .copy {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  cursor: pointer;
}

.panel-head .copy:hover {
  color: var(--ink);
  border-color: var(--muted);
}

pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--ink-2);
  font-size: 0.8rem;
  line-height: 1.72;
  tab-size: 2;
}

pre .c {
  color: var(--muted);
}

pre .k {
  color: var(--accent-strong);
}

pre .s {
  color: var(--ok);
}

pre .n {
  color: var(--warn);
}

/* terminal blocks: a prompt in the accent, output in the body colour */

.term {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.term .term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.term pre {
  border: 0;
  background: transparent;
}

.term .p {
  color: var(--accent);
  user-select: none;
}

.term .out {
  color: var(--muted);
}

.term .ok {
  color: var(--ok);
}

/* ---------- quick example ---------- */

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

.split h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.split h3 .step {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-wash);
  border-radius: 4px;
  padding: 1px 6px;
}

.split h3 + * {
  margin-bottom: 22px;
}

/* ---------- command chips ---------- */

.cmd-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.cmd-grid a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  background: var(--bg-soft);
  color: var(--ink-2);
}

.cmd-grid a:hover {
  background: var(--panel-2);
  text-decoration: none;
}

.cmd-grid .cmd {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-strong);
}

.cmd-grid .what {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- CTA band ---------- */

.cta {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  padding: clamp(30px, 5vw, 52px);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--accent-wash), transparent 62%),
    var(--bg-soft);
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}

.cta h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin-bottom: 10px;
}

.cta p {
  color: var(--ink-2);
  max-width: 52ch;
  font-size: 0.95rem;
}

.cta .cta-row {
  margin-left: auto;
}

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

.site-footer {
  border-top: 1px solid var(--line-2);
  padding-block: 44px 30px;
  background: var(--bg-soft);
}

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

.footer-brand p {
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 30ch;
  margin-top: 12px;
}

.footer-col h4 {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  color: var(--ink-2);
  font-size: 0.86rem;
  padding: 4px 0;
}

.footer-col a:hover {
  color: var(--ink);
  text-decoration: none;
}

.footer-bottom {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--mono);
}

.footer-bottom .right {
  margin-left: auto;
}

/* ---------- docs shell ---------- */

.docs-wrap {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 190px;
  gap: 46px;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 24px;
  align-items: start;
}

.side {
  position: sticky;
  top: var(--header);
  max-height: calc(100vh - var(--header));
  overflow-y: auto;
  padding: 34px 8px 40px 0;
  border-right: 1px solid var(--line-2);
  font-size: 0.88rem;
}

.side-group + .side-group {
  margin-top: 26px;
}

.side-group > .label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 9px;
  padding-left: 11px;
}

.side a {
  display: block;
  color: var(--ink-2);
  padding: 6px 11px;
  border-radius: 0 6px 6px 0;
  border-left: 2px solid transparent;
  line-height: 1.45;
}

.side a:hover {
  color: var(--ink);
  background: var(--panel-2);
  text-decoration: none;
}

.side a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent-wash);
  border-left-color: var(--accent);
  font-weight: 500;
}

.toc {
  position: sticky;
  top: var(--header);
  padding: 38px 0 40px;
  font-size: 0.8rem;
  max-height: calc(100vh - var(--header));
  overflow-y: auto;
}

.toc .label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

.toc a {
  display: block;
  color: var(--muted);
  padding: 4px 0 4px 10px;
  border-left: 1px solid var(--line);
  line-height: 1.45;
}

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

.toc a.active {
  color: var(--accent-strong);
  border-left-color: var(--accent);
}

.toc a.depth-3 {
  padding-left: 22px;
  font-size: 0.94em;
}

.doc {
  padding: 40px 0 80px;
  min-width: 0;
}

.doc h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.4rem);
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.doc .lede {
  color: var(--ink-2);
  font-size: 1.02rem;
  max-width: 62ch;
  margin-bottom: 34px;
}

.doc h2 {
  font-size: 1.32rem;
  margin: 44px 0 14px;
  padding-top: 8px;
  letter-spacing: -0.02em;
}

.doc h2 .anchor {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.9rem;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.doc h2:hover .anchor {
  opacity: 1;
}

.doc h3 {
  font-size: 1.02rem;
  margin: 28px 0 10px;
}

.prose > p {
  color: var(--ink-2);
  margin-bottom: 14px;
  max-width: 72ch;
}

.prose > p strong {
  color: var(--ink);
  font-weight: 600;
}

.prose ul,
.prose ol {
  color: var(--ink-2);
  margin: 0 0 16px;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 6px;
}

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

.prose code {
  color: var(--ink);
}

.doc .term,
.doc .tabs,
.doc .code {
  margin: 0 0 20px;
}

.code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}

.code .code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--code-head);
  border-bottom: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.code .code-head .file {
  color: var(--ink-2);
}

.code .code-head .copy {
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font: inherit;
  font-size: 0.7rem;
  padding: 3px 8px;
  cursor: pointer;
}

.code .code-head .copy:hover {
  color: var(--ink);
}

.code pre {
  border: 0;
}

/* tables */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 22px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
  vertical-align: top;
}

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

td code {
  color: var(--ink);
  white-space: nowrap;
}

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

/* callouts: the colour bar is a straight edge, so the left corners are square */

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin: 0 0 20px;
  background: var(--bg-soft);
  font-size: 0.9rem;
  color: var(--ink-2);
}

.callout .t {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 4px;
}

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

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

.callout p + p {
  margin-top: 8px;
}

/* API reference. The markup is generated by scripts/gen_api_reference.py, so
 * these class names are a contract with that script: change one and the page
 * loses its styling on the next regeneration. Signatures wrap rather than
 * scroll -- a wrapped type is readable, a clipped one is not. */

.api-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin: -6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.api-meta code {
  color: var(--ink-2);
}

.api-list {
  margin: 0 0 20px;
  border-top: 1px solid var(--line-2);
}

.api-item {
  padding: 11px 0 12px;
  border-bottom: 1px solid var(--line-2);
}

.api-item:last-child {
  border-bottom: 0;
}

.api-sig {
  display: block;
  font-family: var(--mono);
  font-size: 0.79rem;
  line-height: 1.65;
  color: var(--ink);
  font-variant-ligatures: no-contextual;
  overflow-wrap: anywhere;
}

.api-sig .k {
  color: var(--muted);
}

.api-sig .n {
  color: var(--accent-strong);
}

.api-tag {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--muted);
}

.api-doc {
  margin: 5px 0 0;
  max-width: 76ch;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.api-doc + .api-doc {
  margin-top: 6px;
}

.api-doc code {
  font-size: 0.87em;
}

.api-bullets {
  padding-left: 18px;
  margin-top: 6px;
}

.api-bullets li {
  margin-bottom: 4px;
}

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

.api-code {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-x: auto;
  tab-size: 2;
}

.api-type {
  margin: 0 0 14px;
  padding: 14px 16px 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.api-type > .table-wrap,
.api-type > .api-variants {
  margin: 12px 0 14px;
}

.doc h4.api-sub {
  margin: 16px 0 2px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.api-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
}

.api-variants li code {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.api-table td code {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* pager */

.pager {
  display: flex;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line-2);
}

.pager a {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--ink);
  display: block;
}

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

.pager .dir {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

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

/* the sidebar is a drawer on narrow screens */

.side-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.85rem;
  padding: 7px 12px;
  margin-bottom: 20px;
  cursor: pointer;
}

.side-toggle:hover {
  color: var(--ink);
  border-color: var(--accent-line);
}

/* ---------- responsive ---------- */

@media (width <= 1120px) {
  .docs-wrap {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 36px;
  }

  .toc {
    display: none;
  }
}

@media (width <= 980px) {
  .hero .container {
    grid-template-columns: minmax(0, 1fr);
  }

  .spec-card {
    max-width: 560px;
  }

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

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

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

  .section-head {
    flex-wrap: wrap;
  }

  .section-head p {
    margin-left: 0;
    flex-basis: 100%;
  }
}

@media (width <= 860px) {
  :root {
    --header: 56px;
  }

  .container {
    padding-inline: 18px;
  }

  .nav {
    display: none;
  }

  .nav-toggle {
    display: grid;
  }

  .site-header.open .nav {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 18px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .site-header.open .nav a {
    padding: 11px 10px;
  }

  .brand .sub {
    display: none;
  }

  .docs-wrap {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 18px;
  }

  .side {
    position: static;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line-2);
    padding: 20px 0 18px;
    display: none;
  }

  .side.open {
    display: block;
  }

  .side-toggle {
    display: inline-flex;
  }

  .doc {
    padding-top: 26px;
  }

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

  .cta .cta-row {
    margin-left: 0;
  }
}

@media (width <= 620px) {
  .card-grid,
  .cmd-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  pre {
    font-size: 0.76rem;
  }

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

/* The page scroll bar shows while the page moves or under the pointer and
   hides a moment after; it keeps its place, so nothing shifts. */
@supports selector(::-webkit-scrollbar) {
  html:not(.scrolling)::-webkit-scrollbar-thumb { background: transparent; border-color: transparent; box-shadow: none; }
}
@supports not selector(::-webkit-scrollbar) {
  html:not(.scrolling) { scrollbar-color: transparent transparent; }
}
