.rich-content { min-width:0; max-width:650px; padding-bottom:calc(145px + env(safe-area-inset-bottom)); }
/* Chapter text follows the bounded header/footer frame and its responsive gutters. */
.chapter-page > .rich-content,
.chapter-page > .rich-content > .chapter-heading { max-width:none; }
.chapter-page > .rich-content > .chapter-heading { text-wrap:wrap; overflow-wrap:anywhere; text-align:center; }
/* Preview typography trial; keep this value isolated for easy adjustment. */
.chapter-page .entry-body { font-size:20px; line-height:1.25; }
.rich-content > .entry-body { max-width:100%; margin:0 0 1.5em; white-space:pre-wrap; overflow-wrap:anywhere; }
.chapter-page > .rich-content > .entry-body { margin-bottom:20px; }
.rich-content .rich-heading { margin:1.8em 0 .7em; font:400 32px/1.5 var(--type); letter-spacing:-.025em; overflow-wrap:anywhere; text-wrap:wrap; }
.rich-content h1.rich-heading { font-size:42px; }
.rich-content h2.rich-heading { font-size:36px; }
.rich-content h3.rich-heading { font-size:32px; }
.rich-content h4.rich-heading { font-size:28px; }
.rich-content h5.rich-heading { font-size:26px; }
.rich-content h6.rich-heading { font-size:25px; }
.rich-content .rich-divider { border:0; border-top:1px solid var(--rule); margin:2.5em 0; }
.rich-content .rich-spacer { min-height:1.5em; }
.rich-content .rich-table-scroll { max-width:100%; margin:2em 0; overflow-x:auto; overscroll-behavior-inline:contain; border:1px solid var(--rule); }
.rich-content .rich-table-scroll:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.rich-content table { width:max-content; min-width:100%; border-collapse:collapse; text-align:left; }
.rich-content caption { padding:12px 14px; color:var(--quiet); text-align:left; }
.rich-content th,.rich-content td { min-width:9em; padding:10px 14px; border-top:1px solid var(--rule); border-right:1px solid var(--rule); vertical-align:top; }
.rich-content th { font-weight:600; }
.rich-content a { text-decoration:underline; text-underline-offset:3px; overflow-wrap:anywhere; }
.rich-content .rich-figure { max-width:100%; margin:2.25em 0; }
.rich-content .rich-figure img { display:block; width:auto; height:auto; max-width:100%; max-height:80vh; object-fit:contain; }
.rich-content .rich-figure figcaption { margin-top:.7em; color:var(--quiet); font-size:.9em; }
.homepage .read-chapter-link { display:inline-block; margin-top:14px; color:#21334a; font:400 12px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing:.025em; text-decoration:underline; text-underline-offset:4px; }
.homepage .read-chapter-link:hover { color:#17283a; text-decoration-thickness:2px; }
.homepage .read-chapter-link:focus-visible { outline:2px solid #21334a; outline-offset:4px; }
.homepage:not(.scene-ready) .read-chapter-link { margin-top:18px; }
.notebook .rich-content { padding-bottom:calc(145px + env(safe-area-inset-bottom)); }
@media(max-width:760px) {
  .rich-content h1.rich-heading { font-size:36px; }
  .rich-content h2.rich-heading { font-size:32px; }
  .rich-content h3.rich-heading { font-size:28px; }
  .rich-content h4.rich-heading { font-size:26px; }
  .rich-content h5.rich-heading { font-size:24px; }
  .rich-content h6.rich-heading { font-size:23px; }
  .rich-content { padding-bottom:calc(130px + env(safe-area-inset-bottom)); }
  .rich-content th,.rich-content td { min-width:8em; padding:9px 11px; }
}
@media print {
  .rich-content { padding-bottom:0; }
}

/* Handwritten marginalia. Text is static; an optional script adds decorative arrows. */
@font-face {
  font-family:"Caveat Questions";
  src:url("/fonts/Caveat-variable.ttf") format("truetype");
  font-style:normal;
  font-weight:400 700;
  font-display:swap;
}
.draft-preview-label { margin:30px 0; color:var(--quiet); font:12px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing:.04em; }
.annotated-passage { --note-ink:#743e38; position:relative; min-width:0; margin-block:0 24px; }
.passage-copy { min-width:0; }
.passage-copy > .entry-body { max-width:100%; margin:0 0 20px; }
.passage-copy > :first-child { margin-top:0; }
.passage-copy > :last-child { margin-bottom:0; }
.passage-notes { min-width:0; }
.margin-note {
  margin:18px 0 0 18px;
  padding:0 0 0 14px;
  border-inline-start:2px solid #8b4b43;
  color:var(--note-ink);
  max-width:32rem;
  overflow-wrap:anywhere;
  font:400 19px/1.4 "Kalam Notes","Comic Sans MS",cursive;
  letter-spacing:normal;
}
.rich-content .margin-note .entry-body,
.rich-content .margin-note .rich-heading { font:inherit; letter-spacing:normal; white-space:pre-wrap; max-width:none; margin:0 0 .6em; }
.rich-content .margin-note :last-child { margin-bottom:0; }
.margin-note a { text-underline-offset:3px; }
@media (min-width:1100px) {
  .notebook .frame:has(.margin-note) { max-width:1120px; }
  .notebook .rich-content:has(.margin-note) { max-width:none; padding-inline:190px; }
  .annotated-passage { display:grid; grid-template-columns:minmax(0,1fr) 170px; gap:20px; margin-inline-end:-190px; align-items:start; }
  .margin-note { max-width:none; border:0; padding:0; margin:0; }
  .margin-note + .margin-note { margin-top:24px; }
}
@media print {
  .draft-preview-label { color:#111; }
  .notebook .rich-content:has(.margin-note) { padding-inline:0; }
  .annotated-passage { display:block; margin-inline-end:0; }
  .margin-note { margin:16px 0 0 16px; padding-inline-start:12px; border-inline-start:1px solid #555; color:#111; break-inside:avoid; }
}

/* Chapter title: subtract 4px and reduce the unitless line-height by one third.
   An explicit 8px lower margin adds breathing room; the previous CSS gap was 0. */
.chapter-page > .rich-content > .chapter-heading { font-size:44px; line-height:1.0666667; margin-bottom:8px; }
@media (max-width:760px) {
  .chapter-page > .rich-content > .chapter-heading { font-size:clamp(26px,calc(7vw - 4px),40px); }
}
/* Arrow paths are decorative, never focusable, and cannot intercept text selection. */
.margin-note-arrow { position:absolute; inset:0; width:100%; height:100%; overflow:visible; pointer-events:none; color:var(--note-ink); }
.margin-note-arrow path { fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
@media (max-width:1099px) {
  .has-margin-arrow > .passage-notes > .margin-note:first-child { margin-top:36px; }
}
@media print {
  .margin-note-arrow { display:none; }
  .has-margin-arrow > .passage-notes > .margin-note:first-child { margin-top:16px; }
}

/* An explicit inline target reserves an ink lane below that line only while
   arrows are enabled. The empty anchor adds no text, focus stop or width. */
.has-margin-arrow .margin-anchor { display:inline-block; width:0; height:var(--margin-lane-size,22px); vertical-align:calc(-1 * var(--margin-lane-size,22px)); }
@media print {
  .has-margin-arrow .margin-anchor { display:inline; }
}

/* Neat Kalam for red reflections; flowing Caveat for blue questions.
   Requested cyan accents and darker related question ink remain unchanged. */
@font-face {
  font-family:"Kalam Notes";
  src:url("/fonts/Kalam-Regular.ttf") format("truetype");
  font-style:normal;
  font-weight:400;
  font-display:swap;
}
.margin-question {
  --note-ink:#006a7b;
  border-inline-start-color:rgb(2,180,210);
  font:500 24px/1.25 "Caveat Questions","Segoe Print","Bradley Hand",cursive;
}
.margin-question-arrow { color:rgb(2,180,210); }
.question-preview { margin-top:48px; border-top:1px dashed var(--rule); padding-top:12px; }
.question-preview > .draft-preview-label { margin:12px 0 24px; }
@media print {
  .margin-question { --note-ink:#111; color:#111; border-color:#555; }
}

/* A restrained continuation on the typewriter sheet. */
.homepage .paper-actions .read-chapter-link { font:400 14px/1.4 var(--type); letter-spacing:-.02em; text-decoration:none; }
.homepage .paper-actions .read-chapter-link:hover { text-decoration:underline; }
