html,
body {
	min-height: 100%;
	background: var(--frame);
	color: var(--text);
	font-family: var(--font-sans);
	line-height: var(--line);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Chromium on Linux lays web fonts out on whole-pixel advances unless
	   asked for geometric precision, which made Comic Mono about 3% wider
	   than in Firefox (9px per character at 16px instead of 8.72px). */
	text-rendering: geometricPrecision;
}

/* Removed by the router after the first render. The delayed animation reveals
   the page anyway if the scripts fail to run. */
html.booting body {
	opacity: 0;
	animation: bootFallbackReveal 0s 2s forwards;
}

@keyframes bootFallbackReveal {
	to {
		opacity: 1;
	}
}

html.no-scroll,
html.no-scroll .content-scroll {
	overflow: hidden;
}

body.photos-page .content-scroll {
	overflow: hidden;
}

body.photos-page main {
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1 1 auto;
}

@media (max-height: 240px), (max-width: 280px) and (max-height: 300px) {
	body.photos-page .content-scroll {
		overflow: visible;
	}

	body.photos-page main {
		display: block;
		flex: none;
		overflow: visible;
	}
}

/* Links underline in the accent on hover and focus: the line springs out
   from the start of the link, overshooting slightly on Material 3's
   expressive fast spatial curve, and pulls back on the fast effects curve.
   With the custom cursor (cursor.js), the cursor itself becomes the hover
   underline, so only focus draws this one. The line sits on the border box's
   bottom edge, where the cursor's underline lands too. Links within running
   text also keep a hairline underline at rest, so they are not told apart
   by colour alone. */
a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	background:
		linear-gradient(var(--accent), var(--accent)) no-repeat left bottom / 0% 2px border-box,
		linear-gradient(var(--underline-rest, transparent), var(--underline-rest, transparent)) no-repeat left bottom / 100% 1px border-box;
	transition:
		color 200ms cubic-bezier(0.34, 0.8, 0.34, 1),
		background-size 150ms cubic-bezier(0.31, 0.94, 0.34, 1);
}

a:hover,
a:focus-visible {
	color: var(--accent);
	background-size: 100% 2px, 100% 1px;
	transition:
		color 200ms cubic-bezier(0.34, 0.8, 0.34, 1),
		background-size 350ms cubic-bezier(0.42, 1.67, 0.21, 0.9);
}

html.custom-cursor a:hover:not(:focus-visible) {
	background-size: 0% 2px, 100% 1px;
}

main :is(p, li, dd) a {
	--underline-rest: var(--border);
}

@media (prefers-reduced-motion: reduce) {
	a,
	a:hover,
	a:focus-visible {
		transition: none;
	}
}

/* Everforest's visual-selection background, with an accent underline: the
   light theme's selection colour sits close to the page, and the underline
   marks the selected run in either theme. Firefox draws a selection only
   within the text's own box, which ends at the font's descent (0.1875em,
   theme.css), so the underline's foot is set there, closing the highlight,
   and runs unbroken through the descenders. Chromium also draws the
   underline, in black, under text a selection passes over but leaves out
   (user-select: none), so such text sets --selection-line: none. */
::selection {
	background: var(--selection);
	color: var(--text);
	text-decoration: var(--selection-line, underline 2px var(--accent));
	text-underline-offset: calc(0.1875em - 2px);
	text-decoration-skip-ink: none;
	text-shadow: none;
}

/* A button's label belongs to the control, not the text: Firefox already
   leaves it out of a selection, and Chromium does with this. */
button {
	user-select: none;
	--selection-line: none;
}

*:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.card:focus-visible {
	outline-offset: -2px;
}
