@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&family=Inter:wght@300;400;500;600;700&family=Caveat:wght@400;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #1c1a17;
  --ink-2: #3d3a35;
  --ink-3: #6b6760;
  --rule: #ddd8cf;
  --paper: #faf8f4;
  --page: #ffffff;
  --accent: #b5451b;
  --accent-pale: #f7ede7;
  --warm: #c8a97a;
  --chapter-bg: #f4f0e8;
  --sketch: #2d2a25;
  --nav-w: 220px;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
  background: var(--paper);
}

section[id] {
  scroll-margin-top: 1.5rem;
}

body {
  font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
  color: var(--ink);
  line-height: 1.75;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── Floating sidebar nav ── */
.float-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--sketch);
  color: #e8e4dc;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-brand {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
  padding: 1.6rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.4;
}

.float-nav nav {
  flex: 1;
  padding: 0.75rem 0;
}

.float-nav nav a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: rgba(232, 228, 220, 0.65);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.float-nav nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.float-nav nav a.active {
  color: #fff;
  background: rgba(181, 69, 27, 0.18);
  border-left-color: var(--accent);
}

.nav-num {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--warm);
  min-width: 1.4rem;
  opacity: 0.8;
}

.float-nav nav a.active .nav-num {
  color: var(--accent);
  opacity: 1;
}

.nav-title {
  line-height: 1.35;
}

.nav-footer {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  color: rgba(232, 228, 220, 0.4);
  padding: 1rem 1.25rem 1.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.6;
}

.nav-toggle {
  display: none;
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 200;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 6px;
  background: var(--sketch);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* ── Main content area ── */
.book-wrap {
  margin-left: var(--nav-w);
  min-height: 100vh;
  background: var(--paper);
}

/* ── Cover ── */
#cover {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sketch);
  padding: 3rem 2rem;
}

.cover {
  max-width: 640px;
  text-align: center;
  color: #f0ece4;
}

.cover-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 2rem;
}

.cover h1 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 300;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 1.5rem;
}

.cover h1 em {
  font-style: italic;
  color: var(--warm);
}

.cover-sub {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.65;
  color: rgba(240, 236, 228, 0.75);
  max-width: 480px;
  margin: 0 auto 2.5rem;
}

.cover hr {
  border: none;
  border-top: 1px solid rgba(200, 169, 122, 0.35);
  width: 60px;
  margin: 0 auto 2rem;
}

.cover-author {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.04em;
}

.cover-year {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: rgba(240, 236, 228, 0.5);
  margin-top: 0.4rem;
}

/* ── Epigraph ── */
.epigraph {
  max-width: 560px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  text-align: center;
}

.epigraph blockquote {
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink-2);
  line-height: 1.65;
  border: none;
}

.epigraph cite {
  display: block;
  margin-top: 1.25rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-style: normal;
  color: var(--ink-3);
}

/* ── Table of contents ── */
.toc-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.toc-page > h2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.toc-list {
  list-style: none;
}

.toc-list li {
  border-bottom: 1px solid var(--rule);
}

.toc-list li a {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.1rem 0;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.toc-list li a:hover {
  color: var(--accent);
}

.toc-num {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warm);
  min-width: 1.5rem;
  padding-top: 0.15rem;
}

.toc-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toc-title {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}

.toc-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.45;
}

/* ── Chapters ── */
.chapter {
  background: var(--page);
  border-top: 1px solid var(--rule);
}

.chapter-header {
  background: var(--chapter-bg);
  border-bottom: 1px solid var(--rule);
  padding: 4rem 2rem 3rem;
}

.chapter-header-inner {
  max-width: 680px;
  margin: 0 auto;
}

.chapter-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.chapter-header h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.chapter-deck {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink-3);
  line-height: 1.6;
  max-width: 560px;
}

.chapter-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.chapter-body > p {
  margin-bottom: 1.25rem;
  color: var(--ink-2);
}

.chapter-body h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2.5rem 0 1rem;
}

.chapter-body ul,
.chapter-body ol {
  margin: 0 0 1.5rem 1.25rem;
  color: var(--ink-2);
}

.chapter-body li {
  margin-bottom: 0.6rem;
  padding-left: 0.25rem;
}

.chapter-body strong {
  color: var(--ink);
  font-weight: 700;
}

/* ── Scene block ── */
.scene {
  background: var(--accent-pale);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  border-radius: 0 6px 6px 0;
}

.scene-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.scene p {
  font-size: 0.95rem;
  color: var(--ink-2);
  margin-bottom: 0.85rem;
}

.scene p:last-child {
  margin-bottom: 0;
}

/* ── Diagrams ── */
.diagram-wrap {
  margin: 2.5rem 0;
  text-align: center;
}

.diagram-wrap svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.diagram-wrap--xl svg {
  max-width: 900px;
  width: 100%;
  min-width: min(900px, 100%);
}

.diagram-caption {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.5;
  margin-top: 0.85rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Status colors (matches launch tracker palette) ── */
.status-red {
  color: #b5451b;
  font-weight: 600;
}

.status-yellow {
  color: #8a6000;
  font-weight: 600;
}

.status-green {
  color: #2a7a3a;
  font-weight: 600;
}

/* ── Project brief question flow ── */
.brief-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.25rem auto 1.5rem;
  max-width: 440px;
}

.brief-step {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  line-height: 1.45;
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.8rem 1.1rem;
}

.brief-arrow {
  color: var(--warm);
  font-size: 0.65rem;
  line-height: 1;
  padding: 0.4rem 0;
}

/* ── Pull quote ── */
.pullquote {
  margin: 2.5rem 0;
  padding: 1.5rem 0 1.5rem 1.5rem;
  border-left: 3px solid var(--warm);
}

.pullquote p {
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink-2);
  line-height: 1.65;
}

/* ── Callout ── */
.callout {
  background: var(--chapter-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}

.callout-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.65rem;
}

.callout p {
  font-size: 0.92rem;
  color: var(--ink-2);
  margin-bottom: 0;
}

/* ── Section divider ── */
.section-divider {
  text-align: center;
  color: var(--warm);
  font-size: 1.1rem;
  letter-spacing: 0.5em;
  margin: 2.5rem 0;
}

/* ── Tables ── */
.book-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

.book-table thead {
  background: var(--chapter-bg);
}

.book-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--rule);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.book-table td {
  padding: 0.85rem 1rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  line-height: 1.5;
}

.book-table tr:last-child td {
  border-bottom: none;
}

.book-table td strong {
  color: var(--ink);
}

/* ── About page ── */
.about-page {
  background: var(--sketch);
  color: #e8e4dc;
  padding: 5rem 2rem;
}

.about-inner {
  max-width: 560px;
  margin: 0 auto;
}

.about-inner h2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 1.5rem;
}

.about-inner p {
  font-size: 0.95rem;
  color: rgba(232, 228, 220, 0.8);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.about-inner .name {
  font-family: 'Inter', sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: #fff;
  margin-bottom: 0.25rem;
}

.about-inner .edition {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: rgba(232, 228, 220, 0.45);
  margin-top: 2rem;
}

/* ── Responsive ── */
@media (max-width: 820px) {
  .float-nav {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .float-nav.open {
    transform: translateX(0);
  }

  .nav-toggle {
    display: block;
  }

  .book-wrap {
    margin-left: 0;
  }

  #cover {
    padding-top: 4.5rem;
  }

  .chapter-header {
    padding: 3.5rem 1.5rem 2.5rem;
  }

  .chapter-body {
    padding: 2rem 1.5rem 3rem;
  }

  .book-table {
    font-size: 0.78rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .cover h1 {
    font-size: 2rem;
  }

  .toc-list li a {
    gap: 0.85rem;
  }
}
