:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --fg: #171717;
  --fg-body: #333333;
  --fg-muted: #666666;
  --fg-faint: #8f8f8f;
  --link: #0067d6;
  --article: 720px;
  --rail: 200px;
  --radius: 6px;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

::selection { background: #cce3ff; }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: .2em; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

code, pre, .meta, .toc, .figure-caption, .article-footer { font-family: var(--mono); }

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: .6rem .85rem;
  background: var(--fg);
  color: #fff;
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* Header */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.masthead-inner {
  max-width: 1120px;
  min-height: 56px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  color: var(--fg);
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--fg-faint); font-weight: 400; }
.masthead nav { margin-left: auto; display: flex; gap: 4px; }
.masthead nav a {
  color: var(--fg-muted);
  font-size: .85rem;
  padding: .35rem .6rem;
  border-radius: var(--radius);
}
.masthead nav a:hover { color: var(--fg); background: var(--bg-subtle); text-decoration: none; }
.toc-button, .lang-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  padding: .3rem .6rem;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: .8rem;
  cursor: pointer;
}
.toc-button { display: none; margin-left: auto; }
.lang-toggle { order: 1; }
.toc-button:hover, .lang-toggle:hover { color: var(--fg); border-color: var(--border-strong); text-decoration: none; }

.mobile-toc {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 24px 12px;
}
.mobile-toc a {
  display: block;
  color: var(--fg-muted);
  padding: .35rem 0;
  font-size: .88rem;
}

/* Layout */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  display: grid;
  grid-template-columns: minmax(0, var(--article)) var(--rail);
  gap: 80px;
  align-items: start;
}
article { min-width: 0; }

.toc {
  position: sticky;
  top: 88px;
  font-size: .8rem;
  line-height: 1.5;
  font-family: var(--sans);
}
.toc p {
  margin: 0 0 8px;
  font-weight: 500;
  color: var(--fg);
  font-size: .8rem;
}
.toc a {
  display: block;
  padding: 3px 0 3px 12px;
  color: var(--fg-muted);
  border-left: 1px solid var(--border);
}
.toc a:hover { color: var(--fg); border-left-color: var(--border-strong); text-decoration: none; }
.toc a[aria-current="true"] {
  color: var(--fg);
  font-weight: 500;
  border-left-color: var(--link);
  box-shadow: -1px 0 0 var(--link);
}
.toc-group {
  margin: 14px 0 4px;
  padding-left: 12px;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.toc-group:first-of-type { margin-top: 4px; }
.mobile-toc .toc-group { padding-left: 0; margin: 12px 0 2px; }
.toc .updated {
  margin-top: 20px;
  color: var(--fg-faint);
  font-size: .72rem;
  font-weight: 400;
}

/* Article header */
.article-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
h1 {
  margin: 0;
  color: var(--fg);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.dek {
  max-width: 600px;
  margin: 16px 0 12px;
  color: var(--fg-muted);
  font-size: 1.1rem;
  line-height: 1.55;
  text-wrap: pretty;
}
.meta { margin: 0; color: var(--fg-faint); font-size: .74rem; }

/* Sections */
section { scroll-margin-top: 80px; margin: 0 0 56px; }
h2 {
  margin: 0 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--fg);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.02em;
  text-wrap: balance;
  scroll-margin-top: 80px;
}
h3 {
  margin: 28px 0 8px;
  color: var(--fg);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
p { margin: 0 0 .95rem; max-width: 68ch; }
ul, ol { padding-left: 1.35rem; margin: 0 0 1rem; }
li { margin-bottom: .45rem; max-width: 66ch; }
strong { color: var(--fg); font-weight: 600; }

.lead { color: var(--fg); font-size: 1.02rem; }
.note {
  margin: 20px 0;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .92rem;
}
.note p { max-width: none; }
.note p:last-child { margin-bottom: 0; }
.small-note { color: var(--fg-muted); font-size: .86rem; }

/* Emphasised block for a key takeaway */
.key {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid var(--fg);
  border-radius: var(--radius);
}
.key p { max-width: none; }
.key p:last-child { margin-bottom: 0; }
.key-label {
  display: block;
  margin-bottom: 6px;
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* Two-column do / do-not */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 22px;
}
.split > div {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.split h3 { margin: 0 0 8px; font-size: .92rem; }
.split ul { margin: 0; padding-left: 1.1rem; }
.split li { font-size: .9rem; margin-bottom: .35rem; }
.split .yes h3 { color: #0a7d33; }
.split .no h3 { color: #b3261e; }

/* Quote */
.quote {
  margin: 20px 0;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--border-strong);
}
.quote p {
  margin: 0 0 .6rem;
  color: var(--fg-body);
  font-size: .95rem;
  max-width: 66ch;
}
.quote footer {
  color: var(--fg-muted);
  font-size: .82rem;
  font-family: var(--sans);
}

/* Figure */
figure { margin: 20px 0 24px; }
figure svg { display: block; width: 100%; height: auto; }
.figure-caption { margin: 8px 0 0; color: var(--fg-faint); font-size: .72rem; }

/* Steps */
.steps {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}
.steps > li {
  counter-increment: steps;
  position: relative;
  padding: 0 0 20px 44px;
  margin: 0;
  max-width: none;
}
.steps > li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--fg);
  font: 500 .78rem var(--mono);
}
.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 2px;
  width: 1px;
  background: var(--border);
}
.steps h3 { margin: 0 0 4px; padding-top: 2px; }
.steps p { margin-bottom: 0; }

/* Glossary */
.glossary { margin: 16px 0 0; }
.glossary dt {
  margin-top: 16px;
  font-weight: 600;
  color: var(--fg);
  font-size: .95rem;
}
.glossary dd { margin: 2px 0 0; max-width: 68ch; }

/* Code */
pre {
  overflow: auto;
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: .8rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
code { font-size: .9em; }
p code, li code, dd code {
  padding: .1em .35em;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 4px;
  color: var(--fg);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 10px 14px;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: 0; }
th {
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-family: var(--sans);
  font-weight: 500;
  font-size: .76rem;
}
td:first-child { min-width: 140px; }
table strong { font-size: .84rem; }
.decision-table td:first-child { font-weight: 500; color: var(--fg); }

/* Command list */
.command-list {
  margin: 14px 0 18px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.command-list li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  max-width: none;
}
.command-list li:last-child { border-bottom: 0; }
.command-list li:nth-child(odd) { background: var(--bg-subtle); }
.command-list code { color: var(--fg); }
.command-list span { color: var(--fg-muted); font-size: .85rem; font-family: var(--sans); }

/* Reference lists */
.refs {
  margin: 12px 0 22px;
  padding: 0;
  list-style: none;
}
.refs li {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  max-width: none;
}
.refs li:first-child { border-top: 1px solid var(--border); }
.refs > li > a { font-weight: 500; }
.refs span { display: block; color: var(--fg-muted); font-size: .85rem; }

.article-footer {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--fg-faint);
  font-size: .74rem;
}

@media (max-width: 960px) {
  .page { grid-template-columns: minmax(0, 1fr); max-width: 800px; gap: 0; }
  .toc { display: none; }
  .masthead nav { display: none; }
  .toc-button { display: block; }
  .mobile-toc[hidden] { display: none; }
  .mobile-toc:not([hidden]) { display: block; }
}

@media (max-width: 620px) {
  .masthead-inner { padding: 0 16px; }
  .page { padding: 36px 16px 56px; }
  h1 { font-size: 1.75rem; }
  .dek { font-size: 1rem; }
  h2 { font-size: 1.2rem; }
  .steps > li { padding-left: 40px; }
  .command-list li { grid-template-columns: 1fr; gap: 2px; }
  .split { grid-template-columns: 1fr; }
  table { min-width: 660px; }
}

@media print {
  .masthead, .toc, .mobile-toc { display: none !important; }
  body { font-size: 10.5pt; }
  .page { display: block; max-width: none; padding: 0; }
  a { color: #000; }
  section { break-inside: avoid-page; }
}
