/*
 * The print sheet.
 *
 * Loaded at media="print", so it costs no render-blocking bytes on the drill
 * path and tools/print-check.js can diff it on its own.
 *
 * A full inversion: the screen palette is a dark navy card, and a student who
 * prints that gets a page of toner and an unreadable worksheet. Everything here
 * is black on white, and every piece of site chrome is removed -- a printed
 * worksheet with a navigation menu across the top is a worksheet a teacher will
 * not hand out.
 */

@page {
	margin: 14mm;
}

body.cnt-page {
	background: #fff;
}

/*
 * The theme's chrome, plus the ad containers.
 *
 * Kept as a list rather than a blanket `body > * { display: none }` so that a
 * theme update which renames one of these fails visibly in print-check instead
 * of silently blanking the sheet.
 *
 * Nothing ad-shaped belongs on a printed worksheet. An adhesion bar printed
 * across the bottom of a sheet is worse than useless.
 */
body.cnt-page header,
body.cnt-page footer,
body.cnt-page nav,
body.cnt-page aside,
body.cnt-page .site-header,
body.cnt-page .site-footer,
body.cnt-page .t33-breadcrumbs,
body.cnt-page [id^="mv-"],
body.cnt-page [class^="mv-"],
body.cnt-page [id^="mvad"],
body.cnt-page .adthrive,
body.cnt-page [class*="adthrive"] {
	display: none;
}

/*
 * The tool's own chrome, at THREE classes deep, not two.
 *
 * This is the specificity trap from CONTRACT.md arriving from an unexpected
 * direction: not the theme beating this plugin, but this plugin's screen sheet
 * beating its own print sheet. The screen rules are written
 * `body.cnt-page .entry-content .cnt-sets { display: flex }` at (0,3,0), and
 * that sheet is media="all", so it applies when printing too. A print rule at
 * `body.cnt-page .cnt-noprint` is (0,2,0) and loses, silently, and the worksheet
 * prints with a mode switcher and an answer box on it.
 *
 * Matching the depth ties the specificity, and the print sheet is enqueued as a
 * dependent of the screen sheet so it always loads second and wins the tie.
 * tools/print-check.js asserts the depth rather than trusting it.
 */
body.cnt-page .entry-content .cnt-noprint,
body.cnt-page .entry-content .cnt-modes,
body.cnt-page .entry-content .cnt-sets,
body.cnt-page .entry-content .cnt-sheets,
body.cnt-page .entry-content .cnt-links,
body.cnt-page .entry-content .cnt-form,
body.cnt-page .entry-content .cnt-keypad,
body.cnt-page .entry-content .cnt-controls,
body.cnt-page .entry-content .cnt-verdict,
body.cnt-page .entry-content .cnt-harder,
body.cnt-page .entry-content .cnt-work,
body.cnt-page .entry-content .cnt-sheet-actions {
	display: none;
}

body.cnt-page .entry-content .cnt,
body.cnt-page .entry-content .cnt-sheet,
body.cnt-page .entry-content .cnt-card {
	background: #fff;
	color: #000;
	border: 0;
	padding: 0;
	margin: 0;
	min-height: 0;
}

body.cnt-page .entry-content .cnt-sheet-title {
	color: #000;
	font-size: 15pt;
	margin: 0 0 4pt;
}

body.cnt-page .entry-content .cnt-sheet-sub,
body.cnt-page .entry-content .cnt-sheet-foot {
	color: #444;
	font-size: 9pt;
}

body.cnt-page .entry-content .cnt-table {
	width: 100%;
	border-collapse: collapse;
	margin: 6pt 0 14pt;
	/* A worksheet that splits a row across two sheets of paper is a worksheet
	 * somebody reprints. */
	page-break-inside: auto;
}

body.cnt-page .entry-content .cnt-table tr {
	page-break-inside: avoid;
}

body.cnt-page .entry-content .cnt-table th,
body.cnt-page .entry-content .cnt-table td {
	border: 1px solid #000;
	color: #000;
	padding: 7pt 6pt;
	font-size: 11pt;
}

body.cnt-page .entry-content .cnt-table th {
	color: #000;
	font-size: 9pt;
	background: #eee;
	/* Backgrounds are dropped by default in print. The header row is the one
	 * place it earns the ink. */
	-webkit-print-color-adjust: exact;
	print-color-adjust: exact;
}

/* Room to actually write. 140px on screen is about 10mm on paper, which is not
 * a line a student can write "dihydrogen phosphate" on. */
body.cnt-page .entry-content .cnt-cell-blank {
	min-width: 55mm;
	height: 9mm;
}

body.cnt-page .entry-content .cnt-cell-formula {
	font-weight: 700;
	white-space: nowrap;
}

/* The answer key prints without blanks, so it needs no writing room and fits on
 * one page. */
body.cnt-page.cnt-key-view .entry-content .cnt-cell-blank {
	min-width: 0;
	height: auto;
}

body.cnt-page .entry-content h1 {
	color: #000;
	font-size: 16pt;
}
