/* Print stylesheet for the side-by-side lens comparison.
   Loaded with media="print" so it never affects on-screen layout.
   Activated by adding .printing to <body> before window.print(). */

@page {
  size: A4;
  margin: 18mm 14mm;
}

@media screen {
  /* Hide print-only blocks when viewing on screen. */
  .print-only { display: none !important; }
}

@media print {
  /* When printing, hide the screen-only meta input strip. */
  .screen-only { display: none !important; }
  .print-only { display: block; }

  html, body {
    background: #fff !important;
    color: #1a2332;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 10pt;
    margin: 0;
    padding: 0;
  }

  /* Hide on-screen chrome entirely. */
  body.printing .nav-bar,
  body.printing .search-hero,
  body.printing .search-howitworks,
  body.printing .search-section,
  body.printing .results-header,
  body.printing .compare-bar,
  body.printing .lang-switcher,
  body.printing .closing-cta {
    display: none !important;
  }

  /* Promote the modal card to a full-page block. */
  body.printing .compare-modal {
    position: static !important;
    background: #fff !important;
    display: block !important;
    inset: auto !important;
    padding: 0 !important;
    z-index: auto !important;
  }
  body.printing .compare-modal-card {
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #fff !important;
  }
  body.printing .compare-modal-header {
    display: none !important;
  }
  body.printing .disc-alert {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Print header block (populated from the screen form just before print). */
  body.printing .print-only.print-header {
    display: block;
    border-bottom: 2px solid #0D9488;
    padding-bottom: 6mm;
    margin-bottom: 5mm;
  }
  body.printing .print-only.print-header .ph-row1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 6mm;
  }
  body.printing .print-only.print-header .ph-wordmark {
    font-family: 'DM Serif Display', serif;
    font-size: 22pt;
    color: #1a2332;
    line-height: 1;
  }
  body.printing .print-only.print-header .ph-wordmark span { color: #0D9488; }
  body.printing .print-only.print-header .ph-meta {
    text-align: right;
    font-size: 9.5pt;
    color: #1a2332;
    line-height: 1.45;
  }
  body.printing .print-only.print-header .ph-meta .ph-meta-label {
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7a8c;
    font-weight: 600;
    margin-bottom: 1mm;
  }
  body.printing .print-only.print-header .ph-row2 {
    margin-top: 4mm;
    font-size: 9pt;
    color: #44556a;
    display: flex;
    justify-content: space-between;
    gap: 6mm;
  }

  /* The comparison table itself. */
  body.printing .compare-table-wrap {
    overflow: visible !important;
    padding: 0 !important;
  }
  body.printing .compare-table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    font-size: 9pt;
  }
  body.printing .compare-table thead th {
    background: #f8fafb !important;
    color: #1a2332 !important;
    border-bottom: 2px solid #e2e8ef !important;
    padding: 2mm 2mm !important;
    vertical-align: top !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.printing .compare-table thead th .th-brand {
    font-size: 7pt !important;
    color: #0D9488 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.printing .compare-table thead th .th-product {
    font-family: 'DM Serif Display', serif;
    font-size: 10.5pt !important;
  }
  body.printing .compare-table thead th .th-score {
    background: #e0f4f2 !important;
    color: #0a7c73 !important;
    font-size: 7.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.printing .compare-table tbody tr td:first-child {
    background: #f8fafb !important;
    color: #44556a !important;
    font-weight: 600 !important;
    width: 38mm !important;
    white-space: nowrap !important;
    padding: 1.8mm 2mm !important;
  }
  body.printing .compare-table tbody tr td {
    border-bottom: 1px solid #e2e8ef !important;
    padding: 1.8mm 2mm !important;
    word-break: break-word;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 9pt;
  }
  body.printing .compare-table th.best-col,
  body.printing .compare-table td.best-col {
    background: #e0f4f2 !important;
    border-top: 3px solid #0D9488 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.printing .best-match-badge {
    background: #0D9488 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Print footer block at the end of the table wrap. */
  body.printing .print-only.print-footer {
    display: flex;
    justify-content: space-between;
    gap: 6mm;
    margin-top: 6mm;
    padding-top: 3mm;
    border-top: 1px solid #e2e8ef;
    font-size: 8pt;
    color: #44556a;
    line-height: 1.45;
  }

  /* Keep table rows together when possible so a single row doesn't split
     across the page boundary. */
  body.printing .compare-table tr { page-break-inside: avoid; }
}
