/*
 * Print
 *
 * Applies to the ten screens that are printed as evidence: registers, queues,
 * agendas, audit extracts and the questionnaires. The official forms take a
 * different path entirely, rendered server-side to PDF so their layout matches
 * the paper original exactly.
 *
 * Linked with media="print", so none of this reaches the screen.
 *
 * Six of the class hooks below were renamed or deleted while this file was not
 * looked at: the section 12 audit replaced `.gc-badge`, `.gc-card`, `.gc-table`
 * and `.gc-table--cards` with the template's own `.badge`, `.block`, `.table`
 * and `.table--cards`, and D-78 deleted `.gc-sort` when DataTables took over
 * sorting. Every rule that referred to them silently did nothing -- the
 * badge-to-outline rule, the table borders, the repeating `thead` and the
 * card-mode reversal -- which is invisible until somebody prints a form.
 */

@page {
  size: Letter;
  margin: 18mm 14mm 20mm;
}

/* --- Shell --------------------------------------------------------------- */
#sidebar,
#side-overlay,
#page-header,
#page-footer,
#page-overlay,
#gc-toasts,
#gc-modal,
.gc-skip-link,
.gc-actionbar,
.gc-chipbar,
.pagination,
form[hx-post],
.btn { display: none !important; }

#main-container { padding: 0 !important; margin: 0 !important; }
.content { max-width: none !important; padding: 0 !important; }

/* --- Ink ----------------------------------------------------------------- */
body {
  background: #fff !important;
  color: #000 !important;
  font-size: 10pt;
  line-height: 1.35;
}

.block {
  border: 1px solid #999 !important;
  box-shadow: none !important;
  background: #fff !important;
}

/* A tinted badge is invisible on a monochrome office printer, so every badge
   prints as an outline with its text. The word was always there; only the fill
   is dropped. */
.badge {
  background: none !important;
  color: #000 !important;
  border: 1px solid #000;
}

.badge--crisis { border-width: 2px; font-weight: 700; }

/* --- Tables -------------------------------------------------------------- */
.gc-table-wrap { overflow: visible !important; border: 0 !important; }

.table { border-collapse: collapse !important; width: 100% !important; }

/* The heading repeats on every page, which is what makes a multi-page register
   readable at all. */
.table > thead { display: table-header-group; }

.table > tbody > tr { page-break-inside: avoid; }

.table th,
.table td {
  border: 1px solid #666 !important;
  padding: 4pt 6pt !important;
  background: none !important;
}

/* Card mode is a small-screen affordance and must never reach paper. */
.table--cards,
.table--cards > thead,
.table--cards > tbody,
.table--cards > tbody > tr,
.table--cards > tbody > tr > td { display: revert !important; }

.table--cards td[data-label]::before { content: none !important; }

/* --- Blocks that must not split ------------------------------------------ */
.block,
.timeline-event,
.gc-scale__item,
.gc-crisis-card { page-break-inside: avoid; }

h1, h2, h3 { page-break-after: avoid; }

/* --- Print-only furniture -------------------------------------------------
   Added to the page by the template, hidden on screen, revealed here: who
   printed it, when, and what filter produced it. A printed extract of
   counselling data must be traceable. */
.gc-print-only { display: block !important; }

.gc-print-header {
  margin-bottom: 8pt;
  padding-bottom: 4pt;
  border-bottom: 1.5pt solid #000;
}

.gc-print-header__title { font-size: 13pt; font-weight: 700; margin: 0 0 2pt; }
.gc-print-header__meta  { font-size: 8.5pt; }

.gc-print-footer {
  margin-top: 8pt;
  padding-top: 4pt;
  border-top: .5pt solid #666;
  font-size: 8pt;
}

/* --- Links ----------------------------------------------------------------
   A printed page cannot be clicked, so an internal link prints as plain text. An
   external one prints its address, because that is the only way to follow it. */
a { color: #000 !important; text-decoration: none !important; }

a[href^="http"]::after {
  content: " (" attr(href) ")";
  font-size: 8pt;
  word-break: break-all;
}
