/* Print stylesheet — loaded with media="print", so it never touches the screen.
 *
 * Two things people print from TaskMeet: the view they are looking at, and one
 * open decision thread. The app chrome is noise on paper in both cases, and when
 * an entry is open that entry is the whole document.
 *
 * The body classes are set by printDocument() in app.js before window.print():
 *   body.printing        a print run is in progress
 *   body.printing-modal  the open modal is the document
 */

@page {
  margin: 14mm 14mm 16mm;
}

@media print {
  :root {
    color-scheme: light;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* App chrome: never on paper. */
  aside,
  .mobile-dock,
  .skip-link,
  #toast,
  header,
  footer,
  .theme-atmosphere,
  .modal-backdrop {
    display: none !important;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: auto !important;
  }

  /* The content column: no cards, no shadows, no rounded corners. */
  .rounded-2xl,
  .rounded-xl,
  .rounded-lg {
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .bg-white,
  [class*="bg-[#f"],
  [class*="bg-[var(--color-surface)]"] {
    background: #fff !important;
  }

  .border,
  [class*="border-[#"] {
    border-color: #c9cec8 !important;
  }

  .shadow-sm,
  .shadow-md,
  .shadow-lg,
  .shadow-xl,
  .shadow-2xl {
    box-shadow: none !important;
  }

  a {
    color: #111 !important;
    text-decoration: underline;
  }

  /* Keep a record together. */
  .ledger-item,
  .task-row,
  tr,
  .node,
  li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Open entry: print the entry and nothing else. */
  body.printing-modal #todayView,
  body.printing-modal #alternateView {
    display: none !important;
  }

  body.printing-modal #modal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: none !important;
    padding: 0 !important;
    z-index: auto !important;
  }

  body.printing-modal #modalPanel {
    display: block !important;
    max-width: none !important;
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* A view, with no entry open. */
  body.printing:not(.printing-modal) #modal {
    display: none !important;
  }

  /* Controls that do nothing on paper. */
  button,
  select,
  input[type="checkbox"] {
    display: none !important;
  }

  input[type="text"],
  input[type="search"],
  input[type="date"],
  input[type="datetime-local"],
  textarea {
    border: 0 !important;
    border-bottom: 1px solid #c9cec8 !important;
    padding: 0 !important;
    background: none !important;
  }

  /* Footer stamp, so a printed page says which build it came from. */
  body.printing::after {
    content: "TaskMeet · printed " attr(data-printed-at);
    display: block;
    margin-top: 10mm;
    font-size: 8pt;
    color: #666;
    border-top: 1px solid #d8dcd6;
    padding-top: 3mm;
  }
}
