/* Shared styles for the Twenty-One Million book pages.
   Palette and type mirror the homepage's inline styles. */
:root {
  --paper: #eae6da;
  --paper-raised: #f3f0e5;
  --ink: #1f241f;
  --ink-soft: #52584c;
  --ink-faint: #7c8172;
  --line: rgba(31, 36, 31, 0.16);
  --line-strong: rgba(31, 36, 31, 0.32);
  --copper: #8a4d29;
  --copper-strong: #6e3c1f;
  --copper-tint: rgba(138, 77, 41, 0.1);
  --shadow: 0 1px 0 rgba(31, 36, 31, 0.08);
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --paper-raised: #1e1b15;
    --ink: #eae4d3;
    --ink-soft: #b7ae98;
    --ink-faint: #837a67;
    --line: rgba(234, 228, 211, 0.14);
    --line-strong: rgba(234, 228, 211, 0.28);
    --copper: #d98a53;
    --copper-strong: #e9a06c;
    --copper-tint: rgba(217, 138, 83, 0.14);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image: radial-gradient(rgba(31,36,31,0.05) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}
@media (prefers-color-scheme: dark) {
  body { background-image: radial-gradient(rgba(234,228,211,0.05) 0.6px, transparent 0.6px); }
}

a { color: var(--copper-strong); }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.crumbs {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-bottom: 1.4rem;
}
.crumbs a { color: var(--ink-faint); }

.book-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.3rem;
  margin: 0 0 2.2rem;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.book-nav a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid transparent; }
.book-nav a:hover { color: var(--copper-strong); border-bottom-color: var(--copper); }

.progress-track {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 2.4rem;
}
.progress-track .bar {
  flex: 1;
  height: 3px;
  background: var(--line-strong);
  position: relative;
  max-width: 220px;
}
.progress-track .bar span {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--copper);
}
.progress-track .label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1.15;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
.kicker {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper-strong);
  margin: 0 0 0.9rem;
}
.dek {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 2.5rem;
  max-width: 55ch;
}

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  margin: 2.6rem 0 0.8rem;
}
p, li { color: var(--ink); font-size: 1rem; }
article p { margin: 0 0 1.1rem; }

/* Drop cap on the article's opening paragraph */
article > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.4rem;
  line-height: 0.8;
  float: left;
  padding: 0.1rem 0.35rem 0 0;
  color: var(--copper);
}

blockquote.pull {
  margin: 2rem 0;
  padding: 0 0 0 1.3rem;
  border-left: 3px solid var(--copper);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink);
}

.arith {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--copper);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.8;
}
.aside {
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
  padding: 0.9rem 0;
  margin: 1.6rem 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* TOC on the book landing page — one card per chapter */
.toc { list-style: none; margin: 0; padding: 0; counter-reset: ch; display: flex; flex-direction: column; gap: 0.9rem; }
.toc li {
  counter-increment: ch;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
}
.toc li.published { border-left: 3px solid var(--copper); }
.toc .toc-head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}
.toc .toc-num {
  font-family: var(--font-mono);
  color: var(--copper);
  font-size: 0.78rem;
}
.toc .toc-num::before { content: counter(ch, decimal-leading-zero); }
.toc a.toc-title { font-family: var(--font-display); font-size: 1.15rem; text-decoration: none; }
.toc a.toc-title:hover { text-decoration: underline; }
.toc .soon-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink-faint);
}
.toc .tag {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px dashed var(--line-strong);
  padding: 0.1rem 0.45rem;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.toc .toc-summary {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
  max-width: 62ch;
}
.toc .toc-read {
  font-size: 0.82rem;
  color: var(--copper-strong);
}

/* Reusable chapter-teaser cards (used on the homepage too) */
.book-teasers {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.book-teaser {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--copper);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}
.book-teaser .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--copper);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.book-teaser h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  margin: 0.2rem 0 0.35rem;
}
.book-teaser h3 a { text-decoration: none; }
.book-teaser h3 a:hover { text-decoration: underline; }
.book-teaser p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}
.book-teaser .read {
  font-size: 0.8rem;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1.4rem;
  font-size: 0.92rem;
}

footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding-top: 1.4rem;
  color: var(--ink-faint);
  font-size: 0.78rem;
}
footer p { margin: 0 0 0.4rem; color: var(--ink-faint); }
