:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --border: #e4e4e8;
  --surface: #f5f5f7;
  --accent: #0066cc;
  --accent-fill: #0071e3;
  --radius: 14px;
  --gutter: 24px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --fg: #f0f0f3;
    --muted: #98989f;
    --border: #2a2a2e;
    --surface: #19191c;
    --accent: #4da3ff;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.wrap {
  width: 100%;
  max-width: calc(680px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6.5px;
}

.site-nav {
  display: flex;
  gap: 24px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  font-size: 15px;
}

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

.site-nav:empty {
  display: none;
}

.site-nav a {
  padding: 16px 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  color: var(--fg);
  box-shadow: inset 0 -2px var(--fg);
}

.site-nav a:focus-visible {
  outline-offset: -2px;
}

main {
  flex: 1 0 auto;
  padding-block: 72px 112px;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  scroll-margin-top: 24px;
}

h1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.022em;
  margin: 0 0 12px;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.016em;
  margin: 56px 0 14px;
}

h3 {
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 32px 0 6px;
}

h4 {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 28px 0 8px;
}

h2 + h3 {
  margin-top: 20px;
}

h3 + h4 {
  margin-top: 16px;
}

p,
ul,
ol,
table,
blockquote {
  margin: 0 0 16px;
}

p,
li {
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.25em;
}

li + li {
  margin-top: 8px;
}

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

strong {
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

a:hover {
  text-decoration-color: currentColor;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

code {
  font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 5px;
}

.updated {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 40px;
}

.lead {
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 36px;
}

.toc {
  margin: 0 0 48px;
  padding-block: 20px;
  border-block: 1px solid var(--border);
  font-size: 15px;
}

.toc strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
  columns: 2;
  column-gap: 40px;
}

.toc li {
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 3px 0;
  break-inside: avoid;
  counter-increment: toc;
}

.toc li::before {
  content: counter(toc);
  min-width: 1.25em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.toc a:hover {
  text-decoration: underline;
}

.callout {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 32px;
}

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

.table-scroll {
  overflow-x: auto;
  margin: 0 0 24px;
}

.table-scroll table {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.5;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 12px 20px 12px 0;
  border-bottom: 1px solid var(--border);
}

th:last-child,
td:last-child {
  padding-right: 0;
}

th {
  font-weight: 500;
  color: var(--muted);
}

thead th {
  font-size: 13px;
}

th[scope="row"] {
  width: 1%;
  padding-right: 32px;
  white-space: nowrap;
  font-weight: 400;
}

.links {
  list-style: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.links li {
  margin: 0;
}

.links li + li {
  border-top: 1px solid var(--border);
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.15s;
}

.links a::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border: solid var(--muted);
  border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
  opacity: 0.6;
}

.links a:active {
  background: var(--surface);
}

@media (hover: hover) {
  .links a:hover {
    background: var(--surface);
  }
}

.links a:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius);
}

.button {
  display: inline-block;
  background: var(--accent-fill);
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  transition: filter 0.15s;
}

.button:hover {
  filter: brightness(1.1);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-block: 28px 40px;
}

.site-footer a {
  color: inherit;
}

@media (max-width: 640px) {
  .site-header .wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .brand {
    padding: 14px 0;
  }

  .site-nav {
    gap: 22px;
    margin: -8px calc(var(--gutter) * -1) 0;
    padding-inline: var(--gutter);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  }

  .site-nav a {
    padding: 10px 0 14px;
  }

  main {
    padding-block: 40px 72px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 22px;
    margin-top: 48px;
  }

  .updated {
    margin-bottom: 32px;
  }

  .lead {
    font-size: 18px;
    margin-bottom: 28px;
  }

  .toc {
    margin-bottom: 40px;
  }

  .toc ol {
    columns: 1;
  }

  .toc li {
    padding: 5px 0;
  }

  .callout {
    padding: 16px 18px;
  }

  .links a {
    padding-inline: 18px;
  }

  table:has(thead) thead {
    display: none;
  }

  table:has(thead) :is(tbody, tr, td) {
    display: block;
  }

  table:has(thead) tr {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }

  table:has(thead) td {
    padding: 0;
    border: 0;
  }

  table:has(thead) td + td {
    margin-top: 10px;
  }

  table:has(thead) td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 13px;
    color: var(--muted);
  }

  th[scope="row"] {
    padding-right: 20px;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toc {
    display: none;
  }

  main {
    padding: 0;
  }

  a {
    color: inherit;
  }
}
