/* ==========================================================================
   TRIPLEMETER PRINT STYLESHEET
   Controls page layout, breaks, and print rendering.
   For PDF export: use Chrome headless or File > Print > Save as PDF.
   ========================================================================== */

@media print {

  /* -------------------------
     PAGE SETUP
  ------------------------- */

  /* One-pager: US Letter portrait */
  @page {
    size: 8.5in 11in;
    margin: 0.5in 0.5in 0.5in 0.5in;
  }

  /* Slide deck: 16:9 landscape */
  @page.slide {
    size: 13.33in 7.5in;
    margin: 0;
  }

  /* Remove browser default page headers/footers */
  html {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color-adjust: exact;
  }

  /* -------------------------
     GLOBAL PRINT RESETS
  ------------------------- */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    background: #FFFFFF;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* -------------------------
     HIDE NON-PRINT ELEMENTS
  ------------------------- */
  .no-print,
  .print-nav,
  nav,
  .doc-nav,
  .slide-controls,
  .browser-bar,
  button.ui-only,
  .tooltip,
  .dropdown-menu {
    display: none !important;
  }

  /* Show print-only elements */
  .print-only {
    display: block !important;
  }

  /* -------------------------
     LINKS
  ------------------------- */
  a {
    color: var(--color-body) !important;
    text-decoration: none;
  }

  /* Show URLs for external links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #6B7280;
  }

  /* Don't show URLs for internal anchors or buttons */
  a[href^="#"]::after,
  a.btn::after,
  a.no-url::after {
    content: none;
  }

  /* -------------------------
     PAGE BREAK CONTROL
  ------------------------- */

  /* Never break inside these elements */
  .stat-card,
  .callout,
  .feature-row,
  .pull-quote,
  .tm-table thead,
  h1, h2, h3, h4 {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Always start new page */
  .page-break,
  .slide {
    page-break-before: always;
    break-before: page;
  }

  /* Never start new page */
  .no-break {
    page-break-before: avoid;
    break-before: avoid;
  }

  /* Keep heading with next paragraph */
  h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* -------------------------
     COLOR PRESERVATION
  ------------------------- */

  /* Ensure colored backgrounds print */
  .section-teal,
  .section-teal-dark,
  .hero-cover,
  .callout,
  .callout.callout-dark,
  .stat-card,
  .badge,
  .bg-teal,
  .bg-teal-dark,
  .bg-orange {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* -------------------------
     LAYOUT ADJUSTMENTS
  ------------------------- */
  .cols-2,
  .cols-3,
  .cols-2-1,
  .cols-1-2 {
    /* Maintain grid in print */
    display: grid;
  }

  /* Prevent grids from breaking across pages when small */
  .stat-grid {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* -------------------------
     TYPOGRAPHY ADJUSTMENTS
  ------------------------- */
  h1       { font-size: 28pt; }
  h2       { font-size: 18pt; }
  h3       { font-size: 14pt; }
  .lead    { font-size: 12pt; }
  p, li    { font-size: 10.5pt; orphans: 3; widows: 3; }

  .stat-card .stat-value {
    font-size: 32pt;
  }

  /* -------------------------
     SLIDE-SPECIFIC PRINT
     Each .slide fills one page
  ------------------------- */
  .slide {
    width: 100%;
    min-height: 100vh;
    page-break-before: always;
    break-before: page;
    overflow: hidden;
    position: relative;
  }

  .slide:first-child {
    page-break-before: auto;
    break-before: auto;
  }

  /* -------------------------
     ONE-PAGER SPECIFIC
  ------------------------- */
  .onepager-body {
    max-width: 100%;
  }

  /* Footer for print — show page number */
  .print-footer {
    display: block;
    position: fixed;
    bottom: 0;
    right: 0;
    font-size: 8pt;
    color: #9CA3AF;
    text-align: right;
  }

  .print-footer::after {
    content: counter(page) " of " counter(pages);
  }

}

/* -------------------------
   SCREEN: Print preview mode
   Add .print-preview to <body> to
   preview print layout in browser
------------------------- */
body.print-preview {
  background: #e5e7eb;
  padding: 40px;
}

body.print-preview .print-page {
  background: white;
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto 40px;
  padding: 0.5in;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

body.print-preview .print-page.landscape {
  width: 11in;
  min-height: 8.5in;
}

body.print-preview .print-page.slide-page {
  width: 13.33in;
  min-height: 7.5in;
  padding: 0;
}
