/* Print / Save as PDF (#8, print.js). Loaded last. On screen only the print header is
   hidden; on paper the dashboard turns into a document: the print header (club, title,
   context, printed time) leads, the tokens switch to ink on white, the rail, top bar,
   buttons, pagers and live-only lists step aside, dropdowns read as plain text, and
   panels, cards, chart and table rows keep together across pages. */

.d-print-head, .d-perf-print, .d-print-only { display: none; }

@media print {
  @page { margin: 12mm 12mm 14mm; }

  body.is-dash {
    --d-bg: #ffffff; --d-panel: #ffffff; --d-raised: #f4f4f5; --d-hover: #f4f4f5; --d-selected: #e4e4e7;
    --d-border: #d4d4d8; --d-border-strong: #a1a1aa;
    --d-text: #111113; --d-text-2: #2c2c30; --d-muted: #55555c; --d-faint: #71717a; --d-focus: #111113;
    --d-emerald: #15803d; --d-emerald-bg: #e3f6e8; --d-emerald-border: #9fd5ae;
    --d-amber: #b45309; --d-amber-bg: #fdf0dc; --d-amber-border: #f0c98a;
    --d-rose: #b91c1c; --d-rose-bg: #fbe4e4; --d-rose-border: #f0aeae;
    background: #ffffff; color: var(--d-text); font-size: 10pt;
  }
  html, body { background: #ffffff !important; }

  /* The screen's furniture. */
  .d-rail, .d-topbar, .feedback-fab, .app-backdrop, .toast, .page-hero, .d-print-btn,
  .d-pager, .d-cards-pager, .list-pager, .d-table-foot, .view-chips, .d-cards-foot, .d-foot-link,
  .d-ov-side, .d-perf-controls, .d-perf-scroll, .d-perf-tip, .d-sos-cursor, .skip-link { display: none !important; }
  .d-workspace { margin: 0 !important; min-height: 0 !important; }
  .d-view { padding: 0 !important; }
  .is-dash .stack { gap: 10pt; }
  .is-dash .d-ov-row { display: block; }
  a { color: inherit !important; text-decoration: none !important; }

  /* The document header. */
  .d-print-head { display: block; margin-bottom: 4pt; padding-bottom: 8pt; border-bottom: 1.5pt solid #111113; }
  .d-print-club { margin: 0; color: #55555c; font-size: 8.5pt; letter-spacing: 0.04em; text-transform: uppercase; }
  .d-print-title { margin: 2pt 0 0; color: #111113; font-size: 18pt; font-weight: 700; line-height: 1.2; }
  .d-print-context { margin: 3pt 0 0; color: #2c2c30; font-size: 10pt; }
  .d-print-time { margin: 2pt 0 0; color: #55555c; font-size: 8.5pt; }

  /* Panels and cards: hairline boxes on white that stay whole where they fit. */
  .is-dash .panel { border: 0.75pt solid #d4d4d8; border-radius: 6pt; background: #ffffff; box-shadow: none; break-inside: avoid; }
  .is-dash .panel-head { break-after: avoid; }
  .is-dash .panel-title { font-size: 12pt; }
  .is-dash .d-stat { border: 0.75pt solid #d4d4d8; background: #ffffff; }
  .is-dash .d-stats, .is-dash .d-stat, .is-dash .d-cards > li, .is-dash .rank-list > li, .is-dash .photo-card,
  .is-dash .d-sos-chart, .is-dash .d-perf-print-block { break-inside: avoid; }
  .is-dash table { break-inside: auto; }
  /* Scroll boxes would cut a long table or list at one page: on paper they grow and paginate. */
  .is-dash .d-table-wrap { max-height: none !important; overflow: visible !important; }
  .is-dash thead { display: table-header-group; }
  .is-dash tr { break-inside: avoid; }
  .is-dash .rank-list > li[hidden], .is-dash .d-cards > li[hidden] { display: revert !important; }

  /* Print-only blocks (the Overview's month of hunts as a table) replace their cards. */
  .d-print-only { display: revert !important; }
  .is-dash .d-reports-panel:has(.d-print-only) .d-cards { display: none !important; } /* the Overview's table; Hunt reports print their cards */
  .is-dash .d-print-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .is-dash .d-print-table th, .is-dash .d-print-table td { padding: 3pt 4pt; border-bottom: 0.5pt solid #d4d4d8; text-align: left; vertical-align: top; }
  .is-dash .d-print-table thead th { color: #55555c; font-weight: 600; }
  .is-dash .d-print-table .is-num { text-align: right; font-weight: 600; }
  .is-dash .d-print-table td:nth-child(-n + 3), .is-dash .d-print-table th { white-space: nowrap; } /* #, date, blind on one line */

  /* Dropdowns read as their chosen value. */
  .is-dash select, .is-dash .d-select {
    -webkit-appearance: none; appearance: none; height: auto; padding: 0 !important; border: 0; background: none !important;
    color: var(--d-text); font-weight: 600;
  }

  /* Season over season and the forecast: keep the plot box and its colours. */
  .is-dash .d-sos-graph { height: 150px; outline: 0.75pt solid #d4d4d8; }
  .is-dash .d-sos-readout { display: none; }

  /* Blind performance: every view as its own table, lighter tints on paper. */
  .d-perf-print { display: grid; gap: 10pt; }
  .d-perf-print-title { margin: 0 0 3pt; font-size: 10.5pt; font-weight: 600; }
  .is-dash .d-perf .d-perf-blind { position: static; min-width: 0; width: auto; max-width: none; background: none; font-size: 9pt; }
  .is-dash .d-perf td, .is-dash .d-perf thead th { min-width: 0 !important; padding: 3pt 2pt; font-size: 8.5pt; }
  .is-dash .d-perf td small { display: inline; margin-left: 2pt; font-size: 7pt; } /* the count beside the value: half the height */
  .is-dash .d-perf tr > :nth-child(2), .is-dash .d-perf.is-months tr > :nth-child(2) { position: static; background: none; }
  .is-dash .d-perf.is-months .d-perf-blind { width: auto; min-width: 0; max-width: none; } /* the screen's 132px column clips names */
  .is-dash .d-perf.is-months td, .is-dash .d-perf.is-months thead th { min-width: 0 !important; }
  .is-dash .d-perf td, .is-dash .d-perf-legend i, .is-dash .d-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .is-dash .d-perf .is-much-better, .is-dash .d-perf-legend .is-much-better { background: #c4d9f4; }
  .is-dash .d-perf .is-better, .is-dash .d-perf-legend .is-better { background: #e2ecf9; }
  .is-dash .d-perf .is-usual, .is-dash .d-perf-legend .is-usual { background: #f1f1f3; }
  .is-dash .d-perf .is-worse, .is-dash .d-perf-legend .is-worse { background: #f9e2e2; }
  .is-dash .d-perf .is-much-worse, .is-dash .d-perf-legend .is-much-worse { background: #f0c3c3; }
  .is-dash .d-perf .is-now { box-shadow: inset 0 0 0 1pt #111113; }

  /* The calendar: its month and events, without the arrows and edit buttons. */
  .is-dash .d-cal-nav .pill, .is-dash .d-cal-actions { display: none !important; }
  .is-dash .d-cal td { height: 64pt; }
  .is-dash .d-cal-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Photos fit the page. */
  .is-dash img { max-width: 100%; }
}
