/* Palettes. Every text colour clears WCAG AA (4.5:1) on --paper.
   Verified by script/verify.py, which recomputes the ratios from these
   declarations rather than trusting a comment. */
:root {
  --paper: #FBFAF8;
  --ink: #16130F;
  --body: #2A241D;
  --muted: #6B6256;
  --faint: #7A7062;
  --accent: #C93F1A;
  --rule: #E8E2D8;
  --rule-soft: #F0EBE2;
  --accent-line: rgba(201, 63, 26, .34);
  --accent-wash: rgba(201, 63, 26, .08);
  --accent-band: rgba(201, 63, 26, .16);
}

html[data-theme="dark"] {
  --paper: #14110E;
  --ink: #F5F1EA;
  --body: #D8D0C4;
  --muted: #8C8275;
  --faint: #938879;
  --accent: #E8A15D;
  --rule: #2A2520;
  --rule-soft: #211D19;
  --accent-line: rgba(232, 161, 93, .38);
  --accent-wash: rgba(232, 161, 93, .13);
  --accent-band: rgba(232, 161, 93, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.wrap { max-width: 680px; margin: 0 auto; padding: 4.5rem 1.6rem 3rem; }

/* Theme toggle */
.toggle {
  position: fixed; top: 1rem; right: 1rem; z-index: 9;
  background: transparent; border: 1px solid var(--rule); color: var(--faint);
  border-radius: 6px; padding: .4rem .5rem; font: inherit; line-height: 0;
  cursor: pointer; transition: border-color .18s, color .18s;
}
.toggle:hover { border-color: var(--accent); color: var(--accent); }
.toggle svg { width: 15px; height: 15px; fill: currentColor; display: block; }
.toggle .moon { display: none; }
html[data-theme="dark"] .toggle .sun { display: none; }
html[data-theme="dark"] .toggle .moon { display: block; }

/* Masthead */
h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 3.6rem;
  line-height: 1.02; letter-spacing: -.015em; color: var(--ink);
  text-align: center; margin: 0 0 1.1rem;
}
.links {
  display: flex; justify-content: center; align-items: center;
  gap: 1.35rem; margin: 0 0 2.6rem;
}
.links a { display: inline-flex; color: var(--faint); transition: color .18s, transform .18s; }
.links a:hover { color: var(--accent); transform: translateY(-1px); }
.links svg { width: 17px; height: 17px; fill: currentColor; display: block; }

/* Body */
/* height:auto is required. The <img> carries width/height attributes so the
   browser can reserve the right box before the file loads; without this the
   height attribute maps to a presentational height:440px and the portrait
   renders 168x440. */
.portrait { float: right; width: 168px; height: auto; border-radius: 7px; margin: .35rem 0 1rem 1.7rem; }
/* Hyphenation is scoped to paragraphs on purpose. Without it a long word like
   "conditioners" cannot fit at the end of a line, drops whole to the next one
   and leaves a 94px hole behind; hyphenated the gap is 19px. It is NOT applied
   to .fact dd, where the small grey caption would split "hu-man". Needs the
   lang attribute on <html> to pick a dictionary. */
p { margin: 0 0 1.15rem; font-size: .95rem; hyphens: auto; -webkit-hyphens: auto; }
a.in {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: background .15s, border-color .15s;
}
a.in:hover { border-bottom-color: var(--accent); background: var(--accent-wash); }
.hl { font-weight: 600; color: var(--ink); box-shadow: inset 0 -.4em 0 var(--accent-band); }

/* Facts */
.facts { margin: 2.1rem 0 2.2rem; }
.fact {
  display: flex; gap: 1.3rem; padding: .72rem 0;
  border-top: 1px solid var(--rule-soft); font-size: .9rem; line-height: 1.65;
}
.fact:last-child { border-bottom: 1px solid var(--rule-soft); }
.fact dt {
  flex: 0 0 5.4rem; margin: 0; font-size: .67rem; letter-spacing: .11em;
  text-transform: uppercase; font-weight: 700; color: var(--faint); padding-top: .3rem;
}
.fact dd { flex: 1; margin: 0; }
.fact dd b { font-weight: 600; color: var(--ink); }
.fact dd a {
  font-weight: 600; color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
}
.fact dd a:hover { background: var(--accent-wash); }
.fact dd .q { color: var(--faint); font-size: .84rem; }

/* Close */
.verse {
  font-style: italic; font-weight: 400; font-size: .88rem; line-height: 1.7;
  color: var(--muted); text-align: center;
  border-top: 1px solid var(--rule); padding-top: 1.7rem; margin-top: 2.4rem;
}
.verse .ref { font-style: normal; font-size: .76rem; color: var(--faint); }
footer {
  text-align: center; font-size: .72rem; color: var(--faint);
  margin-top: 2.2rem; line-height: 1.9;
}
footer .dot { color: var(--rule); margin: 0 .4rem; }

@media (max-width: 560px) {
  .wrap { padding-top: 3rem; }
  h1 { font-size: 2.9rem; }
  .portrait { float: none; display: block; margin: 0 auto 1.5rem; width: 140px; }
  .fact { flex-direction: column; gap: .15rem; }
  .fact dt { flex: none; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
