/* Prevent iOS Safari from auto-inflating font sizes */
body {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

/* Prevent Quarto's inline height from distorting aspect ratio */
img {
	height: auto !important;
}

/* Tables */
table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5em 0;
}

th, td {
	padding: 0.5em 1em;
	text-align: left;
	border-bottom: 1px solid #ddd;
}

thead th {
	border-bottom: 2px solid var(--fontcolor);
}

tbody tr:last-child td {
	border-bottom: none;
}

/* PDF download link */
.pdf-download {
	margin-top: 4px;
	margin-bottom: 0;
	font-size: 0.9em;
}

/* Disable Fira Code ligatures in code blocks */
code {
	font-variant-ligatures: none;
}

/* Focus states for keyboard navigation */
a:focus-visible,
*:focus-visible {
	outline: 2px solid var(--linkcolor);
	outline-offset: 2px;
}

/* color-mix() fallback for older browsers */
.code-fold {
	background-color: rgba(58, 153, 26, 0.2);
	background-color: color-mix(in srgb, var(--codecalloutbg) 20%, transparent);
}

/* Header layout */
.header-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
}

.header-subtitle {
	font-size: 0.9em;
	color: #666;
}

/* Heading line-height */
h1, h2, h3 {
	line-height: 1.4;
}

/* Skip-to-content link */
.skip-link {
	position: absolute;
	top: -40px;
	left: 0;
	background: var(--bgcolor);
	color: var(--fontcolor);
	padding: 8px;
	z-index: 100;
}

.skip-link:focus {
	top: 0;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
	body {
		margin: 20px auto;
		padding: 0 15px;
		font-size: 13px;
	}

	.header-row {
		flex-direction: column;
	}
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
	:root {
		--bgcolor: #1a1a2e;
		--fontcolor: #e0e0e0;
		--linkcolor: #e07a7a;
		--visitedcolor: #b39ddb;
		--precolor: #e0e0e0;
		--prebgcolor: #0d0d1a;
	}

	.header-subtitle {
		color: #aaa;
	}

	th, td {
		border-bottom-color: #444;
	}

	figcaption {
		color: #aaa;
	}
}
