/*
 * Print styles — P1-15.
 *
 * /slate/ tells a voter "Bring this guide to the polls and vote Democratic, top to bottom", and
 * until now there was no way to bring it: the site had zero `@media print` rules anywhere, so
 * printing produced the navigation, the donate band, the newsletter sign-up and a candidate list
 * broken across pages wherever the columns happened to fall.
 *
 * The artifact this is aiming at is narrow and worth naming: a sheet of paper someone holds in a
 * voting booth. That means every candidate present, each one whole, nothing on it that cannot be
 * acted on with a pen.
 *
 * Loaded as a separate file at media="print" rather than an @media block inside
 * fulton-extras.css, so it never competes with screen rendering and never reaches the editor —
 * add_editor_style() pulls fulton-extras.css into the block editor, and print rules there would
 * be dead weight at best.
 */

@media print {

	/* ---- Chrome a printed page cannot use -------------------------------- */

	.fd-header,
	.fdc-announce,
	.fd-newsletter-band,
	.fd-news-aside,
	.fd-donate-band,
	.wp-block-template-part footer,
	footer.wp-block-template-part,
	.fd-footer,
	.skip-link,
	#wpadminbar {
		display: none !important;
	}

	/*
	 * The city filter is a control, not content. Its pills do nothing on paper — but the class it
	 * applies decides which candidates exist, so both halves have to be dealt with together or
	 * printing a filtered region page silently produces a partial ballot.
	 */
	.fd-candfilter {
		display: none !important;
	}
	.is-cand-hidden {
		display: revert !important;
	}

	/* ---- Ink ------------------------------------------------------------- */

	/*
	 * Tokens, not literals. `ink` (#10202E) is a very dark navy rather than pure black; on white
	 * that is roughly 17:1, far past anything paper needs, and it keeps the printed sheet in the
	 * same palette as the screen it came from. Pure black would save a fraction of colour ink on
	 * a printer with no black cartridge — not enough to justify a value the design system does
	 * not contain.
	 */
	body {
		background: var(--wp--preset--color--snow, #fff) !important;
		color: var(--wp--preset--color--ink, #10202E) !important;
	}

	/*
	 * Links are underlined but their URLs are NOT printed after them. The usual
	 * `a::after { content: " (" attr(href) ")" }` trick is wrong for this page: 49 candidate
	 * cards each carrying a campaign URL would bury the names the sheet exists to carry.
	 */
	a {
		color: var(--wp--preset--color--ink, #10202E) !important;
		text-decoration: underline;
	}

	/* Decoration that only means something on screen. */
	.fd-lift,
	.is-style-fd-card,
	.fd-cand {
		box-shadow: none !important;
		transform: none !important;
	}

	/* ---- Keep a candidate whole ------------------------------------------ */

	/*
	 * A name split from its office, or a headshot orphaned at the foot of a page, is the specific
	 * failure this is preventing — someone reads the wrong row in a booth.
	 */
	.fd-cand,
	.fd-list-card,
	.fd-step,
	.fd-event-card,
	.fd-guide-card,
	figure,
	tr {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	h1, h2, h3, h4 {
		break-after: avoid;
		page-break-after: avoid;
	}

	/*
	 * Screen grids are sized for a viewport. On paper the useful measure is how many candidates
	 * fit legibly across a sheet, which is two.
	 */
	.fd-candidates__grid {
		display: grid !important;
		grid-template-columns: 1fr 1fr !important;
		gap: 12px !important;
	}

	/* Nothing should be clipped by a scroll container that no longer scrolls. */
	.fd-scroll,
	[style*="overflow"] {
		overflow: visible !important;
	}
}
