/* ══════════════════════════════════════════════════════════════════
   PRINT.css  —  the memo on paper

   This is the original goal of the whole product: a sheet you can
   print and put on a coworker's desk.

   v1 could not have this file work. 8,120 inline style="" attributes
   carried the dark palette, and inline styles beat stylesheet rules,
   so every override would have needed !important. v1 shipped with
   zero print rules in either CSS file.

   Because v2 keeps color in tokens, print is a variable swap.
   ═════════════════════════════════════════════════════════════════ */

/* I AM HERE — and this one had to learn the hard way.
   9 Oct. A 22-page PDF came back: the whole board instead of the memo,
   every number in pale screen grey on white paper, Reset and Reload
   printed across the top, and the input boxes rendered as form
   controls. Every symptom traced to one cause — this file was not on
   the server. Nothing said so. The app booted, the board looked
   right, and the fault only appeared at the one moment it mattered,
   in a document going to somebody else.
   Everything below lives inside @media print, so it cannot be seen on
   screen and cannot be checked by looking. This property can be, and
   index.html checks it at boot. */
:root { --rb-print: 1; }

/* ══ THE PAPER PALETTE ═══════════════════════════════════════════
   9 Oct. These same values now also live on `.paper` in tokens.css,
   which is the memo rendered as a sheet ON SCREEN — white, two
   columns, lying on a dark backdrop in the middle of the board.

   Two copies of a palette is normally the thing this project hunts.
   It is deliberate here and only because CSS cannot share a
   declaration block between a class and an `@media print :root`,
   and the alternative — forcing every print path to add a body
   class — would silently stop working the day somebody presses
   Ctrl+P without going through a button.

   So instead: test/styles.js holds them together. It renders the
   memo on screen and again under print emulation and asserts the
   computed colours match. If these two ever drift, that law says
   so, which is the guarantee the duplication would otherwise cost
   us. Change one, change both, and run styles.
   ═════════════════════════════════════════════════════════════════ */
@media print {

  /* Flip the token values. Everything downstream follows. */
  :root {
    --bg:          #ffffff;
    --surface:     #ffffff;
    --surface-2:   #f8fafc;
    --border:      #94a3b8;
    --border-soft: #cbd5e1;

    --text:        #000000;
    --text-2:      #1e293b;
    --text-3:      #475569;
    --text-4:      #64748b;

    /* Ink-safe semantics. Emerald on white is unreadable at 9pt. */
    --good:        #047857;
    --good-soft:   #047857;
    --good-bg:     #ecfdf5;
    --warn:        #b45309;
    --warn-soft:   #b45309;
    --bad:         #b91c1c;
    --bad-soft:    #b91c1c;
    --accent:      #3730a3;
    --accent-soft: #3730a3;

    --ready-edge:   #047857;
    --prov-edge:    #b45309;
    --blocked-edge: #94a3b8;
  }

  @page { margin: 14mm 12mm; }

  body { background: #fff; color: #000; font-size: 10pt; }

  /* Screen chrome doesn't print. */
  .no-print,
  .sticky-header,
  .section-toggle,
  button,
  input[type="range"],
  .rd-chip,
  nav {
    display: none !important;
  }

  /* Inputs print as their values, not as form controls. */
  input, select, textarea {
    border: none !important;
    background: transparent !important;
    color: #000 !important;
    padding: 0 !important;
    -webkit-appearance: none;
    appearance: none;
  }

  .card {
    background: #fff;
    border: 1px solid var(--border-soft);
    box-shadow: none !important;
    padding: 8pt 10pt;
    margin-bottom: 8pt;
    break-inside: avoid;
  }

  /* A memo section should not split across a page. */
  .memo-section { break-inside: avoid; page-break-inside: avoid; }
  .memo-section h2, .memo-section h3 { break-after: avoid; }

  /* Readiness still matters on paper — a provisional number in a memo
     handed to a lender needs to say so. Rendered as text, not color. */
  .val-prov::after {
    content: " (provisional)";
    font-size: 8pt;
    color: var(--text-3);
  }
  .val-blocked::after {
    content: " \2014 not set";
    font-size: 8pt;
    color: var(--text-3);
  }

  /* Numbers stay monospace so columns line up on paper. */
  .num, .stat-value { font-family: var(--mono); }

  /* Emoji render inconsistently on print drivers and eat ink. */
  .emoji { display: none !important; }

  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: var(--text-3); }
  /* …except where the url is already printed as its own line. The
     See-the-property panel spells each one out in full on purpose,
     and this rule was printing every one of them a second time in
     grey parentheses underneath. */
  .ph-l[href^="http"]::after { content: none; }

  /* .print-footer is gone — the memo has one footer now, .memo-foot,
     and it is the same one on screen and on paper. */
  .memo-foot { font-size: 8pt; color: var(--text-3); }
}

/* ── printing the due-diligence sheet ─────────────────────────────
   10 Oct. This used to print the questionnaire: three pages, seventy-
   three questions, most of them unanswered, no address on any page,
   and checkboxes that came out as the digit 1 because the print font
   had no glyph for \2610.

   Nobody wants that. What you hand a coordinator is the outstanding
   work, the deadline, and what can still unwind the deal — which is
   the sheet at the bottom of the section. So this prints that, and
   the questionnaire above it is screen furniture, the same way the
   board is screen furniture around the memo.

   Named as SHOW, not as HIDE. A category added tomorrow is hidden by
   default, which is the right default for a document going to
   somebody else. The long note further down explains why that
   distinction cost a day. */
@media print {
  body.print-dd #app > * { display: none !important; }
  body.print-dd #app > .act-after { display: block !important; }
  body.print-dd .act-after > .act-head { display: none !important; }

  /* inside the section, only the sheet. It is a sibling of the
     checklist card, not part of it — a document, the same way the
     memo's sheet is a document. */
  body.print-dd .act-after > .dd { display: none !important; }
  body.print-dd .act-after > .paper-stage { display: block !important; }

  /* A BLOCK MAY SPLIT; A LINE MAY NOT. Holding a whole block
     together threw "Not yet looked at" onto a page of its own and
     left two thirds of the previous page white. The thing that must
     never break is one item across two pages. */
  .ds-clock, .ds-sign { break-inside: avoid; }
  .ds-item, .ds-wrow, .ds-haz-i { break-inside: avoid; }
  .ds-h { break-after: avoid; }
  /* the three piles are the shape of the document — each starts a page
     only if it would otherwise be orphaned at the foot of one */
  .ds-block { orphans: 3; widows: 3; }
}

@media print {
  body.print-sc #app > * { display: none !important; }
  body.print-sc #app > .act-call { display: block !important; }
  body.print-sc .act-call > .act-head { display: none !important; }
  /* the two input cards are a screen surface; the who-card keeps its
     own print rules and shows the name and number only */
  body.print-sc .id-card { display: none !important; }

  /* a script on paper wants room to breathe and margin to write in */
  .sc-body { background: none; border: none; padding: 0;
             font-size: 11pt; line-height: 1.9; max-width: none; }
  .sc-flag { break-inside: avoid; background: none;
             border-left: 2pt solid #000; padding-left: 8pt; }
  .sc-say { background: #f4f4f5; font-style: italic; }
  .sc-receipts, .chips, .btnrow { display: none !important; }
  .sc-obj { break-inside: avoid; background: none;
            border-bottom: 1px solid #cbd5e1; padding: 6pt 0; }
}

@media print {
  /* ═══ SHOW ONE SECTION, HIDE THE REST ═══════════════════════
     8 Oct. These three blocks used to name what to HIDE — the facts
     act, the sandbox act, the memo, the scripts, and so on — and a
     list of things to hide is wrong the moment anything is added.

     It went wrong the same afternoon. Three acts became seven, and
     `.act-sandbox` stopped existing while `.act-intake`, `.act-call`,
     `.act-after`, `.act-papers` and the masthead had never been on
     the list. So page one of a memo PDF — the thing you email to a
     buyer — was the app's own name, a Reset button, "1 Intake", and
     "3 The case" with a struck-through Lease Option card on it. The
     memo did not begin for pages.

     Naming what to SHOW cannot rot that way: a section added
     tomorrow is hidden by default, which is the right default for a
     document going to somebody else. The section's own numbered head
     goes too — it is app furniture and the memo carries its own
     masthead. */
  body.print-memo #app > * { display: none !important; }
  body.print-memo #app > .act-memo { display: block !important; }
  body.print-memo .act-memo > .act-head { display: none !important; }

  /* nothing floating, on any printed view */
  #totop, .pn, .rd-acts, .dd-jump, .ob-done, .dk, .dk-min { display: none !important; }
}
