@media print {
  /* 1. Hide non-essential print elements */
  .navbar, 
  .footer, 
  .ad-slot, 
  .sidebar, 
  .calc-inputs, 
  .share-row, 
  .was-helpful, 
  .related-posts, 
  .post-nav, 
  .cta-box, 
  .newsletter-box,
  .calc-btn-calculate,
  .calc-btn-reset,
  .calc-share-row,
  .navbar-dropdown,
  .navbar-hamburger,
  .modal-overlay,
  .progress-bar,
  .article-progress,
  [data-tooltip]::after {
    display: none !important;
  }

  /* 2. Reset layout and backgrounds for printing */
  html, body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 12pt !important;
    font-family: "DM Sans", sans-serif !important;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* 3. Re-structure layouts that usually require sidebars */
  .calc-layout,
  .layout-with-sidebar {
    display: block !important;
  }

  /* 4. Display calculator results cleanly */
  .calc-results {
    display: block !important;
    width: 100% !important;
    opacity: 1 !important;
  }

  .calc-result-cards {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12pt !important;
    margin-bottom: 20pt !important;
  }

  .calc-result-card,
  .card,
  .stat-card {
    border: 1px solid #CCCCCC !important;
    background: #FFFFFF !important;
    box-shadow: none !important;
    transform: none !important;
    color: #000000 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* 5. Force tables to print completely and not scroll */
  .calc-table-wrapper,
  .article-content-table-wrapper {
    overflow: visible !important;
    border: 1px solid #000000 !important;
    border-radius: 0 !important;
  }

  .calc-table,
  .article-content table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .calc-table th,
  .article-content th {
    background-color: #F0F0F0 !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
  }

  .calc-table td,
  .article-content td {
    border-bottom: 1px solid #CCCCCC !important;
    background: transparent !important;
    color: #000000 !important;
  }

  /* 6. Formulate math formulas */
  .formula-display {
    background: #F0F0F0 !important;
    color: #000000 !important;
    border: 1px solid #CCCCCC !important;
    white-space: normal !important;
  }

  .formula-display span {
    color: #000000 !important;
    font-weight: bold !important;
  }

  /* 7. Page break management */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  blockquote {
    border-left: 3pt solid #000000 !important;
    background: #F5F5F5 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* 8. Add sitemark header to printed page */
  @page {
    margin: 1.5cm;
    @top-center {
      content: "CompoundPro — compoundpro.com";
      font-size: 9pt;
      color: #666666;
    }
    @bottom-center {
      content: counter(page);
    }
  }

  body::before {
    content: "CompoundPro — compoundpro.com";
    display: block;
    text-align: center;
    font-size: 10pt;
    color: #666666;
    border-bottom: 1px solid #CCCCCC;
    padding-bottom: 5px;
    margin-bottom: 20px;
  }
}
