/* ---------------------------------------------------------------------------
   print.css — the shared print baseline for the Forge printables
   ---------------------------------------------------------------------------
   Loaded AFTER styles.css on every printable page. The per-component print
   blocks stay where they are in styles.css, next to the screen styles they
   extend — this file carries only what every printable needs and what none of
   them currently has.

   Added 2026-10-11 (#3021).
   --------------------------------------------------------------------------- */

/* --- 1. Page size: fit BOTH Letter and A4 --------------------------------
   styles.css pins `@page{size:Letter portrait}`. That is wrong for a document
   meant to print anywhere: `size` forces the PAPER, so an A4 printer either
   scales the sheet down or clips it. Letter and A4 are not the same shape —

       Letter  215.9 x 279.4 mm
       A4      210.0 x 297.0 mm
       both    210.0 x 279.4 mm   <- the intersection

   `size:auto` uses whatever paper the printer is loaded with, and the content
   is then constrained to the INTERSECTION (210 mm wide, 279.4 mm tall) in
   section 2 so it fits either without scaling. That is the whole trick: do not
   pick a paper, fit the smaller of the two in both axes. */
@page{ size:auto; margin:10mm }

/* --- 2. Content fits the intersection ------------------------------------ */
@media print{
  /* 210mm page - 2 x 10mm margin = 190mm usable on the NARROWER paper.
     Capping at 190mm means A4 (the narrow one) cannot overflow sideways. */
  body.page-gdd .wrap,
  body.page-gdd main{ max-width:190mm; margin-left:auto; margin-right:auto }

  /* --- 3. Print the colours -------------------------------------------------
     THE MISSING PIECE. Nothing in styles.css sets print-color-adjust anywhere,
     so browsers strip backgrounds, fills and coloured rules by default: the
     parchment sheets, the bordered cards and the coloured ledger lines all
     print as plain black text on white. The printables are DESIGNED as coloured
     sheets, so this is the single highest-impact line in this file. */
  body.page-gdd{
    -webkit-print-color-adjust:exact;   /* Safari / older WebKit */
    print-color-adjust:exact;
  }

  /* --- 4. A general no-print utility ---------------------------------------
     `.no-print` is currently defined ONLY inside the page-gdd print block in
     styles.css, so it works on printables and silently does nothing elsewhere.
     Re-declared here unscoped so it means the same thing on any page. */
  .no-print{ display:none !important }

  /* --- 5. Text flow on paper ------------------------------------------------
     Orphans and widows are a screen non-issue and a paper one: a rule heading
     alone at the foot of a page, or a single line carried over, is what makes a
     printable read as a printout rather than a sheet. */
  body.page-gdd p,
  body.page-gdd li,
  body.page-gdd .bible-rule,
  body.page-gdd .es-pair{
    orphans:3;
    widows:3;
    break-inside:avoid;
  }
  body.page-gdd h1,
  body.page-gdd h2,
  body.page-gdd h3{
    break-after:avoid;      /* never leave a heading stranded at a page foot */
  }

  /* --- 6. Links are printed, not clicked ------------------------------------
     Underlining every anchor on a printed sheet is noise, and the URL is useful
     only when it is not the page's own relative link. */
  body.page-gdd a{ text-decoration:none; color:inherit }
  body.page-gdd a[href^="http"]::after{
    content:" (" attr(href) ")";
    font-size:.72em;
    color:#6b6153;
    word-break:break-all;
  }
}

/* --- 7. Screen-only: hide the print baseline from the browser -------------- */
@media screen{
  .print-only{ display:none !important }
}
