/* ==========================================================================
   print.css — the app's print rules.

   🔴 WHY THIS FILE EXISTS AT ALL. The estimator works from HARD COPY. Before
   this file, the nine pages that carry a record activity feed shipped LITERALLY
   ZERO print CSS: the only `@media print` block anywhere in the app's own
   stylesheets is in help-enterprise.css, which _ModernLayout never links, and
   Bootstrap's CSS (which carries the .d-print-* utilities) is not linked either.

   So printing any of these pages today wastes a 280px gutter on every sheet —
   modern.css sets `.main-content { margin-left: var(--sidebar-width) }` with
   `--sidebar-width: 280px` — and the `position: fixed` sidebar paints over the
   top of page one.

   🔴 THERE IS NOTHING HERE THAT OPENS A COLLAPSED REGION, AND NOTHING MAY BE
   ADDED THAT NEEDS ONE. The communications feed collapses nothing (see
   _RecordActivityFeed.cshtml and QuotedChainBoundaries), which is deliberate:
   CSS cannot force a <details> open — `open` is a DOM attribute, not a style —
   so a print rule can never rescue folded content. The house rule from PR #1181
   stands: must-print content is a SIBLING, never a child of a disclosure.

   Linked after every other app stylesheet in _ModernLayout (verified in the
   browser — an earlier cut sat above three of them). Most declarations here are
   !important; the page-break rule deliberately is not, because nothing competes
   with it. An earlier version of this comment claimed EVERY declaration was
   !important, which was false of the one rule specific to this feed.

   🔴 THIS FILE DOES SET COLOURS, AND ONLY BECAUSE PAPER HAS NO DARK MODE.
   `_ModernLayout` adds `.dark` automatically from prefers-color-scheme, with no
   user action, and that class is still on the element while printing. The theme
   tokens then resolve to their DARK values on WHITE paper: --lux-text is #f1f5f9
   and --lux-text-secondary is #cbd5e1, i.e. about 1.3:1 — invisible. The message
   body text has printed white-on-white from a dark session for as long as the
   dark theme has existed; tokenising this feed's three inline hexes would have
   added the timestamp, the footer and the quote rules to that list.

   So the three primitives are pinned back to their LIGHT values for print only.
   They are transcribed from `cherryai-theme.css`'s own `:root` block — the same
   file that overrides them under `html.dark` — because a print rule cannot
   reference a token that is itself what flipped. ADR-010's intent is one place
   to change a colour; these are mirrors, not new colours, and this note is the
   pointer back to the original.
   ========================================================================== */

@media print {

  /* --- Paper is light, whatever the screen was ---------------------------
     Mirrors of cherryai-theme.css's :root values, applied only when .dark is
     on the element and only for print. Fixes the four elements this PR
     tokenised AND the message body text, which predates it. */
  html.dark {
    --lux-text: #0f172a;
    --lux-text-secondary: #475569;
    --color-border-2: #cbd5e1;
    /* W9 light-mode sweeps B and C moved the E&Q views' literal inks onto tokens that FLIP in dark — the muted ink, the tone
       inks the pills and banners use, the danger ink, the accent — and on paper their dark values are pale (an RFQ warning printed
       from a dark session fell from 4.90:1 to 2.86:1: Codex on sweep C). The same mirrors of their light values; EqPrintInkMirrorsTests
       ties each to its home (tokens.css / cherryai-theme.css). */
    --lux-text-muted: #5b6776;
    --ink-on-warning-tint: #92400e;
    --ink-on-danger-tint: #991b1b;
    --ink-on-success-tint: #166534;
    --ink-on-info-tint: #1d4ed8;
    --color-danger-700: #991b1b;
    --color-accent: #10748f;
  }

  /* --- Chrome that is not part of the record ----------------------------- */
  .sidebar,
  .sidebar-overlay,
  .mobile-menu-btn-floating,
  .app-footer,
  [data-testid="send-message-btn"] {
    display: none !important;
  }

  /* --- Reclaim the page the sidebar was holding -------------------------- */
  .app-container { display: block !important; }
  .main-content  { margin-left: 0 !important; }
  .page-content  { padding: 0 !important; }

  /* --- Stop the card clipping what it contains ---------------------------
     primitives.css declares `.ds-card { overflow: hidden }`, which on screen
     CLIPS an over-wide line with no scrollbar — measured on the communications
     feed, where the longest whitespace-free token in the real corpus is a
     629-character safelink. On paper there is no scrollbar to fall back on at
     all, so the clip is silent data loss. The screen half of this fix is
     `overflow-wrap: anywhere` on the message body. */
  .ds-card {
    overflow: visible !important;
    box-shadow: none !important;
  }

  /* --- Keep one logged message on one sheet where it fits ----------------
     Both spellings on purpose: `break-inside` is the current property but is
     honoured inconsistently across browser versions, and the legacy
     `page-break-inside` is what older engines actually obey. Printing is the
     one output here with no scrollbar to recover from a bad break, so the
     redundancy is cheap insurance. (Copilot, #1184.) */
  [data-testid^="comms-msg-"] {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}
