:root {
  color-scheme: dark;

  /* Contrast against --bg */
  --bg:         #141210;
  --surface:    #22201d;  /* code blocks               */
  --surface-2:  #302d29;  /* inline code               */
  --border:     #45423e;  /* 1.87:1, quiet rules       */
  --border-hi:  #5d5a55;  /* 2.72:1, emphasized rules  */

  --fg:         #e2dfdb;  /* 14.07:1  body text        */
  --fg-muted:   #a7a49f;  /*  7.52:1  captions         */
  --fg-faint:   #807d78;  /*  4.56:1  list markers     */

  --link:       #79c4f7;  /*  9.83:1 */

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono",
          monospace;
}

html {
  color: var(--fg);
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 8rem;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}

@media (max-width: 640px) {
  body { padding: 2rem 1.1rem 4rem; font-size: 1.0625rem; }
}

h1, h2, h3, h4, h5, h6 {
  margin: 2.75rem 0 1rem;
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: 2.1rem; margin-top: 0; letter-spacing: -0.015em; }
h2 { font-size: 1.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1.3rem; margin-top: 2.25rem; }

p { margin: 0 0 1.25rem; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
}

a:visited { color: var(--link); }
a:hover { text-decoration-color: var(--link); }

ul, ol { margin: 0 0 1.25rem; padding-left: 1.6em; }
li > ul, li > ol { margin-top: 0.35rem; margin-bottom: 0; }
li + li { margin-top: 0.35rem; }
li::marker { color: var(--fg-faint); }

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

code {
  padding: 0.15em 0.35em;
  font-size: 0.875em;
  white-space: break-spaces;
  background-color: var(--surface-2);
  border-radius: 3px;
}

pre {
  padding: 1rem 1.15rem;
  margin: 0 0 1.5rem;
  overflow: auto;
  font-size: 0.875rem;
  line-height: 1.55;
  background-color: var(--surface);
  border-radius: 4px;
}

pre code {
  padding: 0;
  font-size: 100%;
  white-space: pre;
  background-color: transparent;
}

table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 0 1.5rem;
  overflow: auto;
  font-size: 0.95rem;
  border-collapse: collapse;
  font-variant-numeric: lining-nums tabular-nums;
}

caption {
  margin-bottom: 0.6rem;
  color: var(--fg-muted);
  text-align: left;
}

th, td {
  padding: 0.5rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { font-weight: 600; border-bottom: 2px solid var(--border-hi); }
tbody tr:last-child td { border-bottom: 0; }
