/*
   The printable canon's sheet: the twenty-eight books made for paper.
   Proper chapter breaks, running heads (folios) with the book's name, verse
   numbers that survive the sheet, tables that never cut, the archaic register
   intact. On screen the page reads as the temple does; on paper it becometh
   a book. Generated companion to tools/print/gen-canon.py.
   TEMPLE MARK J-canon: the keeper's to set.
*/

body.print-canon main {
  max-width: 46rem;
}

/* On screen: each book openeth with a quiet leaf, the folio a whisper. */
.canon-folio {
  font-family: "Cormorant SC", Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--bureau);
  margin: 3rem 0 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-dark);
}
.canon-book:first-of-type .canon-folio { margin-top: 1rem; }

/* The books' own inner headings stay as the house wrote them. The KD
   demotion of 2026-10-04 turned each gathered book's h1 into an h2 of class
   .book-title; the dress below is byte-for-byte the same box. */
.canon-body > h1,
.canon-body > h2.book-title {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: normal;
  font-size: var(--step-3);
  margin-top: 0.5rem;
}
.canon-body h2.chapter-heading {
  margin-top: 2.2rem;
}

/* ---- KF (2026-10-05): the book-pill cluster, center-balanced -------------
   The twenty-eight pills wrapped raggedly (rows of 3, 2, 3, ... and a lone
   last pill). A grid of four columns setteth them in seven even rows on the
   screen; on a phone, two columns setteth them in fourteen even rows.
   Measured at 1440/1024/768 (4-col: 4,4,4,4,4,4,4; no overflow) and at 390
   (2-col: 2x14; no overflow). Nothing but the layout changeth. */
@media screen {
  body.print-canon .orientation-index {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-items: stretch;
    max-width: 48rem;
  }
  body.print-canon .orientation-index a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
@media screen and (max-width: 48rem) {
  body.print-canon .orientation-index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* The screen reading keeps the books' own styles, which arrive with the
   books' classes and need no duplication here. The canon sheet speaks only
   to paper and to the assembly. */

@media print {
  body.print-canon {
    background: #fff;
    color: #000;
    font-size: 11.5pt;
  }
  body.print-canon .no-print { display: none !important; }
  body.print-canon main { max-width: none; padding: 0; margin: 0; }

  /* Each book beginneth upon its own sheet; the folio rideth the head of it. */
  body.print-canon .canon-book {
    break-before: page;
    page-break-before: always;
  }
  .canon-folio {
    border: 0;
    margin: 0 0 1.2rem;
    padding: 0 0 0.5rem;
    border-bottom: 0.5pt solid #999;
    color: #000;
    font-size: 9pt;
  }

  /* The KD chapter jumps are of the screen; the sheets keep the verses. */
  body.print-canon .chapter-toc { display: none !important; }

  /* Chapters never orphan their heading from their opening verses. */
  .canon-body h2.chapter-heading {
    break-after: avoid;
    page-break-after: avoid;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 1.4rem;
  }
  /* A scripture block keepeth its verse-number beside its verse. */
  .canon-body .scripture-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-block: 0.7rem;
  }
  /* A long block may still break if it must; a short one never orphans. */
  .canon-body .scripture-block > .verse {
    orphans: 3;
    widows: 3;
  }
  /* Tables never cut across sheets if they fit; they keep their headers. */
  .canon-body table {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .canon-body thead { display: table-header-group; }
  .canon-body tr { break-inside: avoid; page-break-inside: avoid; }
  /* Margins ride where the house put them. */
  .canon-body .margin,
  .canon-body .elder-witness,
  .canon-body .lesson-note {
    font-size: 9.5pt;
  }
  /* The verses keep their numbers on paper. */
  .canon-body .verse-no { font-weight: 600; }
  .canon-body .citation { font-size: 9pt; }
  /* Links print as the house prints them: plain ink. */
  .canon-body a { color: #000; text-decoration: none; }
  .canon-body a[href^="http"]::after { content: ""; }

  @page { margin: 18mm 16mm; }
}
