/* ============================================================
   BYR — PRINT STYLESHEET
   ============================================================
   Loads on every page with media="print". Patients print
   condition pages to bring to specialist appointments; the
   output must be clean, readable, ink-efficient, and
   information-complete. Not branded. Not decorative. Content.

   Entire file is wrapped in @media print { } so it is safe
   either enqueued with media="print" or inlined.
============================================================ */

@media print {

  /* --------------------------------------------------------
     1. GLOBAL RESET
     Flatten colour, remove screen-only effects, stop motion.
  -------------------------------------------------------- */
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;        /* removes grayscale if a11y toggle was on */
    animation: none !important;
    transition: none !important;
  }

  body {
    font-size: 12pt !important;
    line-height: 1.5 !important;
    font-family: Georgia, 'Times New Roman', serif !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  @page {
    margin: 1.8cm 1.5cm;
    size: A4 portrait;
  }

  /* The screen stylesheet pins body::before as a fixed
     full-viewport gradient layer. The global * reset kills
     its background and animation but not its positioning,
     so we explicitly unstick it here. */
  body::before {
    position: static !important;
    inset: auto !important;
  }


  /* --------------------------------------------------------
     2. HIDE NON-CONTENT ELEMENTS
  -------------------------------------------------------- */

  /* Site chrome — header, nav, hamburger, mobile menu */
  #byr-header,
  .byr-header,
  .byr-skip-link,
  #byr-nav,
  .byr-nav,
  #byr-hamburger,
  .byr-hamburger,
  #byr-mobile-menu,
  .byr-mobile-menu,
  #byr-mode-toggle,
  .byr-mode-toggle,
  .byr-coin-3d,

  /* Accessibility toolbar */
  .byr-a11y-trigger,
  #byr-a11y-panel,

  /* Footer */
  .byr-site-footer,
  #byrFooter,

  /* Per-page TOCs (all 5 condition templates) */
  .byr-toc,
  #ecd-toc,
  #sps-toc,
  #fech-toc,
  #poems-toc,
  #hcs-toc,

  /* Heroes — homepage + inner-page + condition-page banners */
  .byr-hero-home,
  .byr-hero-inner,
  .ecd-hero-intro,
  .fech-hero,
  .sps-page .hero,

  /* Decorative coins / badges (condition-page hero badges —
     NOT .tier-badge, which labels SPS treatment tiers and is content) */
  .ecd-badge,
  .fech-badge,

  /* WordPress chrome.
     NOTE: do NOT hide .admin-bar — that class lives on <body> when
     a user is logged in, so hiding it blanks the whole page.
     #wpadminbar alone hides the actual toolbar element. */
  .wp-block-navigation,
  #wpadminbar,

  /* Cookie / GDPR plugin banners — harmless if absent */
  .cookie-notice,
  .cookie-banner,
  #cookie-law-info-bar,
  .cli-bar-container {
    display: none !important;
  }

  /* All <video> elements site-wide (homepage has none, but
     inner-page heroes, footer, and condition-page figures
     may contain them). */
  video {
    display: none !important;
  }


  /* --------------------------------------------------------
     3. GLASS PANELS → white box with simple border
  -------------------------------------------------------- */
  [class*="glass"],
  [class*="byr-card"],
  [class*="byr-panel"],
  .byr-a11y-panel,
  .byr-hero,                /* glass-card class (confusingly named) from 09-glass-panels.css */
  .byr-med-disclaimer {
    background: #fff !important;
    border: 1pt solid #999 !important;
    border-radius: 0 !important;
    padding: 0.5cm !important;
  }


  /* --------------------------------------------------------
     4. INLINE LINK HREFS
     Print the URL after each body-text link so the reader
     can still follow the reference on paper.
  -------------------------------------------------------- */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #444 !important;
    word-break: break-all;
  }

  /* Skip URL printing for anchors, JS pseudo-links, and
     navigational links (the nav/header is hidden anyway,
     but these rules keep output clean if any nav-styled
     link survives inside content). */
  a[href^="#"]::after,
  a[href^="javascript"]::after,
  nav a::after,
  .site-header a::after,
  .byr-header a::after {
    content: none !important;
  }


  /* --------------------------------------------------------
     5. TYPOGRAPHY & LAYOUT FOR PRINT
  -------------------------------------------------------- */

  /* Headings */
  h1 { font-size: 20pt !important; margin-bottom: 0.3cm !important; }
  h2 { font-size: 15pt !important; margin-top: 0.5cm !important; }
  h3 { font-size: 12pt !important; }

  /* Avoid page breaks inside cards, callouts, and media */
  .byr-card,
  [class*="glass"],
  .byr-med-disclaimer,
  blockquote,
  figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Keep headings attached to their following content */
  h1, h2, h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Images: constrain, preserve aspect ratio */
  img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Tables: full width, visible rules */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  th, td {
    border: 0.5pt solid #999 !important;
    padding: 4pt 6pt !important;
    font-size: 10pt !important;
    text-align: left !important;
  }


  /* --------------------------------------------------------
     6. SITE NAME HEADER
     The site header is hidden, so inject a small attributable
     top-of-page label. body::before already exists in the
     screen stylesheet as the fixed gradient layer; §1 unsticks
     it and the * reset killed its background/animation, so
     this rule simply gives it new content.
  -------------------------------------------------------- */
  body::before {
    content: "bareyourrare.org";
    display: block !important;
    font-size: 9pt;
    color: #666 !important;
    background: transparent !important;
    padding-bottom: 0.3cm;
    border-bottom: 0.5pt solid #ccc;
    margin-bottom: 0.5cm;
    font-family: Georgia, serif;
  }

}
