@media print {
	header, nav {
		display: none;
	}

	body {
		background: white;
		color: black;
		margin: 0;
		padding: 0;
	}

	.cheatsheet-container {
		max-width: 100%;
		margin: 0;
		padding: 0;
	}

	.cheatsheet-print {
		columns: 1;
		column-gap: 0;
	}

	.algo-section {
		page-break-inside: avoid;
		border-color: #000 !important;
		background: white !important;
		color: #000 !important;
	}

	.algo-section h3 {
		color: #000 !important;
		margin-top: 0.5rem;
		margin-bottom: 0.3rem;
	}

	.algo-section pre {
		background: #f5f5f5 !important;
		border: 1px solid #ccc;
		padding: 0.5rem !important;
		font-size: 0.7rem !important;
	}

	.algo-section code {
		color: #000 !important;
	}

	.category-title {
		color: #000 !important;
		border-bottom: 1px solid #000;
		page-break-after: avoid;
		margin-top: 0.8rem;
		margin-bottom: 0.5rem;
	}
}

.cheatsheet-container {
	max-width: 1000px;
	margin: 0 auto;
}

.category-section {
	margin-bottom: 1.3rem;
	break-inside: avoid;
	page-break-inside: avoid;
}

.category-title {
	font-family: var(--serif);
	font-size: 1.1rem;
	color: var(--ink);
	margin-bottom: .35rem;
	padding-bottom: .3rem;
	border-bottom: 1px solid var(--rule-strong);
}

.category-description {
	color: var(--ink-dim);
	font-size: .84rem;
	margin-bottom: .7rem;
	font-style: italic;
}

.algo-section {
	background: var(--paper-2);
	border: 1px solid var(--rule);
	padding: .55rem .8rem;
	margin-bottom: .55rem;
	border-radius: 4px;
	break-inside: avoid;
	page-break-inside: avoid;
	/* Inside a CSS multicol container (.cheatsheet-print), a block's
	   intrinsic content width (namely the code block below) can push
	   past the column box instead of respecting it, since multicol
	   items don't automatically get a min-width like flex/grid items
	   do. Without this, overflow-x on the pre never kicks in. */
	min-width: 0;
}

.algo-heading {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: .6rem;
	flex-wrap: wrap;
	margin-bottom: .3rem;
}

.algo-section h3 {
	color: var(--ink);
	font-size: .92rem;
	font-weight: 600;
}

.algo-description {
	color: var(--ink-dim);
	font-size: .82rem;
	margin-bottom: .5rem;
	line-height: 1.45;
}

.algo-author {
	color: var(--ink-dim);
	font-size: .76rem;
	font-style: italic;
}

.complexity-info {
	font-family: var(--mono);
	font-size: .76rem;
	color: var(--ink-dim);
	white-space: nowrap;
}

.complexity-info .sep {
	margin: 0 .35rem;
	color: var(--rule-strong);
}

.algo-section pre {
	margin: 0;
	max-width: 100%;
	background: var(--paper);
	border: 1px solid var(--rule);
	padding: .6rem .7rem;
	border-radius: 4px;
	overflow-x: auto;
}

.algo-section code {
	font-size: .74rem;
	line-height: 1.4;
	font-family: var(--mono);
}

.no-algos {
	text-align: center;
	padding: 3rem 2rem;
	color: var(--ink-dim);
}

.cheatsheet-print {
	columns: 2;
	column-gap: 2rem;
	column-fill: balance;
}

@media (max-width: 1200px) {
	.cheatsheet-print {
		columns: 1;
		column-gap: 0;
	}
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
	.category-section {
		margin-bottom: 1.5rem;
	}

	.category-title {
		font-size: 1.05rem;
	}

	.algo-section {
		padding: .65rem .8rem;
		margin-bottom: .8rem;
	}

	.no-algos {
		padding: 2.5rem 1rem;
	}
}
