/*
 * FreightPlus Market Report · Print Stylesheet
 * Loaded via wp_enqueue_style on market-report-*.php templates.
 * Users hit "Download PDF" which triggers window.print() · this CSS
 * strips site chrome and renders the report content in a clean A4/Letter format.
 * Added 2026-07-09 for backlog B1 (Market report PDF download).
 */

@page {
  size: Letter;
  margin: 0.6in 0.5in 0.7in 0.5in;
}

@media print {

  /* Neutralize dark navy hero and any full-bleed backgrounds. Print on white. */
  html, body {
    background: #ffffff !important;
    color: #00263A !important;
    font-family: Calibri, Arial, sans-serif !important;
    font-size: 10.5pt;
    line-height: 1.35;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide site chrome: nav, footer, CTAs, forms, related-content, PDF button itself. */
  header nav,
  .site-header nav,
  #masthead nav,
  .fp-nav,
  .fp-header-cta,
  .fp-download-pdf,
  .fp-subscribe-form,
  .fp-related-resources,
  .fp-cta-strip,
  .fp-cta,
  .fp-footer,
  footer,
  .site-footer,
  #colophon,
  .no-print,
  section.bg-navy:has(.btn-green),
  section.bg-navy.py-24,
  a[href*="#quote"],
  a[href*="/#quote"] {
    display: none !important;
  }

  /* Hide "Back to Resources" and prev-month link row at top */
  section.max-w-\[1280px\]:first-of-type > .flex.flex-wrap.items-center.gap-4 {
    display: none !important;
  }

  /* Rebuild hero section for print · white background, dark type, no topo overlay */
  section.max-w-\[1280px\]:first-of-type {
    padding: 0 !important;
    background: #ffffff !important;
  }
  section.max-w-\[1280px\]:first-of-type h1,
  section.max-w-\[1280px\]:first-of-type h1 span {
    color: #00263A !important;
    font-size: 22pt !important;
    line-height: 1.15 !important;
    margin-bottom: 8pt !important;
  }
  section.max-w-\[1280px\]:first-of-type p {
    color: #00263A !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }
  section.max-w-\[1280px\]:first-of-type .text-green,
  section.max-w-\[1280px\]:first-of-type p.text-green {
    color: #2a7a1a !important;
    font-weight: 700 !important;
  }

  /* Metric card row · At a Glance */
  .grid.grid-cols-2.md\:grid-cols-4 > div {
    border: 1pt solid #b4b8bd !important;
    padding: 8pt !important;
    page-break-inside: avoid;
    background: #ffffff !important;
  }
  .grid.grid-cols-2.md\:grid-cols-4 .font-display {
    font-size: 16pt !important;
    color: #00263A !important;
  }

  /* Article body */
  article {
    background: #ffffff !important;
    padding: 0 !important;
  }
  article h2 {
    color: #00263A !important;
    font-size: 15pt !important;
    line-height: 1.2 !important;
    margin-top: 14pt !important;
    margin-bottom: 6pt !important;
    page-break-after: avoid;
  }
  article h3 {
    color: #00263A !important;
    font-size: 12.5pt !important;
    margin-top: 10pt !important;
    margin-bottom: 4pt !important;
    page-break-after: avoid;
  }
  article p {
    color: #00263A !important;
    font-size: 10.5pt !important;
    line-height: 1.4 !important;
    margin: 0 0 6pt 0 !important;
  }

  /* Tables · keep together, print-safe borders */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: avoid;
    font-size: 9.5pt !important;
  }
  th, td {
    border: 0.5pt solid #c5c7c9 !important;
    padding: 4pt 6pt !important;
    color: #00263A !important;
  }
  thead tr {
    background: #eaeef1 !important;
  }
  th {
    font-weight: 700 !important;
    color: #00263A !important;
    background: #eaeef1 !important;
  }
  /* Preserve red-emphasis on delta cells but keep readable */
  .text-red-500, .text-red-600 { color: #a01818 !important; }
  .text-green { color: #2a7a1a !important; }

  /* Diesel trajectory SVG · scale to fit */
  svg {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  /* Risk grid · keep two columns side by side, avoid page break inside */
  .grid.md\:grid-cols-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8pt !important;
    page-break-inside: avoid;
  }
  .grid.md\:grid-cols-2 > div {
    border: 0.5pt solid #b4b8bd !important;
    padding: 6pt !important;
    background: #ffffff !important;
  }

  /* Sources footer · keep with content */
  section.bg-white.border-t {
    padding: 8pt 0 !important;
    page-break-inside: avoid;
  }

  /* Links · print URL after link text so PDF reader can follow */
  article a[href^="http"]:after,
  article a[href^="/"]:after {
    content: "";
  }

  /* Add print footer with URL + date via @page pseudo-elements is limited;
     instead we rely on browser's default header/footer. Users can also
     print with "Headers and footers" enabled for URL/date. */
}
