/* ════════════════════════════════════════════════════════════
   04-layout.css — The Compositor's Garden
   CSS Grid definitions for the page body and major sections.
   No typography. No page media. If it affects how elements
   are positioned in space, it lives here.
   ════════════════════════════════════════════════════════════ */

/* ── Page body grid ──────────────────────────────────────────── */
/* Three column tracks:
   - inner margin (fixed, narrow — 2rem)
   - text column  (flexible, 1fr)
   - notes column (fixed, wider — 6rem, for marginal use)       */

.chapter-body {
  display:               grid;
  grid-template-columns: 2rem 1fr 6rem;
  grid-template-areas:   "margin  text  notes";
  column-gap:            1.5rem;
  max-width:             52rem;
  margin:                0 auto;
  padding:               0 2rem;
}

/* All block-level content defaults to the text column          */
.chapter-body > *,
.chapter-body p,
.chapter-body h2,
.chapter-body blockquote,
.chapter-body figure,
.chapter-body .callout,
.chapter-body .sep,
.chapter-body .saying,
.chapter-body .saying,
.chapter-body .planting-calendar,
.chapter-body .calendar-note,
.chapter-body .teachers-sayings {
  grid-column:  2;  /* text column */
}

/* Planting calendar: two columns within the text column        */
.planting-calendar {
  column-count: 2;
  column-gap:   2rem;
  column-rule:  1px solid var(--rule);
  column-fill:  auto;
}

/* ── Display pages (title, half-title, dedication, etc.) ────── */
.display-page {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      100vh;  /* full page in browser preview         */
}

.title-page-inner {
  text-align:  center;
  padding:     4rem 3rem;
  display:     flex;
  flex-direction: column;
  align-items: center;
  gap:         0;
}

.half-title-page { background: var(--paper); }
.title-page      { background: var(--paper); }

.dedication-page {
  background: var(--paper);
}

.dedication-inner {
  text-align: center;
  padding:    0 3rem;
}

.colophon-page { background: var(--paper); }
.colophon-inner {
  padding: 2rem 3rem;
  text-align: center;
}

/* ── Part opener ─────────────────────────────────────────────── */
.part-opener {
  background: var(--paper);
}

.part-opener-inner {
  text-align: center;
  padding:    0 3rem;
}

/* ── Chapter opener ──────────────────────────────────────────── */
.chapter-label-block {
  max-width:  52rem;
  margin:     0 auto;
  padding:    0 2rem;
  /* Sits in the chapter-opener page's large head margin.
     The @page chapter-opener gives 2in of head space above.     */
}

/* ── TOC layout ──────────────────────────────────────────────── */
.toc-page {
  max-width: 52rem;
  margin:    0 auto;
  padding:   0 2rem;
}

.toc {
  display:        flex;
  flex-direction: column;
  gap:            0;
}

.toc-entry {
  display:         flex;
  align-items:     baseline;
  gap:             0.5rem;
  padding:         0.45rem 0;
  border-bottom:   1px solid var(--highlight);
}

.toc-entry:last-child { border-bottom: none; }

.toc-num {
  font-family:    var(--font-ui);
  font-size:      var(--text-xs);
  color:          var(--accent);
  flex-shrink:    0;
  width:          1.5rem;
  text-align:     right;
}

.toc-item-title {
  font-family: var(--font-body);
  font-size:   var(--text-base);
  color:       var(--ink);
  flex-shrink: 0;
}

.toc-leader {
  flex:         1;
  border-bottom: 1px dotted var(--rule);
  margin-bottom: 0.2rem;
  margin-left:   0.4rem;
  margin-right:  0.4rem;
}

.toc-page-num {
  font-family:          var(--font-ui);
  font-size:            var(--text-xs);
  color:                var(--ink-faint);
  flex-shrink:          0;
  font-variant-numeric: lining-nums tabular-nums;
  min-width:            2rem;
  text-align:           right;
}

.toc-section-label {
  font-family:    var(--font-ui);
  font-size:      var(--text-xs);
  font-weight:    500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          var(--ink-faint);
  padding:        1.25rem 0 0.4rem;
  border-bottom:  1px solid var(--rule);
}

.toc-front, .toc-back {
  padding-left: 1.5rem; /* indent, no number */
}

/* ── Preface layout ──────────────────────────────────────────── */
.preface-page {
  max-width: 52rem;
  margin:    0 auto;
  padding:   0 2rem;
}

/* ── Notes / acknowledgements / back matter ─────────────────── */
.notes-section,
.acknowledgements-section {
  max-width: 52rem;
  margin:    0 auto;
  padding:   0 2rem;
}

/* ── Plant entries (inside two-col multicol) ─────────────────── */
.plant-entry {
  break-inside:  avoid;
  margin-bottom: var(--space-sm);
}

.plant-name {
  font-family: var(--font-body);
  font-size:   var(--text-sm);
  font-weight: 500;
  color:       var(--ink);
  font-style:  italic;
  line-height: 1.4;
}

.plant-common {
  font-style:  normal;
  font-weight: 400;
  color:       var(--ink-mid);
}

.plant-note {
  font-family: var(--font-ui);
  font-size:   9px;
  color:       var(--ink-faint);
  line-height: 1.6;
  margin-top:  0.2rem;
}
