/**
 * NEB GPA Calculator - print styles.
 *
 * When the student presses "Print Result" only the marksheet is printed: site
 * navigation, the header, the footer, the calculator form, buttons and every
 * unrelated page element are removed from the printed output. The browser print
 * dialog provides "Save as PDF".
 *
 * The script moves the marksheet into a temporary #neb-print-root element
 * appended to <body> for the duration of the print call. Everything else is
 * then hidden with `display: none`, which - unlike `visibility: hidden` - does
 * not leave the rest of the page occupying space. That is what stops a blank
 * leading page and trailing blank pages appearing in the printout.
 */

@page {
	size: A4 portrait;
	margin: 12mm;
}

@media print {
	/* Only the print root survives. */
	body.neb-printing > *:not(#neb-print-root) {
		display: none !important;
	}

	body.neb-printing #neb-print-root {
		display: block !important;
		position: static !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body.neb-printing {
		background: #fff !important;
		background-image: none !important;
	}

	body.neb-printing .neb-marksheet {
		color: #000 !important;
		font-size: 11pt !important;
		gap: 8pt !important;
		max-width: none !important;
	}

	body.neb-printing .neb-marksheet__head,
	body.neb-printing .neb-marksheet__meta > div,
	body.neb-printing .neb-summary {
		background: #fff !important;
		border-color: #999 !important;
	}

	body.neb-printing .neb-table {
		width: 100% !important;
	}

	body.neb-printing .neb-table thead th {
		background: #fff !important;
		color: #000 !important;
		border-bottom: 1.5pt solid #000 !important;
	}

	/* Repeat the column headings at the top of every printed page. */
	body.neb-printing .neb-table thead {
		display: table-header-group;
	}

	body.neb-printing .neb-table tr {
		page-break-inside: avoid;
	}

	body.neb-printing .neb-table tbody tr:hover {
		background: transparent !important;
	}

	/* Grade colours are decoration; print them as plain black for legibility. */
	body.neb-printing .neb-summary__value,
	body.neb-printing .neb-grade,
	body.neb-printing .neb-status--pass,
	body.neb-printing .neb-status--fail {
		color: #000 !important;
	}

	/* Keep the provisional watermark so a printed copy is never mistaken for an
	   official document. */
	body.neb-printing .neb-marksheet__watermark {
		color: rgba(0, 0, 0, 0.12) !important;
	}

	body.neb-printing .neb-marksheet__formula {
		background: #fff !important;
		border: 1pt solid #999 !important;
	}

	body.neb-printing .neb-signature {
		border-top: 1pt dashed #000 !important;
		color: #000 !important;
	}

	body.neb-printing .neb-signature strong {
		color: #000 !important;
	}

	/* Screen-reader-only helpers and the live region must not print. */
	body.neb-printing .screen-reader-text,
	body.neb-printing .neb-live {
		display: none !important;
	}
}
