/* The Knowledge Custodian — shared styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Hero image (e.g. part 1 opening illustration) */
.hero-image {
  margin: 40px 0 32px;
  text-align: center;
}
.hero-image img {
  width: 100%;
  max-width: 720px;
  height: auto;
  display: block;
  margin: 0 auto;
  border: 1px solid #e0ddd4;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.hero-image figcaption {
  margin-top: 14px;
  font-size: 14px;
  font-style: italic;
  color: #666;
  line-height: 1.5;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}


body {
  font-family: 'Georgia', serif;
  background: #fafaf8;
  color: #1a1a1a;
  line-height: 1.8;
  font-size: 17px;
}

/* Logo */
.logo { position: fixed; top: 66px; left: 20px; z-index: 100; }
.logo a { border-bottom: none; }
.logo a:hover { border-bottom: none; }
.logo img { height: 36px; opacity: 0.7; }

/* Part nav — horizontal top bar */
.part-nav {
  position: fixed; top: 0; left: 0; right: 0;
  background: #f0efe8;
  border-bottom: 1px solid #e0ddd4;
  display: flex; justify-content: center; align-items: center;
  gap: 8px; z-index: 100;
  padding: 10px 20px;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
}
.part-nav a {
  color: #888; text-decoration: none;
  padding: 4px 12px; border-radius: 4px;
  transition: all 0.2s;
  border-bottom: none;
  white-space: nowrap;
}
.part-nav a:hover { color: #2a5a3a; background: rgba(42,90,58,0.06); border-bottom: none; }
.part-nav a.active { color: #fff; background: #2a5a3a; }
.part-nav .sep { color: #ccc; user-select: none; }

/* Main layout */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 100px 20px 120px;
}

/* Series header */
.series-title {
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 3px; color: #999;
  margin-bottom: 8px; font-family: -apple-system, sans-serif;
}
.part-title {
  font-size: 42px; font-weight: 400;
  line-height: 1.2; margin-bottom: 8px;
}
.part-subtitle {
  font-size: 20px; color: #666;
  font-style: italic; margin-bottom: 48px;
}

/* Headings */
h2 {
  font-size: 24px; font-weight: 400;
  margin-top: 56px; margin-bottom: 20px;
  border-bottom: 1px solid #eee; padding-bottom: 8px;
}

/* Prose */
p { margin-bottom: 20px; }
.lead { font-size: 19px; color: #333; }
strong { font-weight: 600; }
em { font-style: italic; }
a { color: #2a5a3a; text-decoration: none; border-bottom: 1px solid #c9d4c9; }
a:hover { border-bottom-color: #2a5a3a; }

/* Diagrams */
.diagram {
  margin: 40px 0; padding: 32px;
  background: #fff; border: 1px solid #e0ddd4;
  border-radius: 8px;
}
.diagram-title {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 2px; color: #999;
  margin-bottom: 24px; text-align: center;
  font-family: -apple-system, sans-serif;
}
.diagram-caption {
  font-size: 13px; color: #888;
  text-align: center; margin-top: 20px;
  font-style: italic;
}
.diagram-columns {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 32px; align-items: start;
}
.diagram-column {
  text-align: center;
}
.diagram-column-label {
  font-size: 13px; font-weight: 600;
  font-family: -apple-system, sans-serif;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid #e0ddd4;
}
.diagram-column-label.expert { color: #2a5a3a; border-bottom-color: #2a5a3a; }
.diagram-column-label.ai { color: #8a5a3a; border-bottom-color: #c9b896; }
.diagram-item {
  font-size: 14px; font-family: -apple-system, sans-serif;
  padding: 6px 12px; margin: 6px 0;
  border-radius: 4px; color: #444;
}
.diagram-item.expert-item { background: #f0f5f0; }
.diagram-item.ai-item { background: #f5f0e8; }
.diagram-stat {
  font-size: 36px; font-weight: 600; color: #2a5a3a;
  text-align: center; margin: 16px 0 4px;
  font-family: -apple-system, sans-serif;
}
.diagram-stat-label {
  font-size: 13px; color: #888; text-align: center;
  font-family: -apple-system, sans-serif;
}
.diagram-flow {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.diagram-flow-item {
  font-size: 13px; font-family: -apple-system, sans-serif;
  padding: 8px 16px; border-radius: 6px;
  color: #444; width: 100%; text-align: center;
}
.diagram-arrow {
  font-size: 18px; color: #ccc; line-height: 1;
}
.diagram-loop-arrow {
  font-size: 13px; color: #2a5a3a; font-style: italic;
  margin: 4px 0;
}
.bias-bar {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0; font-family: -apple-system, sans-serif;
}
.bias-bar-label {
  font-size: 13px; color: #444; width: 100px; text-align: right;
  flex-shrink: 0;
}
.bias-bar-track {
  flex: 1; height: 24px; background: #f5f3ee;
  border-radius: 4px; overflow: hidden; position: relative;
}
.bias-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #c9b896, #8a5a3a);
}
.bias-bar-value {
  font-size: 12px; color: #888; width: 40px; flex-shrink: 0;
}
.bullshit-table {
  width: 100%; border-collapse: collapse;
  font-family: -apple-system, sans-serif; font-size: 14px;
  margin: 16px 0;
}
.bullshit-table th {
  text-align: left; padding: 10px 14px;
  background: #f5f3ee; border-bottom: 2px solid #e0ddd4;
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 1px; color: #999; font-weight: 600;
}
.bullshit-table td {
  padding: 10px 14px; border-bottom: 1px solid #eee;
  vertical-align: top; line-height: 1.5;
}
.bullshit-table td:first-child {
  font-weight: 600; color: #2a5a3a; white-space: nowrap;
}
.bullshit-table tr:last-child td { border-bottom: none; }
.convo-line {
  font-size: 13px; font-family: -apple-system, sans-serif;
  padding: 6px 12px; margin: 4px 0; border-radius: 6px;
  line-height: 1.5;
}
.convo-line.human { background: #eef2ee; text-align: right; margin-left: 20%; }
.convo-line.ai { background: #f5f0e8; text-align: left; margin-right: 20%; }
.convo-line.grounding { background: #e8eef5; text-align: right; margin-left: 20%; font-style: italic; color: #4a6fa5; }

@media (max-width: 768px) {
  .diagram-columns { grid-template-columns: 1fr; }
}

/* Pull quote */
.pullquote {
  font-size: 22px; line-height: 1.5;
  color: #2a5a3a; border-left: 3px solid #c9b896;
  padding: 16px 0 16px 24px; margin: 36px 0;
  font-style: italic;
}

/* Superscript footnote links */
sup a {
  color: #2a5a3a;
  font-size: 12px;
  border-bottom: none;
  font-family: -apple-system, sans-serif;
}
sup a:hover { color: #c9b896; border-bottom: none; }

/* Claude aside */
.claude-aside {
  background: #f5f3ee; border-left: 3px solid #c9b896;
  padding: 24px 28px; margin: 36px 0; border-radius: 0 8px 8px 0;
}
.claude-aside .aside-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 2px; color: #999;
  margin-bottom: 12px; font-family: -apple-system, sans-serif;
  display: flex; align-items: center; gap: 8px;
}
.claude-aside .aside-label::before {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='2' fill='%23D4A574'/%3E%3Cellipse cx='12' cy='5' rx='2' ry='4' fill='%23D4A574' opacity='0.9'/%3E%3Cellipse cx='12' cy='19' rx='2' ry='4' fill='%23D4A574' opacity='0.9'/%3E%3Cellipse cx='5' cy='12' rx='4' ry='2' fill='%23D4A574' opacity='0.9'/%3E%3Cellipse cx='19' cy='12' rx='4' ry='2' fill='%23D4A574' opacity='0.9'/%3E%3Cellipse cx='7.1' cy='7.1' rx='1.5' ry='3.5' transform='rotate(-45 7.1 7.1)' fill='%23D4A574' opacity='0.6'/%3E%3Cellipse cx='16.9' cy='16.9' rx='1.5' ry='3.5' transform='rotate(-45 16.9 16.9)' fill='%23D4A574' opacity='0.6'/%3E%3Cellipse cx='16.9' cy='7.1' rx='1.5' ry='3.5' transform='rotate(45 16.9 7.1)' fill='%23D4A574' opacity='0.6'/%3E%3Cellipse cx='7.1' cy='16.9' rx='1.5' ry='3.5' transform='rotate(45 7.1 16.9)' fill='%23D4A574' opacity='0.6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}
.claude-aside p {
  font-size: 15px; line-height: 1.8;
  color: #555; margin-bottom: 14px;
}
.claude-aside p:last-child { margin-bottom: 0; }

/* Extended claude-aside for the postscript — keeps the warm box and sparkle
   but allows h2 subheadings and longer prose inside */
.postscript-aside {
  padding: 32px 40px;
}
.postscript-aside h2 {
  font-size: 22px; font-weight: 400;
  margin-top: 40px; margin-bottom: 16px;
  border-bottom: 1px solid #e0ddd4; padding-bottom: 8px;
  color: #2a5a3a;
  font-family: 'Georgia', serif;
}
.postscript-aside h2:first-of-type {
  margin-top: 16px;
}
.postscript-aside p {
  font-size: 16px;
  color: #333;
}
.postscript-aside .aside-label {
  margin-bottom: 20px;
  font-size: 12px;
}

/* Closing */
.closing-question {
  margin-top: 56px; padding: 32px;
  background: #f5f3ee; border-radius: 8px;
}
.closing-question p.question {
  font-size: 20px; font-style: italic;
  color: #2a5a3a; margin-bottom: 16px; line-height: 1.5;
}
.closing-question p { font-size: 15px; color: #555; line-height: 1.8; }
.closing-mirror {
  font-size: 17px; color: #888;
  font-style: italic; text-align: center; margin-top: 32px;
}

/* Notes / footnotes */
.notes {
  margin-top: 60px; padding-top: 24px;
  border-top: 1px solid #e0ddd4;
}
.notes h3 {
  font-size: 14px; text-transform: uppercase;
  letter-spacing: 2px; color: #999;
  margin-bottom: 16px; font-family: -apple-system, sans-serif;
}
.notes ol {
  font-size: 14px; color: #666;
  line-height: 1.8; padding-left: 20px;
}
.notes ol li { margin-bottom: 6px; }
.notes ol li a { color: #888; word-break: break-all; }

/* Horizontal rule / section divider */
hr {
  border: none;
  border-top: 1px solid #e0ddd4;
  margin: 48px 0;
}

/* Blockquote */
blockquote {
  border-left: 3px solid #e0ddd4;
  padding-left: 20px;
  margin: 24px 0;
  color: #555;
  font-style: italic;
}

/* Chapter footer nav */
.chapter-footer-nav {
  margin-top: 80px; padding-top: 32px;
  border-top: 1px solid #eee;
  display: flex; justify-content: space-between;
}
.chapter-footer-nav a {
  font-size: 14px; font-family: -apple-system, sans-serif;
  color: #888; text-decoration: none; border: none;
}
.chapter-footer-nav a:hover { color: #2a5a3a; }
.chapter-footer-nav .next { text-align: right; }
.chapter-footer-nav .label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: #bbb; display: block; margin-bottom: 4px;
}

/* Series closing */
.series-closing {
  margin-top: 48px;
  padding: 24px 0;
  font-size: 15px;
  color: #888;
  font-style: italic;
  line-height: 1.8;
}

/* Print styles */
@media print {
  body { font-size: 12px; }
  .lead { font-size: 14px; }
  .part-title { font-size: 32px; }
  .part-subtitle { font-size: 16px; }
  h2 { font-size: 19px; }
  .pullquote { font-size: 17px; }

  .pullquote { break-inside: avoid; page-break-inside: avoid; }
  .claude-aside { break-inside: avoid; page-break-inside: avoid; }
  .closing-question { break-inside: avoid; page-break-inside: avoid; }
  blockquote { break-inside: avoid; page-break-inside: avoid; }

  h2 { break-after: avoid; page-break-after: avoid; }

  .part-nav { display: none; }
  .logo { position: static; margin-bottom: 24px; }

  @page { margin: 2cm 1.5cm 1.5cm 1.5cm; }

  .page { margin: 0 auto; padding: 0 20px; }
}

@media (max-width: 768px) {
  .part-title { font-size: 32px; }
  .part-nav {
    position: static; margin-bottom: 0;
    font-size: 11px; gap: 4px; padding: 8px 12px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .part-nav a { padding: 4px 8px; }
  .logo { position: static; padding: 10px 0 0 16px; }
  .page { padding: 20px 16px 80px; }
}
