/* moonnet docs — one stylesheet, two themes, no framework.

   The look: warm paper, ink, and a single signal colour, with a mono voice for anything the
   machine says. Edges are tight, rules are hairlines, and the only soft thing is a shadow that
   lifts a panel off the page. */

:root {
  color-scheme: light;

  --paper: #f7f5ef;
  --paper-2: #fffdf8;
  --paper-3: #f1eee5;
  --ink: #0d161d;
  --ink-2: #33424c;
  --muted: #63717a;
  --muted-2: #87939a;
  --line: #e0dbcf;
  --line-2: #ece7dc;
  --signal: #0a7a72;
  --signal-2: #0f9d92;
  --signal-soft: #dcefe9;
  --amber: #a2591f;
  --amber-soft: #f6e8d7;
  --code-bg: #0b1216;
  --code-bg-2: #0e171c;
  --code-ink: #dde8e6;
  --code-dim: #84999a;
  --code-key: #6fd6c4;
  --code-str: #eab06a;
  --code-com: #566b6c;
  --code-line: rgba(221, 232, 230, 0.09);

  --r-lg: 14px;
  --r-md: 9px;
  --r-sm: 5px;

  --shadow-1: 0 1px 2px rgba(13, 22, 29, 0.05);
  --shadow-2: 0 18px 40px -28px rgba(13, 22, 29, 0.45);

  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --nav-h: 64px;
}

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

  --paper: #080d11;
  --paper-2: #0d151b;
  --paper-3: #111b22;
  --ink: #ebe7dd;
  --ink-2: #c6c8c2;
  --muted: #8d9ba4;
  --muted-2: #6f7f88;
  --line: #1e2b33;
  --line-2: #16222a;
  --signal: #4ed3c1;
  --signal-2: #6ee0d0;
  --signal-soft: #102827;
  --amber: #e9a75f;
  --amber-soft: #2a2016;
  --code-bg: #060b0e;
  --code-bg-2: #0a1115;
  --code-ink: #dde8e6;
  --code-dim: #7e9295;
  --code-key: #6fd6c4;
  --code-str: #eab06a;
  --code-com: #55696b;
  --code-line: rgba(221, 232, 230, 0.08);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 24px 48px -30px rgba(0, 0, 0, 0.9);
}

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

/* A figure is a panel here, not a quotation from a book: no UA margin, no stray 40px. */
figure {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

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

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

/* ---- scroll bars ------------------------------------------------------
   The page thumb hides while the page sits at the top and stays once it has
   moved. Inner areas keep a thin thumb that darkens under the pointer.
   The standard properties live only where ::-webkit-scrollbar does not
   exist, or they would override it in Chrome. */

@supports selector(::-webkit-scrollbar) {
  html::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  html::-webkit-scrollbar-track {
    background: transparent;
  }
  html::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-radius: 99px;
    background-clip: content-box;
    background-color: color-mix(in srgb, var(--ink) 24%, transparent);
  }
  html.at-top::-webkit-scrollbar-thumb {
    background-color: transparent;
  }
  .toc::-webkit-scrollbar,
  .codeblock pre::-webkit-scrollbar,
  .table-wrap::-webkit-scrollbar,
  .figure pre::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  .toc::-webkit-scrollbar-track,
  .codeblock pre::-webkit-scrollbar-track,
  .table-wrap::-webkit-scrollbar-track,
  .figure pre::-webkit-scrollbar-track {
    background: transparent;
  }
  .toc::-webkit-scrollbar-thumb,
  .codeblock pre::-webkit-scrollbar-thumb,
  .table-wrap::-webkit-scrollbar-thumb,
  .figure pre::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 99px;
    background-clip: content-box;
    background-color: color-mix(in srgb, var(--ink) 14%, transparent);
  }
  /* At rest the sidebar's thumb is hidden: a long thin bar under the list reads as a rule, not
     as a scrollbar. It comes back under the pointer and under the keyboard, where it means
     something. */
  .toc::-webkit-scrollbar-thumb {
    background-color: transparent;
  }
  .toc:hover::-webkit-scrollbar-thumb,
  .toc:focus-within::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--ink) 22%, transparent);
  }

  .toc:hover::-webkit-scrollbar-thumb,
  .codeblock pre:hover::-webkit-scrollbar-thumb,
  .table-wrap:hover::-webkit-scrollbar-thumb,
  .figure pre:hover::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--ink) 34%, transparent);
  }

  /* On the dark panels the thumb has to come from the code ink, not from the page's. */
  .codeblock pre::-webkit-scrollbar-thumb {
    background-color: rgba(221, 232, 230, 0.18);
  }
  .codeblock pre:hover::-webkit-scrollbar-thumb {
    background-color: rgba(221, 232, 230, 0.34);
  }
}

@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 24%, transparent) transparent;
  }
  html.at-top {
    scrollbar-color: transparent transparent;
  }
}

::selection {
  background: color-mix(in srgb, var(--signal) 85%, transparent);
  color: var(--paper);
}

/* The chrome is for clicking: a drag that starts on the header, a tab or a button should not
   leave a selection smeared across the interface. Prose, code and tables stay selectable, so
   what the page says can still be copied. */
.nav,
.nav__link,
.nav__icon,
.btn,
.tabs,
.tab,
.stepper,
.toc,
.pkg-index,
.eyebrow,
.card__label,
.codeblock__bar,
.fan svg,
.trace li::before {
  -webkit-user-select: none;
  user-select: none;
}

button,
.tab,
.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--signal) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--signal);
  text-decoration-color: currentColor;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  z-index: 60;
}

.skip:focus {
  left: 16px;
  top: 12px;
}

.wrap {
  width: min(1180px, 100% - 56px);
  margin-inline: auto;
}

/* ---- navigation -------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 26px;
  height: var(--nav-h);
  padding: 0 max(28px, calc((100% - 1180px) / 2));
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

/* A hairline of signal colour under the header, gone from the middle out. */
.nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--signal) 45%, transparent),
    transparent
  );
  opacity: 0.55;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 18.5px;
  letter-spacing: -0.015em;
  text-decoration: none;
  color: var(--ink);
}

.nav__brand svg {
  width: 32px;
  height: 24px;
  color: var(--signal);
  flex: none;
}

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

.nav__link {
  position: relative;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--r-sm);
}

.nav__link:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.nav__link.is-active {
  color: var(--ink);
}

.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--signal);
}

/* The one item that leaves the site. It used to sit at the quietest grey in the palette, which
   read as disabled rather than as a link; the divider and the arrow say "outbound" instead. */
.nav__link--ext {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding-left: 15px;
  font-family: var(--mono);
  font-size: 12.8px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.nav__link--ext::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 15px;
  margin-top: -7.5px;
  background: color-mix(in srgb, var(--ink) 14%, var(--line));
}

.nav__link--ext:hover {
  color: var(--ink);
}

.nav__ext {
  width: 12px;
  height: 12px;
  flex: none;
  opacity: 0.5;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.nav__link--ext:hover .nav__ext {
  opacity: 1;
  transform: translate(1px, -1px);
}

.nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.nav__icon svg {
  width: 18px;
  height: 18px;
}

.nav__icon:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-2);
}

.nav__menu {
  display: none;
  margin-left: auto;
}

/* ---- type -------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 20px;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
  flex: none;
}

.lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0;
}

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

/* Inline code reads as code, not as a key cap: a tint of ink, no border, no lift. */
p code,
li code,
td code,
dd code {
  font-size: 0.885em;
  padding: 0.08em 0.34em;
  border: 0;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 5.5%, transparent);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ---- hero -------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 104px;
  border-bottom: 1px solid var(--line);
}

/* Light falling from the top left, and a dot grid that fades before the text. */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% 30% auto -25%;
  height: 780px;
  background: radial-gradient(
    55% 55% at 50% 45%,
    color-mix(in srgb, var(--signal) 13%, transparent),
    transparent 72%
  );
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--ink) 13%, transparent) 1px,
    transparent 0
  );
  background-size: 24px 24px;
  mask-image: radial-gradient(60% 55% at 78% 30%, black, transparent 78%);
  opacity: 0.5;
  pointer-events: none;
}

[data-theme="dark"] .hero::after {
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--ink) 26%, transparent) 1px,
    transparent 0
  );
  opacity: 0.45;
}

.hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 64px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(38px, 4.35vw, 58px);
  letter-spacing: -0.035em;
  line-height: 1.06;
  margin-bottom: 26px;
}

.hero h1 em {
  font-style: normal;
  color: var(--signal);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 7px;
  text-decoration-color: color-mix(in srgb, var(--signal) 38%, transparent);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.16s ease;
}

.btn:hover {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--signal) 80%, transparent);
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn--ghost {
  background: var(--paper-2);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 16%, var(--line));
}

.btn--ghost:hover {
  background: var(--paper-2);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.hero__proof {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 32px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.hero__proof span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero__proof span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--signal);
  opacity: 0.85;
}

.hero__proof span:first-child::before {
  display: none;
}

/* the fan: one call, four carriers, one reply */

.fan {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, var(--paper-2), color-mix(in srgb, var(--paper-2) 55%, var(--paper)));
  box-shadow: var(--shadow-2), var(--shadow-1);
  padding: 18px 18px 14px;
}

/* A panel of its own graph paper: the diagram sits on a plot, not on a blank card. */
.fan::before {
  content: "";
  position: absolute;
  inset: 46px 12px 38px;
  z-index: 0;
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--ink) 15%, transparent) 1px,
    transparent 0
  );
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 46%, #000 0%, transparent 76%);
  mask-image: radial-gradient(ellipse at 50% 46%, #000 0%, transparent 76%);
  opacity: 0.8;
  pointer-events: none;
}

.fan > * {
  position: relative;
  z-index: 1;
}

.fan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 0 2px 8px;
}

.fan__head b {
  font-weight: 500;
  color: var(--signal);
}

.fan__head i {
  font-style: normal;
  color: var(--muted-2);
}

.fan svg {
  display: block;
  width: 100%;
  height: auto;
}

.fan svg text {
  font-family: var(--mono);
  fill: var(--ink);
}

.fan svg .node rect {
  fill: var(--paper-2);
  stroke: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.fan svg .node--signal rect {
  stroke: color-mix(in srgb, var(--signal) 62%, var(--line));
  fill: color-mix(in srgb, var(--signal) 10%, var(--paper-2));
}

.fan svg .lane {
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  opacity: 0;
  animation: draw 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fan svg .lane-1 {
  stroke: color-mix(in srgb, var(--signal) 72%, transparent);
  animation-delay: 0.1s;
}
.fan svg .lane-2 {
  stroke: color-mix(in srgb, var(--signal) 56%, transparent);
  animation-delay: 0.2s;
}
.fan svg .lane-3 {
  stroke: color-mix(in srgb, var(--signal) 40%, transparent);
  animation-delay: 0.3s;
}
/* WebSocket is not another version of HTTP, so it is not another shade of the same colour. */
.fan svg .lane-4 {
  stroke: color-mix(in srgb, var(--amber) 62%, transparent);
  animation-delay: 0.4s;
}

.fan svg .side {
  font-size: 9px;
  letter-spacing: 0.2em;
  fill: var(--muted);
}

.fan svg .hair {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.fan svg .pkt {
  fill: var(--amber);
  stroke: var(--paper-2);
  stroke-width: 1.6;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--amber) 50%, transparent));
}

.fan svg .tag {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  fill: var(--muted);
}

/* A label that sits over its lane is given a halo of the panel's paper, so the line passes
   behind the word instead of through it. */
.fan svg .tag,
.fan svg .side,
.fan svg .node-title,
.fan svg .node-sub {
  paint-order: stroke;
  stroke: var(--paper-2);
  stroke-width: 3.5px;
  stroke-linejoin: round;
}

.fan svg .node-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.fan svg .node-sub {
  font-size: 9.8px;
  letter-spacing: 0.06em;
  fill: var(--muted);
}

.fan figcaption {
  margin: 6px 2px 0;
  font-size: 13px;
  color: var(--muted);
}

@keyframes draw {
  from {
    opacity: 0;
    stroke-dasharray: 520;
    stroke-dashoffset: 520;
  }
  to {
    opacity: 1;
    stroke-dasharray: 520;
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fan svg .lane {
    animation: none;
    opacity: 1;
  }
  html {
    scroll-behavior: auto;
  }
}

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

.section {
  position: relative;
  padding: 88px 0;
  border-bottom: 1px solid var(--line);
}

.section::before {
  content: "";
  position: absolute;
  left: max(16px, calc((100% - 1180px) / 2));
  top: -3.5px;
  width: 6px;
  height: 6px;
  border: 1px solid color-mix(in srgb, var(--signal) 55%, var(--line));
  border-radius: 50%;
  background: var(--paper);
}

.section:first-of-type::before {
  display: none;
}

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

.section__head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 28px;
  margin-bottom: 44px;
  align-items: start;
}

/* Wide enough for a real gutter: the numeral moves out into it, so the heading and the body
   below it begin on the same line instead of the heading being indented by a column that is
   mostly empty. */
@media (width >= 1440px) {
  .section__head {
    display: block;
    position: relative;
  }

  .section__no {
    position: absolute;
    right: calc(100% + 22px);
    top: -6px;
    font-size: 48px;
  }
}

.section__no {
  font-family: var(--display);
  font-weight: 700;
  font-size: 54px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--ink) 34%, transparent);
  padding-top: 2px;
  user-select: none;
}

.section h2 {
  font-size: clamp(28px, 3.2vw, 38px);
  margin-bottom: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-2);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--signal) 45%, var(--line));
  box-shadow: var(--shadow-2);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--signal) 30%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--signal) 8%, var(--paper));
  color: var(--signal);
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.card__icon svg {
  width: 20px;
  height: 20px;
}

.card:hover .card__icon {
  border-color: color-mix(in srgb, var(--signal) 58%, var(--line));
  background: color-mix(in srgb, var(--signal) 13%, var(--paper));
}

.card__label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}

.card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.card p {
  margin: 0 0 18px;
  font-size: 14.8px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* A card that is a way out, rather than a note: the arrow waits at the foot of the tile, so a
   short caption and a long one still give the row a bottom line. */
.card--link::after {
  content: "\2192";
  margin-top: auto;
  padding-top: 16px;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  color: var(--muted-2);
  transition:
    color 0.16s ease,
    transform 0.16s ease;
}

.card--link:hover::after {
  color: var(--signal);
  transform: translateX(3px);
}

.card__meta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 10.8px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--muted-2);
}

/* ---- code -------------------------------------------------------------- */

.codeblock {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--code-ink) 12%, transparent);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--code-bg-2), var(--code-bg));
  box-shadow: var(--shadow-2);
  overflow: hidden;
  margin: 24px 0;
}

.codeblock__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--code-line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--code-dim);
}

.codeblock__bar::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--code-ink) 18%, transparent);
  box-shadow:
    15px 0 0 color-mix(in srgb, var(--code-ink) 12%, transparent),
    30px 0 0 color-mix(in srgb, var(--code-ink) 8%, transparent);
  margin-right: 32px;
  flex: none;
}

.codeblock__bar .copy {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--code-line);
  border-radius: 4px;
  background: none;
  color: var(--code-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.14s ease,
    border-color 0.14s ease;
}

.codeblock__bar .copy:hover {
  color: var(--code-ink);
  border-color: color-mix(in srgb, var(--code-ink) 45%, transparent);
}

.codeblock pre {
  margin: 0;
  padding: 20px 18px;
  overflow-x: auto;
  color: var(--code-ink);
  font-size: 13.3px;
  line-height: 1.72;
  tab-size: 2;
}

.codeblock pre code {
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  white-space: pre;
}

.codeblock .out {
  border-top: 1px solid var(--code-line);
  padding: 13px 18px 15px;
  font-family: var(--mono);
  font-size: 12.6px;
  line-height: 1.7;
  color: var(--code-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--code-ink) 3%, transparent);
}

.codeblock .out::before {
  content: "› ";
  color: var(--code-key);
}

.kw {
  color: var(--code-key);
}

.str {
  color: var(--code-str);
}

.com {
  color: var(--code-com);
  font-style: italic;
}

.num {
  color: var(--code-str);
  opacity: 0.9;
}

/* ---- tables ------------------------------------------------------------ */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-2);
  overflow-x: auto;
  box-shadow: var(--shadow-1);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.6px;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  background: var(--paper-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--signal) 4%, transparent);
}

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

td:first-child {
  color: var(--ink);
}

td code {
  white-space: nowrap;
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border-color: transparent;
}

/* ---- docs layout ------------------------------------------------------- */

.docs {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 60px;
  padding: 56px 0 96px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px);
  /* The sidebar is a scroll container, and a scroll container clips: the rail's own margin is
     given back as padding so the accent can sit in the gutter without being cut off. */
  margin-left: -16px;
  overflow-y: auto;
  padding: 0 10px 24px 16px;
  font-size: 13.5px;
}

.toc a {
  position: relative;
  display: block;
  padding: 5px 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.14s ease;
}

.toc a::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--signal);
  opacity: 0;
  transition: opacity 0.14s ease;
}

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

.toc a.is-active {
  color: var(--ink);
  font-weight: 600;
}

.toc a.is-active::before {
  opacity: 1;
}

.toc__pkg {
  display: block;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink) !important;
}



.toc__pkg:first-child {
  margin-top: 0;
}

.toc-sub {
  padding-left: 12px !important;
  font-size: 13px;
}

.toc-sub--deep {
  padding-left: 24px !important;
  font-size: 12.3px;
  color: var(--muted-2) !important;
}

.toc-sub--deep.is-active {
  color: var(--ink) !important;
}

.content {
  min-width: 0;
}

.content > .page-title {
  font-size: clamp(32px, 4.2vw, 46px);
  letter-spacing: -0.032em;
  margin-bottom: 16px;
}

.content > .lead {
  margin-bottom: 40px;
  font-size: 18.5px;
}

.content h2 {
  position: relative;
  font-size: clamp(23px, 2.4vw, 28px);
  margin: 60px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.content h2:first-of-type {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.content h3 {
  font-size: 18.5px;
  margin: 30px 0 8px;
}

.content p {
  margin: 14px 0;
  max-width: 68ch;
  color: var(--ink-2);
}

.content > p:first-of-type {
  color: var(--ink);
}

.content ul,
.content ol {
  max-width: 68ch;
  padding-left: 22px;
  color: var(--ink-2);
}

.content li {
  margin: 7px 0;
}

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

/* the step number sits in the margin, in mono, small */

.page-guide .content {
  counter-reset: step;
  position: relative;
}

.page-guide .content::before {
  content: "";
  position: absolute;
  left: -46px;
  top: 8px;
  bottom: 40px;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--line) 6%,
    var(--line) 92%,
    transparent
  );
}

.page-guide .content h2 {
  counter-increment: step;
}

.page-guide .content h2::after {
  content: "";
  position: absolute;
  left: -50px;
  top: 29px;
  width: 9px;
  height: 9px;
  border: 1px solid color-mix(in srgb, var(--signal) 65%, var(--line));
  border-radius: 50%;
  background: var(--paper);
}

.page-guide .content h2::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: -84px;
  width: 26px;
  text-align: right;
  top: 25px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}

.page-guide .content h2:first-of-type::before {
  top: 3px;
}

.page-guide .content h2:first-of-type::after {
  top: 7px;
}

.note {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid color-mix(in srgb, var(--signal) 26%, var(--line));
  border-left: 3px solid var(--signal);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: color-mix(in srgb, var(--signal) 6%, var(--paper));
  padding: 14px 16px;
  margin: 24px 0;
  font-size: 14.6px;
  color: var(--ink-2);
}

.note::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--signal);
  color: var(--paper);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
}

.note p {
  margin: 0;
  max-width: none;
}


/* ---- API --------------------------------------------------------------- */

.pkg-index {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 40px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.pkg-index a {
  font-family: var(--mono);
  font-size: 11.8px;
  letter-spacing: 0.01em;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  text-decoration: none;
  transition:
    border-color 0.14s ease,
    color 0.14s ease,
    background 0.14s ease;
}

.pkg-index a:hover {
  border-color: color-mix(in srgb, var(--signal) 55%, var(--line));
  background: color-mix(in srgb, var(--signal) 7%, var(--paper));
  color: var(--signal);
}

/* Both pages share the sidebar measure, so the title of one lines up with the title of the
   other when a reader moves between them. */
.page-api .docs {
  grid-template-columns: 270px minmax(0, 1fr);
}

.api-pkg {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--mono) !important;
  font-size: 14px !important;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink) !important;
  margin: 64px 0 6px !important;
  padding: 26px 0 0 !important;
  border-top: 1px solid var(--line) !important;
  scroll-margin-top: calc(var(--nav-h) + 18px);
}

.api-pkg::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
  transform: translateY(-1px);
}

.api-pkg:first-of-type {
  margin-top: 4px !important;
  padding-top: 0 !important;
  border-top: 0 !important;
}

.api-blurb {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0 0 22px !important;
  padding-left: 19px;
  max-width: 60ch;
}

.api-item {
  position: relative;
  padding: 14px 0 15px 19px;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.16s ease;
}

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

.api-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: var(--line);
  transition: background 0.16s ease;
}

.api-item:hover {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--signal) 5%, transparent),
    transparent 70%
  );
}

.api-item:hover::before {
  background: color-mix(in srgb, var(--signal) 60%, var(--line));
}

.api-sig {
  font-family: var(--mono);
  font-size: 13.6px;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.api-sig .kw {
  color: var(--muted);
  font-size: 12.4px;
}

.api-sig .fn {
  color: var(--signal);
  font-weight: 500;
}

.api-sig--member {
  color: var(--ink-2);
  font-size: 12.7px;
  padding: 2px 0;
}

.api-sig--impl {
  color: var(--muted-2);
  font-size: 12.2px;
  padding: 8px 0 8px 19px;
}

.api-sub {
  margin: 12px 0 2px;
  padding: 10px 14px;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--paper-2);
}

.api-vdoc .api-desc {
  margin: 2px 0 10px;
  font-size: 13.4px;
  color: var(--muted);
}

.api-sub .api-sig--member + .api-vdoc .api-desc {
  margin-top: 3px;
}

.api-desc {
  margin: 8px 0 0;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 70ch;
}

.api-desc code {
  font-size: 0.88em;
}

/* ---- showcase ---------------------------------------------------------- */

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 26px 0 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-3);
}

.tab {
  font-family: var(--mono);
  font-size: 12.3px;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    box-shadow 0.14s ease;
}

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

.tab[aria-selected="true"] {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.panel[hidden] {
  display: none;
}


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

.figure {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 16px;
  background: var(--paper-2);
  box-shadow: var(--shadow-1);
}

.figure pre {
  margin: 0;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.figure__cap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* the trace: steps that light up one at a time */

.trace {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  counter-reset: t;
}

.trace li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  transition: color 0.2s ease;
}

.trace li::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 36px;
  bottom: -6px;
  width: 1px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}

.trace li:last-child::after {
  display: none;
}

.trace li::before {
  content: counter(t);
  counter-increment: t;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  z-index: 1;
}

.trace li.is-on {
  color: var(--ink);
}

.trace li.is-on::before {
  border-color: var(--signal);
  background: var(--signal);
  color: var(--paper);
}

.trace b {
  font-family: var(--mono);
  font-size: 12.6px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.trace code {
  font-size: 0.86em;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-color: transparent;
  padding: 0.05em 0.3em;
}

.stepper {
  display: flex;
  gap: 8px;
  margin: 18px 0 0;
}

.stepper button {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  color: var(--ink-2);
  cursor: pointer;
  transition:
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease;
}

.stepper button:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
}

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

.footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 30px 0 38px;
  font-size: 13px;
  color: var(--muted);
  background: var(--paper-3);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.footer__brand svg {
  width: 26px;
  height: 19px;
  color: var(--signal);
}

.footer a {
  text-decoration: none;
  margin-left: 14px;
}

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

/* ---- small screens ----------------------------------------------------- */

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

  .hero {
    padding: 64px 0 72px;
  }

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

  .docs,
  .page-api .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .toc {
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
    overflow: visible;
  }

  .toc a::before {
    display: none;
  }

  .page-guide .content::before {
    display: none;
  }

  .page-guide .content h2::before {
    position: static;
    display: block;
    margin-bottom: 6px;
  }

  .page-guide .content h2::after {
    display: none;
  }
}

@media (width <= 780px) {
  :root {
    --nav-h: 58px;
  }

  body {
    font-size: 16px;
  }

  .wrap {
    width: min(100% - 32px, 1180px);
  }

  .nav {
    padding: 0 16px;
    gap: 12px;
  }

  .nav__menu {
    display: inline-flex;
  }

  .nav__links {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 16px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-2);
  }

  .nav.is-open .nav__links {
    display: flex;
  }

  .nav__link {
    width: 100%;
    padding: 10px 8px;
  }

  .nav__link.is-active::after {
    left: 8px;
    right: auto;
    width: 16px;
    bottom: 4px;
  }

  .nav__icon {
    align-self: center;
  }

  .nav__link--ext {
    margin: 6px 0 0;
    padding-left: 8px;
  }

  .nav__link--ext::before {
    left: 8px;
    right: 8px;
    top: 0;
    width: auto;
    height: 1px;
    margin: 0;
  }

  .hero h1 {
    font-size: clamp(34px, 9vw, 44px);
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero__actions .btn {
    justify-content: center;
  }

  /* At this width the diagram is a third of its size, so the small print is dropped and the
     two nodes are given type that survives the scale. */
  .fan__head {
    font-size: 9.5px;
    letter-spacing: 0.1em;
  }

  .fan__head i {
    display: none;
  }

  .fan svg .side,
  .fan svg .tag {
    display: none;
  }

  .fan svg .node-title {
    font-size: 17px;
  }

  .fan svg .node-sub {
    font-size: 13px;
  }

  .section {
    padding: 56px 0;
  }

  .section__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 30px;
  }

  .section__no {
    font-size: 40px;
  }

  .codeblock pre {
    font-size: 12.3px;
  }

  .content h2 {
    margin-top: 44px;
  }
}
