* {
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

html {
	text-wrap: pretty;
	scroll-behavior: smooth;
	// scrollbar-color: var(--primary-color) transparent;
	accent-color: var(--primary-color);
	font-size: 16px;
	overflow-wrap: break-word;

	// Smaller font size on mobile
	// @media only screen and (max-width: 480px) {
	//     font-size: 14px;
	// }
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	display: grid; // Put footer at the bottom for short pages, such as the 404
	grid-template-rows: auto minmax(auto, 1fr) auto; // Header, stuff, footer
	background: var(--bg-color), var(--primary-color);
	min-height: 100vh;
	color: var(--fg-color);
	line-height: 1.6;
	font-family: var(--font-system-ui), var(--font-emoji);
}

// Style text selection to use primary color
::selection {
	background-color: var(--primary-color);
	color: var(--fg-color);
}

// Make focused anchor not get covered by nav,
// and flash it with primary color when jumping to it
:target:not(#main) {
	animation: var(--transition-long) 1s highlight-in-out;
	transition: all var(--transition-longer), scroll-margin-top 0s;
	scroll-margin-top: 20vh;
	color: var(--primary-color);
	text-shadow: var(--primary-color-alpha) 0 0 0.25rem, var(--primary-color) 0 0 0.75rem;

	@keyframes highlight-in-out {
		50% {
			letter-spacing: 0.0125em;
		}
	}
}

// Custom focus indicator
:focus-visible {
	animation: focus-in var(--transition);
	outline: 0.125rem solid var(--primary-color);
	outline-offset: 0.125rem;
}

// Fallback for older browsers
@supports not selector(:focus-visible) {
	:focus {
		animation: focus-in var(--transition);
		outline: 0.125rem solid var(--primary-color);
		outline-offset: 0.125rem;
	}
}

@keyframes focus-in {
	from {
		outline: 0.5rem solid transparent;
		outline-offset: 0.25rem;
	}
}
