/* ==========================================================================
   Standardized Base Bot print styles
   P1.F2.T5 · ©2026 Vexstorm Studios – All Rights Reserved

   The base every printed surface extends. P4.F4.T6's base_print.html strips the
   application chrome server-side; this file makes any page printable without
   it, so a moderator who hits Ctrl+P on an observation detail gets something
   readable rather than a screenshot of a dark interface.

   Loaded with media="print" from both shells, so nothing here affects screen
   rendering.

   Two rules govern everything below:

   1. **Print is always light.** A dark theme printed literally wastes toner and
      produces grey-on-grey text. The theme tokens are overridden to a light,
      high-contrast set for the printed page regardless of the resolved theme —
      this is the one place the token indirection is deliberately short-circuited,
      and it is why it is done by redefining the roles rather than by writing
      colours into the rules below.

   2. **Nothing is hidden that carries information.** Navigation, toggles, and
      toasts go, because they are controls. Tables, captions, notices, badges,
      and the exact-value table beside every chart stay, because they are data.

   !important appears here, which is permitted in exactly two places: this file
   and the reduced-motion block in utilities.css.
   ========================================================================== */

@media print {
  /* ------------------------------------------------------------------------
     Force the light role set, whichever theme was resolved on screen.
     ------------------------------------------------------------------------ */

  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bp-color-surface-base: var(--bp-color-white);
    --bp-color-surface-raised: var(--bp-color-white);
    --bp-color-surface-sunken: var(--bp-color-white);
    --bp-color-surface-overlay: var(--bp-color-white);
    --bp-color-surface-inverse: var(--bp-color-slate-900);
    --bp-color-text-primary: var(--bp-color-slate-950);
    --bp-color-text-secondary: var(--bp-color-slate-800);
    --bp-color-text-muted: var(--bp-color-slate-700);
    --bp-color-text-inverse: var(--bp-color-white);
    --bp-color-text-link: var(--bp-color-azure-800);
    --bp-color-text-on-accent: var(--bp-color-white);
    --bp-color-border-subtle: var(--bp-color-slate-300);
    --bp-color-border-default: var(--bp-color-slate-600);
    --bp-color-border-strong: var(--bp-color-slate-800);
    --bp-color-border-focus: var(--bp-color-azure-700);
    --bp-color-accent-default: var(--bp-color-azure-700);
    --bp-color-accent-hover: var(--bp-color-azure-700);
    --bp-color-accent-active: var(--bp-color-azure-800);
    --bp-color-accent-subtle: var(--bp-color-white);
    --bp-shadow-sm: none;
    --bp-shadow-md: none;
    --bp-shadow-lg: none;
    color-scheme: light;
  }

  @page {
    margin: 15mm;
  }

  html,
  body {
    background-color: var(--bp-color-white) !important;
    color: var(--bp-color-slate-950) !important;
    /* Physical units, because this is physical output. */
    font-size: 10pt;
  }

  /* ------------------------------------------------------------------------
     Controls disappear; data does not.
     ------------------------------------------------------------------------ */

  .bp-skip-link,
  .bp-nav,
  .bp-nav__toggle,
  .bp-theme-toggle,
  .bp-header__actions,
  .bp-toast,
  .bp-toast-region,
  .bp-tooltip,
  .bp-pagination,
  .bp-modal__close,
  .bp-notice__dismiss,
  .bp-button,
  .bp-tabs__list {
    display: none !important;
  }

  .bp-header,
  .bp-footer {
    position: static !important;
    border: 0 !important;
  }

  .bp-page {
    display: block !important;
    min-height: 0 !important;
  }

  .bp-main {
    padding: 0 !important;
  }

  .bp-container {
    max-width: none !important;
    padding-inline: 0 !important;
  }

  /* A modal that was open when the user printed becomes ordinary content
     rather than an overlay clipped to the viewport. */
  .bp-modal,
  .bp-modal__dialog {
    position: static !important;
    max-height: none !important;
    box-shadow: none !important;
  }

  .bp-modal__backdrop {
    display: none !important;
  }

  /* Panels keep their boundary so the structure survives, but lose fills that
     would print as grey blocks. */
  .bp-card,
  .bp-notice,
  .bp-empty-state {
    border: 1pt solid var(--bp-color-slate-300) !important;
    background: none !important;
    break-inside: avoid;
  }

  /* ------------------------------------------------------------------------
     Tables are the product's real content on paper.
     ------------------------------------------------------------------------ */

  .bp-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .bp-table th,
  .bp-table td {
    border: 0.5pt solid var(--bp-color-slate-300) !important;
    padding: 3pt 4pt !important;
  }

  .bp-table thead {
    /* Repeat the header on every printed page of a long table. */
    display: table-header-group;
  }

  .bp-table tr,
  .bp-table caption {
    break-inside: avoid;
  }

  .bp-table__caption {
    font-weight: var(--bp-weight-bold);
    text-align: start;
  }

  /* A chart canvas prints as a bitmap of unknown quality; its exact-value table
     is the authority and is always present in the DOM (FEAT-027). Keep both,
     but never let the canvas break across pages. */
  .bp-chart {
    break-inside: avoid;
  }

  /* ------------------------------------------------------------------------
     Headings, links, and page breaks.
     ------------------------------------------------------------------------ */

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

  p,
  blockquote {
    orphans: 3;
    widows: 3;
  }

  /* Reveal the destination of an off-page link, because a printed underline
     points nowhere. Same-page fragments and javascript-free controls are
     excluded, since their href is noise on paper. */
  a[href^="http"]::after,
  a[href^="/"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: var(--bp-color-slate-700);
    word-break: break-all;
  }

  a {
    text-decoration: underline;
  }

  /* Nothing animates on paper. */
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
