/* ==========================================================================
   Print foundation - Phase A (tokens only)
   ==========================================================================

   THIS FILE DECLARES CUSTOM PROPERTIES AND NOTHING ELSE.

   It is linked with media="print", so it is inert on screen by definition,
   and because it contains no selectors that paint, it is inert on paper
   too. Printing the application today produces exactly what it produced
   before Phase A. That is intentional: the print STRATEGY is specified
   here in comments and its rules are written in Phase C, alongside the
   executive-report work they exist to serve.

   Why print matters enough to have its own foundation: the application's
   primary deliverable is a weekly executive report, and `@media print`
   currently appears ZERO times in 1,603 lines of main.css. Reports are
   printed and circulated with the browser's default stylesheet, which
   keeps the navigation sidebar, drops chart context, and splits tables
   across pages mid-row.

   ---------------------------------------------------------------------
   PRINT STRATEGY - specified now, implemented in Phase C
   ---------------------------------------------------------------------

   1. SURFACES AND INK
      White background, black text. No brand tint behind data: a gradient
      masthead that looks right on screen wastes toner and reduces contrast
      on paper. --print-brand is reserved for the masthead rule and the
      logo, nothing else.

   2. NAVIGATION AND CHROME
      Hidden: sidebar, mobile top bar, nav toggle, profile menu, filter
      bars, action buttons, pagination, modal backdrops. None of it is
      actionable on paper and all of it costs column width.

   3. TABLES
      Visible borders on every cell - screen styling leans on subtle fills
      and 1px light rules that disappear in print. `thead { display:
      table-header-group }` so headers repeat on every page, and
      `tr { break-inside: avoid }` so no row is split across a page break.

   4. CHARTS
      Charts print at their rendered size, and the visually-hidden data
      table that accompanies every chart (see the component spec) is made
      VISIBLE in print. A bar chart reproduced in greyscale is often
      unreadable; the figures beside it are not. Series must remain
      distinguishable by dash pattern and point shape, not colour alone.

   5. DATA LABELS AND TARGETS
      Explicit data labels and target lines are retained, never suppressed
      to save space. An executive reading a printed report has no tooltip.

   6. PAGE BREAKS
      Report section bands use `break-after: avoid` so a heading never
      lands alone at the foot of a page. Each major report section may
      begin on a new page where it improves readability.

   7. MASTHEAD AND EXECUTIVE SUMMARY
      The logo prints once, top-left of page one, at --print-logo-width.
      Never a watermark, never repeated per page. The as-of date and the
      reporting scope print directly beneath it, because a circulated
      report detached from its week is worse than no report.
      The executive summary prints immediately after the masthead, before
      the detail sections.

   8. LINKS
      URLs are NOT expanded inline. An HR report full of bracketed
      /hr/weekly-executive-report?executive_id=3 strings is noise.

   PHASE C: the rules below implement this strategy for the executive report
   family. They live inside the same @media print block as the tokens.
   ========================================================================== */

@media print {
  :root {
    /* Ink */
    --print-ink: #000000;
    --print-muted: #333333;
    --print-rule: #999999;
    --print-brand: #1d4484;
    --print-surface: #ffffff;

    /* Type - points, not pixels, because the target is paper */
    --print-body-size: 10.5pt;
    --print-caption-size: 8.5pt;
    --print-heading-size: 16pt;
    --print-masthead-size: 20pt;
    --print-line-height: 1.35;

    /* Layout */
    --print-page-margin: 12mm;
    --print-logo-width: 120px;
    --print-table-border: 1px solid #999999;
  }

  /* ---------------------------------------------------------------- ink
     Never assume the reader enabled "background graphics". Every surface
     prints white and every rule is drawn with a BORDER, which prints
     regardless, rather than a background fill, which usually does not. */

  html,
  body {
    background: var(--print-surface);
    color: var(--print-ink);
    font-size: var(--print-body-size);
    line-height: var(--print-line-height);
  }

  /* --------------------------------------------------------- chrome off
     Navigation, controls and anything that only exists to be clicked. The
     report keeps its data; it loses its interface. */

  .sidebar,
.sidebar-backdrop,
.mobile-topbar,
.nav-toggle,
.skip-link,
.profile-menu,
.sidebar-cta,
.filters-bar,
.header-actions,
/* The drill-down modal is outside #reportRoot,
so an image export
     cannot reach it - but PRINT walks the whole document,
so it is
     named here too. No employee row from a modal may reach paper. */
  #retentionDrilldownBackdrop,
.report-masthead-controls,
.modal-backdrop,
.btn {
    display: none !important;
  }

  /* The one !important block outside the reduced-motion guard. Screen rules
     set `display:flex` on several of these with higher specificity than a
     bare class selector can reach, and a printed report that still carries
     a navigation sidebar wastes a third of every page. */

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
    max-width: none;
  }

  /* ------------------------------------------------------------ masthead
     Compact, ink-light, and printed once. An oversized gradient banner
     wastes the first page, so the gradient is dropped and the identity is
     carried by a rule and the logo. */

  .report-masthead {
    background: none;
    color: var(--print-ink);
    border: none;
    border-bottom: 2px solid var(--print-brand);
    border-radius: 0;
    padding: 0 0 var(--space-3);
    margin-bottom: var(--space-5);
    break-after: avoid;
  }

  .report-masthead h1 {
    color: var(--print-brand);
    font-size: var(--print-masthead-size);
  }

  .report-masthead-subtitle,
  .report-meta-label {
    color: var(--print-muted);
  }

  .report-meta-value {
    color: var(--print-ink);
  }

  /* Printed identity: the logo appears ONCE, at the top of page one, and
     never as a watermark. */
  .report-print-header {
    display: block;
    margin-bottom: var(--space-4);
  }

  /* The wrapper supplies the clear space the master itself lacks; the
     height token drives the size and width follows, so the mark keeps its
     1.7156:1 ratio on paper as on screen. */
  .report-print-header .brand-logo {
    --brand-logo-height: var(--print-logo-width);
    display: inline-flex;
    padding: calc(var(--print-logo-width) * var(--logo-clear-space-ratio));
  }

  .report-print-header img {
    height: var(--print-logo-width);
    width: auto;
  }

  /* ------------------------------------------------------------- bands */

  .report-band {
    background: none;
    color: var(--print-brand);
    border-bottom: 1px solid var(--print-brand);
    border-radius: 0;
    padding: 0 0 2px;
    break-after: avoid;
  }

  .report-band-note {
    border: none;
    padding: var(--space-2) 0;
    color: var(--print-muted);
  }

  /* ------------------------------------------------- cards and grouping
     Visual grouping survives without background ink: borders, not fills. */

  .chart-card,
  .metric-tile,
  .card,
  .table-card,
  .report-narrative,
  .data-quality-notice,
  .report-empty {
    background: none;
    box-shadow: none;
    border: 1px solid var(--print-rule);
    break-inside: avoid;
  }

  .metric-tile-value,
  .chart-card-title {
    color: var(--print-brand);
  }

  .data-quality-notice {
    border-left: 3px solid var(--print-ink);
    color: var(--print-ink);
  }

  /* -------------------------------------------------------------- charts
     A chart and its supporting table are one unit and are kept together.
     The table is what actually survives greyscale, so it is never hidden
     in print - it is the reason a printed report is still readable. */

  .chart-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .chart-canvas-wrap,
  .chart-canvas-wrap.is-tall {
    height: 220px;
    break-inside: avoid;
  }

  canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* -------------------------------------------------------------- tables
     Borders on every cell, headers repeated on each page, and no row split
     across a page break. */

  .data-table,
  .cohort-table {
    border-collapse: collapse;
    width: 100%;
  }

  .data-table th,
  .data-table td,
  .cohort-table th,
  .cohort-table td {
    border: var(--print-table-border);
    background: none;
    color: var(--print-ink);
    padding: 4px 6px;
    white-space: normal;
  }

  .data-table thead,
  .cohort-table thead {
    display: table-header-group;
  }

  .data-table tr,
  .cohort-table tr {
    break-inside: avoid;
  }

  .report-row-current td,
  .report-row-summary td {
    font-weight: 700;
  }

  .table-card {
    overflow: visible;
  }

  /* ------------------------------------------------- meaning, preserved
     Targets, variances and status keep their glyphs, so the printed report
     carries the same meaning as the screen without relying on colour. */

  .variance,
  .target-indicator,
  .status-pill,
  .cohort-status {
    color: var(--print-ink);
    background: none;
    border: 1px solid var(--print-rule);
  }

  .cohort-label,
  .supporting-count,
  .report-footnote {
    color: var(--print-muted);
  }

  /* ---------------------------------------------------------- page setup */

  @page {
    margin: var(--print-page-margin);
  }

  /* URLs are not expanded inline - a report full of bracketed query strings
     is noise, not information. */
  a[href]::after {
    content: "";
  }

  /* A clickable value prints as a value. The button chrome, the hit-area
     padding and the dotted affordance are all screen concerns; on paper the
     percentage is just the percentage. */
  .value-drilldown {
    min-height: 0;
    margin: 0;
    padding: 0;
    background: none;
    color: var(--print-ink);
    text-decoration: none;
    font-weight: inherit;
  }

  /* ------------------------------------------------------- roster sheets

     One sheet, one page. The sheet is already the unit of layout on screen,
     so printing is a matter of breaking between them rather than reflowing:
     what was reviewed on screen is what comes out of the printer.

     The builder and the export controls are not part of the document. Their
     inner .filters-bar/.header-actions/.btn are hidden by the block above,
     but the section headings and status lines are not, so the sections are
     removed whole. */
  #rosterBuilder,
  #rosterExportSection {
    display: none;
  }

  .roster-sheet {
    /* The screen's card chrome is a screen concern; on paper the page
       boundary already separates one sheet from the next. */
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: none;
    break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }

  /* No trailing blank page. */
  .roster-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  /* Four across on paper whatever the screen was doing - the phone's
     two-column reflow must not follow the roster to the printer. */
  .roster-sheet .roster-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
  }

  /* A face split across a page break is the one thing a roster must never
     do. */
  .roster-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border-color: var(--print-rule);
  }

  .roster-sheet-head {
    break-after: avoid;
    border-bottom: 1px solid var(--print-rule);
  }

  .roster-card-title,
  .roster-card-meta,
  .roster-sheet-page {
    color: var(--print-muted);
  }
}
