/*
 * WCAG in Plain English — Print / Save-to-PDF stylesheet
 *
 * The on-screen layout uses fixed-height (100vh) scroll containers and a wide
 * flex grid. Those clip the article body and run off the paper when printing.
 * These rules release the clipping, collapse the layout to a single full-width
 * column, hide on-screen chrome, and make the dark code blocks legible on paper.
 *
 * Strictly print-only and tightly scoped to the WCAG templates:
 *   - Loaded with media="print", so nothing here affects the on-screen UI.
 *   - Only enqueued on WCAG article / archive / taxonomy pages.
 *   - Every selector is scoped to the WCAG body classes or .wcag-article-container.
 *
 * @since 1.0.0
 */

/* 1. Release the fixed-height / overflow clipping so the whole body prints.
 *    Scoped to the WCAG body classes (these are the only pages this sheet loads on). */
body.single-wcag_article,
body.post-type-archive-wcag_article,
body.tax-principle,
body.tax-theme,
body.tax-level,
body.tax-disability,
body.tax-responsibility,
body.tax-wcag-version,
body.tax-guideline {
  height: auto !important;
  overflow: visible !important;
}

.wcag-article-container {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  background: #ffffff !important;
}

.wcag-article-container .wcag-main {
  flex: none !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* 2. Collapse the layout to a single, page-width column. */
.wcag-article-container .wcag-article-content,
.wcag-article-container .wcag-article-content-inner,
.wcag-article-container .wcag-article-content-inner-content,
.wcag-article-container .wcag-article-list,
.wcag-article-container .custom-post-single,
.wcag-article-container .wcag-article-coming-soon-container {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

.wcag-article-container .custom-post-single {
  /* keep a little breathing room around the article body */
  padding: 0 0 1rem 0 !important;
}

/* 3. Hide on-screen chrome: sidebar, hamburger/nav, search, TOC, pagination, footer menu. */
.wcag-article-container .sidebar,
.wcag-article-container .sidebar-fixed-overlay,
.wcag-article-container .wcag-title-container-mobile,
.wcag-article-container .sidebar-toggle,
.wcag-article-container .wcag-toggle-sidebar,
.wcag-article-container .wcag-search,
.wcag-article-container .wcag-article-toc,
.wcag-article-container .pagination,
.wcag-article-container .wcag_articles_footer-menu-class {
  display: none !important;
}

/* 4. Suppress the theme's print "link URL" expansion. hello-elementor's
 *    reset.css ships `a[href]:after { content: " (" attr(href) ")" }` inside an
 *    @media print block (a separate handle the plugin doesn't dequeue). That
 *    appends every URL in print, which clutters the text and bloats / overlaps
 *    the criterion metadata pills. Scoped to the WCAG container only. */
.wcag-article-container a[href]::after,
.wcag-article-container abbr[title]::after {
  content: "" !important;
}

/* 5. Make dark code blocks legible on white paper (print strips backgrounds,
 *    which would otherwise leave the light code text invisible). */
.wcag-article-container .custom-post-single .wcag-custom-fields pre,
.wcag-article-container .custom-post-single .wcag-custom-fields pre code {
  background: #f6f8fa !important;
  color: #1a202e !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.wcag-article-container .custom-post-single .wcag-custom-fields pre {
  border: 1px solid #d0d7de !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow: visible !important;
}

/* 6. Avoid awkward page breaks within the article body. */
.wcag-article-container .wcag-custom-fields h2,
.wcag-article-container .wcag-custom-fields h3,
.wcag-article-container .wcag-custom-fields h4 {
  break-after: avoid;
  page-break-after: avoid;
}

.wcag-article-container .wcag-custom-fields pre,
.wcag-article-container .wcag-custom-fields figure,
.wcag-article-container .wcag-custom-fields img,
.wcag-article-container .wcag-article-list .custom-post-item {
  break-inside: avoid;
  page-break-inside: avoid;
}

.wcag-article-container img,
.wcag-article-container pre,
.wcag-article-container table {
  max-width: 100% !important;
}

/* 7. AAArdvark branding band, shown once at the very top of page 1 (an eyebrow
 *    line above the title). Kept in normal flow — not fixed or repeated — so it
 *    can never overlap article text. */
@page {
  margin: 1.4cm;
}

.wcag-article-container .wcag-print-branding {
  display: block !important;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d0d7de;
  break-inside: avoid;
  page-break-inside: avoid;
}

.wcag-article-container .wcag-print-branding__text {
  display: block;
  font-size: 9pt;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #5b6472 !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.wcag-article-container .wcag-print-branding__text strong {
  color: #1a202e !important;
  font-weight: 600;
}

.wcag-article-container .wcag-print-branding__text a {
  color: #5b6472 !important;
  text-decoration: none;
}
