html {
	background-color: #aa7744;
}

.title {
	font-size: 2.4em;
	line-height: 1.2;
}

.scrollwork {
	margin-top: 0.75em;
	white-space: nowrap;
	overflow: scroll;
}

body {
	margin: auto;
	padding-right: 1em;
	padding-left: 1em;
	padding-top: 1em;
	padding-bottom: 1em;
	max-width: 44em;
	border-left: 1px solid black;
	border-right: 1px solid black;
	font-family: Garamond, Cormorant Garamond, serif;
	line-height: 140%;
	color: #301500;
	background-color: #fffdd0;
	hyphens: auto;
	overflow-wrap: break-word;
	text-rendering: optimizeLegibility;
	font-kerning: normal;
}

@media screen and (min-width: 720px) {
	.layout-default #TOC {
		position: fixed;
		width: 20em;
		left: 0;
		top: 0;
		height: 100%;
		background-color: #aa7744;
		overflow-y: scroll;
		padding: 1em;
		color: black;
	}
	body.layout-default {
		margin-left: 22em;
	}
	.layout-default #settings {
		position: sticky;
		width: 100%;
		top: 0;
		z-index: 10;
		background-color: #ffeeaa;
		text-align: center;
	}
}

@media screen {
	.layout-wide #TOC {
		position: fixed;
		width: 20em;
		left: 0;
		top: 0;
		height: 100%;
		background-color: #aa7744;
		overflow-y: scroll;
		padding: 1em;
		color: black;
	}
	body.layout-wide {
		margin-left: 22em;
	}
	.layout-wide #settings {
		position: sticky;
		width: 100%;
		top: 0;
		z-index: 10;
		background-color: #ffeeaa;
		text-align: center;
	}
}

td:has(.signs) { /* Add a border specifically around cells that have signs in them */
	border: 1px dotted black;
	border-collapse: collapse;
}

.footer {
	font-size: 85%;
	text-align: center;
	font-style: italic;
}

.smaller {
	font-size: 85%;
}

@media (max-width: 600px) {
	body {
		font-size: 0.9em;
		padding: 12px;
	}
	h1 {
		font-size: 1.8em;
	}
}

@media print {
	#settings {
		display: none;
	}
	html {
		background-color: white;
	}
	body {
		background-color: transparent;
		color: black;
		font-size: 12pt;
		border-right: 0;
		border-left: 0;
	}
	p, h2, h3 {
		orphans: 3;
		widows: 3;
	}
	h2, h3, h4 {
		page-break-after: avoid;
	}
}

p {
	margin: 1em 0;
}
a {
	color: #1a1a1a;
}
a:visited {
	color: #1a1a1a;
}
img {
	max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
	margin-top: 1.4em;
}
h5, h6 {
	font-size: 1em;
	font-style: italic;
}
h6 {
	font-weight: normal;
}
ol, ul {
	padding-left: 1.7em;
	margin-top: 1em;
}
li > ol, li > ul {
	margin-top: 0;
}
blockquote {
	margin: 1em 0 1em 1.7em;
	padding-left: 1em;
	border-left: 2px solid #e6e6e6;
	color: #606060;
}
code {
	font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
	font-size: 85%;
	margin: 0;
	hyphens: manual;
}
pre {
	margin: 1em 0;
	overflow: auto;
}
pre code {
	padding: 0;
	overflow: visible;
	overflow-wrap: normal;
}
.sourceCode {
	background-color: transparent;
	overflow: visible;
}
hr {
	background-color: #1a1a1a;
	border: none;
	height: 1px;
	margin: 1em 0;
}
table {
	margin: 1em 0;
	border-collapse: collapse;
	width: 100%;
	overflow-x: auto;
	display: block;
	font-variant-numeric: lining-nums tabular-nums;
}
table caption {
	margin-bottom: 0.75em;
}
tbody {
	margin-top: 0.5em;
	border-top: 1px solid #1a1a1a;
	border-bottom: 1px solid #1a1a1a;
}
th {
	border-top: 1px solid #1a1a1a;
	padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
	padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
	margin-bottom: 4em;
	text-align: center;
}
#TOC li {
	list-style: none;
}
#TOC ul {
	padding-left: 1.3em;
}
#TOC > ul {
	padding-left: 0;
}
#TOC a:not(:hover) {
	text-decoration: none;
}

/* All this taken from Tufte-CSS */
/* Except I've been messing around with the size, margin-right, and width values */

body {
	counter-reset: sidenote-counter;
}

.sidenote,
.marginnote {
	float: right;
	clear: right;
	margin-right: -40%;
	width: 18em;
	margin-top: 0.3rem;
	margin-bottom: 0;
	font-size: 0.8em;
	line-height: 1.3;
	vertical-align: baseline;
	position: relative;
}

.sidenote-number {
	counter-increment: sidenote-counter;
}

.sidenote-number:after,
.sidenote:before {
	font-family: et-book-roman-old-style;
	position: relative;
	vertical-align: baseline;
}

.sidenote-number:after {
	content: counter(sidenote-counter);
	font-size: 0.7rem;
	top: -0.5rem;
	left: 0.1rem;
}

.sidenote:before {
	content: counter(sidenote-counter) " ";
	font-size: 0.85rem;
	top: -0.5rem;
}

blockquote .sidenote,
blockquote .marginnote {
	margin-right: -82%;
	min-width: 59%;
	text-align: left;
}

label.sidenote-number {
	display: inline;
}

label.margin-toggle:not(.sidenote-number) {
	display: none;
}

input.margin-toggle {
	display: none;
}

label.sidenote-number {
	display: inline;
}

label.margin-toggle:not(.sidenote-number) {
	display: none;
}

@media screen and (max-width:720px) { /* TODO what's the appropriate width here? */
	.layout-default .sidenote-number { /* Added to make them more link-like */
		text-decoration: underline dotted;
		color: #660088;
	}
	
	.layout-default label.margin-toggle:not(.sidenote-number) {
		display: inline;
	}

	.layout-default .sidenote,
	.layout-default .marginnote {
		display: none;
	}

	.layout-default .margin-toggle:checked + .sidenote,
	.layout-default .margin-toggle:checked + .marginnote {
		display: block;
		float: left;
		left: 1rem;
		clear: both;
		width: 95%;
		margin: 1rem 2.5%;
		vertical-align: baseline;
		position: relative;
	}
}

/* This duplication is really not ideal but I can't find a better way to handle it */

@media screen {
	.layout-narrow .sidenote-number { /* Added to make them more link-like */
		text-decoration: underline;
		color: #660088;
	}
	
	.layout-narrow label.margin-toggle:not(.sidenote-number) {
		display: inline;
	}

	.layout-narrow .sidenote,
	.layout-narrow .marginnote {
		display: none;
	}

	.layout-narrow .margin-toggle:checked + .sidenote,
	.layout-narrow .margin-toggle:checked + .marginnote {
		display: block;
		float: left;
		left: 1rem;
		clear: both;
		width: 95%;
		margin: 1rem 2.5%;
		vertical-align: baseline;
		position: relative;
	}
}

/* And make them always visible when printing */
@media print {
	label.margin-toggle:not(.sidenote-number) {
		display: inline;
	}
	
	.sidenote,
	.marginnote {
		display: block;
		float: left;
		left: 1rem;
		clear: both;
		width: 95%;
		margin: 1rem 2.5%;
		vertical-align: baseline;
		position: relative;
	}
}
