@page {
  /* Provide consistent margins for printed pages */
  margin: 15mm 12mm;
}

@media print {
  /* Remove default body margin; @page handles outer margins */
  body {
    margin: 0;
    color: #000;
    background: none;
  }

  /* Constrain content width for readability and center it */
  #main-content {
    margin: 0 auto;
  }

  /* Print-only header containing logo and horizontal rule */
  .print-header {
    margin: 0 0 8mm;
  }

  .print-header-logo {
    display: block;
    max-width: 200px;
    height: auto;
  }

  .print-header-rule {
    border: 0;
    border-bottom: 1px solid #000;
    width: 100%;
    margin: 4mm 0 0;
  }

  /* HOMEPAGE SPECIFIC PRINT STYLES */
  /* Remove background image and change text color to black */
  section.homepage-hero {
    height: auto !important;
    background: none;
    color: #000;
    margin: 30px 0 50px;
    padding: 0;
  }
  
  div.hero-text {
    margin: 0;
  }

  /* Adjust font size and spacing for the h1 on the homepage and list pages */
  .hero-text h1 {
    color: #000;
    font-size: 3rem !important;
    margin: 0 0 20px;
  }

  div.hero-text h2 {
    font-size: 1rem;
  }

  #homepage h2.section-heading {
    color: #000;
    font-size: 2rem !important;
  }

  main#homepage img.infographic {
    width: 150px;
  }

  section.explore-data-section {
    margin: 30px 0;
  }

  .explore-panel-row > * {
    width: auto;
    margin: 0 auto;
    padding: 0;
  }

  .explore-panel-container {
    height: auto !important;
  }

  .explore-panel-container h3 {
    color: #585858;
    font-size: 2rem !important;
  }

  .explore-panel-container h4 {
    font-size: 1.25rem !important;
  }

  /* LIST PAGE SPECIFIC PRINT STYLES */
  #hero-section.listpage-hero {
    margin: 0;
    padding: 0;
    background: none;
  }
  
  #hero-section.listpage-hero .hero-text,
  main:not(#homepage) div.container:first-child,
  div.container:has(#reports-table_info) {
    margin: 0;
    padding: 0;
  }

  /* On list pages, filters are normally pulled up over the hero with a negative top.
     When we remove the hero background/margins for print, that overlap can cover the h1.
     Reset positioning so the heading remains visible. */
  .reports-table-section {
    position: static !important;
    top: 0 !important;
  }

  #reports-table_info {
    font-size: 1.5rem !important;
  }

  table#reports-table th,
  table#reports-table td {
    font-size: 0.85rem !important;
  }

  table#reports-table td.dataTables_empty {
    font-size: 1.5rem !important;
  }

  /* GLOBAL NON-HOME/LIST PRINT STYLES */
  /* Remove the margins from the main content on all pages except the homepage and list view */
  main:not(#homepage, #list-view),
  main:not(#homepage, #list-view) > .container {
    margin: 0;
  }

  h1.page-heading {
    margin: 0 0 10px;
  }

  h2.page-sub-heading {
    margin: 0 0 30px;
  }

  #details-view .data-definition-section:first-of-type {
    margin: 50px 0 0;
  }

  #details-view .data-definition-heading {
    margin: 30px 0 15px;
  }
}
