/* The documentation pages. Same paper, same ink, same two typefaces as the
   landing page — but a single measured column, because these are read rather
   than scanned. */

:root {
  --ink:     #111111;
  --ink-2:   #3d3d3d;
  --muted:   #5c5c5c;
  --faint:   #8f8f8f;
  --cream:   #f3f1ec;
  --cream-2: #eae7e0;
  --line:    #e3e0d8;
  --white:   #ffffff;
  --frame:   #0a0a0a;

  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --pad: clamp(20px, 5vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--pad);
  background: rgba(243, 241, 236, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.word {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--ink);
}
.word svg { display: block; }
.barlinks { display: flex; gap: 20px; }
.barlinks a {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}
.barlinks a:hover { color: var(--ink); }

/* ---------- the column ---------- */

main {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) var(--pad) 96px;
}

.crumb { font-size: 13px; margin-bottom: 20px; }
.crumb a { color: var(--faint); text-decoration: none; }
.crumb a:hover { color: var(--ink); }

.toc {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 18px 22px 20px;
  margin: 40px 0 8px;
}
/* the first h2 after the contents already has the rule it needs */
.toc + h2 { border-top: 0; padding-top: 0; margin-top: 40px; }
.toc b {
  display: block;
  font-size: 10.5px;
  font-weight: 640;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}
.toc ol { list-style: none; margin: 0; columns: 2; column-gap: 28px; }
.toc li { break-inside: avoid; }
.toc a {
  display: block;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--muted);
  text-decoration: none;
}
.toc a:hover { color: var(--ink); }
.toc code { font-size: 12.5px; background: none; padding: 0; }

/* ---------- prose ---------- */

article h1, .lede + p, article > h1 { letter-spacing: -.028em; }

article h1 {
  font-size: clamp(30px, 4.4vw, 42px);
  line-height: 1.1;
  font-weight: 720;
  margin-bottom: 22px;
}
article h2 {
  font-size: clamp(21px, 2.6vw, 26px);
  line-height: 1.25;
  font-weight: 690;
  letter-spacing: -.022em;
  margin: 52px 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
article h3 {
  font-size: 17.5px;
  font-weight: 660;
  letter-spacing: -.016em;
  margin: 32px 0 10px;
}
article h4 {
  font-size: 15px;
  font-weight: 660;
  margin: 24px 0 8px;
}
article h1 + p, article h2 + p, article h3 + p { margin-top: 0; }

article p { margin: 16px 0; color: var(--ink-2); }
article > p:first-of-type,
.lede {
  font-size: 18px;
  line-height: 1.62;
  color: var(--muted);
}

article a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
article a:hover { color: #000; }

article strong { font-weight: 640; color: var(--ink); }

article ul, article ol { margin: 16px 0 16px 22px; }
article li { margin: 7px 0; color: var(--ink-2); }
article li::marker { color: var(--faint); }

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

article blockquote {
  border-left: 2px solid var(--line);
  padding-left: 18px;
  margin: 20px 0;
  color: var(--muted);
}

/* ---------- code ---------- */

code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--cream-2);
  border-radius: 4px;
  padding: 1.5px 5px;
  color: var(--ink);
  overflow-wrap: break-word;
}

pre {
  background: #14140f;
  border-radius: 11px;
  padding: 20px 22px;
  margin: 22px 0;
  overflow-x: auto;
}
pre code {
  background: none;
  padding: 0;
  font-size: 12.75px;
  line-height: 1.7;
  color: #e8e3cf;
  white-space: pre;
}

/* ---------- tables ---------- */

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

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  font-size: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 10.5px;
  font-weight: 640;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
td { color: var(--ink-2); }
td code { font-size: 12.5px; background: var(--cream); }

/* ---------- the index page ---------- */

ul.index { list-style: none; margin: 24px 0 0; }
ul.index li {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 18px 20px 20px;
  margin: 0 0 10px;
}
ul.index > li > a {
  font-size: 16.5px;
  font-weight: 640;
  letter-spacing: -.015em;
  text-decoration: none;
  color: var(--ink);
}
ul.index > li > a:hover { text-decoration: underline; }
ul.index p {
  margin: 6px 0 0;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--muted);
}
ul.index code { font-size: 12.5px; background: var(--cream); }

/* ---------- foot ---------- */

.pagefoot {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.pagefoot p { font-size: 13.5px; line-height: 1.7; color: var(--faint); }
.pagefoot p + p { margin-top: 8px; }
.pagefoot a { color: var(--muted); }
.pagefoot code { font-size: 12.5px; background: var(--cream-2); }

@media (max-width: 620px) {
  .toc ol { columns: 1; }
  .barlinks a:first-child { display: none; }
}
