/* timetable-print.html - one service's timetable as a document to save as a PDF.
   A4 sheets on screen, the same sheets on paper. Laid out on TSY's printed timetables. */

@page {
	size: A4;
	margin: 12mm;
}

.ttp-body {
	margin: 0;
	background: var(--brand-charcoal-25);
	color: var(--brand-asphalt-black);
	font-family: Inter, sans-serif;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ttp-bar {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--neutral-white);
	border-bottom: 1px solid var(--brand-asphalt-black-25);
}

.ttp-back {
	color: var(--brand-asphalt-black);
}

.ttp-back .material-symbols-outlined {
	margin: -3px;
	color: var(--brand-molten-orange);
	font-size: 22px;
	transform: rotate(180deg);
}

.ttp-bar [data-save]:disabled {
	cursor: progress;
}

.ttp-status {
	margin: 24px 16px;
	text-align: center;
}

.ttp-status.is-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.ttp-status[hidden] {
	display: none;
}

.ttp-status.is-loading::before {
	content: "";
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border: 3px solid var(--brand-asphalt-grey-25);
	border-top-color: var(--brand-molten-orange);
	border-radius: 50%;
	animation: ttp-spin 0.8s linear infinite;
}

@keyframes ttp-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ttp-status.is-loading::before {
		animation-duration: 2.4s;
	}
}

.ttp-sheets {
	display: grid;
	gap: 24px;
	justify-items: center;
	padding: 24px 16px;
}

.ttp-sheet {
	box-sizing: border-box;
	width: 210mm;
	max-width: 100%;
	min-height: 297mm;
	padding: 12mm;
	overflow-x: auto;
	background: var(--neutral-white);
	box-shadow: 0 1px 4px color-mix(in srgb, var(--basic-black) 15%, transparent);
	font-size: 9pt;
	line-height: 1.35;
}

.ttp-sheet h2,
.ttp-sheet h3 {
	margin: 0 0 2mm;
	font-weight: 700;
}

.ttp-small {
	margin: 0 0 3mm;
	color: var(--brand-asphalt-grey);
	font-size: 7.5pt;
}

.ttp-title {
	font-size: 13pt;
}

/* Cover */

.ttp-logo {
	display: block;
	height: 14mm;
	margin-bottom: 8mm;
}

.ttp-band {
	display: flex;
	gap: 6mm;
	align-items: baseline;
	justify-content: space-between;
	margin: 0 0 2mm;
	padding: 4mm 5mm;
	background: var(--brand-asphalt-black);
	color: var(--neutral-white);
	font-size: 12pt;
	font-weight: 400;
}

.ttp-band strong {
	font-size: 30pt;
	line-height: 1.1;
}

.ttp-band--thin strong {
	font-size: 14pt;
}

.ttp-boxes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4mm;
	margin: 6mm 0 4mm;
}

.ttp-box {
	margin-bottom: 4mm;
	padding: 4mm 5mm;
	border: 1px solid var(--brand-asphalt-black-25);
	border-top: 2mm solid var(--brand-molten-orange);
}

.ttp-boxes .ttp-box {
	margin: 0;
}

.ttp-box h2 {
	font-size: 11pt;
}

.ttp-box ul,
.ttp-box ol {
	margin: 0;
	padding-left: 5mm;
}

.ttp-box ul {
	columns: 2;
	column-gap: 6mm;
}

.ttp-box p {
	margin: 0;
}

/* Map - the pins are numbered as the cover's "Places on the route" */

.ttp-map {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1000 / 1280;
	background: var(--brand-charcoal-25);
}

/* Stopping points */

.ttp-sheet h3 {
	margin-top: 5mm;
	font-size: 10pt;
}

.ttp-stops {
	margin: 0 0 4mm;
	line-height: 1.6;
}

/* Timetables - flows over as many pages as it takes, a block never split */

.ttp-times {
	min-height: 0;
}

.ttp-part {
	margin-bottom: 6mm;
}

.ttp-day {
	display: flex;
	flex-wrap: wrap;
	gap: 1mm 4mm;
	justify-content: space-between;
	padding: 1.5mm 2mm;
	background: var(--brand-asphalt-black);
	color: var(--neutral-white);
	font-size: 9pt;
	break-after: avoid;
}

.ttp-sheet .ttp-day {
	margin-bottom: 1mm;
}

.ttp-grid {
	margin-bottom: 3mm;
	border-collapse: collapse;
	font-size: 7pt;
	font-variant-numeric: tabular-nums;
	break-inside: avoid;
}

.ttp-grid th,
.ttp-grid td {
	padding: 0.4mm 0.8mm;
	font-weight: 400;
	text-align: center;
	white-space: nowrap;
}

.ttp-grid th[scope="row"],
.ttp-grid thead th:first-child {
	width: 70mm;
	text-align: left;
	white-space: normal;
}

.ttp-grid td,
.ttp-grid thead th {
	width: 8.4mm;
}

.ttp-grid thead th {
	font-weight: 600;
}

.ttp-grid tbody tr:nth-child(odd) {
	background: var(--brand-charcoal-25);
}

/* Large text */

.is-large .ttp-sheet {
	font-size: 12pt;
}

.is-large .ttp-small {
	font-size: 10pt;
}

.is-large .ttp-title {
	font-size: 16pt;
}

.is-large .ttp-box h2 {
	font-size: 14pt;
}

.is-large .ttp-sheet h3,
.is-large .ttp-day {
	font-size: 12pt;
}

.is-large .ttp-grid {
	font-size: 10pt;
}

.is-large .ttp-grid th[scope="row"],
.is-large .ttp-grid thead th:first-child {
	width: 66mm;
}

.is-large .ttp-grid td,
.is-large .ttp-grid thead th {
	width: 11.5mm;
}

@media print {
	.ttp-body {
		background: none;
	}

	.ttp-bar,
	.ttp-status {
		display: none;
	}

	.ttp-sheets {
		display: block;
		padding: 0;
	}

	.ttp-sheet {
		width: auto;
		min-height: 0;
		padding: 0;
		overflow: visible;
		box-shadow: none;
		break-after: page;
	}

	.ttp-sheet:last-child {
		break-after: auto;
	}

	/* The bands and stripes are the layout, not decoration */
	.ttp-body * {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}
