/* FH Zápis o utkání – A4 SVG master sheet (preview + print). Geometry lives in sheet-geometry.js.
 * @page size is injected per print mode (portrait for match sheet, landscape for crosstable)
 * so a global portrait rule cannot force MediaBox 595×842 on landscape crosstable PDFs. */

.fh-match-sheet-svg,
.fh-ms-roster-svg {
	background: #fff;
	color: #000;
	display: block;
	font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
	height: 100%;
	print-color-adjust: exact;
	-webkit-print-color-adjust: exact;
	width: 100%;
}

.fh-match-sheet-svg text {
	white-space: pre;
}

.fh-ms-print-host {
	display: none;
}

@media print {
	html,
	body {
		background: #fff !important;
		margin: 0 !important;
		min-height: 0 !important;
		padding: 0 !important;
		width: 210mm !important;
	}

	/* Single-sheet print keeps a fixed A4 viewport. */
	body.fh-ms-printing:not(.fh-ms-printing--batch) {
		height: 297mm !important;
		overflow: hidden !important;
	}

	/* Day batch: one SVG per page, body grows with the number of matches. */
	body.fh-ms-printing--batch {
		height: auto !important;
		overflow: visible !important;
	}

	body.fh-ms-printing > *:not(.fh-ms-print-host) {
		display: none !important;
	}

	body.fh-ms-printing > .fh-ms-print-host {
		display: block !important;
		margin: 0;
		overflow: hidden;
		padding: 0;
		width: 210mm;
	}

	body.fh-ms-printing:not(.fh-ms-printing--batch) > .fh-ms-print-host {
		height: 297mm;
	}

	body.fh-ms-printing--batch > .fh-ms-print-host {
		height: auto;
		overflow: visible;
	}

	/* Never print the single-sheet preview host alongside a day batch. */
	body.fh-ms-printing--batch > .fh-ms-print-host:not(.fh-ms-print-host--batch) {
		display: none !important;
	}

	.fh-ms-print-host .fh-match-sheet-svg,
	.fh-ms-paper,
	.fh-match-sheet-svg {
		height: 297mm !important;
		transform: none !important;
		width: 210mm !important;
	}

	/* Break before next page — avoids a trailing blank sheet after the last match. */
	.fh-ms-print-host--batch .fh-ms-print-page {
		break-after: auto;
		break-inside: avoid;
		height: 297mm;
		margin: 0;
		overflow: hidden;
		padding: 0;
		page-break-after: auto;
		page-break-inside: avoid;
		width: 210mm;
	}

	.fh-ms-print-host--batch .fh-ms-print-page + .fh-ms-print-page {
		break-before: page;
		page-break-before: always;
	}

	.fh-ms-print-host--batch .fh-ms-print-page .fh-match-sheet-svg,
	.fh-ms-print-host--batch .fh-ms-print-page .fh-ms-roster-svg {
		display: block;
		height: 297mm !important;
		margin: 0;
		width: 210mm !important;
	}
}
