/* ─── Document print base ────────────────────────────────────────────────────
   Print layout shared by every document bundle that can take print styles
   (dgcoks_county_document PrintBlockRegistry::BUNDLES). Attached, with the
   body.document-print marker class, by
   dgcoks_county_document_preprocess_html(), so it only loads on those pages.
   Bundle-specific print rules stay in each bundle's own CSS
   (node-county-document.css, node-freeform-document.css).

   The library depends on global-styling so this file loads after
   node-county-document.css: its screen banner color
   (body.node--type-county-document .county-document-banner) isn't scoped to
   @media screen and has the same specificity as the print title rule below.

   #dgco-border/#topBtn/#header/.site-footer and the highlighted and
   featured-top regions are global page chrome from
   page.html.twig, reached via the body class rather than by editing that
   shared template (see CLAUDE.md). */
@media print {
  /* Bootstrap Barrio's own print.css sets body { width: 640px } sitewide
     (web/themes/contrib/bootstrap_barrio/css/print.css:13-14), capping the
     whole print page well below its printable area. Overridden here rather
     than in the contrib file. */
  body.document-print {
    width: auto;
  }

  /* Logged in, core's toolbar JS sets an inline padding-top on <body>
     (ToolbarVisualView.js) to clear the fixed toolbar. Core hides the
     toolbar in print but keeps the padding, which pushed the page onto a
     blank trailing page. !important to beat the inline style. */
  body.document-print.toolbar-fixed {
    padding-top: 0 !important;
  }

  /* Site chrome: header (the site header only, page.html.twig's
     header#header; a <header> inside the document stays), footer,
     decorative borders, back-to-top button, Editoria11y. */
  body.document-print #header,
  body.document-print .site-footer,
  body.document-print #dgco-border,
  body.document-print #topBtn,
  body.document-print .ed11y-element,
  /* The highlighted and featured-top regions (page.html.twig's
     div.highlighted and div.featured-top, direct children of #page): site
     alerts (the county_news alert block), editor tabs (local tasks) and
     the language switcher. Child selectors, so content that happens to use
     these class names stays. */
  body.document-print #page > .highlighted,
  body.document-print #page > .featured-top,
  /* Banner chrome: everything in the banner except its h1 (see "Print
     title" below), the banner's divider stripe, the Documents Hub link and
     the print button itself. */
  body.document-print .county-document-banner > :not(h1),
  body.document-print .dgco-border,
  body.document-print .county-doc__back-wrapper,
  body.document-print .county-doc__print,
  /* Drupal status messages ("... has been updated"): the Barrio alert
     wrapper (bootstrap_barrio components/alert) and core's JS fallback
     container both carry these data attributes. */
  body.document-print [data-drupal-messages],
  body.document-print [data-drupal-messages-fallback],
  /* Screen-reader-only helpers that scripts append to the end of <body>:
     core's Drupal.announce live region and jQuery UI's live regions
     (autocomplete, tooltip). Each is visually hidden, i.e. a 1px
     absolutely positioned box, and Chrome paginates them: when one falls
     just past the end of the content it adds an empty trailing page.
     Direct children of <body> only for .visually-hidden, so hidden text
     inside the document is untouched. */
  body.document-print #drupal-live-announce,
  body.document-print .ui-helper-hidden-accessible,
  body.document-print > .visually-hidden {
    display: none !important;
  }

  /* Print title: the banner's h1 is the printed title, so the tagged PDF
     starts at h1. The banner's screen styling (color fill, centered flex,
     40px padding) is dropped. */
  body.document-print .county-document-banner {
    display: block;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: none;
    color: #000;
  }

  body.document-print .county-document-banner h1 {
    margin: 0 0 20px;
    padding: 0;
    color: #000;
    font-size: 1.5em;
    text-align: left;
  }

  /* Tables are wrapped in div.table-responsive (dgcoks_county_document
     TableResponsiveFilter); Bootstrap makes it a horizontal scroll
     container, which can clip a table at a page break. */
  body.document-print .table-responsive {
    overflow: visible;
  }
}
