/* ═══════════════════════════════════════════════════
   The Undoctored — Shared Print Stylesheet
   Linked on all content pages via:
   <link rel="stylesheet" href="print.css" media="print">
   ═══════════════════════════════════════════════════ */

@media print {

  /* ── Page setup ── */
  @page { margin: 1.8cm 2.2cm; size: letter; }

  /* ── Hide site chrome ── */
  .glass-nav, nav, header, footer,
  .sticky, .share-btn, .ud-print-btn, .ud-share-btn, .tab-btn, .topic-btn,
  section:not([id]), [class*="hero"], [class*="glass"],
  .leaf-bar, .badge, .print-hide,
  details.resources-block { display: none !important; }

  /* Apothecary: show named content sections */
  section[id] { display: block !important; }

  /* ── Show only active tab panel ── */
  .tab-panel   { display: none !important; }
  .tab-panel.active   { display: block !important; width: 100% !important; }
  .topic-panel { display: none !important; }
  .topic-panel.active { display: block !important; width: 100% !important; }

  /* ── Force reveals visible ── */
  .reveal, .reveal.active {
    opacity: 1 !important; transform: none !important;
    max-height: none !important; overflow: visible !important;
  }

  /* ── Reset to clean document ── */
  *, *::before, *::after {
    transition: none !important; animation: none !important;
    box-shadow: none !important; border-radius: 0 !important;
    color: black !important; background-color: white !important;
    border-color: #999 !important;
  }

  html, body { background: white !important; }
  html { font-size: 8pt !important; } /* anchors all rem units to 8pt */
  body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 8pt !important; line-height: 1.55 !important;
    color: black !important; margin: 0; padding: 0;
  }
  main { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
  p, li {
    hyphens: auto; -webkit-hyphens: auto;
    overflow-wrap: break-word; margin: 0 0 4pt;
    orphans: 4; widows: 4;
    color: black !important; font-size: 8pt !important;
  }
  ul, ol { padding-left: 1.2em; margin: 0 0 4pt; }
  a { color: black !important; text-decoration: none !important; }
  a[href]::after { content: none !important; }
  [style*="color"] { color: black !important; }

  /* ── Headings ── */
  h2, h3, h4 {
    font-family: Georgia, serif !important;
    page-break-after: avoid; break-after: avoid;
    color: black !important; background: white !important;
  }
  h2 { font-size: 11pt !important; font-weight: bold !important; margin: 12pt 0 3pt !important; padding-bottom: 2pt; border-bottom: 0.75pt solid #999 !important; line-height: 1.3 !important; }
  h3 { font-size: 9.5pt !important; font-weight: bold !important; margin: 10pt 0 2pt !important; line-height: 1.3 !important; }
  h4 { font-size: 8pt !important; font-weight: bold !important; margin: 7pt 0 2pt !important; font-style: italic !important; line-height: 1.3 !important; }
  h4 + p { page-break-before: avoid; break-before: avoid; }

  /* ── Cards ── */
  .trap-card {
    border: none !important; background: white !important;
    border-left: 1.5pt solid #7D8E7E !important;
    padding: 1pt 0 1pt 9pt !important; margin: 0 0 8pt 0 !important;
  }
  .trap-card h4 { margin-top: 0 !important; }
  .trap-card h4 + p { page-break-before: avoid; break-before: avoid; }

  /* ── Callouts ── */
  .callout, .warning-box, .caution-box, .rounded-2xl {
    border: 0.75pt solid #4A3F35 !important;
    padding: 6pt 9pt !important; margin-bottom: 8pt !important;
    background: white !important;
    page-break-inside: avoid; break-inside: avoid;
  }
  .callout *, .warning-box *, .caution-box *, .rounded-2xl * { background: white !important; }

  /* ── VS comparison rows ── */
  .vs-row { display: block !important; }
  .vs-box { display: block !important; background: white !important; border: none !important; border-left: 1pt solid #aaa !important; padding: 0 0 0 8pt !important; margin-bottom: 5pt !important; }
  .vs-label { font-size: 7pt !important; font-weight: bold; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 2pt !important; display: block; }

  /* ── Grids → single column ── */
  .grid, [class*="grid-cols"] { display: block !important; }
  .grid > *, [class*="grid-cols"] > * { display: block !important; width: 100% !important; margin-bottom: 4pt !important; }

  /* ── Resource links ── */
  .resource-link { display: block !important; border: none !important; background: white !important; padding: 0 !important; margin-bottom: 3pt !important; }

  /* ── Citations ── */
  .citation { font-size: 6.5pt !important; font-style: italic; display: block; border: none !important; padding: 0 !important; margin-bottom: 2pt !important; color: #555 !important; hyphens: auto; }

  /* ── Tables (decoder, ban chart, data tables) ── */
  [style*="overflow-x"] { overflow: visible !important; }
  .decoder-table, .ban-table, table {
    display: table !important; width: 100% !important;
    border-collapse: collapse !important; font-size: 7pt !important;
    overflow: visible !important; page-break-inside: auto;
  }
  .decoder-table thead, .ban-table thead, thead { display: table-header-group !important; }
  .decoder-table tbody, .ban-table tbody, tbody { display: table-row-group !important; }
  .decoder-table tr, .ban-table tr, tr { display: table-row !important; page-break-inside: avoid; }
  .decoder-table th, .ban-table th, th {
    display: table-cell !important; font-size: 6.5pt !important; font-weight: bold !important;
    border-bottom: 1pt solid #000 !important; padding: 3pt 5pt !important;
    text-align: left !important; background: #eee !important; color: black !important;
  }
  .decoder-table td, .ban-table td, td {
    display: table-cell !important; font-size: 7pt !important;
    border-bottom: 0.5pt solid #ccc !important; padding: 3pt 5pt !important;
    vertical-align: top !important; color: black !important;
    font-family: inherit !important; white-space: normal !important;
  }
  .decoder-table td:first-child { font-weight: bold !important; }
  .risk-high, .risk-mid, .ban-cat { display: none !important; }
  .ban-eu, .ban-us { color: black !important; font-size: 7pt !important; font-weight: normal !important; }

  /* ── Print header (logo) ── */
  .ud-print-header {
    display: flex !important; align-items: center; gap: 14pt;
    border-bottom: 1pt solid #4A3F35; padding-bottom: 8pt; margin-bottom: 14pt;
  }
  .ud-print-header img { height: 36pt !important; width: auto !important; display: block !important; }
  .ud-print-header-text { display: flex; flex-direction: column; gap: 2pt; }
  .ud-print-header-title { font-family: Georgia, serif !important; font-size: 13pt !important; font-weight: bold !important; color: black !important; letter-spacing: 0.02em; display: block !important; }
  .ud-print-header-tagline { font-size: 7pt !important; color: #555 !important; font-style: italic !important; line-height: 1.4 !important; display: block !important; }

  /* ── Print footer ── */
  .ud-print-footer {
    display: flex !important; flex-direction: column; align-items: center;
    gap: 2pt; border-top: 1pt solid #4A3F35;
    margin-top: 18pt; padding-top: 7pt; text-align: center;
  }
  .ud-print-footer-name { font-family: Georgia, serif !important; font-size: 10pt !important; font-weight: bold !important; color: black !important; letter-spacing: 0.04em; display: block !important; }
  .ud-print-footer-url { font-size: 8pt !important; color: #555 !important; display: block !important; margin-top: 1pt !important; }
  .ud-print-footer-disc { font-size: 6.5pt !important; color: #666 !important; font-style: italic !important; display: block !important; margin-top: 2pt !important; }

  /* ── Pharmacology drug cards ── */
  .drug-card, [class*="drug-"] { page-break-inside: avoid; }
  .tab-content { display: block !important; }

}
