:root {
	--serif: Georgia, serif;
	--sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
	font-family: var(--sans-serif);
	line-height: 1.4;
}

body, html {
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
}

body {
	padding: 8px;
	box-sizing: border-box;
}

body::after {
	content: "";
	height: 2em;
}

body {
	/* Grid layout */

	display: grid;
	grid-template-areas:
		"header header"
		"nav nav"
		"main aside"
		"footer footer";

	max-width: 1000px;
	margin-left: auto;
	margin-right: auto;

	background: #e8e8e8;

	grid-template-columns: auto 240px;
	grid-template-rows: auto auto 1fr auto;

	header {
		grid-area: header;
		padding-left: calc(1em + 50px);
	}

	> nav {
		grid-area: nav;
		padding-left: calc(1em + 24px);
	}

	aside {
		grid-area: aside;

		padding-top: 2em;
	}

	main {
		grid-area: main;

		> div {
			margin-top: 0;
			margin-left: 36px;
			padding-top: 2em;
		}
	}

	footer {
		grid-area: footer;
	}

	@media (max-width: 720px) {
		grid-template-columns: 1fr;
		grid-template-areas:
			"header"
			"nav"
			"main"
			"aside"
			"footer";

		main > div {
			margin-bottom: 36px;
		}

		aside {
			border: none !important;
			padding-left: 48px;
		}
	}
}

header {
	background: darkslateblue;
	color: white;
	padding: 1em 1em 1.8em 1em;

	h1, h2 {
		max-width: 40rem;
	}

	h1 {
		margin-bottom: 0.2em;
	}

	h2 {
		font-size: 1.0em;
		margin-top: 0;
	}

	a {
		color: inherit;
		text-decoration: none;
	}
}

footer {
	background: darkslateblue;
	color: #fafafa;
	text-align: center;
	padding: 0.5em 0 1em;
	font-size: 0.85em;
	font-weight: 500;

	p, ul {
		margin: 0.25em 0;
	}

	ul {
		display: flex;
		justify-content: center;
		padding: 0;
		flex-wrap: wrap;
	}

	li {
		display: inline-block;
		list-style: none;
	}

	li:not(:last-child)::after {
		content: "-";
		margin: 0 0.25rem;
	}

	a {
		color: inherit;
		text-decoration: none;
	}
}

aside {
	> div {
		position: sticky;
		top: 1em;
	}

	background: white;
	color: #777;
	border-right: 4px solid darkslateblue;
	/*border-left: 4px solid darkslateblue;*/
	padding: 1em;
	font-size: 0.9em;

	h1 {
		font-size: 1rem;
		margin: 0 0 0 20px;
	}

	ul {
		margin-top: 0.5em;
		padding-left: 20px;
	}

	a.current {
		font-weight: 800;
	}
}

body > nav {
	background: black;
	color: white;
	box-shadow: 0 2px 4px -2px #000c;
	z-index: 999;
	display: flex;

	a {
		display: inline-block;
		font-size: 0.9em;
		color: white;
		text-decoration: none;
		padding: 7px 16px 9px;
		border-top: 2px solid transparent;
		border-bottom: 1px solid transparent;
		border-radius: 2px;
		margin-top: -1.5px;
	}

	a.current {
		font-weight: 800;
		border-bottom-color: white;
	}

	a:hover {
		background: white;
		color: black;
	}
}

main {
	font-family: var(--serif);
	background: white;

	padding: 0 1em;

	> article {
		h1 a {
			text-decoration: none;
		}

		h1 a:not(:hover) {
			color: black;
		}
	}

	> div {
		max-width: 40rem;
		margin-left: auto;
		margin-right: auto;
		margin-top: 3em;
		margin-bottom: 6em;
	}

	nav {
		margin-bottom: 1em;
	}

	img, figure {
		max-width: 100%;
		margin: 0;

		&[align=right], &[align=left] {
			max-width: 18rem;

			&:is(article *) {
				max-width: 14rem;
			}
		}

		&[align=right] {
			float: right;
			margin-left: 1rem;
			margin-bottom: 0.5rem;
		}

		&[align=left] {
			float: left;
			margin-right: 1rem;
			margin-bottom: 0.5rem;
		}
	}

	figure {
		display: block;

		figcaption {
			font-style: oblique;
			text-align: center;
			margin-top: 0.5em;
			margin-bottom: 0.5em;
		}
	}
}