/* ============================================================
   DAY91 — PRINT / SAVE AS PDF
   Linked with media="print" on the four tool pages.
   Nothing here affects the screen.
   ============================================================ */

@page {
  size: A4 portrait;
  margin: 16mm 14mm 16mm 14mm;
}

@media print {

  /* ---------- strip the site chrome ---------- */

  .topbar, .masthead, footer.site, .subscribe, .beehiiv-slot, .founding-slot, .founding,
  .actions, .no-print, .marquee, .machine, .machine-cap, .scene, .agentbar,
  #after, #convert, #request, .setup-note, .privnote,
  nav, .issue-switch, .toolgrid, .plans, .faq, .cmp {
    display: none !important;
  }

  /* the method / explainer sections are screen furniture, not results */
  main > section.section.rail:not([data-print]) { display: none !important; }

  html, body {
    background: #fff !important;
    color: #17181B !important;
    font-size: 9.6pt;
    line-height: 1.45;
  }

  .shell { max-width: none !important; padding: 0 !important; }
  .rail { padding-left: 0 !important; }
  .rail::before, .mark { display: none !important; }
  section { padding: 0 !important; border: 0 !important; }
  .hero { display: none !important; }

  /* ---------- keep the evidence colours ---------- */

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ---------- the print-only masthead ---------- */

  .pdf-head { display: block !important; }
  .pdf-head {
    border-bottom: 1.5pt solid #17181B;
    padding-bottom: 7pt;
    margin-bottom: 12pt;
  }
  .pdf-head .pdf-brand {
    font-family: var(--display), Archivo, sans-serif;
    font-weight: 700;
    font-size: 12pt;
    letter-spacing: -0.02em;
  }
  .pdf-head .pdf-brand span { color: #1F3FA8; }
  .pdf-head .pdf-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10pt;
  }
  .pdf-head h1.pdf-title {
    font-family: var(--display), Archivo, sans-serif;
    font-size: 16pt;
    letter-spacing: -0.025em;
    margin: 6pt 0 3pt;
    line-height: 1.15;
  }
  .pdf-head .pdf-sub {
    font-size: 9pt;
    color: #35383E;
    margin: 0;
    max-width: 150mm;
  }
  .pdf-head .pdf-meta {
    font-family: var(--mono), "JetBrains Mono", monospace;
    font-size: 7.5pt;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #63676E;
    white-space: nowrap;
  }

  .pdf-foot { display: block !important; }
  .pdf-foot {
    border-top: 0.75pt solid #DCDAD2;
    margin-top: 14pt;
    padding-top: 7pt;
    font-size: 7.5pt;
    color: #63676E;
    line-height: 1.5;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .pdf-foot strong { color: #17181B; }

  /* ---------- results blocks stay whole ---------- */

  .check, .bm, .dossier, .livecard, .rankcard, .verdict-box, .claims .cl,
  .step, .persona, .tier-key, .entry, .stat {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .summary {
    position: static !important;
    top: auto !important;
    border: 0.75pt solid #DCDAD2;
    background: #FBFBF9 !important;
    padding: 6pt 8pt;
    margin-bottom: 10pt;
    break-inside: avoid;
  }

  h2 { font-size: 12pt !important; margin: 10pt 0 5pt !important; letter-spacing: -0.02em; }
  h3 { font-size: 10.5pt !important; }
  p { max-width: none !important; orphans: 3; widows: 3; }

  /* ---------- print the source URLs — this is the whole point ---------- */

  .srcs a::after,
  .precedent a::after,
  .routes a::after,
  a[data-print-href]::after {
    content: " (" attr(href) ")";
    font-family: var(--mono), monospace;
    font-size: 6.8pt;
    color: #63676E;
    word-break: break-all;
  }
  a { color: #16307E !important; text-decoration: none; }

  /* ---------- tool-specific ---------- */

  /* Benchmarks: the strips are absolutely positioned, keep them intact */
  .strip { break-inside: avoid; page-break-inside: avoid; }
  .disclose { break-inside: avoid; page-break-inside: avoid; }
  .bmfield { break-inside: avoid; }
  .bmfield input {
    border: 0 !important;
    border-bottom: 0.75pt solid #17181B !important;
    border-radius: 0 !important;
    padding-left: 0 !important;
    font-weight: 700;
  }

  /* Mirror: inputs are the source material, results are the output */
  .srcgrid { break-inside: auto; }
  .srcrow textarea { display: none !important; }
  .srcrow .fstat, .srcrow .wc, .fetchbtn { display: none !important; }
  .srcrow { padding: 3pt 0 !important; background: none !important; border: 0 !important; }
  .srcrow input { border: 0 !important; padding: 0 !important; background: none !important; }
  .srcgrid { border: 0 !important; background: none !important; gap: 0 !important; }
  .scoretable { font-size: 8.5pt; }
  .scoretable th, .scoretable td { padding: 4pt 3pt; }

  /* Watchlist: chips describe the input set */
  .chips { break-inside: avoid; }
  .picker, .co-form, .suggest { display: none !important; }

  /* Check: inputs are the evidence, keep them readable */
  .check input {
    border: 0 !important;
    border-bottom: 0.75pt solid #17181B !important;
    border-radius: 0 !important;
    padding-left: 0 !important;
    font-weight: 700;
  }
}

@media print {
  /* Check: an untested row is noise on paper — only print what was run */
  .check[data-state="idle"] { display: none !important; }

  /* Mirror: empty rows and unfilled inputs print as placeholder text */
  .srcrow:not(:has(textarea:not(:empty))) { display: none !important; }
  input:placeholder-shown { visibility: hidden !important; }

  /* instructional copy is screen furniture */
  section > p.small, .hint, .howto { display: none !important; }
  .pdf-head .pdf-sub, .pdf-foot { display: block !important; visibility: visible !important; }
  .summary .small { display: inline !important; }
}
