/* ---- Print root: hidden on screen ---- */
#print-root { display: none; }

/* ---- @page margin boxes (CSS Paged Media spec) ----
   Supported in Prince, WeasyPrint, PDFreactor.
   Chrome/Firefox/Safari ignore these rules — disable "Headers and footers"
   in the browser print dialog to avoid overlap with the browser's own footer. */
@page {
  @top-left   { content: ""; }
  @top-center { content: ""; }
  @top-right  { content: ""; }
  @bottom-left  {
    content: string(doc-title);
    font-size: 8pt;
    color: #555;
  }
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-size: 8pt;
    color: #555;
  }
}

/* ---- Print layout ---- */
@media print {
  body > *:not(#print-root) { display: none !important; }

  html, body {
    background: #fff !important;
  }

  #print-root {
    display: block;
    color: #000;
    background: #fff;
    font-size: 11pt;
    line-height: 1.6;
  }

  /* Page break between items (column print) */
  .print-item + .print-item { break-before: page; }

  /* Pull content away from the right page edge so borders are fully visible */
  .print-item { margin-right: 12pt; }

  /* Header row: board name left, column/folder path right */
  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 8pt;
    color: #666;
    border-bottom: 1px solid #bbb;
    padding-bottom: 4pt;
    margin-bottom: 14pt;
    letter-spacing: 0.02em;
  }

  .print-board { font-weight: 600; }
  .print-context { color: #888; }

  /* Title — also registers its text for the @bottom-left margin box */
  .print-title {
    font-size: 20pt;
    font-weight: 700;
    color: #000;
    margin: 0 0 14pt;
    line-height: 1.25;
    string-set: doc-title content(text);
  }

  /* Markdown body — reuses .card-desc-preview styles from markdown.css */
  .print-body {
    margin-bottom: 18pt;
    font-size: 11pt;
    font-family: Helvetica, sans-serif;
  }

  /* Suppress interactive/screen-only UI inside the print body */
  .print-body.card-desc-preview:hover { background: transparent; }
  .md-copy-btn,
  .md-copy-all-btn { display: none !important; }

  /* Custom checkbox rendering — native appearance is ignored in print */
  .print-body input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border: 1.5px solid #888;
    border-radius: 2px;
    background: #fff;
    vertical-align: middle;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-body input[type="checkbox"]:checked {
    background-color: #10b981;
    border-color: #10b981;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 13 13' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6.5L5 9.5L11 3.5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Images inside markdown body */
  .print-body img {
    max-width: 100%;
    height: auto;
    display: block;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Force browsers to print background colors and images */
  .print-body,
  .print-body * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Resolve CSS variables that print media cannot inherit from :root */
  .print-body code,
  .print-body pre  { background: #f4f4f4; border-color: #ccc; }
  .print-body blockquote { border-color: #888; color: #555; }
  .print-body a    { color: #3b4cf0; }
  .print-body mark { background: rgba(250, 204, 21, 0.4); }

  /* Footer */
  .print-footer {
    border-top: 1px solid #bbb;
    padding-top: 7pt;
    margin-top: 16pt;
  }

  .print-footer-row {
    display: flex;
    gap: 6pt;
    margin: 2.5pt 0;
    font-size: 8.5pt;
    line-height: 1.4;
  }

  .print-footer-label {
    font-weight: 600;
    min-width: 72pt;
    color: #222;
    flex-shrink: 0;
  }

  .print-footer-value {
    color: #444;
    word-break: break-all;
  }
}
