:root {
	--color-bg: #ffffff;
	--color-text: #1a1a1a;
	--color-muted: #666666;
	--color-border: #cccccc;
	--color-accent: #b3001b;
	--color-row-alt: #f4f4f4;
	font-family: system-ui, sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text);
	line-height: 1.4;
}

a {
	color: inherit;
}

.site-header {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 0.75rem 1.25rem;
	border-bottom: 3px solid var(--color-accent);
	flex-wrap: wrap;
}

.site-title {
	font-weight: 700;
	font-size: 1.15rem;
	text-decoration: none;
}

.site-nav {
	flex: 1;

	a {
		text-decoration: none;
		margin-right: 1rem;
	}
}

.lang-toggle {
	button {
		border: 1px solid var(--color-border);
		background: var(--color-bg);
		padding: 0.2rem 0.6rem;
		cursor: pointer;

		&[aria-pressed="true"] {
			background: var(--color-accent);
			color: #fff;
			border-color: var(--color-accent);
		}
	}
}

main {
	max-width: 1400px;
	margin: 0 auto;
	padding: 1.25rem;
}

.site-footer {
	max-width: 1400px;
	margin: 2rem auto 1rem;
	padding: 1rem 1.25rem;
	border-top: 1px solid var(--color-border);
	color: var(--color-muted);
	font-size: 0.85rem;
}

.print-btn {
	border: 1px solid var(--color-border);
	background: var(--color-bg);
	padding: 0.35rem 0.9rem;
	cursor: pointer;
	margin-bottom: 0.5rem;
}

.line-badge {
	display: inline-block;
	min-width: 2.2em;
	padding: 0.1em 0.4em;
	text-align: center;
	font-weight: 700;
	border-radius: 4px;
	color: #fff;
	background: var(--color-muted);

	&.line-badge--titsa {
		background: var(--color-titsa);
	}

	&.line-badge--tranvia {
		background: var(--color-tranvia);
	}

	&.line-badge--large {
		min-width: 1.6em;
		padding: 0.15em 0.3em;
		font-size: 2.4rem;
		border-radius: 6px;
		border: 2px solid var(--color-text);
		line-height: 1.15;
	}
}

.search-box {
	width: 100%;
	padding: 0.6rem 0.8rem;
	font-size: 1rem;
	border: 1px solid var(--color-border);
	margin-bottom: 1.25rem;
}

.category-heading {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.category-icon {
	height: 1.6em;
	width: auto;
}

.line-list,
.pattern-list,
.stop-list,
.stop-service-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.line-list {
	display: grid;
	grid-template-columns: max-content 1fr;
}

.line-item,
.pattern-item,
.stop-service-item {
	a {
		display: flex;
		align-items: center;
		gap: 0.6rem;
		padding: 0.5rem 0.25rem;
		text-decoration: none;
		border-bottom: 1px solid var(--color-border);
	}

	a:hover {
		background: var(--color-row-alt);
	}
}

.line-item {
	display: contents;

	&[hidden] {
		display: none;
	}

	a {
		display: grid;
		grid-template-columns: subgrid;
		grid-column: 1 / 3;
	}
}

.stop-item {
	.stop-row {
		display: flex;
		align-items: center;
		gap: 0.6rem;
		padding: 0.5rem 0.25rem;
		text-decoration: none;
		border-bottom: 1px solid var(--color-border);
	}

	a.stop-row:hover {
		background: var(--color-row-alt);
	}
}

.stop-offset {
	display: inline-block;
	min-width: 2.4em;
	color: var(--color-muted);
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.home-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem 2rem;

	@media (width <= 640px) {
		grid-template-columns: 1fr;
	}
}

.line-columns {
	display: grid;
	gap: 0.5rem 2rem;

	@media (width <= 640px) {
		grid-template-columns: 1fr !important;
	}
}

.line-column {
	min-width: 0;
}

.line-column-heading {
	font-size: 1rem;
	border-bottom: 2px solid var(--color-border);
	padding-bottom: 0.3rem;

	a {
		text-decoration: none;
	}
}

.period-switcher {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.period-switch-link {
	border: 1px solid var(--color-border);
	background: var(--color-bg);
	color: var(--color-text);
	padding: 0.3rem 0.7rem;
	font: inherit;
	cursor: pointer;

	&.is-current {
		background: var(--color-accent);
		color: #fff;
		border-color: var(--color-accent);
	}
}

.breadcrumb {
	font-size: 0.9rem;
	color: var(--color-muted);

	a {
		text-decoration: none;
	}
}

.dpp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	margin: 1rem 0;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--color-text);
}

.dpp-header-main {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.dpp-header-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.2rem;
	margin-left: auto;
	text-align: right;
}

.dpp-operator-badge {
	margin: 0;
	font-weight: 600;
}

.dpp-validity {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-muted);
}

.dpp-operator-icon {
	height: 3.5rem;
	width: auto;
}

.dpp-stop-name {
	margin: 0;
	font-size: 1.4rem;
}

.pattern-headsign-line {
	margin: 0.2rem 0 0;
	color: var(--color-muted);
}

.timetable-grid {
	width: 100%;
	border-collapse: collapse;
	margin-top: 1rem;
	border: 2px solid var(--color-text);

	th,
	td {
		border: 1px solid var(--color-text);
		padding: 0.4rem 0.6rem;
		text-align: left;
		vertical-align: top;
		font-variant-numeric: tabular-nums;
	}

	.minute-cell {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		gap: 5px;
	}

	thead th {
		background: var(--color-row-alt);
		text-align: center;

		sup {
			color: var(--color-accent);
		}
	}

	.col-hour {
		background: var(--color-row-alt);
		font-weight: 700;
		text-align: center;
		width: 2.6em;
	}

	tr.hour-row--current {
		background: var(--color-row-alt);
	}

	.minute--next {
		color: var(--color-accent);
		font-weight: 700;
	}

	.minute--after-next {
		font-weight: 700;
	}

	@media (width <= 640px) {
		.col-hour:last-child {
			display: none;
		}
	}
}

.dpp-legend {
	margin: 0.75rem 0 0;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--color-text);
	font-size: 0.85rem;
}

.dpp-legend-row {
	display: flex;
	gap: 0.5rem;
	padding: 0.15rem 0;

	dt {
		color: var(--color-accent);
		font-weight: 700;
	}

	dd {
		margin: 0;
		color: var(--color-muted);
	}
}

.no-service {
	color: var(--color-muted);
	font-style: italic;
}

.dpp-map {
	height: 300px;
	margin-top: 4rem;
	border: 1px solid var(--color-border);
}

.timetable-layout {
	display: flex;
	gap: 1.5rem;
	align-items: flex-start;
	margin-top: 1rem;

	@media (width <= 640px) {
		flex-direction: column;
	}
}

.timetable-sidebar {
	flex: 0 0 270px;
	min-width: 0;

	@media (width <= 640px) {
		flex-basis: auto;
		width: 100%;
	}
}

.timetable-main {
	flex: 1;
	min-width: 0;

	.timetable-grid {
		margin-top: 0;
	}
}

.sidebar-stop-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: auto 1fr auto auto;
}

.sidebar-stop-item {
	display: grid;
	grid-template-columns: subgrid;
	grid-column: 1 / -1;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.15rem 0rem;
	font-size: 0.9rem;

	a {
		text-decoration: none;
		min-width: 0;
		overflow-wrap: break-word;
	}

	&.stop-item--current {
		background: var(--color-row-alt);
		font-weight: 700;

		.stop-name {
			color: var(--color-accent);
			text-decoration: underline;
		}
	}
}

.sidebar-stop-delta {
	color: var(--color-muted);
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.sidebar-stop-dot {
	color: var(--color-accent);
	font-weight: 700;
}

.coverage-mark {
	color: var(--color-accent);
}

.direction-origin {
	color: var(--color-muted);
	font-weight: normal;
	font-size: 0.9em;
}

.coverage-legend {
	margin: 0.75rem 0 0;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--color-text);
	font-size: 0.85rem;
}

.coverage-legend-row {
	display: flex;
	gap: 0.5rem;
	padding: 0.15rem 0;

	dt {
		color: var(--color-accent);
		font-weight: 700;
	}

	dd {
		margin: 0;
		color: var(--color-muted);
	}
}

.network-map {
	height: 80vh;
	min-height: 400px;
	margin-top: 1rem;
	border: 1px solid var(--color-border);
}
