@font-face {
	font-family: spectral;
	font-style: normal;
	font-weight: 400;
	src: url("/fonts/spectral-regular.woff2") format("woff2"),
	url("/fonts/spectral-regular.woff")	format("woff"),
	url("/fonts/spectral-regular.ttf")	 format("truetype");
}
@font-face {
	font-family: spectral;
	font-style: normal;
	font-weight: 700;
	src: url("/fonts/spectral-bold.woff2") format("woff2"),
	url("/fonts/spectral-bold.woff")	format("woff"),
	url("/fonts/spectral-bold.ttf")	 format("truetype");
}
@font-face {
	font-family: spectral;
	font-style: italic;
	font-weight: 400;
	src: url("/fonts/spectral-italic.woff2") format("woff2"),
	url("/fonts/spectral-italic.woff")	format("woff"),
	url("/fonts/spectral-italic.ttf")	 format("truetype");
}

::selection{
	background-color: #ffffb2;
	color: #000;
}

html { scroll-behavior: smooth }

.wrap {
	max-width: 55rem;
	margin: 0 auto;
	padding: 0 1rem;
}
.grid {
	display: grid;
	grid-template-columns: 10em auto;
	grid-column-gap: 2em;

	/* Do not let wide blocks, such as pre, expand the column and overflow */
	&>*{ min-width: 0 }

	& nav>*:first-child,
	& main>*:first-child,
	& main>article:first-child h2
	{ padding-top: 0; margin-top: 0; }
}

body {
	font-family: spectral, serif;
	text-rendering: optimizeLegibility;
	font-size: 18px;
	line-height: 1.5;
	margin: 0;
}

header {
	padding: 1rem 0;
	margin-bottom: 5rem;
	background-color: #000;
	color: #fff;
	line-height: 1;

	a { color: inherit }

	.wrap {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
	}

	.title { font-size: 1.5em; }
	.title:hover { text-decoration: none }

	.links { font-size: 1rem }
}

nav {
	position: sticky;
	align-self: start;
	top: 2em;
	margin-bottom: 4rem;
	max-height: calc(100vh - 2em);
	box-sizing: border-box;
	overflow-y: auto;

	span.title {
		display: block;
		margin: 2em 0 1em 0;
		font-weight: bold;
	}
	ul {
		list-style-type: none;
		padding: 0;

		li a {
			color: #000;
			display: block;
			line-height: 1;
			padding: .25em .5em;

			&:hover {
				color: #fff;
				background-color: #000;
				text-decoration: none;
			}
		}
	}
	ul.table-of-contents li {
		a {
			color: #e1140a;
			position: relative;

			&::before, &::after {
				content: "";
				background-color: #bbb;
				position: absolute;
				left: 0;
				top: 0;
			}
			&::before {
				height: 2px;
				width: .5em;
			}
			&::after {
				width: 2px;
				height: .5em;
			}
			&:hover { color: #fff }
			&:hover::before, &:hover::after { display: none }
		}

		li {
			padding: 0 .5em;
			&>a::before, &>a::after { display: none }
		}
	}
}

main {
	margin-bottom: 2rem;

	h1, h2, h3, h4, h5, h6 {
		margin-top: 1.5em;
		padding-top: 1em;
		line-height: 1;
	}

	article h2 { margin-top: 1em }
	article h2 a { color: inherit }

	.info {
		border-top: 1px solid #ccc;
		margin-top: 2em;
		padding: 1em 0;

		ul {
			list-style-type: none;
			margin: 0;
			padding: 0;
			display: flex;
			font-size: .85em;

			li { margin-right: 1em }
		}
	}

	.updates ul {
		margin-top: .5em;
		padding: 0;
		list-style-type: none;
	}

	img {
		max-width: 100%;
		box-sizing: border-box;
		border: 1px solid #bbb;
		border-radius: .2rem;
		padding: .2rem;

		& + em {
			display: block;
			text-align: center;
		}
	}

	table {
		display: flex;
		flex-direction: column;
		margin: 1.25em 0;
		text-align: left;
		overflow: auto;

		td, th { padding-right: 2em }
	}

	blockquote {
		margin: 1em 0;
		background-color: #f5f5f5;

		p {
			border-left: .3em solid #729fcf;
			padding: 1em 1.5em;
		}
	}

	code { font-size: 14px }
	li>code { word-wrap: break-word }
	p>code {
		background-color: #383838;
		color: #e6e1dc;
		padding: .2em .5em;
		border-radius: .3em;
	}

	pre {
		padding: 1em;
		overflow: auto;
		border-radius: .3em;
	}

	input.search {
		box-sizing: border-box;
		width: 100%;
		border: 1px solid #ccc;
		padding: .4rem .9rem;
		margin: 1em 0;
		outline: none;
		background-color: inherit;
		color: inherit;
		font-family: spectral, serif;
		font-size: 1rem;
	}

	.all-posts { text-align: right }
}

a {
	text-decoration: none;
	color: #e1140a;

	&:hover { text-decoration: underline }
}

.profile-picture {
	float: right;
	width: 15rem;
	margin-left: 3em;
}

@media screen and (max-width: 50rem) {

	.grid { grid-template-columns: auto }

	header { margin-bottom: 0 }

	nav {
		position: initial;
		margin-bottom: 1rem;
		ul { display: none }
		ul.main {
			display: flex;
			justify-content: center;
			flex-wrap: wrap;
			border: 1px solid #43494c;
			padding: .25rem 0;
		}
		span.title { display: none }
	}

	.profile-picture {
		width: 10rem;
		margin-left: 1em;
	}
}

@media (prefers-color-scheme: dark) {
	body {
		background-color: #131516;
		color: #cdcdcd;
	}

	header {
		background-color: inherit;
		color: inherit;
	}

	nav ul li a, nav ul.table-of-contents li a {
		color: inherit;
		&:hover {
			color: #131516;
			background-color: #cdcdcd;
		}
	}
	nav ul.table-of-contents li a {
		color: #ff6e67;
		&::before, &::after {
			background-color: #383838;
		}
	}

	main {
		.info, input.search { border-color: #383838 }
		img { border-color: #43494c }
		blockquote { background-color: #383838 }
	}

	a {
		color: #ff6e67;
	}
}