/* Theme-wide print rules; block-specific ones sit in each block's style.css.
   The inner @media print keeps this print-only if an optimizer merges it into an "all" bundle. */
@media print {
	/* @page can't read custom properties. */
	@page {
		size: A4 portrait;
		margin: 15mm 15mm 18mm;
	}

	html:root {
		font-size: 9.5pt;
		--wp--custom--section-block: var(--print-section-block);
		--wp--custom--hero-block: var(--print-section-block);
		--wp--custom--page-header-block: var(--print-section-block);
		--wp--custom--gutter: 0;
	}

	:root,
	:root body {
		background: none;
	}

	/* A flex column with min-height: 100vh fragments unpredictably. */
	.wp-site-blocks {
		display: block;
		min-height: 0;
	}

	/* Skip link, contact modal, admin bar and any future overlay. */
	body > :not(.wp-site-blocks) {
		display: none;
	}

	/* Animated values beat every normal declaration, including the card slider's ID selectors. */
	html *,
	html *::before,
	html *::after {
		animation: none !important;
		transition: none !important;
	}

	/* Scroll-revealed content must print whether or not it was ever scrolled into view. */
	:root [data-scroll-animate],
	:root :is(.page-card, .page-grid-call, .steps-item, .wp-block-column)[data-scroll-animate],
	:root .wp-block-list.is-style-checklist li[data-scroll-animate],
	:root .hero :is(.hero-title, .hero-image img) {
		opacity: 1;
		transform: none;
		visibility: visible;
	}

	.tone-paper,
	.tone-warm,
	.tone-deep {
		background: none;
		border-block: 0;
		color: var(--wp--preset--color--neutral-900);
	}

	.tone-warm:has(+ .tone-paper) {
		padding-block-end: 0;
	}

	.tone-warm + .tone-paper {
		padding-block-start: 0;
	}

	.tone-warm + .tone-paper::after {
		display: none;
	}

	/* Only text tokens; remapping color presets would also darken card backgrounds. */
	.tone-deep {
		--focus-ring-color: var(--wp--preset--color--neutral-900);
		--tone-text-muted: var(--wp--custom--text-muted);
		--wp--custom--text-muted-on-dark: var(--wp--custom--text-muted);
		--wp--custom--border-color-on-dark: var(--print-rule-color);
	}

	.tone-deep a:not(.wp-element-button) {
		color: var(--wp--preset--color--primary-500);
	}

	/* Buttons are interactions; page-grid restyles its "more" links in its own print section. */
	.cta-group,
	.wp-block-buttons,
	:root .wp-block-ptsussis-cta {
		display: none;
	}

	/* The front page prints all its images; other pages only the offer photo and the place-box map. */
	body:not(.home) main img:not(.wp-block-post-featured-image img, .place-box-map img),
	body:not(.home) main .wp-block-image {
		display: none;
	}

	/* Matches buttons.css's :is() specificity, which a plain .cta selector loses to. */
	:root :is(.cta.is-style-outline-light) {
		border: 0;
	}

	/* Side by side as a grid, which ignores core's !important flex-basis. */
	:root .wp-block-columns {
		display: grid;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
	}

	/* Firefox only: it moves a side-by-side row to the next page whole instead of splitting it. */
	@supports (-moz-appearance: none) {
		:root .wp-block-columns {
			display: block;
		}

		:root .wp-block-columns > .wp-block-column + .wp-block-column {
			margin-block-start: var(--print-section-block);
		}
	}

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

	figure,
	img,
	tr,
	blockquote {
		break-inside: avoid;
	}

	p,
	li {
		orphans: 3;
		widows: 3;
	}

	/* Internal, tel:, mailto: and # links are left out; their text already says enough. */
	main a.is-external:not(.wp-element-button, .cta, [href*="swish"], :has(img))::after {
		content: " (" attr(href) ")";
		overflow-wrap: anywhere;
	}
}
