/* weft */
/*
 * The framework's stylesheet. An application that writes no CSS gets this, and it is meant to
 * be enough: type, spacing, colour in both schemes, and the handful of components a
 * server-rendered page actually needs.
 *
 * Two rules govern what is in here. Every class is prefixed `weft-` or is a bare element, so
 * an application's own CSS cannot be ambushed by a name collision. And nothing here depends on
 * JavaScript: a page whose script never loads looks exactly the same.
 */

:root {
  --weft-bg: #fbfbfa;
  --weft-surface: #ffffff;
  --weft-surface-2: #f4f4f2;
  --weft-line: #e3e2de;
  --weft-line-strong: #cfcec8;
  --weft-text: #1c1b19;
  --weft-muted: #6b6a65;
  --weft-accent: #8a4b2a;
  --weft-accent-soft: #f4ece7;
  --weft-good: #2f6b47;
  --weft-warn: #8a6a1f;
  --weft-bad: #8f2f2f;
  --weft-radius: 10px;
  --weft-gap: 1.25rem;
  --weft-measure: 68ch;
  /*
   * The page's column, and the gutter either side of it.
   *
   * One pair of tokens rather than a width on `.weft-main` alone, because the header, the content
   * and the footer are three separate bands and a width on one of them centres that band against
   * nothing. That is what they used to do: `.weft-main` was centred at 72rem while the header and
   * footer were full-bleed with only a viewport gutter, so on a wide screen the brand sat at the
   * window edge, the content began 350px further in, and the footer went back to the edge again.
   * Three left edges on one page.
   *
   * So the bands stay full-bleed — a border that stops short of the window looks like a mistake —
   * and their *content* is inset to the same column with the padding below.
   */
  --weft-shell: 72rem;
  --weft-gutter: clamp(1rem, 4vw, 3rem);
  --weft-sans:
    ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --weft-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --weft-bg: #16161a;
    --weft-surface: #1d1d22;
    --weft-surface-2: #24242b;
    --weft-line: #2f2f37;
    --weft-line-strong: #414150;
    --weft-text: #ecebe6;
    --weft-muted: #9d9c98;
    --weft-accent: #d99a6c;
    --weft-accent-soft: #2b2320;
    --weft-good: #7fbf95;
    --weft-warn: #d9bd72;
    --weft-bad: #e08b8b;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--weft-bg);
  color: var(--weft-text);
  font-family: var(--weft-sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

/*
 * A document as tall as the window, so a page with four things on it does not leave its footer
 * floating in the middle of the screen with the background showing underneath.
 *
 * Conditional on the page using this stylesheet's own layout band, and that is the whole reason for
 * `:has`. An application writes its own `layout.tsx` — the demo and the documentation site both do,
 * with a sidebar and a header of their own and no `.weft-main` anywhere — and turning every `body`
 * into a flex column would re-lay-out pages that never asked this stylesheet for a layout. Scoped
 * this way it reaches the framework's own document and the scaffold, which are the pages whose
 * footer position this stylesheet is responsible for.
 *
 * `100dvh` rather than `100vh`: on a phone the dynamic viewport accounts for the browser's chrome
 * coming and going, and `vh` there is a footer pushed just off the bottom of the screen.
 */
body:has(> .weft-main) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* The band holding the page takes the slack, so the footer after it lands on the bottom edge. */
body:has(> .weft-main) > .weft-main {
  flex: 1 0 auto;
}

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

.weft-top {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 1rem;
  padding-inline: max(var(--weft-gutter), calc((100% - var(--weft-shell)) / 2 + var(--weft-gutter)));
  border-bottom: 1px solid var(--weft-line);
  background: color-mix(in srgb, var(--weft-surface) 70%, transparent);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.weft-brand {
  font-weight: 620;
  letter-spacing: -0.01em;
  font-size: 1.0625rem;
  color: var(--weft-text);
  text-decoration: none;
}

.weft-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9375rem;
}

.weft-nav a {
  color: var(--weft-muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}

.weft-nav a:hover {
  color: var(--weft-text);
}

.weft-nav a[data-current='yes'] {
  color: var(--weft-text);
  border-bottom-color: var(--weft-accent);
}

.weft-main {
  max-width: var(--weft-shell);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--weft-gutter) 5rem;
}

.weft-foot {
  border-top: 1px solid var(--weft-line);
  padding-block: 1.5rem;
  padding-inline: max(var(--weft-gutter), calc((100% - var(--weft-shell)) / 2 + var(--weft-gutter)));
  color: var(--weft-muted);
  font-size: 0.875rem;
}

/* ── type ────────────────────────────────────────────────────────────────────────── */

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin: 0 0 0.5em;
  font-weight: 640;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 2.75rem);
}

h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.125rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
  max-width: var(--weft-measure);
}

a {
  color: var(--weft-accent);
  text-underline-offset: 2px;
}

small,
.weft-hint {
  color: var(--weft-muted);
  font-size: 0.875rem;
}

.weft-lede {
  font-size: 1.125rem;
  color: var(--weft-muted);
  max-width: var(--weft-measure);
}

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

code {
  background: var(--weft-surface-2);
  border: 1px solid var(--weft-line);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--weft-surface-2);
  border: 1px solid var(--weft-line);
  border-radius: var(--weft-radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
}

/* ── components ──────────────────────────────────────────────────────────────────── */

.weft-card {
  background: var(--weft-surface);
  border: 1px solid var(--weft-line);
  border-radius: var(--weft-radius);
  padding: 1.25rem 1.375rem;
  margin: 0 0 var(--weft-gap);
}

.weft-card > :last-child {
  margin-bottom: 0;
}

.weft-grid {
  display: grid;
  gap: var(--weft-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  margin-bottom: var(--weft-gap);
}

.weft-grid .weft-card {
  margin: 0;
}

.weft-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.weft-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--weft-line-strong);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8125rem;
  color: var(--weft-muted);
  text-decoration: none;
  background: var(--weft-surface);
}

.weft-pill[data-state='good'] {
  color: var(--weft-good);
  border-color: color-mix(in srgb, var(--weft-good) 45%, var(--weft-line));
}

.weft-pill[data-state='warn'] {
  color: var(--weft-warn);
  border-color: color-mix(in srgb, var(--weft-warn) 45%, var(--weft-line));
}

.weft-pill[data-state='bad'] {
  color: var(--weft-bad);
  border-color: color-mix(in srgb, var(--weft-bad) 45%, var(--weft-line));
}

button,
.weft-button {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 520;
  color: var(--weft-text);
  background: var(--weft-surface);
  border: 1px solid var(--weft-line-strong);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

button:hover,
.weft-button:hover {
  border-color: var(--weft-accent);
  color: var(--weft-accent);
}

button[data-variant='primary'],
.weft-button[data-variant='primary'] {
  background: var(--weft-accent);
  border-color: var(--weft-accent);
  color: var(--weft-bg);
}

button[data-variant='primary']:hover,
.weft-button[data-variant='primary']:hover {
  color: var(--weft-bg);
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  color: var(--weft-muted);
}

input,
select,
textarea {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--weft-text);
  background: var(--weft-surface);
  border: 1px solid var(--weft-line-strong);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
}

input[type='range'] {
  padding: 0;
  accent-color: var(--weft-accent);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 0 0 1rem;
}

th,
td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--weft-line);
  vertical-align: top;
}

th {
  color: var(--weft-muted);
  font-weight: 560;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* A readout: a label, a measured value, and what the value does not cover. */
.weft-readout {
  display: grid;
  grid-template-columns: minmax(8rem, auto) auto 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.9375rem;
  max-width: none;
}

.weft-readout dt {
  color: var(--weft-muted);
}

.weft-readout .weft-value {
  font-family: var(--weft-mono);
  font-variant-numeric: tabular-nums;
}

.weft-readout .weft-note {
  color: var(--weft-muted);
  font-size: 0.8125rem;
}

/* A slot that has not arrived. In-order streaming never shows one; out-of-order does. */
.weft-skeleton {
  display: block;
  height: 1rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--weft-surface-2), var(--weft-line), var(--weft-surface-2));
  background-size: 200% 100%;
  animation: weft-shimmer 1.4s linear infinite;
}

@keyframes weft-shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .weft-skeleton {
    animation: none;
  }
}

.weft-slot-markup > :last-child {
  margin-bottom: 0;
}

/* ── the welcome page ────────────────────────────────────────────────────────────── */

.weft-hero {
  padding: clamp(2rem, 6vw, 5rem) 0 2.5rem;
  border-bottom: 1px solid var(--weft-line);
  margin-bottom: 2.5rem;
}

.weft-hero h1 {
  margin-bottom: 0.75rem;
}

.weft-hero .weft-lede {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
}

/*
 * Content centred in the column, for a page that has little of it.
 *
 * Left-aligned text is right for a page of prose and wrong for four elements on an empty screen:
 * they read as a layout that stopped halfway rather than as a page. The measure comes with it,
 * because centred text that runs the width of a wide window is worse than either.
 */
.weft-center {
  max-width: var(--weft-measure);
  margin-inline: auto;
  text-align: center;
}

.weft-center .weft-row {
  justify-content: center;
}

.weft-eyebrow {
  display: inline-block;
  font-family: var(--weft-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--weft-accent);
  background: var(--weft-accent-soft);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  margin-bottom: 1rem;
}

.weft-next {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
  max-width: none;
}

.weft-next li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
}

.weft-next .weft-step {
  font-family: var(--weft-mono);
  font-size: 0.8125rem;
  color: var(--weft-muted);
  padding-top: 0.15rem;
}

/**
 * A refused intent, said out loud.
 *
 * The framework dispatches intents, so the framework owns telling you when one was refused. Before
 * this, a mutation that came back `ok=false` wrote a line to a log nobody had open: over the channel
 * it was invisible, and a plain form post navigated to raw JSON. Neither is an application's bug to
 * fix, because neither is an application's dispatch.
 *
 * An application that wants the feedback somewhere specific puts `[data-weft-toasts]` in its markup
 * and the framework fills that instead.
 */
.weft-toasts {
  position: fixed;
  inset-block-end: 1rem;
  inset-inline-end: 1rem;
  z-index: 999;
  display: grid;
  gap: 0.5rem;
  max-width: min(30rem, calc(100vw - 2rem));
  pointer-events: none;
}

.weft-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding: 0.7rem 0.85rem;
  background: var(--weft-surface);
  border: 1px solid color-mix(in srgb, var(--weft-bad) 45%, var(--weft-line));
  border-inline-start: 3px solid var(--weft-bad);
  border-radius: var(--weft-radius);
  box-shadow: 0 6px 24px rgb(0 0 0 / 12%);
  font-size: 0.875rem;
}

.weft-toast[data-kind='ok'] {
  border-color: color-mix(in srgb, var(--weft-good) 45%, var(--weft-line));
  border-inline-start-color: var(--weft-good);
}

.weft-toast code {
  font-family: var(--weft-mono);
  font-size: 0.8125rem;
  color: var(--weft-bad);
}

.weft-toast[data-kind='ok'] code {
  color: var(--weft-good);
}

.weft-toast p {
  margin: 0.15rem 0 0;
  color: var(--weft-muted);
  max-width: none;
}

.weft-toast button {
  background: none;
  border: 0;
  color: var(--weft-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}

/* ── the error page ──────────────────────────────────────────────────────────────── */

/*
 * `app/layouts/error.tsx` replaces this page entirely; these rules are what the framework's own
 * one is drawn with. Centred and short: an error page's job is to say what happened and offer one
 * way out, and everything else on it competes with those two.
 */
.weft-error {
  max-width: 44rem;
  padding-block: clamp(4rem, 12vh, 8rem);
  text-align: center;
}

.weft-error-mark {
  display: block;
  margin: 0 auto 1.5rem;
  color: var(--weft-accent);
}

.weft-error-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font-family: var(--weft-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--weft-muted);
}

.weft-error-code {
  padding: 0.15em 0.5em;
  border: 1px solid var(--weft-line);
  border-radius: 999px;
}

.weft-error h1 {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  letter-spacing: -0.025em;
}

.weft-error .weft-lede {
  margin-inline: auto;
  max-width: 46ch;
}

.weft-error-subject {
  font-family: var(--weft-mono);
  font-size: 0.875rem;
  color: var(--weft-muted);
  overflow-wrap: anywhere;
}

.weft-error .weft-row {
  justify-content: center;
  margin-top: 2rem;
}

/* Only ever rendered by `weft dev`. See the note on `stack` in `src/assets/error.tsx`. */
.weft-error-stack {
  margin-top: 2.5rem;
  text-align: start;
  max-height: 22rem;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* A hole the framework filled with nothing takes no space, rather than leaving an empty line. */
.weft-hidden {
  display: none;
}


/* app/styles.css */
/**
 * The site's foundations: tokens, reset, type, motion.
 *
 * This file is the only one that defines a value. Everything below it — `layout.css`, each section
 * shell, each fragment's own sheet — spends these tokens and defines none of its own, which is what
 * keeps a colour from being decided twice. It is appended after the framework's stylesheet and is
 * on every page; the sheets beside components are not, because the framework links a page only the
 * stylesheets of the components that page renders.
 *
 * The palette is one set of ramps and two role maps. Dark reads the ramps from the dark end, light
 * from the light end — so a step means the same visual value in both, and there is no second palette
 * anybody has to keep in sync with the first.
 */

/* ── tokens ─────────────────────────────────────────────────────────── */

:root {
  /* ── ramps ─────────────────────────────────────────────────────────────
     Generated in OKLCH on one shared lightness scale, so the same step of
     any role matches the others in visual value. Never referenced by a
     component directly: the roles below are the surface. */
  --neutral-100: #f3f5fe;
  --neutral-200: #e4e7f5;
  --neutral-300: #cfd3e5;
  --neutral-400: #b2b6ca;
  --neutral-500: #9397ab;
  --neutral-600: #75798c;
  --neutral-700: #595d6c;
  --neutral-800: #3f424d;
  --neutral-900: #292b31;

  --accent-100: #f5f4ff;
  --accent-200: #e7e5fe;
  --accent-300: #d2cefd;
  --accent-400: #b5abfc;
  --accent-500: #968ae0;
  --accent-600: #796cbf;
  --accent-700: #5d5294;
  --accent-800: #423a6a;
  --accent-900: #2b2741;

  --accent2-100: #f5f4ff;
  --accent2-200: #e7e5fe;
  --accent2-300: #d2cefd;
  --accent2-400: #b5afe8;
  --accent2-500: #9690c9;
  --accent2-600: #7972a9;
  --accent2-700: #5c5783;
  --accent2-800: #423e5d;
  --accent2-900: #2b293a;

  /* The one hue outside the ramps. A refusal is not an accent, and reading it
     as one is the mistake this token exists to prevent. */
  --danger: #b4483c;

  /* ── geometry ──────────────────────────────────────────────────────── */
  --shell: 1440px;
  --gutter: 46px;
  --rail: 250px;
  --outline: 224px;
  --head-h: 58px;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-pill: 999px;

  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* ── roles, light ──────────────────────────────────────────────────────
     The default, because `color-scheme` is declared and an unset preference
     should not be a coin toss. The dark map follows. */
  --bg: var(--neutral-100);
  --surface: var(--accent-100);
  --raised: #fff;
  --ink: var(--neutral-900);
  --ink-soft: var(--neutral-700);
  --dim: var(--neutral-600);
  --faint: var(--neutral-500);
  --line: var(--neutral-300);
  --line-soft: var(--neutral-200);
  --accent: var(--accent-600);
  --accent-ink: var(--accent-700);
  --accent-quiet: var(--accent-200);
  --accent-edge: var(--accent-300);
  --on-accent: var(--accent-800);
  --code-bg: var(--accent-100);
  --code-ink: var(--neutral-900);
  --head-bg: var(--accent-100);
  --thead-bg: var(--neutral-200);
  --danger-ink: #8f3125;
  --danger-wash: color-mix(in srgb, var(--danger) 8%, var(--surface));
  --scrim: rgb(41 43 49 / 45%);
  --shadow-pop: 0 24px 60px rgb(41 43 49 / 22%);

  /* Syntax roles. Six jobs, not a theme: make a comment recede, and keep a
     string, a keyword and a type separable for somebody scanning. */
  --t-comment: var(--neutral-600);
  --t-string: #2f7d5c;
  --t-number: var(--accent-700);
  --t-keyword: var(--accent-700);
  --t-type: var(--accent2-700);
  --t-tag: var(--accent2-700);
  --t-attr: var(--accent-700);
  --t-key: #2f7d5c;
  --t-command: var(--accent2-700);
  --t-flag: var(--accent-700);
  --t-punct: var(--neutral-600);

  /* The deck ground the landing page's figure band sits on. A saturated
     indigo, deliberately outside the interface palette — a fill, never a
     colour a control takes. */
  --band: #262a60;
  --band-ink: var(--accent-200);
  --band-ink-strong: var(--neutral-100);

  color-scheme: light dark;
  accent-color: var(--accent);
}

/* ── roles, dark ────────────────────────────────────────────────────────
   `:root:not([data-theme='light'])` rather than a bare media query, so the
   toggle wins in both directions and the media query only decides when the
   reader has expressed no preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161826;
    --surface: #232532;
    --raised: #2a2d3c;
    --ink: #e9e9ed;
    --ink-soft: var(--neutral-400);
    --dim: var(--neutral-600);
    --faint: var(--neutral-500);
    --line: color-mix(in srgb, #e9e9ed 16%, transparent);
    --line-soft: color-mix(in srgb, #e9e9ed 9%, transparent);
    --accent: #9184d9;
    --accent-ink: var(--accent-200);
    --accent-quiet: var(--accent-900);
    --accent-edge: var(--accent-800);
    --on-accent: var(--accent-100);
    --code-bg: color-mix(in srgb, #161826 62%, #000);
    --code-ink: var(--neutral-200);
    --head-bg: #161826;
    --thead-bg: var(--surface);
    --danger-ink: #e79c93;
    --danger-wash: color-mix(in srgb, var(--danger) 9%, var(--surface));
    --scrim: rgb(8 9 16 / 72%);
    --shadow-pop: 0 24px 60px rgb(0 0 0 / 70%);

    --t-comment: var(--neutral-600);
    --t-string: var(--accent2-300);
    --t-number: var(--accent-400);
    --t-keyword: var(--accent-400);
    --t-type: var(--accent2-400);
    --t-tag: var(--accent2-400);
    --t-attr: var(--accent-400);
    --t-key: var(--accent2-300);
    --t-command: var(--accent2-300);
    --t-flag: var(--accent-400);
    --t-punct: var(--neutral-500);
  }
}

:root[data-theme='dark'] {
  --bg: #161826;
  --surface: #232532;
  --raised: #2a2d3c;
  --ink: #e9e9ed;
  --ink-soft: var(--neutral-400);
  --dim: var(--neutral-600);
  --faint: var(--neutral-500);
  --line: color-mix(in srgb, #e9e9ed 16%, transparent);
  --line-soft: color-mix(in srgb, #e9e9ed 9%, transparent);
  --accent: #9184d9;
  --accent-ink: var(--accent-200);
  --accent-quiet: var(--accent-900);
  --accent-edge: var(--accent-800);
  --on-accent: var(--accent-100);
  --code-bg: color-mix(in srgb, #161826 62%, #000);
  --code-ink: var(--neutral-200);
  --head-bg: #161826;
  --thead-bg: var(--surface);
  --danger-ink: #e79c93;
  --danger-wash: color-mix(in srgb, var(--danger) 9%, var(--surface));
  --scrim: rgb(8 9 16 / 72%);
  --shadow-pop: 0 24px 60px rgb(0 0 0 / 70%);

  --t-comment: var(--neutral-600);
  --t-string: var(--accent2-300);
  --t-number: var(--accent-400);
  --t-keyword: var(--accent-400);
  --t-type: var(--accent2-400);
  --t-tag: var(--accent2-400);
  --t-attr: var(--accent-400);
  --t-key: var(--accent2-300);
  --t-command: var(--accent2-300);
  --t-flag: var(--accent-400);
  --t-punct: var(--neutral-500);
}

/* ── reset ─────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

figure {
  margin: 0;
}

:focus {
  outline: none;
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── type ─────────────────────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  font-size: 17px;
  line-height: 1.3;
}

h4 {
  font-size: 14px;
  line-height: 1.3;
}

p {
  margin: 0 0 0.9rem;
  max-width: 74ch;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: 0.87em;
}

:not(pre) > code {
  padding: 0.12em 0.35em;
  border: 0;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--code-ink);
}

/* The framework's own stylesheet gives `pre` and `code` a box: a border, a radius, a background and
   padding. That is the right default for an application that writes no CSS, and wrong inside a
   figure that already is a box — so this undoes it rather than layering a second frame on it. */
pre {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.75;
}

mark {
  background: var(--accent-quiet);
  color: var(--on-accent);
  padding: 0 2px;
  border-radius: 3px;
}

/* The two label styles the whole site runs on: an accent kicker above a
   heading, and a dim eyebrow above a list. */
.kicker {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow,
h2.hint {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 11px;
}

/**
 * The sentence under the heading, and the only block on the page spaced from both sides.
 *
 * The body below it is a slot, so the first thing in it is not the lede's sibling and cannot be
 * selected from here — and what that thing is varies by page: a paragraph, a strip of numbers, a
 * panel. Each carries its own space above; this adds the rest of the gap that separates the head of
 * the page from its body, whichever of them comes first.
 */
.lede {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 70ch;
  margin: 16px 0 12px;
}

.hint {
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.55;
}

.anchor {
  color: inherit;
  text-decoration: none;
}

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

.anchor:hover::after {
  content: ' #';
  color: var(--dim);
  font-weight: 400;
}

/* Syntax token classes, emitted by `lib/highlight.ts`. `plain` gets no
   element at all, which is most of the bytes on a page of code. */
.t-comment {
  color: var(--t-comment);
  font-style: italic;
}
.t-string {
  color: var(--t-string);
}
.t-number {
  color: var(--t-number);
}
.t-keyword {
  color: var(--t-keyword);
}
.t-type {
  color: var(--t-type);
}
.t-tag {
  color: var(--t-tag);
}
.t-attr {
  color: var(--t-attr);
}
.t-key {
  color: var(--t-key);
}
.t-command {
  color: var(--t-command);
}
.t-flag {
  color: var(--t-flag);
}
.t-punct {
  color: var(--t-punct);
}

/* ── motion ─────────────────────────────────────────────────────────── */

/**
 * The motion vocabulary, deliberately small.
 *
 * A sequence, a sweep, a packet travelling an edge, a value swap, a refusal.
 * Five ideas across every figure in the guide, so a reader who has learnt one
 * figure has learnt the language the next one speaks. Every animated element
 * carries `data-wf`, which is the single handle the reduced-motion rule at the
 * bottom needs: the settled state is the last thing each keyframe holds, so
 * switching motion off leaves the figure showing its conclusion rather than
 * its first frame.
 */
@keyframes wf-play {
  0% {
    left: 0%;
  }
  86%,
  100% {
    left: 100%;
  }
}

/**
 * The shell, and the marks that say when a region became visible.
 *
 * `wf-shell` is the part of the response that never waits: it is on almost the whole cycle, because
 * that is the claim — the shell is not downstream of anything. `wf-tick` and `wf-tick-late` are the
 * two moments worth naming on the clock, and they differ only in when they arrive, which is the
 * entire difference between the two lanes.
 */
@keyframes wf-shell {
  0%,
  2% {
    opacity: 0;
  }
  4%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-tick {
  0%,
  14% {
    opacity: 0;
  }
  16%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-tick-late {
  0%,
  70% {
    opacity: 0;
  }
  72%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-fast-oo {
  0%,
  14% {
    opacity: 0;
  }
  16%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-slow {
  0%,
  68% {
    opacity: 0;
  }
  70%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-fast-io {
  0%,
  70% {
    opacity: 0;
  }
  72%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-step {
  0%,
  5% {
    opacity: 0.16;
  }
  9%,
  92% {
    opacity: 1;
  }
  100% {
    opacity: 0.16;
  }
}

@keyframes wf-grow {
  0% {
    transform: scaleX(0);
  }
  14%,
  94% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

/**
 * A measured bar, and the number that belongs to it.
 *
 * The pair is two keyframes rather than one because they are two claims: the bar draws the
 * comparison and the value states it, and the value should land when the bar it labels arrives
 * rather than counting up beside it — so the two are timed apart at the call site rather than
 * folded into one curve.
 *
 * Both run once and stay, filled forwards by the rule that starts them: unlike every other figure
 * on the site these carry a measured number, and a number that erases and redraws itself reads as
 * a thing still loading. The growth is slow for a bar and deliberate: the charts measure a response
 * crossing a network, and a bar that snaps to length draws a number rather than a transfer.
 */
@keyframes wf-bar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes wf-val {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes wf-rise {
  0% {
    transform: scaleX(0);
  }
  18%,
  92% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

@keyframes wf-travel {
  0% {
    left: 0%;
    opacity: 0;
  }
  7% {
    opacity: 1;
  }
  84% {
    left: calc(100% - 8px);
  }
  92% {
    left: calc(100% - 8px);
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-flash {
  0%,
  52% {
    background: transparent;
  }
  56% {
    background: var(--accent-quiet);
  }
  76%,
  100% {
    background: transparent;
  }
}

@keyframes wf-swap-a {
  0%,
  46% {
    opacity: 1;
  }
  50%,
  94% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes wf-swap-b {
  0%,
  46% {
    opacity: 0;
  }
  50%,
  94% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-refuse {
  0%,
  62% {
    opacity: 0;
    transform: translateX(0);
  }
  66% {
    opacity: 1;
    transform: translateX(-2px);
  }
  70% {
    transform: translateX(2px);
  }
  74%,
  94% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
  }
}

@keyframes wf-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/**
 * A line that draws itself, and the mark that runs it afterwards.
 *
 * `wf-draw` is the edge arriving: the dash is the whole path length, so retracting the offset
 * paints it from source to target. `wf-flow` is a 14-unit dash on the same path, which is the
 * direction — an arrowhead states it statically and badly at this scale; a mark that travels
 * states it once and is then out of the way.
 *
 * Both settle drawn, so reduced motion is the finished graph rather than an empty frame.
 */
@keyframes wf-draw {
  0% {
    stroke-dashoffset: 600;
  }
  22%,
  94% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: 600;
  }
}

/** A node arriving. It never reaches zero: a box at 14% is still a box, and the graph never blinks. */
@keyframes wf-nodein {
  0%,
  4% {
    opacity: 0.14;
  }
  10%,
  94% {
    opacity: 1;
  }
  100% {
    opacity: 0.14;
  }
}

/**
 * A playhead over a fixed time axis, reaching the end at 80% of the cycle.
 *
 * The last fifth is the hold: the chart it sweeps is a schedule, and a reader needs the finished
 * schedule longer than they need to watch it fill. `wf-play` is the same idea at 86% for figures
 * with less to read at the end.
 */
@keyframes wf-play80 {
  0% {
    left: 0%;
  }
  80%,
  100% {
    left: 100%;
  }
}

@keyframes wf-flow {
  0% {
    stroke-dashoffset: 600;
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  94% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}

@keyframes wf-caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/**
 * Every figure holds its settled state instead of stopping mid-cycle.
 *
 * `animation: none` alone would leave an element at its authored style, which
 * for a bar that grows from `scaleX(0)` is invisible. Resetting opacity and
 * transform with it is what makes the reduced-motion version a diagram rather
 * than a blank box.
 */
@media (prefers-reduced-motion: reduce) {
  [data-wf] {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── util ─────────────────────────────────────────────────────────── */

/** A table wider than its column scrolls inside its own box, never widening the page. */
.scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/** The falsy arm of a conditional shape. It writes nothing and occupies nothing. */
.none {
  display: none;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  z-index: 40;
}

.skip:focus-visible {
  left: 12px;
  top: 12px;
}

/* ── the hover glow ───────────────────────────────────────────────────────── */

/**
 * A light that follows the cursor across anything you can click.
 *
 * Three layers, and each one answers a different half of "where is the pointer":
 *
 * 1. **The wash** — a radial gradient painted over the surface and under the content.
 * 2. **The edge** — the same gradient drawn *into the border*, masked so only the one-pixel ring
 *    survives. A flat accent border tells you the element is hovered; a lit one tells you where.
 * 3. **The halo** — a blurred copy sitting outside the box, behind it, so the light falls on what
 *    is next to the element rather than stopping dead at its corner.
 *
 * The centre of all three is two custom properties `app/client.ts` writes on pointer move. With
 * scripting off they keep their initial 50% and the light is centred — a still version of the same
 * idea rather than nothing.
 *
 * `@property` is what makes it fade rather than snap: a custom property has to be *registered* with
 * a type before it can be interpolated, and `--glow` is the number every layer's alpha is computed
 * from — so one transition drives all three. A browser without `@property` still gets the light; it
 * arrives at once instead of over 240ms, which is a difference nobody will report.
 *
 * The two lists below are the design system's answer to "what can you click", which is why they are
 * here and not a class in twenty templates. `client.ts` holds the same selectors, and says so.
 */
@property --glow {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

/* Boxes: a card, a tile, a button — something with an edge and room around it. */
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit),
/* Rows: a line in a rail, an icon, a tab. The wash alone; a halo on a 26px control is a smudge. */
:is(.contents a, .outline a, .top-icon, .tty-tab span, .pane-tab span, .panel-tab-in) {
  --mx: 50%;
  --my: 50%;

  position: relative;
  background-image: radial-gradient(
    260px circle at var(--mx) var(--my),
    color-mix(in srgb, var(--accent) calc(var(--glow) * 18%), transparent),
    transparent 68%
  );
  background-repeat: no-repeat;
  transition:
    --glow 240ms ease,
    border-color 240ms ease;
}

/* The edge. `mask-composite` keeps the padding box out, so what is left is the border itself. */
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit)::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    220px circle at var(--mx) var(--my),
    color-mix(in srgb, var(--accent) calc(var(--glow) * 85%), transparent),
    transparent 62%
  );
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* The halo, behind the element and outside it, so the light reaches its neighbours. */
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit)::after {
  content: '';
  position: absolute;
  inset: -20px;
  z-index: -1;
  border-radius: calc(var(--r-lg) + 20px);
  background: radial-gradient(
    190px circle at calc(var(--mx) + 20px) calc(var(--my) + 20px),
    color-mix(in srgb, var(--accent) calc(var(--glow) * 38%), transparent),
    transparent 72%
  );
  filter: blur(18px);
  pointer-events: none;
}

:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit):hover,
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit):focus-visible,
:is(.contents a, .outline a, .top-icon):hover,
:is(.contents a, .outline a, .top-icon):focus-visible,
:is(.tty-tab, .pane-tab, .panel-tab):hover :is(span, .panel-tab-in) {
  --glow: 1;
}

/* The edge, twice over. The masked ring above lights the part of the border nearest the cursor;
   this lifts the whole border off the divider colour, so the element reads as picked up rather
   than as having a bright spot on one side of it. */
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit):hover,
:is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit):focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

@media (prefers-reduced-motion: reduce) {
  :is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit),
  :is(.contents a, .outline a, .top-icon) {
    transition: none;
  }

  :is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit)::after {
    display: none;
  }
}

/* ── the theme's circular reveal ──────────────────────────────────────────── */

/**
 * The browser's own cross-fade, switched off so the clip-path circle is the whole effect.
 *
 * Both snapshots are painted; the new one is stacked over the old and revealed through a circle
 * that grows from the toggle. Leaving the default fade in as well makes the edge of the circle
 * muddy, which is the one thing the effect is for.
 */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

/**
 * For the length of the sweep, the two decorations that are expensive to re-composite.
 *
 * A view transition animates a snapshot of the whole page, so a `backdrop-filter` behind a sticky
 * header and a blurred halo behind every card are re-rasterised on every frame of it. Neither is
 * doing anything for a reader who is watching a palette change.
 */
:root.theming .top {
  backdrop-filter: none;
}

/**
 * And every figure on the page, which is the larger cost now that there are many.
 *
 * A guide page carries a dozen animated elements and the guide index over a hundred, each one
 * compositing on its own timeline. Under a view transition they animate inside a snapshot that is
 * itself being animated, and they all resume at once on the frame the snapshot is discarded — which
 * is the frame the sweep visibly stalled on. Paused rather than stopped, so they pick up where they
 * were rather than restarting together and drawing attention to themselves.
 *
 * `!important` for the same reason the reduced-motion rule above needs it, and it is not optional:
 * every one of these carries its timing in an inline `style="animation:…"`, because each figure's
 * delay is derived from where its own mark stands. The `animation` shorthand resets
 * `animation-play-state` to `running`, and an inline declaration outranks any selector — so
 * without this the rule matched all 202 elements on `/guide` and paused none of them.
 */
:root.theming [data-wf] {
  animation-play-state: paused !important;
}

:root.theming :is(.glow, a.card, .btn, .chip, .stat, .absence, .verdict, .rail-card, .finder-hit)::after {
  display: none;
}

/*
 * The two asset directories, used rather than described.
 *
 * `app/assets/weave.svg` is processed: it is published once under a digest of its own contents and
 * is immutable for a year, and the relative `url()` below is rewritten to that address at build
 * time. `public/robots.txt` beside it is copied — it goes out at exactly the path it is written
 * at, because that is the only path a crawler looks for it at, and a URL that does not name its
 * contents can never be held.
 */
.foot {
  background-image: url('/_weft/a/ffded7c45a/weave.svg');
  background-repeat: repeat;
}


/* app/layout.css */
/**
 * The document: its header, its footer, the shells a page sits in, and the article vocabulary.
 *
 * `styles.css` defines the values; this file spends them. It is linked on every page because every
 * page of this site is a document page — a header, one of three shells, and an article made of
 * headings, prose, figures, tables and callouts. What is *not* here is anything a single component
 * owns: the contents rail, the outline rail and the examples each carry their own sheet, and the
 * framework links those only to the pages that render them.
 */

/* ── the header ───────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--head-bg);
  border-block-end: 1px solid var(--line);
}

@supports (backdrop-filter: blur(1px)) {
  .top {
    background: color-mix(in srgb, var(--head-bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
  }
}

.top-in {
  max-width: var(--shell);
  margin: 0 auto;
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  flex: none;
}

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

.wordmark {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 19px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.top-nav a {
  color: var(--ink-soft);
  white-space: nowrap;
}

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

.top-nav a[data-current='yes'] {
  color: var(--accent);
}

.top-end {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.ver {
  font: 500 12px/1 var(--mono);
  color: var(--dim);
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.top-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
}

.top-icon:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

/* A control nobody can operate is worse than no control, so the toggle appears only once the boot
   script has said scripting is on. See `BOOT` in `lib/shell.ts`. */
.theme {
  display: none;
}

:root[data-js='on'] .theme {
  display: inline-flex;
}

/* ── the shells ───────────────────────────────────────────────────────────── */

main {
  display: block;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--outline);
  gap: 44px;
  padding: 34px var(--gutter) 70px;
  align-items: start;
}

/* Sections with no outline column: the guide index, examples, the glossary, the error index. */
.shell.two {
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 52px;
}

/**
 * One column: a section whose page *is* its own contents, so a rail would repeat it.
 *
 * The rail is still in the layout — the nested chain is the file tree, so the tutorial's index and
 * its steps are one template — and the index fills that slot with nothing. Hidden rather than
 * absent for that reason, and it costs an empty `<nav>`.
 */
.shell.one {
  grid-template-columns: minmax(0, 1fr);
}

.shell.one .rail,
.shell.one .outline-rail {
  display: none;
}

/* The landing page and the playground own their whole width. */
.shell.full {
  display: block;
  max-width: none;
  padding: 0;
}

.rail,
.outline-rail {
  position: sticky;
  top: calc(var(--head-h) + 18px);
  max-height: calc(100vh - var(--head-h) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.rail {
  font-size: 13.5px;
}

.outline-rail {
  font-size: 13px;
}

@media (width < 1180px) {
  :root {
    --outline: 190px;
  }

  .shell {
    gap: 32px;
    padding-inline: 28px;
  }
}

@media (width < 1000px) {
  .shell,
  .shell.two {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .rail,
  .outline-rail {
    position: static;
    max-height: none;
  }

  /* The outline duplicates headings that are now a thumb-scroll away. */
  .outline-rail {
    display: none;
  }
}

/* ── the article ──────────────────────────────────────────────────────────── */

/**
 * The article is a container, so what is in it can size to the column rather than to the window.
 *
 * The same block appears in a two-column shell and a three-column one, which are 53rem and 40rem
 * wide at the same viewport width. See `.duo` for the case this exists for.
 */
article {
  container: article / inline-size;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--dim);
  margin-block-end: 18px;
}

.crumbs a {
  color: var(--ink-soft);
}

.crumbs [aria-current] {
  color: var(--ink);
}

.head-kicker {
  margin-block-end: 14px;
}

article > h1 {
  max-width: 26ch;
}

article h2 {
  margin-block-start: 44px;
  scroll-margin-top: calc(var(--head-h) + 20px);
}

article h3 {
  margin-block-start: 28px;
  scroll-margin-top: calc(var(--head-h) + 20px);
}

/**
 * A paragraph is spaced from above, like every other block on the page.
 *
 * Everything a body slot emits — a figure, a note, a table, a strip, a panel of tiles — carries
 * `margin-block-start` and nothing below, which is the rule that makes a run of mixed blocks space
 * evenly whatever order they come in. The base `p` in `styles.css` is spaced from below instead,
 * being the browser's convention, and the two together meant a paragraph after any of those blocks
 * sat flush against its bottom edge: the sentence under a goal callout, the one under a diff, the
 * one under an example's output. Inside a component that sets its own paragraph margins — a card, a
 * note, a rail — that component still wins, which is why this is scoped to the article's own prose.
 */
article p,
.prose p {
  margin-block: 18px 0;
}

/* A heading already carries 44px above it; its own paragraph belongs closer than the default. */
article h2 + p,
article h3 + p,
.prose h2 + p,
.prose h3 + p {
  margin-block-start: 12px;
}

article p {
  color: var(--ink-soft);
}

article > p,
.prose p {
  max-width: 74ch;
}

/* ── cards ────────────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 14px;
  margin: 16px 0 0;
}

.card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.card h3 a {
  color: var(--ink);
}

.card p {
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--faint);
  max-width: none;
}

.card p.hint {
  margin-block-start: 8px;
  font-size: 12px;
}

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

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

/* The one card that is the page you are on, or the one being pointed at. */
.card.lit {
  border-color: var(--accent-edge);
  background: var(--accent-quiet);
}

.card.lit h3 a,
.card.lit h3 {
  color: var(--accent-ink);
}

.card.lit p {
  color: var(--accent-ink);
}

/* ── callouts ─────────────────────────────────────────────────────────────── */

.note {
  margin: 22px 0 0;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: var(--surface);
}

.note h4 {
  margin: 0;
  font-size: 14px;
}

.note p {
  margin: 7px 0 0;
  max-width: 80ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.note-careful {
  border-inline-start-color: var(--accent2-500);
}

.note-refused {
  border-inline-start-color: var(--danger);
  background: var(--danger-wash);
}

.note-refused h4 {
  color: var(--danger-ink);
}

/* A goal, an outcome, a thing that worked: filled rather than edged, because it is not an aside. */
.note-goal {
  border: 1px solid var(--accent-edge);
  border-radius: 9px;
  background: var(--accent-quiet);
}

.note-goal h4,
.note-goal p {
  color: var(--accent-ink);
}

/* ── tables ───────────────────────────────────────────────────────────────── */

.scroll {
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

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

thead tr {
  background: var(--thead-bg);
}

th {
  text-align: start;
  padding: 9px 14px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  border-block-end: 1px solid var(--line);
  white-space: nowrap;
}

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

tbody tr:last-child td {
  border-block-end: 0;
}

td code {
  white-space: nowrap;
}

/* ── code and output figures ──────────────────────────────────────────────── */

figure.code,
figure.output {
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

figure.code {
  background: var(--code-bg);
}

figure.output {
  background: var(--surface);
}

figcaption {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-block-end: 1px solid var(--line);
  font: 12.5px/1 var(--mono);
  color: var(--faint);
  background: var(--surface);
}

figure.output figcaption {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

/* The dot marks a caption that names a real file, which is most of them on this site. */
figure.code > .fig-head figcaption::before,
figure.code > figcaption::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

figure.code pre {
  padding: 18px;
  color: var(--code-ink);
}

.output-frame {
  padding: 18px;
}

.sketch figcaption::before {
  display: none;
}

.sketch-mark {
  color: var(--dim);
}

/* An empty caption slot must take no space, or every uncaptioned block grows a bar. */
.fig-head:empty,
.fig-head .none {
  display: none;
}

/* ── stat tiles ───────────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 14px;
  margin: 16px 0 0;
}

.stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.stat b {
  display: block;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat span {
  display: block;
  margin-block-start: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--faint);
}

.stat.lit {
  border-color: var(--accent-edge);
  background: var(--accent-quiet);
}

.stat.lit b {
  color: var(--accent-ink);
}

.stat.lit span {
  color: var(--accent-ink);
}

/* ── badges, chips, controls ──────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  font: 600 10px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: var(--r-xs);
  background: var(--accent-quiet);
  color: var(--accent-ink);
}

.badge.mute {
  background: var(--surface);
  color: var(--faint);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-block-start: 26px;
}

.chip {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  line-height: 1.4;
  color: var(--faint);
}

.chip[aria-current='true'] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: none;
  font: 500 13px/1 var(--sans);
  color: var(--ink);
  cursor: pointer;
}

.btn:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn kbd {
  font: 11px/1 var(--mono);
  padding: 2px 5px;
  border: 1px solid currentcolor;
  border-radius: var(--r-xs);
  opacity: 0.7;
}

/* ── the pager, and section rules ─────────────────────────────────────────── */

.sequence,
.pager {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-block-start: 48px;
  padding-block-start: 18px;
  border-block-start: 1px solid var(--line);
  font-size: 14px;
}

.sequence .next,
.pager .next {
  margin-inline-start: auto;
  text-align: end;
}

/* ── the footer ───────────────────────────────────────────────────────────── */

.foot {
  border-block-start: 1px solid var(--line);
  margin-block-start: 40px;
}

.foot-in {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 26px var(--gutter) 34px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.foot p {
  margin: 0;
  max-width: 90ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--dim);
}

/* ── the pieces the guide's prose still builds by hand ────────────────────── */

.prose > p:last-child {
  margin-block-end: 0;
}

.hint {
  color: var(--dim);
  font-size: 12.5px;
}

/**
 * Inline code in a rail is a name, not a box.
 *
 * A `<code>` chip carries padding and a background, which is right in prose at 15px and wrong in a
 * 224px column at 12.5px: the padding lands on both sides of the word space that is already there,
 * so a sentence with three names in it reads as though it had been double-spaced, and a two-word
 * name breaks across a line with half its box on each. Here the chip loses its horizontal padding
 * and stops breaking, and the line closes up to match.
 */
.rail .hint,
.outline-rail .hint,
.rail-card p {
  line-height: 1.55;
}

.rail .hint code,
.outline-rail .hint code,
.rail-card p code {
  padding-inline: 0;
  white-space: nowrap;
  background: none;
  color: var(--ink-soft);
}

.undocumented {
  color: var(--accent2-500);
}

.example {
  border-block-start: 1px solid var(--line);
  padding-block-start: 26px;
  margin-block-start: 40px;
}

.example-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.example-head h3 {
  margin-block-start: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

/** Which fragment it is. The convention name, so the file it names can be found by reading it. */
.example-of {
  font: 12px/1 var(--mono);
  color: var(--faint);
}

.example > p {
  margin: 9px 0 0;
  max-width: 74ch;
  font-size: 14.5px;
  line-height: 1.6;
}

/**
 * What it rendered, beside the file that rendered it.
 *
 * Two equal columns, because neither is the subordinate one: the claim this page makes is that
 * these are two views of a single compilation, and a layout that put one under the other made the
 * reader hold the first in their head while scrolling to the second.
 */
.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin-block-start: 16px;
}

/**
 * Side by side only where the column is wide enough for both halves to be readable.
 *
 * A container query and not a media query, because what decides this is the width of the article
 * and not the width of the window: at the same viewport the gallery's article is 65rem and a guide
 * page's is 49rem, because one shell has two columns and the other has three. Keyed to the
 * viewport, a wide window put the guide's examples in two 24rem columns and wrapped every line of
 * both. The threshold is what a half of this is: below 56rem the source column is under 27rem, and
 * a line of this repository's TSX does not fit in one.
 */
@container article (width < 56rem) {
  .duo {
    grid-template-columns: minmax(0, 1fr);
  }
}

.duo > figure {
  margin: 0;
  min-width: 0;
}

/**
 * Source in a half-width column wraps rather than scrolls.
 *
 * A line of this repository's TSX is eighty to ninety characters and the column is about sixty, so
 * `overflow-x: auto` here hid the end of nearly every line behind a scrollbar the reader has to
 * find. Wrapped, the whole declaration is on screen beside the markup it produced, which is the
 * only reason the two are side by side.
 */
.duo pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The fallback where container queries are not supported: below this the article is narrow too. */
@supports not (container-type: inline-size) {
  @media (width < 1100px) {
    .duo {
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

.facts {
  margin-block-start: 14px;
}

.facts summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--faint);
}

.facts h4 {
  margin: 18px 0 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

/**
 * The four facts, as a row of small boxes above the tables that expand them.
 *
 * Label over value, the opposite way round from `.stat`: these are read as a row of answers to
 * four fixed questions, so the questions come first and the eye runs along the second line.
 */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 14px;
  margin-block-start: 12px;
}

.tile {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.tile span {
  display: block;
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.tile b {
  display: block;
  margin-block-start: 6px;
  font: 500 15px/1.3 var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.tile b.lit {
  color: var(--accent-ink);
}

.api-entry {
  border-block-start: 1px solid var(--line);
  padding-block-start: 20px;
  margin-block-start: 28px;
}

.api-entry h3 {
  margin-block-start: 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 19px;
  font-family: var(--mono);
}

/* The glossary reads in two columns: thirty-six short entries down one column is a scroll, and
   beside each other they can be compared, which is what a glossary is for. */
.terms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
  margin-block-start: 36px;
}

.term {
  padding: 18px 0;
  border-block-start: 1px solid var(--line);
}

.term h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  scroll-margin-top: calc(var(--head-h) + 20px);
}

@media (width < 900px) {
  .terms {
    grid-template-columns: minmax(0, 1fr);
  }
}

.kind {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.api-doc p {
  font-size: 14px;
  max-width: 78ch;
}

.term .short {
  margin: 7px 0 0;
  font-weight: 500;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.term > p:not(.short) {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--faint);
}

/* A message the framework actually raises, quoted as it arrives. */
.message {
  margin: 16px 0 0;
  padding: 13px 15px;
  border-inline-start: 3px solid var(--accent);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  font: 13px/1.6 var(--mono);
  color: var(--ink);
}

.refusal {
  border-inline-start-color: var(--danger);
}

/* ── the head line, and the two rails' own furniture ──────────────────────── */

/* An optional piece of chrome is a class rather than a branch: a layout may not carry a derived
   expression, so `shell()` decides the whole class name. See `lib/shell.ts`. */
.crumbs.none,
.head-line.none {
  display: none;
}

.head-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-block-end: 14px;
}

.head-line .hint:empty {
  display: none;
}

.outline {
  display: grid;
  gap: 1px;
}

.outline a {
  padding: 5px 0 5px 11px;
  border-inline-start: 2px solid var(--line);
  color: var(--ink-soft);
  line-height: 1.45;
}

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

.outline a[aria-current='true'] {
  border-inline-start-color: var(--accent);
  color: var(--accent-ink);
}

.rail-card {
  margin-block-start: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.rail-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--faint);
}

.rail-card p + p {
  margin-block-start: 8px;
}

/* On a two-column section the outline column folds into the bottom of the rail. */
.rail-foot {
  margin-block-start: 26px;
}

.rail-foot:empty {
  display: none;
}

/* ── the terminal, with a tab per package manager ─────────────────────────── */

/* `.tty`, not `.term` — which is what the glossary's entries are called, and calling both the same
   thing drew a code-block box around every word in the glossary. A figure's parts belong to the
   figure; this is the second time that rule was learned the hard way here. */

.tty {
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--code-bg);
}

.tty-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 10px 0;
  border-block-end: 1px solid var(--line);
  background: var(--surface);
}

.tty-tab {
  cursor: pointer;
}

.tty-tab input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tty-tab span {
  display: block;
  padding: 7px 13px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--faint);
}

.tty-tab:has(input:checked) span {
  background: var(--accent-quiet);
  color: var(--accent-ink);
}

.tty-tab:has(input:focus-visible) span {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Every panel is in the markup and the checked tab picks one. No script, and no second request. */
.tty-panel {
  display: none;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--code-ink);
}

.tty:has(.tty-tab:nth-of-type(1) input:checked) .tty-panel:nth-of-type(1),
.tty:has(.tty-tab:nth-of-type(2) input:checked) .tty-panel:nth-of-type(2),
.tty:has(.tty-tab:nth-of-type(3) input:checked) .tty-panel:nth-of-type(3) {
  display: block;
}

/* Without `:has` every panel would be hidden, which is worse than showing them all. */
@supports not selector(:has(*)) {
  .tty-panel {
    display: block;
  }

  .tty-tabs {
    display: none;
  }
}

.tty-panel .in,
.tty-panel .out {
  display: block;
}

.tty-panel .prompt {
  color: var(--dim);
}

.tty-panel .out {
  color: var(--faint);
}

.tty-foot {
  padding: 11px 18px;
  border-block-start: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--dim);
  background: var(--surface);
}

/* ── a file tree beside the file that matters ─────────────────────────────── */

.split {
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--code-bg);
}

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

.tree {
  padding: 16px 18px;
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
  font: 13px/2 var(--mono);
  color: var(--ink-soft);
}

.tree .dir {
  color: var(--dim);
}

.tree .lit {
  color: var(--accent-ink);
}

.split pre {
  padding: 16px 18px;
  font-size: 12.8px;
  line-height: 1.75;
  color: var(--code-ink);
}

@media (width < 720px) {
  .split-in {
    grid-template-columns: minmax(0, 1fr);
  }

  .tree {
    border-inline-end: 0;
    border-block-end: 1px solid var(--line);
  }
}

/* ── the two delivery orders, raced ───────────────────────────────────────── */

.race {
  margin: 18px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.race-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 12px/1 var(--mono);
  color: var(--faint);
  margin-block-end: 14px;
}

.race-head.second {
  margin-block-start: 18px;
}

.race-num {
  margin-inline-start: auto;
}

.race-num.lit {
  color: var(--accent-ink);
}

.track {
  position: relative;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.track-bed {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}

/* Prefixed, all of them. `.band` alone collided with the landing page's measurement band and
   absolutely positioned it behind the hero — a figure's parts belong to the figure. */
.race-band {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: 0;
}

.race-band.early {
  left: 0;
  width: 22%;
  background: var(--accent);
}

.race-band.rest {
  left: 22%;
  right: 0;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}

.race-band.late {
  left: 78%;
  right: 0;
  background: var(--accent-700);
}

.race-play {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--faint);
}

.race-play.lit {
  background: var(--accent);
}

/* ── three ways onto the wire, to scale ───────────────────────────────────── */

.wire {
  margin: 18px 0 0;
}

.wire-rows {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.wire-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-block-end: 8px;
}

.wire-form {
  width: 52px;
  flex: none;
  font: 500 13.5px/1 var(--mono);
  color: var(--ink-soft);
}

.wire-what {
  font-size: 12.5px;
  color: var(--dim);
}

.wire-size {
  margin-inline-start: auto;
  font: 13px/1 var(--mono);
  color: var(--ink-soft);
  white-space: nowrap;
}

.wire-size.lit {
  color: var(--accent-ink);
}

/**
 * The bars are a three-rung ramp, and the rung is the row's position.
 *
 * Each step down the list is a cheaper encoding of the same region, so each step is a lighter bar:
 * markup deepest, then the patch, then the delta at full accent. Positional selectors rather than a
 * flag per row, because the ordering *is* the figure — a delta drawn above the markup it replaces
 * would be a different claim.
 */
.wire-bar {
  height: 16px;
  border-radius: 3px;
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent-700), var(--accent-800));
}

.wire-row:nth-child(2) .wire-bar {
  background: linear-gradient(90deg, var(--accent-500), var(--accent-700));
}

.wire-bar.lit {
  background: var(--accent);
}

.wire-cap {
  display: block;
  margin-block-start: 20px;
  padding: 14px 0 0;
  border-block-start: 1px solid var(--line);
  border-block-end: 0;
  background: none;
  font: 12.5px/1.55 var(--sans);
  color: var(--dim);
}

/* ── a sequence of stages, lighting in order ──────────────────────────────── */

.seq {
  margin: 18px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.seq-rail {
  display: grid;
  gap: 10px;
}

.seq-step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  opacity: 0.16;
}

.seq-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--accent);
  transform: translateY(-1px);
}

.seq-label {
  font: 500 13.5px/1.4 var(--mono);
  color: var(--ink);
}

.seq-note {
  font-size: 12.5px;
  color: var(--dim);
}

.seq figcaption {
  margin-block-start: 16px;
  padding: 14px 0 0;
  border-block-start: 1px solid var(--line);
  border-block-end: 0;
  background: none;
  font: 12.5px/1.55 var(--sans);
  color: var(--dim);
}

/* ── a diff, as the lines that changed ────────────────────────────────────── */

.diff pre {
  padding: 14px 0;
}

.dl {
  display: block;
  padding: 0 18px;
  white-space: pre;
}

.dl.add {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.dl.del {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.fig-badge {
  margin-inline-start: auto;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--accent-quiet);
  color: var(--accent-ink);
  font-size: 11px;
}

/* ── accepted beside refused ──────────────────────────────────────────────── */

/**
 * What a mechanism accepts, beside what it refuses.
 *
 * Every page in this guide is about one mechanism, and every mechanism here is defined as much by
 * its boundary as by its behaviour — so the pair opens the page rather than closing it. Somebody
 * deciding whether this framework will fight them wants the constraint on the way in.
 *
 * Two fixed columns rather than `auto-fit`: the pair is a comparison, and a comparison that
 * reflows into one column above a card and below it is no longer a comparison. It collapses only
 * where two columns would each be too narrow to read.
 */
.verdicts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0 0;
}

.verdict {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.verdict h4 {
  margin: 10px 0 0;
  font-size: 14px;
}

.verdict p {
  margin: 0;
  font: 12.5px/1.6 var(--sans);
  color: var(--ink-soft);
}

.verdict-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-block-end: 10px;
}

.verdict-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: var(--r-pill);
  border: 1px solid currentcolor;
  font: 10px/1 var(--mono);
}

.verdict-kind {
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/** What was accepted or refused, in the head rather than as a heading: it is a label, not a title. */
.verdict-what {
  font: 500 12.5px/1.3 var(--sans);
  color: var(--ink);
}

.verdict.ok {
  border-color: var(--accent-edge);
  background: var(--accent-quiet);
}

.verdict.ok .verdict-mark,
.verdict.ok .verdict-kind {
  color: var(--accent);
}

.verdict.ok p {
  color: var(--accent-ink);
}

.verdict.no {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  background: var(--danger-wash);
}

.verdict.no .verdict-mark,
.verdict.no .verdict-kind {
  color: var(--danger-ink);
}

/**
 * What you wrote, the rule it met, and what came back.
 *
 * A refusal a reader cannot trace is indistinguishable from a bug, so the three steps are on the
 * card rather than in prose underneath it. They light in the order the compiler reaches them.
 */
.trace {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-block-end: 10px;
}

.trace-step {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: 11px/1.3 var(--mono);
  color: var(--ink-soft);
  opacity: 0.18;
}

.trace-step.end {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  font-weight: 500;
  color: var(--danger-ink);
}

.trace-to {
  color: var(--faint);
  font-size: 12px;
}

@media (width < 860px) {
  .verdicts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── the mark ─────────────────────────────────────────────────────────────── */
.mark {
  flex: none;
}

.mark .mark-warp {
  fill: var(--neutral-600);
}

.mark .mark-weft {
  fill: var(--accent);
}

/* The footer's mark sits under a rule and should not compete with it. */
.mark.quiet {
  opacity: 0.8;
}

.mark.quiet .mark-warp {
  fill: var(--neutral-700);
}

.mark.quiet .mark-weft {
  fill: var(--accent-700);
}

/* On the deck-indigo band the weft goes light and the warp takes the accent-2 tint. */
.mark.invert .mark-warp {
  fill: var(--accent2-400);
  opacity: 0.6;
}

.mark.invert .mark-weft {
  fill: var(--neutral-100);
}

/* A rail card holding paths rather than prose: each on its own line, breaking anywhere. */
.rail-links {
  display: grid;
  gap: 7px;
  font: 12.5px/1.4 var(--mono);
  overflow-wrap: anywhere;
}

/* ── the guide index: five groups, each with its own rule ─────────────────── */

.guide-groups {
  display: flex;
  flex-direction: column;
  gap: 34px;
  margin-block-start: 44px;
}

.group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-block-end: 10px;
  border-block-end: 1px solid var(--line);
}

.group-count {
  margin-inline-start: auto;
  font: 12px/1 var(--mono);
  color: var(--dim);
}

.card-n {
  font: 13px/1 var(--mono);
  color: var(--dim);
  margin-inline-end: 9px;
}

a.card:hover .card-n {
  color: var(--accent);
}

/* ── the provenance list ──────────────────────────────────────────────────── */

/* Spoken by `fragments/docs/prov.tsx` and by the three rails that still build their own markup —
   the API page, the playground and the guide. A vocabulary two kinds of caller share is the
   document's, not one component's, so it is here rather than beside the fragment. */
.prov-block h2 {
  margin-block-start: 0;
}

.prov {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 14px;
  margin: 0;
  font-size: 13px;
}

/* A mapped row must be a single element, so the component wraps each label/value pair.
   `display: contents` puts the dt and dd back in the grid, which is what keeps the label column one
   width down the whole list instead of one width per row. */
.prov-row {
  display: contents;
}

.prov dt {
  color: var(--dim);
}

.prov dd {
  margin: 0;
  min-width: 0;
  color: var(--ink-soft);

  /* In a 224px rail the value column is about 8rem wide and `app/fragments/examples/` is wider than
     that. A grid item will not shrink below its content unless told to, and a path has no break
     opportunities, so both declarations are needed or the text is simply cut off. */
  overflow-wrap: anywhere;
}

/* The closing link is a variant: absent means the wrapper is empty, so it must take no space. */
.prov-more {
  margin-block-start: 12px;
}

.prov-more:empty,
.prov-more .none {
  display: none;
}

.prov-more p {
  margin: 0;
}

/* A rail card followed by an outline needs air between them; the outline's own heading supplies
   none, because on most pages it is the first thing in the column. */
.rail-card + .eyebrow,
.rail-card + h2 {
  margin-block-start: 26px;
}

.rail-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.rail-card-head .eyebrow {
  margin-block-end: 8px;
}

.rail-card-num {
  margin-inline-start: auto;
  font: 12px/1 var(--mono);
  color: var(--faint);
}

.bar {
  height: 5px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

/* ── the examples' own markup ─────────────────────────────────────────────── */

/**
 * The fifteen live fragments, styled here rather than each beside its own file.
 *
 * They were `.scoped.css` sheets first, which is the arrangement this framework prefers and the one
 * that does not work for *these* files: a page links the stylesheet of every fragment its route
 * renders, and an example is not rendered by a route — it is rendered by `renderExample`, into a
 * string the guide's prose is built from. The framework has no way to know it happened, so the
 * sheet was compiled on every build and linked by nobody.
 *
 * So they are here, in the document's own sheet, and every selector is qualified by the example
 * that owns it. `.count` is the one that had to be: the contents rail uses it too, and the two of
 * them met on the intents page.
 */

/* badge.tsx — * The smallest fragment there is: one hole, and a chip around it. */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-quiet);
  color: var(--accent-ink);
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* greeting.tsx — * The smallest possible read: one value, one hole. */
.greeting {
  margin: 0;
  font-size: 14px;
}

/* crumbs.tsx — * A breadcrumb, from a wildcard route: the trail is a list hole. */
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.crumbs li + li::before {
  content: '/';
  color: var(--dim);
  margin-inline-end: 8px;
}

.crumbs [aria-current='page'] {
  color: var(--faint);
}

/* links.tsx — * A nav whose current entry is an attribute rather than a different element. */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 14px;
}

.links [data-current='true'] {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

/* list.tsx — a list is one sealed row template, projected once per item */
table.rows {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.rows td {
  padding: 7px 0;
  border-block-end: 1px solid var(--line);
  color: var(--ink-soft);
}

table.rows tr:last-child td {
  border-block-end: 0;
}

table.rows .num {
  text-align: end;
  font-family: var(--mono);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* prices.tsx — typed holes: four of these need no escaping, and nothing in the file says so */
.prices .total {
  display: flex;
  gap: 12px;
  margin: 4px 0 0;
  padding-block-start: 9px;
  border-block-start: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.prices .total .num {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* total.tsx — * One typed hole and one untyped one, an annotation apart. */
.total {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.total b {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* feed.tsx — * A region that reads the clock: one row template, projected per item. */
.feed .items {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.feed .items li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-block-start: 1px solid var(--line);
  font-size: 14px;
}

.feed .title {
  color: var(--ink);
}

.feed .price,
.feed .at,
.feed .count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}

.feed .price {
  margin-inline-start: auto;
}

.feed .meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--dim);
}

/* helpful.tsx — * The one thing on this site that writes: a form, posting a real intent. */
.vote {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.vote button {
  display: inline-flex;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font: 500 13px/1 var(--sans);
  color: var(--ink);
  cursor: pointer;
}

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

/* The count is a reading, so it says what it counts. `.count` is also the rail's tally class, and
   the scope attribute is what keeps the two from meeting. */
.vote .count {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-quiet);
  color: var(--accent-ink);
  font: 500 12.5px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}

.vote .count::after {
  content: ' found this useful';
  font-family: var(--sans);
  font-weight: 400;
  color: var(--dim);
  margin-inline-start: 6px;
}

/* signals.tsx — * Client-owned state: a value updates in place, and nothing re-renders around it. */
.signals {
  display: grid;
  gap: 10px;
}

.signals .line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.signals .qty {
  width: 4.5rem;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
}

.signals .unit,
.signals .over {
  font-size: 12.5px;
  color: var(--dim);
}

.signals .over {
  color: var(--danger-ink);
}

.signals .total {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* remote.tsx — * A region served somewhere else, byte-identical to one served here. */
.region {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.region .hits {
  margin: 8px 0 0;
  padding-inline-start: 1.2em;
  font-size: 14px;
}

.region .meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--dim);
}

/* placeholder.tsx — * What a reader sees while a slow region is still on its way. */
.degraded {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--dim);
}

.degraded p {
  margin: 0;
  font-size: 13.5px;
}

/* private.tsx — * A fragment that reads identity, and is private because of it. */
.private {
  padding: 14px 16px;
  border: 1px solid var(--accent-edge);
  border-radius: var(--r-md);
  background: var(--accent-quiet);
  color: var(--accent-ink);
  font-size: 14px;
}

.private p {
  margin: 0;
}

/* device.tsx — * What a low-end device is served, decided before anything renders. */
.device {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ── the 404 and the 500 ──────────────────────────────────────────────────── */

/**
 * `app/layouts/error.tsx`, which is a document rather than a page inside this one.
 *
 * These rules are in the document's own sheet because that is the sheet the error page links: it is
 * not a route, so it has no bundle of its own and borrows the first one's. That is also why it can
 * speak the site's whole vocabulary — `.btn`, `.badge`, `.lede`, the mark — rather than needing a
 * palette of its own.
 */
.lost {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(4rem, 14vh, 9rem) var(--gutter) 4rem;
  text-align: center;
}

.lost-brand {
  justify-content: center;
  margin-block-end: 2.5rem;
}

.lost-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
}

.lost-number {
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--dim);
}

.lost h1 {
  font-size: clamp(28px, 1.4rem + 2vw, 40px);
  letter-spacing: -0.03em;
}

.lost .lede {
  margin-inline: auto;
  max-width: 48ch;
}

.lost-do {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-block-start: 32px;
}

/* Only ever rendered by `weft dev` — see the note on `stack` in the framework's own error page. */
.weft-error-stack {
  margin-block-start: 3rem;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--code-bg);
  text-align: start;
  max-height: 22rem;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--danger-ink);
}

.weft-error-subject {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.weft-hidden {
  display: none;
}

/* ── a tutorial step's goal ───────────────────────────────────────────────── */

/**
 * What the step is for, between the lede and the first edit.
 *
 * A step is a list of edits, and a reader part-way down one has usually lost the thread of why they
 * are making them. This keeps that thread one glance away rather than a scroll back up. It borrows
 * the plain-terms panel's shape from the guide deliberately: the two say the same kind of thing —
 * the point, before the detail — and a reader who has met one should recognise the other.
 */
.goal {
  margin: 22px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--accent-edge);
  border-radius: var(--r-lg);
  background: var(--accent-quiet);
}

.goal-kicker {
  margin: 0 0 8px;
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}

.goal p:last-child {
  margin: 0;
  max-width: 80ch;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--accent-ink);
}

/** How long the step takes, under the bar that says how far through you are. */
.rail-card-time {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--faint);
}

/** The tutorial's running file tree, in the rail beside the step that added to it. */
.so-far {
  display: grid;
  gap: 1px;
  margin-block-start: 10px;
  font: 12px/1.6 var(--mono);
  color: var(--faint);
}

.so-far-row.fresh {
  color: var(--accent-ink);
}

/** What an export's own file refuses by name, linked to the page that argues each one. */
.api-raises {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  font-size: 12.5px;
}

.api-raises-kind {
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

.api-dot {
  color: var(--faint);
}

/** How far a section runs, for a reader deciding whether to read it. */
.api-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.api-group h2 {
  margin-block-end: 0;
}

.api-count {
  font: 500 13px/1 var(--mono);
  color: var(--faint);
}

/* ── the glossary's letter index ─────────────────────────────────────────── */

/** Which part of the framework a term belongs to, beside the term. */
.term-of {
  margin-inline-start: 10px;
  font: 12px/1 var(--sans);
  font-weight: 400;
  color: var(--faint);
}

/* ── the refusal panel ────────────────────────────────────────────────────── */

/**
 * A code's page opens with the refusal itself, in one bordered panel.
 *
 * The border is the danger hue rather than the accent, which is the distinction `--danger` exists
 * to make: a refusal is not an accent, and reading it as one is the mistake. Everything the panel
 * holds was already on the page — the message, the package, the file, the documents — spread over a
 * heading, a quotation, two prose paragraphs and two tables of one column each.
 */
.refusal-panel {
  margin-block-start: 34px;
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  border-radius: var(--r-xl);
  background: var(--danger-wash);
}

.refusal-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.refusal-kind {
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  border-radius: var(--r-pill);
  font: 500 11px/1.4 var(--sans);
  color: var(--danger-ink);
}

/* The file the throw is in. Pushed to the far edge, where every rail on this site puts a number. */
.refusal-where {
  margin-inline-start: auto;
  font: 12.5px/1.5 var(--mono);
  color: var(--faint);
}

.refusal-where a {
  color: var(--ink-soft);
}

.refusal-panel .message {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.refusal-panel .hint {
  margin: 10px 0 0;
}

/* A code with no sentence of its own says why, in the place the sentence would have been. */
.refusal-none {
  margin: 16px 0 0;
  max-width: 80ch;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}

/**
 * Label and value, the shape a fact takes when there are two or three of them.
 *
 * Not a table: a table draws a header row and a rule per line, which for three facts is more
 * furniture than fact. The label column is `max-content`, so the values line up on one edge.
 */
.facts-rows {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 16px 0 0;
  font-size: 13.5px;
}

.facts-rows dt {
  color: var(--dim);
}

.facts-rows dd {
  margin: 0;
  color: var(--ink-soft);
}

@media (width < 700px) {
  .facts-rows {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .facts-rows dd {
    margin-block-end: 8px;
  }
}

/* ── the strip ────────────────────────────────────────────────────────────── */

/**
 * What a generated page is made of, on one line above it.
 *
 * One box rather than `.stats`' three, because these numbers are a header and not a figure: they
 * describe the page below them, so they read as a sentence across and carry the caveat that
 * qualifies them on the same line rather than in a paragraph underneath.
 */
.strip {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  margin-block-start: 22px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.strip-cell b {
  display: block;
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.strip-cell b.lit {
  color: var(--accent-ink);
}

.strip-cell span {
  display: block;
  margin-block-start: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--faint);
}

/**
 * The caveat, beside the numbers where the line has room and under them where it has not.
 *
 * `flex: 1 1 30ch` is what does that: it asks for thirty characters, takes the rest of the line if
 * that is what is left, and wraps to a full-width row of its own when the numbers have used the
 * line up. Pinning it right with `margin-inline-start: auto` instead left a column of dead space
 * under the numbers on every article narrower than the mock.
 */
.strip-note {
  flex: 1 1 30ch;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--faint);
}

.strip-cell {
  flex: none;
}

@media (width < 760px) {
  .strip {
    gap: 18px;
  }
}

/**
 * A generated module's name is the import you write, so it is set in the face you write it in.
 *
 * Only here: every other `h1` on the site is a sentence, and this one is a specifier.
 */
.api > h1 {
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

/* ── the gallery's group headings ─────────────────────────────────────────── */

/**
 * Which guide page a run of examples is from, on one line with the way back to it.
 *
 * The backlink was a paragraph under the heading, which put a heading, a link and then the first
 * example's rule in three stacked rows — a section that looked empty until you scrolled past it.
 */
.gallery-group {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-block-start: 52px;
  scroll-margin-top: calc(var(--head-h) + 20px);
}

.gallery-group h2 {
  margin: 0;
}

.gallery-from {
  font-size: 13px;
}

.gallery-count {
  margin-inline-start: auto;
  font: 500 13px/1 var(--mono);
  color: var(--faint);
}

/* The first example under a group heading carries the group's spacing, not its own. */
.gallery-group + .example {
  margin-block-start: 26px;
}

/* ── the tutorial's parts, and the steps in them ──────────────────────────── */

/**
 * The head of the tutorial index, closed by a rule.
 *
 * The design draws the eyebrow, the heading, the lede and the four numbers as one band across the
 * page with a divider under it, and the parts below. The band is not an element — the heading and
 * the lede are the layout's and the numbers are the body's — so the rule is drawn by the last thing
 * in it. The rule spans the column and the sentence keeps a readable measure, which is two widths
 * and therefore the wrapper as well as the paragraph.
 */
.tutorial-band {
  padding-block-end: 26px;
  border-block-end: 1px solid var(--line);
}

.tutorial-band p {
  margin: 26px 0 0;
  max-width: 74ch;
}

/* The index is the one page whose heading is the whole tutorial, and it is set at that scale. */
.shell.one article > h1 {
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.032em;
  max-width: 22ch;
}

.shell.one .lede {
  font-size: 17px;
  max-width: 74ch;
  margin-block-end: 0;
}

/* Four across, and not wider than four of them want to be. */
.shell.one .stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1040px;
  margin-block-start: 26px;
}

/**
 * A part: what it is for on the left, and the steps in it beside that.
 *
 * The description column is fixed rather than fractional so that the four parts' left edges agree
 * down the page — a part with a one-line blurb and one with three should still start their steps
 * at the same x, or the page reads as four unrelated blocks.
 */
.part {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 34px;
  margin-block-start: 34px;
  scroll-margin-top: calc(var(--head-h) + 20px);
}

.part-of h2 {
  margin: 0;
  font-size: 20px;
}

.part-of p {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.part-of .hint {
  margin-block-start: 12px;
}

.part-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.step-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: inherit;
}

.step-card:hover {
  text-decoration: none;
}

.step-card-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

/* Zero-padded, so a two-digit tutorial does not shift its titles by a character half way down. */
.step-num {
  font: 500 13px/1 var(--mono);
  color: var(--accent);
}

.step-title {
  font: 500 15px/1.25 var(--sans);
  color: var(--ink);
}

.step-mins {
  flex: none;
  margin-inline-start: auto;
  font: 12px/1 var(--mono);
  white-space: nowrap;
  color: var(--faint);
}

.step-card p {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* What the step has you run, read out of the step. See `stepMentions` for why it is not written. */
.step-card .step-runs {
  font: 12px/1.5 var(--mono);
  color: var(--faint);
}

@media (width < 900px) {
  .part {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

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

  .shell.one .stats {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  }

  .shell.one article > h1 {
    font-size: 34px;
  }
}

/**
 * The tutorial's rail numbers its steps, and the number leads.
 *
 * Every other rail on this site puts its count at the right edge, where a count belongs: it is a
 * size, and sizes line up on the right. This one is an ordinal — where you are in nineteen — and
 * an ordinal leads, so the column reads as a sequence rather than as a list with sizes beside it.
 */
.rail.steps .count {
  order: -1;
  width: 1.4em;
  padding-inline: 10px 0;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.rail.steps .contents a {
  padding-inline-start: 4px;
}

/* Its own number is not repeated beside the step you are on; the heading above says it. */
.rail.steps .contents li:has(a[aria-current='page']) .count {
  color: var(--accent-ink);
}


/* app/fragments/docs/contents.css */
/**
 * The contents rail — the one piece of chrome on this site that is a sealed template.
 *
 * It is byte-identical on every page under a section, which is what makes it worth being a region
 * of its own: one cache entry across twenty-two guide pages instead of a copy inside each. This
 * sheet is linked only where the fragment renders, so the landing page and the playground do not
 * pay for it.
 */

.contents-nav {
  display: block;
}

.contents-group {
  margin-block-end: 22px;
}

.contents-group:last-child {
  margin-block-end: 0;
}

.contents-group h2 {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 11px;
}

.contents {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.contents li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-radius: var(--r-sm);
}

.contents a {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  line-height: 1.4;
}

.contents a:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  text-decoration: none;
}

/* The nav is a sealed template, and a sealed template cannot branch — so the entry you are on is
   still a link and says so with `aria-current`, which is the markup assistive technology reads for
   "you are here" and a `<strong>` never was. The weight and the wash come from here. */
.contents a[aria-current='page'] {
  background: var(--accent-quiet);
  color: var(--accent-ink);
  font-weight: 500;
}

.count {
  padding-inline-end: 10px;
  font-size: 12px;
  color: var(--dim);
}

/* An empty `count` hole still renders its span, so give it nothing to occupy when it is empty. */
.count:empty {
  display: none;
}
