/* ============================================================
   Cofounder — Read mode shared styles
   Reading typography optimized for ~70ch line, Fraunces serif body
   ============================================================ */

:root {
  --paper: #FAF7F2;
  --ink: #161411;
  --ink-soft: #3a342d;
  --muted: #6b6358;
  --rule: #e8e1d5;
  --red: #B83A2E;
  --red-deep: #8a2a20;

  --serif: 'Fraunces', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Menlo', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

/* ---------- Top nav ---------- */
.book-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.book-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.book-nav-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.book-nav-brand .dot { color: var(--red); }
.book-nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}
.book-nav-links a.active { color: var(--ink); }
.book-nav-links a { transition: color 0.15s ease; }

/* ---------- Hairline rule ---------- */
.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}
.rule-red {
  height: 2px;
  background: var(--red);
  border: 0;
}

/* ============================================================
   READ — table of contents
   ============================================================ */
.toc-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}
.toc-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}
.toc-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 0 0;
}
.toc-title .dot { color: var(--red); }
.toc-sub {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 14px 0 0;
  max-width: 640px;
}
.toc-meta {
  margin: 36px 0 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc-meta strong { color: var(--ink); font-weight: 500; }

.toc-intro {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 0 64px;
}

.toc-part {
  border-top: 1px solid var(--rule);
  padding: 40px 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
}
.toc-part:last-of-type { border-bottom: 1px solid var(--rule); }

.toc-part-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}
.toc-part-num strong {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--red);
  margin-bottom: 6px;
  font-style: italic;
}
.toc-part-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.toc-part-blurb {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 24px;
  max-width: 560px;
}
.toc-chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.toc-chapter {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px dashed var(--rule);
  font-family: var(--serif);
  transition: padding-left 0.15s ease;
}
.toc-chapter:first-child { border-top: 0; }
.toc-chapter:hover { padding-left: 6px; }
.toc-chapter:hover .toc-ch-title { color: var(--red); }
.toc-ch-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}
.toc-ch-title {
  font-size: 19px;
  font-weight: 400;
  line-height: 1.35;
  transition: color 0.15s ease;
}
.toc-ch-title em {
  font-style: italic;
  color: var(--ink-soft);
}
.toc-ch-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.status-published {
  color: var(--red);
  background: rgba(184, 58, 46, 0.08);
}
.status-draft {
  color: var(--ink-soft);
  background: rgba(22, 20, 17, 0.06);
}
.status-soon {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--rule);
}
.toc-chapter.is-soon { opacity: 0.55; pointer-events: none; }
.toc-chapter.is-soon:hover { padding-left: 0; }

@media (max-width: 720px) {
  .toc-page { padding: 56px 22px 80px; }
  .toc-part { grid-template-columns: 1fr; gap: 14px; }
  .toc-chapter { grid-template-columns: 40px 1fr; }
  .toc-ch-status { grid-column: 2; margin-top: 4px; }
}

/* ============================================================
   READ — chapter / long-form text
   ============================================================ */
.chapter {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 28px 96px;
}
.chapter-head {
  margin-bottom: 56px;
  text-align: left;
}
.chapter-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.chapter-eyebrow .red { color: var(--red); }
.chapter-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.022em;
  margin: 0;
}
.chapter-deck {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 22px 0 0;
}
.chapter-meta {
  margin-top: 32px;
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.chapter-meta-rule {
  width: 60px;
  height: 2px;
  background: var(--red);
  margin-top: 32px;
}

.chapter-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink);
}
.chapter-body p {
  margin: 0 0 1.4em;
}
.chapter-body p.lead { font-size: 21px; line-height: 1.6; }
.chapter-body p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 5.4em;
  line-height: 0.85;
  float: left;
  margin: 0.06em 0.08em 0 -0.04em;
  color: var(--red);
}
.chapter-body h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.4em 0 0.8em;
}
.chapter-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 2em 0 0.6em;
}
.chapter-body em { font-style: italic; }
.chapter-body strong { font-weight: 600; }
.chapter-body blockquote {
  margin: 1.8em 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--red);
  font-style: italic;
  color: var(--ink-soft);
}
.chapter-body hr.divider {
  border: 0;
  height: 0;
  margin: 2.4em 0;
  text-align: center;
}
.chapter-body hr.divider::after {
  content: '· · ·';
  letter-spacing: 0.6em;
  color: var(--muted);
  font-size: 14px;
}
.chapter-body a {
  color: var(--red);
  border-bottom: 1px solid rgba(184, 58, 46, 0.3);
  transition: border-color 0.15s ease;
}
.chapter-body a:hover { border-color: var(--red); }

/* Footer / chapter nav */
.chapter-foot {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.chapter-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}
.chapter-prevnext a {
  flex: 1;
  font-family: var(--serif);
  padding: 18px 0;
}
.chapter-prevnext a.next { text-align: right; }
.chapter-prevnext .label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.chapter-prevnext .title {
  font-size: 18px;
  font-weight: 500;
}

/* Feedback / comments header */
.feedback-head {
  margin: 56px 0 24px;
}
.feedback-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 8px;
}
.feedback-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  margin: 0 0 8px;
}
.feedback-blurb {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

/* utterances iframe styling tweak */
.utterances {
  max-width: 100% !important;
}

/* ---------- Footer (compact) ---------- */
.book-foot {
  border-top: 1px solid var(--rule);
  padding: 36px 32px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.book-foot a:hover { color: var(--red); }
