:root {
  --paper: #faf8f3;
  --ink: #1f1d1a;
  --muted: #6b665d;
  --line: #e2ddd2;
  --link: #1a5fb4;
  --soon: #a49e92;
  --code: #f0ece3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17181a;
    --ink: #e8e4dc;
    --muted: #a39d92;
    --line: #2e2f33;
    --link: #79a8f2;
    --soon: #6c6960;
    --code: #222327;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.65 Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}

.spectrum {
  height: 6px;
  background: linear-gradient(90deg, #e40303, #ff8c00, #ffed00, #008026, #00a4c4, #24408e, #732982);
}

header.site, main, footer.site {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font: 700 1.35rem/1 system-ui, sans-serif;
  letter-spacing: -.02em;
}

.brand span {
  display: block;
  margin-top: .3rem;
  font-weight: 400;
  font-size: .8rem;
  letter-spacing: 0;
  color: var(--muted);
}

header.site nav { display: flex; gap: 1.25rem; font: .9rem system-ui, sans-serif; }

a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }

main { padding-top: 2rem; padding-bottom: 3rem; }

h1, h2, h3 { font-family: system-ui, sans-serif; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 2rem 0 .5rem; }

.lead { font-size: 1.15rem; color: var(--muted); }

code, pre { font: .88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--code); }
code { padding: .1em .3em; border-radius: 3px; }
pre { padding: 1rem; overflow-x: auto; border-radius: 4px; }

.toc-section p { margin: 0 0 .5rem; color: var(--muted); }
.toc-section ol { margin: 0; padding-left: 1.6rem; }
.toc-section li { margin: .15rem 0; }
.soon { color: var(--soon); }

.swatches { display: flex; gap: 4px; margin: 1.5rem 0; }
.swatches span { flex: 1; height: 2.5rem; border-radius: 3px; }

footer.site {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  font: .85rem system-ui, sans-serif;
  color: var(--muted);
}

.formula {
  margin: 1rem 0;
  padding: .75rem 1rem;
  background: var(--code);
  border-left: 3px solid var(--line);
  font: .92rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  white-space: pre;
}

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .92rem; }
th, td { text-align: left; padding: .35rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.note { padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 4px; font-size: .95rem; }

.converter { margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; }
.conv-input { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; font: .9rem system-ui, sans-serif; }
.conv-input input[type=color] { width: 3rem; height: 2rem; padding: 0; border: 1px solid var(--line); background: none; vertical-align: middle; }
.conv-input input[type=text] { font: .95rem ui-monospace, monospace; padding: .3rem .4rem; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.conv-swatch { flex: 1; min-width: 4rem; height: 2rem; border-radius: 3px; }
.conv-table td { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.conv-table th[scope=row] { white-space: nowrap; }

.topic-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font: .9rem system-ui, sans-serif;
}
.topic-nav > :nth-child(2) { text-align: center; }
.topic-nav > :last-child { text-align: right; }
.conv-table .cv { display: inline-block; white-space: nowrap; margin-right: .9em; }
