:root {
	--primary-color: rgb(50, 50, 50);
}

/*****************/
/* Global layout */
/*****************/

nav a {
	color: var(--primary-color);
}

nav a:hover {
	text-decoration: none;
}

nav .current,
nav a:hover {
	border-bottom: 0.25em solid var(--primary-color);
}

.title-row {
	background: url("../images/background.jpg") center center;
	background-size: cover;
	padding: 7rem 0;
	box-shadow: inset 0 0 2em rgba(0, 0, 0, 0.7);
}

.title-row h1 {
	margin: 0;
}

main {
	padding: 1.2em 0;
}

footer {
	border-top: 1px solid grey;
	clear: both;
}

.width-limited {
	max-width: 45rem;
}

.left {
	float: left;
	width: 25%;
	margin: 0 1rem 1rem 0;
}

/*********************/
/* Semantic elements */
/*********************/

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--primary-color);
	clear: both;
}

h1 {
	margin: 1em 0 0;
}

p {
	margin: 1rem 0;
}

img {
	max-width: 100%;
	display: block;
	margin: 0 auto;
}

ol,
ul {
	padding-left: 1em;
}

/*******/
/* TOC */
/*******/

#markdown-toc {
	border: 1px solid #ccc;
	display: inline-block;
	padding: 1rem 1rem 1rem 0;
	margin: 1rem 0 1rem 1.5rem;
	float: right;
}

#markdown-toc > li > a {
	display: none; /* Oh dear. This is a very dirty hack. It is needed here because
	                  Kramdown table of contents start at heading level 1 whereas we
	                  only want them from level 2 */
}

#markdown-toc > ul {
	padding-left: 0;
}

#markdown-toc > ul {
	list-style: none;
}

#markdown-toc,
#markdown-toc ol {
	list-style: none;
}

/* From http://2ality.com/2012/01/numbering-headingshtml.html */
body,
#markdown-toc ~ h1 {
	counter-reset: h2counter;
}
#markdown-toc ~ h2:before {
	content: counter(h2counter) ".\0000a0\0000a0";
	counter-increment: h2counter;
	counter-reset: h3counter;
}
#markdown-toc ~ h3:before {
	content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0";
	counter-increment: h3counter;
}

#markdown-toc ol {
	counter-reset: section; /* Creates a new instance of the
                                            section counter with each ol
                                            element */
	list-style-type: none;
}

#markdown-toc ol li::before {
	counter-increment: section; /* Increments only this instance
                                            of the section counter */
	content: counters(section, ".") " "; /* Combines the values of all instances
                                            of the section counter, separated
                                            by a period */
}
