/* Message & Method: print and PDF design. Applies to browser printing and to the PDFs build_pdfs.py and
   make_pdf.py make with Edge. site_postprocess.py links it on every page and adds the print-only masthead
   (.pdf-mast), colophon (.pdf-colophon) and a per-page @page rule naming the page in the running header.
   A4, always light, Ink and Copper only; site furniture (menus, share buttons, sign-up bands) is left out;
   charts, cards and table rows never split across pages. */
@media screen { .pdf-mast, .pdf-colophon { display: none !important; } }

@page {
  size: A4;
  margin: 20mm 16mm 20mm 16mm;
  @top-left { content: "Message & Method"; font: 600 7.5pt "Libre Franklin", "Segoe UI", Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #A8572A; vertical-align: bottom; padding-bottom: 3mm; }
  @top-right { font: 400 7.5pt "Libre Franklin", "Segoe UI", Arial, sans-serif; color: #5E6878; vertical-align: bottom; padding-bottom: 3mm; }
  @bottom-left { font: 400 7.5pt "Libre Franklin", "Segoe UI", Arial, sans-serif; color: #5E6878; vertical-align: top; padding-top: 3mm; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 600 7.5pt "Libre Franklin", "Segoe UI", Arial, sans-serif; color: #101A31; vertical-align: top; padding-top: 3mm; }
}
@page :first { @top-left { content: ""; } @top-right { content: ""; } }

@media print {
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    --bg: #FFFFFF !important; --fg: #1C2230 !important; --heading: #101A31 !important; --muted: #5E6878 !important;
    --line: #DAD3C6 !important; --hair: #E6E0D5 !important; --panel: #F5F2ED !important; --card: #FFFFFF !important;
    --sheet: #FFFFFF !important; --rule: #DAD3C6 !important; --accent: #A8572A !important; --frame: #F5F2ED !important; --mat: #FFFFFF !important;
    --band: #FFFFFF !important; --band-fg: #101A31 !important; --band-muted: #5E6878 !important; --band-line: #DAD3C6 !important;
    color-scheme: light !important;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; text-shadow: none !important; animation: none !important; transition: none !important; }
  html, body { background: #FFFFFF !important; color: #1C2230 !important; }
  body { font-size: 10.5pt !important; line-height: 1.45 !important; }
  a { color: inherit !important; text-decoration: none !important; }

  /* Site furniture that has no place on paper */
  header.mmh, header.band, header.top, nav.mmh-sub, nav.jump, .jump, .sitenav, .mm-menu, footer, footer.band, aside.signup, .signup,
  .closing, .sh-bar, .sh-btn, .sh-h, .sh-menu, .sh-toast, .cs-btn, .cs-row, .tip, form, button, .credit, img.cover,
  .controls, .toolbar, .zoom, #z-in, #z-out, #z-reset, #z-london, #z-all, .btn, a.btn, .pdf-dl, .player .ctl, [data-print="hide"] { display: none !important; }

  /* Masthead on the first page */
  .pdf-mast { display: flex !important; align-items: center; justify-content: space-between; gap: 6mm; padding-bottom: 4mm; margin-bottom: 6mm; border-bottom: 1.2pt solid #C8693A; break-after: avoid; }
  .pdf-mast img { height: 8mm; width: auto; display: block; }
  .pdf-mast span { font: 600 7.5pt "Libre Franklin", "Segoe UI", Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #5E6878; text-align: right; }

  /* Title block: no photo, no band colour, Ink type */
  .band, .band.summary, .summary, .hero { background: none !important; color: #101A31 !important; min-height: 0 !important; }
  .summary::before, .summary::after, .band::before { display: none !important; }
  .band.summary .wrap, .summary .wrap, .hero .wrap { min-height: 0 !important; padding: 0 0 5mm !important; border: 0 !important; }
  h1 { font-size: 22pt !important; line-height: 1.12 !important; color: #101A31 !important; max-width: none !important; }
  .summary .sub, .summary .intro, .summary p, .summary li { color: #1C2230 !important; font-size: 10.5pt !important; }
  .summary strong, .summary b, .band strong, .band b, .summary a { color: #101A31 !important; }
  .summary .label, .summary .kicker, .label, .kicker { color: #A8572A !important; }
  h2 { font-size: 15pt !important; line-height: 1.2 !important; color: #101A31 !important; break-after: avoid; page-break-after: avoid; }
  h3 { font-size: 12pt !important; break-after: avoid; page-break-after: avoid; }
  /* A section's label, headline and intro stay with what follows them */
  .block-head, .head { break-inside: avoid; page-break-inside: avoid; break-after: avoid; page-break-after: avoid; }
  .label, .kicker, .block-head > * { break-after: avoid; page-break-after: avoid; }
  .wrap { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; }
  section, section.block { padding-block: 5mm 0 !important; border: 0 !important; }
  p, li { orphans: 3; widows: 3; }

  /* Keep charts, cards, rows and figures whole */
  figure, .card, article.card, .mult, .hrow, .bar-row, .bars, .spendbars, .sb, .stat, .stats, .feature, .principle, .mrpchart, .mapbox,
  .trendwrap, .cbar, .list, .method, .shots, .product, tr, .legend, img, svg { break-inside: avoid; page-break-inside: avoid; }
  .cards { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 5mm !important; }
  .card img, .frame img { max-height: 70mm !important; width: auto !important; max-width: 100% !important; margin: 0 auto; }
  img, svg { max-width: 100% !important; }

  /* Tables: full width, no sideways scroll, small type */
  .tablewrap { overflow: visible !important; border-color: #101A31 !important; }
  table { min-width: 0 !important; width: 100% !important; font-size: 8.5pt !important; }
  th, td { padding: 1.6mm 2mm 1.6mm 0 !important; }
  thead { display: table-header-group; }
  .mm-stack tr, .mm-stack td, .mm-stack tbody { display: revert !important; }
  .mm-stack thead { position: static !important; width: auto !important; height: auto !important; clip-path: none !important; }
  .mm-stack td::before { content: none !important; }
  .mm-freeze th:first-child, .mm-freeze td:first-child { position: static !important; width: auto !important; min-width: 0 !important; max-width: none !important; }

  /* Colophon at the end */
  .pdf-colophon { display: block !important; margin-top: 10mm; padding-top: 4mm; border-top: 1.2pt solid #C8693A; font: 400 8pt/1.5 "Libre Franklin", "Segoe UI", Arial, sans-serif; color: #5E6878; break-inside: avoid; }
  .pdf-colophon strong { color: #101A31; }
}
