/* The printed reports, the exam records and the staff notes (app/static/portal/reports.js; task PS-12).

   Parts that house.css lacks, named for PL-07: the report's sheet (.rpt-sheet) with its head, parts, the week-by-week
   grid of sessions (.rpt-grid, .rpt-cell) and the table of the questions on each week (.rpt-checks); the forms on a
   learner's page (.rpt-form); the learner's own record on the exam's page (.rpt-own).

   On screen the sheets stand one under another, each a white page no wider than A4. In print, everything but the
   sheets is hidden while the page that holds them is mounted (body:has(.rpt-sheets)), so the module writes nothing
   outside its element, and each sheet is one A4 page. The colours are the house's tokens (styles.css), so the screen
   form follows the dark theme; the print form is black on white. */

/* ---- the page ---- */

.rpt-actions { margin: 18px 0 6px; }
.rpt-sheets { display: grid; gap: 24px; margin: 24px 0 0; }

/* ---- one sheet ---- */

.rpt-sheet { box-sizing: border-box; width: 100%; max-width: 210mm; padding: 28px 32px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.5; }
.rpt-sheet-head { padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.rpt-kicker { margin: 0; color: var(--ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rpt-sheet h2 { margin: 4px 0 2px; font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.2; }
.rpt-meta { margin: 0; color: var(--ink-2); font-size: 13px; }
.rpt-part { margin-top: 16px; }
.rpt-part h3 { margin: 0 0 6px; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); }
.rpt-where { margin: 0; }

/* Attendance and quizzes: one row for each week, one cell for each session. */
.rpt-grid, .rpt-checks { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; line-height: 1.35; }
.rpt-grid th, .rpt-grid td, .rpt-checks th, .rpt-checks td { padding: 5px 6px; border: 1px solid var(--line);
  text-align: left; vertical-align: top; }
.rpt-grid thead th, .rpt-checks thead th { color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; }
.rpt-grid tbody th { width: 17%; font-weight: 650; }
.rpt-grid thead th:first-child { width: 17%; }
.rpt-cell span { display: block; }
.rpt-cell-day { font-weight: 650; }
.rpt-cell-date { display: inline !important; color: var(--ink-3); font-weight: 400; }
.rpt-cell.is-absent .rpt-cell-seen, .rpt-cell.is-no-check-in .rpt-cell-seen { font-weight: 650; }
.rpt-cell.is-empty { background: var(--surface-2); }
.rpt-checks { max-width: 420px; }
.rpt-checks tbody th { font-weight: 650; }

/* On a phone the grid's cells stack under their week, so that nothing is wider than the window. */
@media (max-width: 640px) {
  .rpt-sheet { padding: 18px 16px; }
  .rpt-sheet h2 { font-size: 22px; }
  .rpt-grid, .rpt-grid thead, .rpt-grid tbody, .rpt-grid tr, .rpt-grid th, .rpt-grid td { display: block; width: auto; }
  .rpt-grid thead { display: none; }
  .rpt-grid tr { margin-bottom: 8px; }
  .rpt-grid tbody th { width: auto; border-bottom: 0; }
  .rpt-grid td.is-empty { display: none; }
  .rpt-grid td + td { border-top: 0; }
}

/* ---- the learner's page: the forms, the notes ---- */

.rpt-form { margin-top: 18px; }
.rpt-form h3 { margin: 0 0 10px; font-size: 16px; }
.rpt-remove { display: block; margin-top: 2px; }
.rpt-remove .link-btn { padding: 0; }
.rpt-note { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.rpt-links { margin: 14px 0; }

/* ---- the learner's own record, on the exam's page ---- */

.rpt-own { margin-top: 8px; }
.rpt-own-list { margin: 8px 0; padding-left: 20px; }
.rpt-own-list li { margin: 4px 0; }

/* ---- print: the sheets alone, one A4 page each ---- */

@page rpt { size: A4; margin: 12mm 13mm; }

@media print {
  body:has(.rpt-sheets) { background: #fff !important; }
  /* Everything that neither holds the sheets nor is inside them goes; what holds them keeps no frame of its own. */
  body:has(.rpt-sheets) :not(:has(.rpt-sheets)):not(.rpt-sheets):not(.rpt-sheets *) { display: none !important; }
  body:has(.rpt-sheets) :has(.rpt-sheets) { display: block !important; position: static !important; width: auto !important;
    max-width: none !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
    background: none !important; box-shadow: none !important; overflow: visible !important; }
  .rpt-sheets { display: block !important; margin: 0 !important; }
  .rpt-sheet { page: rpt; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none;
    background: #fff; color: #000; font-size: 10pt; line-height: 1.4; break-after: page; break-inside: avoid; }
  .rpt-sheet:last-child { break-after: auto; }
  .rpt-sheet-head { border-bottom-color: #000; }
  .rpt-kicker, .rpt-meta, .rpt-part h3, .rpt-cell-date, .rpt-grid thead th, .rpt-checks thead th { color: #333; }
  .rpt-sheet h2 { font-size: 20pt; }
  .rpt-part { margin-top: 10pt; break-inside: avoid; }
  .rpt-grid, .rpt-checks { font-size: 8.5pt; }
  .rpt-grid th, .rpt-grid td, .rpt-checks th, .rpt-checks td { padding: 3pt 4pt; border-color: #999; }
  .rpt-cell.is-empty { background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
