@charset "UTF-8";

html {
	font-size: 16px;
	height: 100%;
	scroll-padding-top: calc(var(--header-height, 2em) + 2rem);
}

*, ::before, ::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	overflow-x: hidden;
}

/* Main column contract */
:where(
	.essay-card-container,
	body h0,
	fieldset, form, table, figure,
	#Footnotes > p,
	#FootnotesExtra > p,
	h0, h1, h2, h3, h4, h5, h6,
	block, blockquote,
	:not(#header-left) > p,
	ol, ul, dl, pre,
	body > div.paragraph
) {
	position: relative;
	width: var(--content-width);
	left: var(--content-left);
	right: var(--content-right);
	margin-left: 0;
	margin-right: 0;
}

/* Header scaffolding */
:where(#header-left, #header-mid, #header-right) {
	position: fixed;
	top: 0;
	z-index: 40;
	height: var(--header-height) !important;
}

#header-left {
	left: 0;
	display: inline-block;
	width: var(--content-left);
	z-index: 100;
	overflow-y: visible;

	& > div {
		padding: 1rem;
		margin-left: 2px;
	}
}

#header-mid {
	display: inline-flex;
	left: var(--content-left);
	right: var(--content-right);
	width: var(--content-width);
}

#header-right {
	right: 0;
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	width: var(--content-right);
}

.header-column {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	flex-direction: column;
	height: 100%;

	& > a {
		flex: 1 1 auto;
		width: 100%;
		height: 50%;
	}

	& > .header-block,
	& > a > .header-block {
		position: relative;
		display: flex;
		width: 100%;
		height: 100%;
		align-items: center;
		justify-content: center;
	}

	& > a > .header-block-fill {
		height: 100%;
	}
}

/* Table of contents */
#tocdivStickySpace {
	position: relative;
	display: none;
	height: 15vh;
	top: 15vh;
}

#tocdiv {
	position: fixed;
	display: flex;
	flex-direction: column;
	justify-content: start;
	top: var(--header-height);
	left: 0;
	z-index: 50;
	width: var(--toc-width);
	height: calc(100vh - var(--header-height));
	margin-left: 0;
	padding: 1em 0 0;
	overflow: hidden scroll;

	& #toccont {
		position: sticky;
		display: none;
		z-index: 20;
		width: 100%;
		height: 5rem;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		white-space: nowrap;
	}
}

#toc {
	display: flex;
	flex-direction: column;
	width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 1em;
	overflow-y: scroll;

	& > div {
		display: flex;
		flex-direction: column;
		flex: var(--toc-flex, 0.01 0 auto);
		align-items: center;
		min-height: var(--toc-row-height);
		overflow: clip;
		padding-top: 3px;
		padding-bottom: 3px;

		& a::before {
			content: "";
			position: absolute;
			display: inline;
			inset: -3px auto -3px -0.25rem;
			width: 2000px;
		}

		& > .toclinkdiv {
			display: flex;
			flex: 1 1 auto;
			align-items: center;
			width: 100%;
			height: 100%;
			padding-left: var(--toc-link-padding-left, 3%);
			padding-right: 4%;
		}

		&.h0 {
			display: flex;
			flex: none;
			height: 1.5rem;
			justify-content: center;
			white-space: nowrap;

			& > div {
				justify-content: center;
			}
		}

		&.h1 {
			--toc-flex: 0.05 0 auto;
		}

		&.h2 {
			--toc-flex: 0.03 0 auto;
			margin-left: var(--toc-indent-step);
			padding: 0 0 1px;
		}

		&.h3 {
			--toc-flex: 0.02 0 auto;
			margin-left: calc(2 * var(--toc-indent-step));
			padding: 0 0 1px;
		}

		&.h4 {
			margin-left: calc(3 * var(--toc-indent-step));
			padding: 0;
		}

		&:where(.h5, .h6) {
			display: none;
		}
	}
}

/* Debug panel */
#debugPanel {
	position: fixed;
	display: inline-block;
	z-index: 200;
	right: 0;
	bottom: 0;

	& > div {
		padding: 0.1em 0.5em;
		border-top-left-radius: 1em;
		text-align: right;

		& > * {
			padding-left: 0.3em;
			padding-right: 0.6em;
		}
	}
}

/* Generic content containers */
:where(figure, figcaption, blockquote, blockquotesource, p, ol, ul, dl, body > div.paragraph, a, fieldset, form, table, block) {
	z-index: 20;
}

:where(figure, figcaption, blockquote, block, a) {
	position: relative;
}

:where(p, ol, ul, dl, body > div.paragraph) {
	position: relative;
	margin-top: 1em;

	&:not(.paragraph) {
		margin-top: 0;
		margin-bottom: 1rem;
	}

	& :where(ol, ul, dl) {
		left: 0;
		width: 100%;
		max-width: 100%;
		margin: 0;
	}
}

:not(#header-left, #tocdiv) > p {
	margin-top: 1.2rem;
	margin-bottom: 1.2rem;
	padding-right: 0;
	z-index: auto;
}

:where(dt, li):not(:first-child) {
	margin-top: 0.25rem;
}

li > blockquote {
	width: 100%;
	margin-left: 0;
}

body > blockquote {
	margin-top: 1.2rem;
	margin-bottom: 1.2rem;
}

.paragraph {
	margin-top: 1em;
	margin-bottom: 0;
}

block {
	display: inline-block;
}

/* Section headers */
:where(h0, h1, h2, h3, h4, h5, h6) {
	display: block;
	position: relative;
	z-index: 20;
	text-align: left;
	margin-top: 2rem;
	margin-bottom: 1.2rem;
	padding-left: 0;
}

body h0 {
	margin-top: 2rem;
	margin-bottom: 2rem;
	padding: 0.3em;
}

h0 {
	z-index: 12;
	top: 4rem;
	padding-bottom: 0.5rem;
	text-align: center;
	justify-content: center;
	align-items: center;
}

h1 {
	margin-top: 4rem;
	margin-bottom: 2rem;
	padding-bottom: 0.2em;
}

:where(h2, h3) {
	text-align: center;
	margin-top: 2em;
	margin-bottom: 1em;
	padding: 0.2em 0;
}

h4 {
	margin-top: 2.5rem;
}

/* Text features */
:where(.sidenote, .sidenote2) {
	position: absolute;
	display: inline-block;
	right: var(--sidenote-offset);
	width: var(--sidenote-width);
	padding: 0.8em;
}

.sn-counter {
	position: relative;
	display: inline-block;
	bottom: 0.5em;
	line-height: 1em;

	&::before {
		position: relative;
		display: inline-block;
		padding-left: 0;
		line-height: 1em;
	}
}

.hovertip {
	position: relative;
	display: inline-flex;

	& .hovertiptext {
		position: absolute;
		display: inline-block;
		z-index: 1;
		visibility: hidden;
		width: var(--tooltip-width);
		top: -100%;
		left: 50%;
		padding: 5px;
		text-align: center;
	}

	&:hover .hovertiptext {
		visibility: visible;
	}
}

.contextual {
	position: relative;

	& > .context {
		position: absolute;
		z-index: 100;
		top: var(--main-line-height);
		left: 0;
		width: max-content;
		padding: 3px;
	}
}

.links-dropdown-label {
	position: relative;
	z-index: 40;
	width: 100%;
	height: 100%;
	text-align: center;
}

.links-dropdown-content {
	position: absolute;
	display: flex;
	flex-direction: column;
	top: 100%;
	width: var(--dropdown-width);
	transform: translateY(-100%);

	& > * {
		padding: 5px;
	}

	.links-dropdown:hover > &,
	&:hover,
	div:hover > & {
		z-index: 100;
		transform: translateY(0);
	}
}

div:hover > .wide-on-hover {
	width: var(--dropdown-wide-width);
}

:where(#Footnotes, #FootnotesExtra) > p:not(:first-child) {
	padding-top: 1%;
}

button.showExtra,
*[id$=Extra_ref]:not(button) {
	display: none;
}

*[id$=Extra_ref]:not(button).showExtra {
	display: inline;
}

@media only screen and (max-width: 1800px) {
	:root {
		--toc-width: var(--toc-width-wide);
	}

	.sidenote2 {
		left: 100%;
		width: var(--sidenote-wide-width);
		padding-left: 2vw;
		padding-right: 2vw;
	}
}

@media only screen and (max-width: 1000px) {
	#tocdiv {
		display: none;
	}
}
