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

html {
	overflow: hidden; // Disable scroll of html, scroll body instead
	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 {
	// Put footer at the bottom for short pages, such as the 404
	display: grid;
	grid-template-rows: auto minmax(auto, 1fr) auto; // Header, stuff, footer
	background: var(--bg-color);
	height: 100vh;
	min-height: 100vh;
	overflow: scroll; // Scroll body instead of html
	color: var(--fg-color);
	line-height: 1.6;
	font-family: var(--font-system);
}

// 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;
	scroll-margin-top: 15vh;
	color: var(--primary-color);
	text-shadow: var(--primary-color-alpha) 0 0 4px, var(--primary-color) 0 0 12px;

	@keyframes highlight-in-out {
		50% {
			letter-spacing: 0.125rem;
		}
	}

	@media (prefers-reduced-motion) {
		animation: none;
	}
}

// LAYOUT
.container {
	margin-right: auto;
	margin-left: auto;
	width: min(var(--content-width), 90%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 3rem 0 1rem;
	font-weight: lighter;
	line-height: 1.25;
	font-family: var(--font-serif);
	letter-spacing: -0.05em;

	.zola-anchor {
		display: none;
		visibility: hidden;
	}

	&:hover .zola-anchor {
		display: inline-block;
		visibility: visible;
		text-decoration: none;
	}
}

h1 {
	font-size: 3rem;
}

h2 {
	font-size: 2.4rem;
}

h3 {
	font-size: 1.5rem;
}

a {
	color: var(--primary-color);
	font-weight: bold;

	&:hover {
		-webkit-text-decoration: underline wavy;
		text-decoration: underline wavy;
	}
}

small {
	color: var(--fg-muted-5);
	font-size: 0.8rem;
}

dl {
	padding: 0;

	dt {
		margin-top: 1rem;
		padding: 0;
		font-weight: bold;
		font-size: 1rem;
	}

	dd {
		margin-bottom: 1rem;
		padding: 0;
	}
}

hr {
	margin: 2rem auto;
	border: 0;
	border-top: 1px solid var(--fg-muted-2);
	width: 100%;
}

.blog-list hr:last-of-type {
	display: none;
}

blockquote {
	margin: 0;
	border-left: 0.25rem solid var(--primary-color);
	border-radius: 0.2rem;
	padding: 0 0.75rem;
	color: var(--fg-muted-5);

	& & {
		border-radius: 0;
	}
}

abbr[title] {
	-webkit-text-decoration: underline dotted;
	cursor: help;
	text-decoration: underline dotted;
}

aside {
	float: right;
	margin-inline-start: 1rem;
	box-shadow: var(--edge-highlight);
	border-radius: var(--rounded-corner);
	background-color: var(--primary-color-alpha);
	padding: 1rem;
	width: 30%;

	@media only screen and (max-width: 720px) {
		float: none;
		margin-inline-start: 0;
		width: 100%;
	}
}

// CODE
pre,
code,
kbd {
	font-family: var(--font-monospace);
}

code:not(pre code) {
	box-shadow: var(--edge-highlight);
	border-radius: var(--rounded-corner-small);
	background-color: var(--fg-muted-2);
	padding: 0.125rem 0.375rem;
	color: var(--red-fg);
}

pre {
	margin: 1rem 0 1rem;
	box-shadow: var(--edge-highlight), var(--shadow);
	border-radius: var(--rounded-corner);
	padding: 1rem;
	max-width: 100vw;
	overflow: auto;
	line-height: normal; // Unset line height

	table td {
		border: none;
		padding: 0;
	}

	// The line number cells
	table td:nth-of-type(1) {
		user-select: none;
		text-align: center;
	}

	mark {
		display: block;
		border-radius: 0; // Unset code block border radius
		background-color: var(--fg-muted-1);
		padding: 0; // Unset mark padding
		color: var(--fg-color); // Unset mark color from primary color to text color
	}

	table {
		box-shadow: none;
		border-radius: 0;
		border-collapse: collapse;
		width: 100%;
		table-layout: auto;
		overflow: auto;
	}

	// The line numbers already provide some kind of left/right padding
	&[data-linenos] {
		padding: 1rem 0;
	}
}

kbd {
	display: inline-block;
	transition: var(--transition);
	cursor: pointer;
	box-shadow: inset 0 -2px 0 var(--fg-muted-2), 0 -1px 0 var(--fg-muted-3);
	border-radius: var(--rounded-corner-small);
	background-color: var(--fg-muted-2);
	padding: 0.125rem 0.375rem;
	font-size: 0.8rem;
	line-height: normal;

	// Small nice thingy, keys can be pressed!
	&:active {
		transform: translateY(2px);
		box-shadow: inset 0 1px 0 var(--fg-muted-2);
		background-color: var(--fg-muted-3);
	}
}

mark {
	box-shadow: var(--edge-highlight);
	border-radius: var(--rounded-corner-small);
	background-color: var(--primary-color-alpha);
	padding: 0.125rem 0.375rem;
	color: var(--primary-color);
}

figcaption {
	display: block;
	color: var(--fg-muted-4);
	font-size: 0.8rem;
	text-align: center;
}

details {
	border-radius: var(--rounded-corner);
	background-color: var(--fg-muted-1);
	padding: 1rem;

	&>summary {
		cursor: pointer;
	}
}

// TABLES
table {
	box-shadow: var(--edge-highlight);
	border-radius: var(--rounded-corner);
	border-collapse: collapse;
	width: 100%;
	table-layout: fixed;
	overflow: hidden;

	th {
		font-weight: bold;
	}

	th,
	td {
		padding: 0.5rem 1rem;
	}

	tr {
		&:nth-child(even) {
			background-color: var(--fg-muted-1);
		}

		th {
			background-color: var(--fg-muted-2);
		}
	}
}

td,
th {
	padding: 0;
}
