/* 6" × 9" (152.4mm × 228.6mm) print override for WeasyPrint — the DEFAULT format.
 *
 * This is the Amazon KDP trade paperback trim, and what every book renders at
 * unless its `printFormat` says otherwise (MFB-143). Loaded whenever the doc's
 * printFormat is "6x9" *or* empty — see resolvePrintFormat() in
 * src/lib/printFormat.ts.
 *
 * Keep this file focused on page geometry; content styles stay in print.css.
 *
 * Bleed: none. The base @page sets `bleed: 0` / `marks: none` (KDP rejects crop
 * marks), so the trim IS the page. KDP's with-bleed variant would be
 * 6.125in × 9.25in applied to the WHOLE interior — an open decision, because
 * the full-bleed purple pages (@page full, module dividers) are the pages that
 * would benefit. MFB-153's printed proof is what answers it. */
@page {
  size: 6in 9in;
}

@page full {
  size: 6in 9in;
}

@page full-bw {
  size: 6in 9in;
}

@page clean {
  size: 6in 9in;
}

/* Margins restated here rather than inherited, so the KDP contract lives with
 * the geometry it constrains: the A5 base happens to satisfy 6×9 today, and a
 * future tweak to those A5 numbers must not silently break compliance.
 *
 * KDP inside (gutter) minimum for 6×9 grows with the page count:
 *      24–150 pages → 0.375in (9.5mm)
 *     151–300 pages → 0.5in  (12.7mm)   ← our worst case today
 *     301–500 pages → 0.625in (15.9mm)  ← would EXCEED the 15mm below
 *     501–700 pages → 0.75in  (19.1mm)
 * Longest book in the catalogue: bitcoin-for-organizations/en at 214 pages, so
 * 15mm (0.591in) clears the 0.5in requirement. **If any language ever crosses
 * 300 pages, raise the inner margin to at least 15.9mm.**
 * Outside/top/bottom minimum is 0.25in; 0.375in (9.5mm) is the safer figure and
 * everything below is well past it. T R B L. */
@page :right {
  margin: 15mm 12mm 14mm 15mm; /* inner = left on recto */
}

@page :left {
  margin: 15mm 15mm 14mm 12mm; /* inner = right on verso */
}

/* Cover / module-intro geometry.
 *
 * 6×9 is 4.4mm wider and 18.6mm taller than the A5 base, so only the values
 * that track the page box are overridden: full-bleed heights (a short
 * --cover-h leaves a white strip at the foot), background boxes, content
 * minimum heights, and the two top offsets that would otherwise sit visibly
 * high on a taller page. Insets, type sizes and bottom-anchored offsets are
 * inherited from print.css on purpose — a 3% width change is not worth
 * retuning, and re-flowing cover titles is how this drifts.
 *
 * Heights scale by 228.6/210 = 1.0886, widths by 152.4/148 = 1.0297. */
:root {
  --cover-h: 228.6mm;         /* = 9in exactly: full-bleed must equal page height */
  --cover-centered-h: 228.6mm;
  --cover-title-top: 46.8mm;  /* 43mm × 1.0886 */
  --cover-deco-h: 143.7mm;    /* 132mm × 1.0886 */
  --inside-flex-h: 189.4mm;   /* 174mm × 1.0886 */
  --module-h1-top: 17.4mm;    /* 16mm × 1.0886 */
  --module-h2-top: 30.5mm;    /* 28mm × 1.0886 */
  --module-bg-w: 144.2mm;     /* 140mm × 1.0297 */
  --module-bg-h: 211.2mm;     /* 194mm × 1.0886 */
  --matter-min-h: 185.1mm;    /* 170mm × 1.0886 */
}
