/*
 * GigaTour print stylesheet.
 *
 * Linked from the public layouts (temp.html, home.html) with media="print",
 * so it never affects the screen. The standalone print page
 * (/<category>/misto/<id>/print, printpr.html) links it without a media
 * attribute; the rules for that page are scoped to .gt-print-page.
 *
 * Bump the `asset_version` setting (admin -> settings) after editing this
 * file so browsers fetch the new version.
 */

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

/* ---------- print header (rendered on every page, hidden on screen) ---------- */

.gt-print-header {
	margin: 0 0 6mm;
	padding: 0 0 2mm;
	border-bottom: 1pt solid #000;
	color: #000;
	font-family: "Inter", Arial, Helvetica, sans-serif;
}

.gt-print-brand {
	font-size: 9pt;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.gt-print-title {
	font-size: 15pt;
	font-weight: 700;
	line-height: 1.25;
	margin: 1mm 0;
}

.gt-print-context {
	font-weight: 600;
}

.gt-print-meta {
	font-size: 8pt;
	word-break: break-all;
}

/* ---------- standalone print page (printpr.html), screen and print ---------- */

.gt-print-page {
	margin: 0 auto;
	padding: 12mm;
	max-width: 210mm;
	background: #fff;
	color: #000;
	font: 10pt/1.35 "Inter", Arial, Helvetica, sans-serif;
}

.gt-print-page .gt-print-header[hidden] {
	display: block;
}

.gt-print-table {
	width: 100%;
	border-collapse: collapse;
}

.gt-print-table th,
.gt-print-table td {
	border: 0.5pt solid #555;
	padding: 1.2mm 2mm;
	text-align: left;
	vertical-align: top;
}

.gt-print-table th {
	font-weight: 700;
	border-bottom: 1pt solid #000;
}

.gt-print-table .num {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

@media print {
	/* ---------- base ---------- */
	*,
	*::before,
	*::after {
		background: transparent !important;
		color: #000 !important;
		box-shadow: none !important;
		text-shadow: none !important;
	}

	/* beats coloured utility classes (.text-primary, .member1, ...) that use
	   !important themselves */
	body *:not(#gt-print-none) {
		color: #000 !important;
	}

	html,
	body {
		background: #fff !important;
		font-size: 10pt;
		line-height: 1.35;
	}

	.gt-print-page {
		padding: 0;
		max-width: none;
	}

	.gt-print-header[hidden] {
		display: block !important;
	}

	/* ---------- UI that is useless on paper ---------- */
	nav,
	.navbar,
	.gt-footer,
	footer,
	.top-scroll,
	button,
	select,
	input,
	textarea,
	form,
	iframe,
	.alert-dismissible .btn-close,
	/* buttons are navigation (season / category / mode switches, "Tisk",
	   "Navštívit web", "Zobrazit přílohu", ...) */
	a.btn,
	/* "V jiných ročnících" season switchers */
	div.bg-light:has(> .d-inline-flex > a.badge),
	/* tournament picker on place pages */
	div:has(> .row > div > #tournament-select),
	/* home page: navigation cards (category links) */
	section .row > div:has(> .gt-card > .row > div > a.btn) {
		display: none !important;
	}

	/* home page: the remaining column (documents) spans the full width */
	section .row > [class*="col-md"] {
		flex: 0 0 100% !important;
		max-width: 100% !important;
		width: 100% !important;
	}

	/* District list: the buttons are the content, print them as a list. */
	.row > [class*="col"] > a.btn.w-100 {
		display: block !important;
		padding: 0.5mm 0 !important;
		border: 0 !important;
		text-align: left !important;
		font-weight: 400;
	}

	/* ---------- layout ---------- */
	.container,
	#_content {
		max-width: none !important;
		width: auto !important;
		padding: 0 !important;
		margin: 0 !important;
	}

	.gt-card,
	.gt-hero,
	section {
		border: 0 !important;
		border-radius: 0 !important;
		padding: 0 !important;
		margin: 0 0 4mm !important;
	}

	/* home page hero: plain heading */
	.gt-hero,
	.gt-hero .container {
		text-align: left !important;
	}

	.gt-hero-title {
		font-size: 16pt !important;
	}

	/* no trailing space that could spill onto an empty last page */
	#_content > .gt-card,
	.gt-card > :last-child,
	.table-responsive:last-child > table {
		margin-bottom: 0 !important;
	}

	.gt-card .gt-card,
	.bg-light.rounded-3.border {
		border: 0.5pt solid #999 !important;
		padding: 2mm 3mm !important;
	}

	.row {
		--bs-gutter-y: 2mm;
		--bs-gutter-x: 3mm;
	}

	h1, .h1, h2, .h2 { font-size: 14pt !important; }
	h3, .h3, h4, .h4 { font-size: 12pt !important; }
	h5, .h5, h6, .h6 { font-size: 10.5pt !important; }
	.fs-4, .fs-5 { font-size: 12pt !important; }
	.fs-6, small, .small { font-size: 9pt !important; }

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

	img {
		max-width: 100% !important;
		max-height: 30mm !important;
		break-inside: avoid;
	}

	a,
	a:visited {
		text-decoration: none !important;
	}

	/* no "(https://...)" after links */
	a[href]::after {
		content: none !important;
	}

	.alert {
		border: 0.5pt solid #999 !important;
		padding: 2mm 3mm !important;
	}

	.badge {
		border: 0.5pt solid #000;
		padding: 0.3mm 1.5mm !important;
		font-size: 8.5pt !important;
	}

	/* ---------- tables ---------- */
	.table-responsive {
		overflow: visible !important;
	}

	table,
	.table,
	.table-gt {
		width: 100% !important;
		border-collapse: collapse !important;
		border: 0.5pt solid #555 !important;
		border-radius: 0 !important;
		overflow: visible !important;
		margin-bottom: 4mm !important;
		font-size: 9.5pt;
	}

	thead {
		display: table-header-group;
	}

	tfoot {
		display: table-footer-group;
	}

	tr {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	th,
	td,
	.table > :not(caption) > * > *,
	.table-gt td,
	.table-gt th {
		border: 0.5pt solid #555 !important;
		padding: 1mm 2mm !important;
		vertical-align: top !important;
	}

	.table-gt thead th,
	thead th {
		font-size: 8.5pt !important;
		font-weight: 700 !important;
		letter-spacing: 0 !important;
		border-bottom: 1pt solid #000 !important;
	}

	.member1,
	.member2,
	.member3 {
		font-weight: 700 !important;
	}
}
