:root {
  color-scheme: light dark;
  --background: #f8f6f1;
  --surface: #fffdf9;
  --ink: #2e4053;
  --link: #3b5871;
  --frame: #c9c7c0;
  --focus: #2f7aa8;
  font-family: system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #252424;
    --surface: #343130;
    --ink: #f3eee8;
    --link: #f39a7e;
    --frame: #8d8581;
    --focus: #b8d9e8;
  }
}

body {
  margin: 0;
  padding: clamp(0.75rem, 5vw, 2.5rem);
  background: var(--background);
  color: var(--ink);
  line-height: 1.6;
}

main {
  max-inline-size: 46rem;
  margin-inline: auto;
  padding: clamp(0.75rem, 5vw, 2.5rem);
  border: 1px solid var(--frame);
  border-radius: 1rem;
  background: var(--surface);
  overflow-wrap: anywhere;
}

h1, h2 { line-height: 1.2; }
h1 { margin-block: 0.5rem 1rem; font-size: 2rem; }
h2 { margin-block: 1.5rem 0.5rem; font-size: 1.25rem; }
p { margin-block: 0.5rem 1rem; }
a { color: var(--link); text-underline-offset: 0.16em; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
nav { display: flex; flex-wrap: wrap; column-gap: 1.25rem; }
nav a, .home-link { display: inline-flex; align-items: center; min-block-size: 44px; }

/* Scale text locally so user-selected iOS text sizes do not enlarge page spacing. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  body { font: -apple-system-body; line-height: 1.6; }
  main { font-size: calc(16em / 17); }
  h1 { font-size: min(2em, calc(.49em + 8vw)); }
  h2 { font-size: min(1.25em, calc(.4em + 7vw)); }
  @media (max-width: 420px) { body, main { padding: clamp(4px, calc(18px - .28em), 12px); } }
}
