/* A House on a Truck — reading styles */

:root {
  --bg-1: #f6f5f2;
  --bg-2: #e9e6e0;
  --card-bg: #ffffff;
  --text: #232220;
  --muted: #6b6862;
  --accent: #a15c3e;
  --accent-2: #5c7a63;
  --name: #8a4b30;
  --border: rgba(35, 34, 32, 0.08);
  --rule: rgba(35, 34, 32, 0.14);
  --shadow: rgba(35, 34, 32, 0.12);
  --paper: #fffdf9;
  --quote-bg: #f4efe6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #17161a;
    --bg-2: #0f0e11;
    --card-bg: #201f24;
    --text: #ece9e4;
    --muted: #9a968f;
    --accent: #e0916b;
    --accent-2: #8fb79a;
    --name: #eaa77f;
    --border: rgba(236, 233, 228, 0.08);
    --rule: rgba(236, 233, 228, 0.16);
    --shadow: rgba(0, 0, 0, 0.4);
    --paper: #17161a;
    --quote-bg: #201f24;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--paper);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.wrap-wide { max-width: 52rem; }

a { color: var(--accent); }

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.25rem;
}
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}
.home-link:hover { color: var(--accent); }
.home-link svg { width: 0.9rem; height: 0.9rem; }
.topbar .here {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* reading progress */
.progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---- cover / landing ---- */
.cover-hero {
  padding: 3.5rem 0 2.5rem;
  background:
    radial-gradient(ellipse at 15% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(ellipse at 85% 20%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 60%),
    linear-gradient(var(--bg-1), var(--bg-2));
  border-bottom: 1px solid var(--border);
}
.cover-hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 2.75rem;
  align-items: center;
}
@media (max-width: 40rem) {
  .cover-hero .wrap {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    justify-items: center;
    text-align: center;
  }
}
.cover-hero img {
  width: 100%;
  max-width: 15rem;
  height: auto;
  display: block;
  border-radius: 0.35rem;
  box-shadow: 0 1.25rem 2.5rem var(--shadow);
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.75rem;
}
.cover-hero h1 {
  margin: 0 0 0.5rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(2.1rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.byline {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1rem;
}
.blurb {
  margin: 0 0 1.5rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 1.05rem;
  color: var(--text);
}
.surnames {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 2;
}
.start-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.start-link:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ---- contents ---- */
.contents { padding: 3rem 0 4rem; }
.contents h2 {
  margin: 0 0 1.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.contents h2 + .toc { margin-bottom: 3rem; }
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.toc li { border-bottom: 1px solid var(--border); }
.toc a {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.25rem 1.25rem;
  align-items: baseline;
  padding: 1.1rem 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.toc a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.toc .num {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.toc .title {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.toc .meta {
  grid-column: 2;
  font-size: 0.85rem;
  color: var(--muted);
}
.toc .fam {
  grid-column: 2;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
}
@media (max-width: 30rem) {
  .toc a { grid-template-columns: 1fr; }
  .toc .meta, .toc .fam { grid-column: 1; }
}

/* ---- chapter ---- */
.chapter-hero {
  padding: 3.25rem 0 1.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.chapter-hero h1 {
  margin: 0 0 0.6rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.9rem, 5.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.chapter-hero .subtitle {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
}
.chapter-hero .families {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 600;
}

article {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  padding-bottom: 1rem;
}
@media (min-width: 45rem) {
  article { font-size: 1.125rem; }
}
article p { margin: 0 0 1.35em; }
article .lede {
  font-size: 1.15em;
  line-height: 1.6;
  color: var(--muted);
}
article h2 {
  margin: 2.75rem 0 1.1rem;
  font-size: 1.35em;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
  scroll-margin-top: 4.5rem;
}
article h2::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-bottom: 0.9rem;
  background: var(--accent);
  opacity: 0.55;
}
article strong { color: var(--name); font-weight: 700; }
article em { font-style: italic; }
article ul { margin: 0 0 1.35em; padding-left: 1.25em; }
article li { margin-bottom: 0.35em; }

/* letters and other transcriptions */
.letter {
  margin: 2rem 0;
  padding: 1.35rem 1.5rem;
  background: var(--quote-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 0.4rem 0.4rem 0;
  font-size: 0.95em;
  line-height: 1.7;
}
.letter p { margin: 0 0 1em; }
.letter p:last-child { margin-bottom: 0; }

figure {
  margin: 2.25rem 0;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
}
figcaption {
  margin-top: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* in-chapter section list */
.sections {
  margin: 0 0 2.75rem;
  padding: 1.1rem 1.35rem;
  background: var(--quote-bg);
  border-radius: 0.6rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.sections h2 {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.sections ol {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}
.sections li { margin: 0.3rem 0; }
.sections a { color: var(--text); text-decoration: none; }
.sections a:hover { color: var(--accent); text-decoration: underline; }

/* ---- chapter nav ---- */
.chapter-nav {
  margin: 2rem 0 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 34rem) {
  .chapter-nav { grid-template-columns: 1fr; }
}
.chapter-nav a {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.chapter-nav a:hover { border-color: var(--accent); transform: translateY(-1px); }
.chapter-nav .dir {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.chapter-nav .name {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-weight: 600;
}
.chapter-nav .next { text-align: right; grid-column: 2; }
@media (max-width: 34rem) {
  .chapter-nav .next { text-align: left; grid-column: 1; }
}

footer.site {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
footer.site a { color: var(--muted); }

@media print {
  .topbar, .chapter-nav, .sections, .start-link { display: none; }
  body { background: #fff; color: #000; }
  article { font-size: 11pt; }
}
