:root {
  color-scheme: dark;
  --bg: #020204;
  --bg-raised: #0b0a10;
  --glow: #241a35;
  --fg: #f1ede6;
  --muted: #a99fb3;
  --accent: #c97a4d;
  --link: #dfa274;
  --node: #efe9e0;
  --button-bg: #dfa274;
  --button-bg-hover: #c97a4d;
  --button-fg: #020204;
  --control-border: #7c7287;
  --focus: #dfa274;
  --border: rgba(241, 237, 230, 0.12);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --size-small: 0.875rem;
  --size-caps: 0.78rem;
  --size-body: 1.0625rem;
  --size-lead: 1.25rem;
  --size-h3: 1.25rem;
  --size-h2: 1.6rem;
  --size-h1: clamp(1.9rem, 4vw + 0.5rem, 2.75rem);
  --line-body: 1.6;
  --line-heading: 1.2;
  --weight-regular: 400;
  --weight-strong: 600;
  --weight-heading: 650;
  --tracking-caps: 0.14em;
  --measure: 62ch;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fbf8f3;
    --bg-raised: #f2ece3;
    --glow: #e8def0;
    --fg: #1c1826;
    --muted: #5b5266;
    --accent: #c97a4d;
    --link: #9a4a1f;
    --node: #2a2236;
    --button-bg: #c97a4d;
    --button-bg-hover: #dfa274;
    --button-fg: #1c1826;
    --control-border: #7d7388;
    --focus: #9a4a1f;
    --border: rgba(28, 24, 38, 0.14);
  }
}
/* The layout. Every colour, size and space below is a token from tokens.json (written as custom
   properties above this file in the built stylesheet); nothing here carries a colour of its own. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: var(--line-body);
  overflow-wrap: break-word;
}

/* The page glow: decoration behind the top of the page. It is an element covering the whole page in
   the glow colour, faded by a mask to a soft patch at the top left (a mask, so its colour is only
   an alpha). The accessibility check measures text against an element's flat colour and cannot
   against a gradient, and it cannot decide where an element covers only part of the text, so the
   element covers everything and the check measures every line of text against the glow colour at
   its strongest, which the token file's pairs also require. */
.glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--glow);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(60rem 36rem at 28% 0%, black 0%, transparent 100%);
  mask-image: radial-gradient(60rem 36rem at 28% 0%, black 0%, transparent 100%);
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2rem);
}

.skip {
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-raised);
  color: var(--fg);
  border: 2px solid var(--control-border);
  border-radius: var(--radius-sm);
  transform: translateY(-300%);
}
.skip:focus { transform: none; z-index: 10; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
main:focus { outline: none; }

a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { color: var(--fg); }

/* ---- Header and footer ---- */

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-5);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--fg); }
.mark { width: 36px; height: 36px; border-radius: var(--radius-sm); flex-shrink: 0; }
.wordmark { height: 0.95rem; width: auto; flex-shrink: 0; }
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--fg);
  text-decoration: none;
  font-weight: var(--weight-strong);
  font-size: var(--size-small);
}
.nav-list a:hover { color: var(--link); }
.nav-list a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

main { flex: 1; padding-block: var(--space-6) var(--space-8); }

.site-footer {
  padding-block: var(--space-5);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--size-small);
}
.site-footer p { margin: 0 0 var(--space-2); }
.site-footer p:last-child { margin-bottom: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.footer-links a { font-weight: var(--weight-strong); }

/* ---- Text ---- */

h1, h2, h3 { line-height: var(--line-heading); font-weight: var(--weight-heading); text-wrap: balance; }
h1 { font-size: var(--size-h1); margin: 0 0 var(--space-5); }
h2 { font-size: var(--size-h2); margin: var(--space-7) 0 var(--space-3); }
h3 { font-size: var(--size-h3); margin: var(--space-6) 0 var(--space-2); }

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 var(--space-4); }
.prose p { color: var(--muted); }
.prose li { margin-bottom: var(--space-1); color: var(--muted); }
.prose li::marker { color: var(--node); }
.prose strong { color: var(--fg); }
/* The picture in a story page's sections is the 1200 by 630 card, never wider than its column. */
.sections img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.prose blockquote {
  padding: var(--space-1) var(--space-4);
  border-left: 3px solid var(--control-border);
  color: var(--muted);
}
.prose blockquote p { margin: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  overflow-wrap: anywhere;
}
pre {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: var(--size-small);
}
pre code { padding: 0; border: 0; background: none; overflow-wrap: normal; }

.table-scroll {
  margin: 0 0 var(--space-4);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table { border-collapse: collapse; width: 100%; font-size: var(--size-small); }
th, td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  min-width: 8rem;
}
th { color: var(--fg); background: var(--bg-raised); font-weight: var(--weight-strong); }
td { color: var(--muted); }
tr:last-child td { border-bottom: 0; }

/* ---- The site layout ---- */

.hero { padding-block: var(--space-5); }
.eyebrow {
  margin: 0 0 var(--space-3);
  color: var(--link);
  font-size: var(--size-caps);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.sections { padding-block: 0 var(--space-5); }
.sections .prose > h2:first-child { margin-top: var(--space-5); }
.lead-first > p:first-of-type { font-size: var(--size-lead); color: var(--fg); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; }
.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--button-bg);
  border-radius: var(--radius-pill);
  background: var(--button-bg);
  color: var(--button-fg);
  font-weight: var(--weight-strong);
  text-decoration: none;
}
.button:hover { background: var(--button-bg-hover); border-color: var(--button-bg-hover); color: var(--button-fg); }
.button.secondary { background: transparent; border-color: var(--control-border); color: var(--fg); }
.button.secondary:hover { border-color: var(--link); color: var(--fg); background: transparent; }

.section { padding-block: var(--space-5) 0; }
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
/* Two columns, then as many as fit (four at a desktop width), so no card is left alone on a row. */
@media (min-width: 36rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 72rem) { .cards { grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); } }
.card {
  padding: var(--space-5);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.card h2 { margin: 0 0 var(--space-2); font-size: var(--size-h3); }
.card p { margin: 0 0 var(--space-3); color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

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

/* The text comes first in the page, so a phone shows it first and a keyboard reaches it first; the
   sidebar sits to its left from the width where there is room. */
.docs {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  grid-template-areas: "side article";
  gap: var(--space-7);
}
.docs-side { grid-area: side; }
.to-side { display: none; }
.docs-side h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--size-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--muted);
}
.docs-side ul { list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.docs-side a {
  display: block;
  padding: var(--space-1) 0;
  font-size: var(--size-small);
  overflow-wrap: anywhere;
}
.docs-side .toc-3 { padding-left: var(--space-3); }
/* A long list scrolls inside its own box; its links are what a keyboard reaches there. */
.docs-side ul { max-height: 18rem; overflow-y: auto; }
.docs-side details { margin: 0 0 var(--space-3); }
.docs-side summary {
  padding: var(--space-1) 0;
  font-size: var(--size-small);
  font-weight: var(--weight-strong);
  color: var(--fg);
  cursor: pointer;
}
.docs-side details ul { margin: 0 0 var(--space-3); padding-left: var(--space-3); }

.docs-search { margin: 0 0 var(--space-5); }
.docs-search[hidden] { display: none; }
.docs-search label {
  display: block;
  margin: 0 0 var(--space-2);
  font-size: var(--size-small);
  font-weight: var(--weight-strong);
  color: var(--fg);
}
.docs-search input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--size-small);
}
.search-status { margin: var(--space-2) 0 0; font-size: var(--size-small); color: var(--muted); }
.search-results { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.search-results:empty { display: none; }
.search-results li { padding: var(--space-1) 0; }
.search-results a { font-size: var(--size-small); overflow-wrap: anywhere; }
.result-page { display: block; font-size: var(--size-small); color: var(--muted); }

.doc-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.doc-list li { margin: 0 0 var(--space-3); }
.doc-list a { overflow-wrap: anywhere; }
.doc-description { display: block; color: var(--muted); font-size: var(--size-small); }
.release { margin-top: var(--space-7); font-size: var(--size-small); color: var(--muted); }
.docs-side a[aria-current="page"] { font-weight: var(--weight-strong); }
.docs article { grid-area: article; min-width: 0; }

@media (max-width: 52rem) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "jump" "article" "side";
    gap: var(--space-5);
  }
  .to-side {
    display: inline-flex;
    grid-area: jump;
    align-items: center;
    min-height: 44px;
    font-size: var(--size-small);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
