/* debugging */
/*
.sic, em {
	padding: 1em;
	background: #F004;
}
em.maths {
	background: #F001;
}
*/

html {
	/*
	--ui-shade : #654;
*/
	--ui-deg: 45deg;
}

body {
	font: 1em/1.35 Cambria, Times, serif;
	-webkit-hyphens: auto;
	hyphens: auto;
}

[href]:any-link {
	text-underline-offset: 0.2em;
}

/* TOC */

nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	max-width: 100vw;
	overflow: hidden;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	grid-template-rows: repeat(2, auto);
	gap: 0 0.5em;
	transition-duration: 500ms;
	color: hsl(var(--ui-deg), 80%, 10%);
	background: hsl(var(--ui-deg), 60%, 99%);
	border-block-end: 1px solid gray;
	z-index: 1945;
	transition-duration: 333ms;
	transition-property: color, background, box-shadow;
}

nav:hover,
nav:focus-within {
	box-shadow: 0 0 3em 3em #FFF;
	color: black;
	background: hsl(var(--ui-deg), 60%, 95%);
}

nav>p {
	grid-row: 1;
	grid-column: 2;
	text-align: center;
	font-weight: 500;
	margin-block-end: -1px;
	padding-block: 0.5em;
	text-indent: 0;
}

nav>a[class] {
	justify-self: stretch;
	padding: 0.5em;
	z-index: 1949;
}

nav>a.prev {
	grid-row: 1;
	grid-column: 1;
}

nav>a.prev::before {
	content: "< ";
}

nav>a.next {
	grid-row: 1;
	grid-column: 3;
	text-align: end;
}

nav>a.next::after {
	content: " >";
}

nav div {
	grid-row: 3;
	grid-column: 1 / -1;
	height: 0;
	padding: 0;
	justify-self: center;
}

nav p:hover~div,
nav p:focus-within~div,
nav div:hover,
nav div:focus-within {
	padding-block: 1em;
	height: auto;
	opacity: 1;
}

nav ol {
	margin: 1em auto;
	padding-inline: 2.5em 0.5em;
	list-style-type: upper-roman;
}

nav ol li {
	break-inside: avoid;
}

nav p span {
	display: none;
}

@media (min-width: 42rem) {
	nav>p {
		grid-column: 2;
		background:
			linear-gradient(currentColor, currentColor) 50% 100% / 50em 1px no-repeat;
	}

	nav>a[class] {
		grid-row: 1;
	}

	nav>a.next {
		grid-column: 3;
	}

	nav div {
		grid-column: 2;
	}

	nav p span {
		display: inline;
	}

	nav ol {
		columns: 2;
		gap: 4em;
		padding: 0;
		transform: translateX(2em);
	}

	nav div .currentPage [href]:any-link::before {
		content: "§";
		margin-right: 0.5ch;
	}
}

nav ul {
	display: flex;
	justify-content: center;
	gap: 1.5em;
	list-style: none;
	margin: 0;
	padding: 0;
}

nav ul li+li {
	list-style: square;
}

nav div [href] {
	display: block;
}

nav [href]:hover {
	background: #0002;
	background: hsla(var(--ui-deg), 60%, 50%, 0.2);
}

nav div [href]:local-link {
	font-weight: 900;
}

nav [href]:any-link {
	color: currentColor;
	text-decoration-style: dotted;
}

nav div [href]:visited {
	color: #555;
}

nav div .currentPage {
	font-weight: 900;
}

nav div .currentPage [href]:any-link {
	color: #000;
	text-decoration-style: solid;
}


main {
	max-width: 40em;
	margin: 0 auto;
	padding-inline: 0.5em;
}

main section {
	margin: 4em 0 2em;
}

main *:is(h1, h2) {
	text-align: center;
}

main *:is(h1, h2, h3) {
	font-weight: normal;
	transform: scaleY(0.9);
	margin-block: 1.5em 0.25em;
}

main h1 {
	margin-block: 2.5em 1em;
	font-size: 2.25em;
}

main h1 i {
	display: block;
	transform: scaleY(0.85);
	letter-spacing: -1px;
	font-size: 75%;
	margin-block-end: 1.75em;
	text-transform: uppercase;
}

main h4 {
	font-weight: normal;
	font-style: italic;
	margin-block: 1em 0.25em;
}

dt {
	margin-inline-start: 1em;
	margin-block: 1.5em 0.75em;
	font-style: italic;
}

p {
	margin: 0;
	text-align: justify;
}

p strong {
	margin-inline-end: 1ch;
}

p[id],
[id] p:first-child,
aside>p {
	text-indent: 1em;
}

:target,
dt:target+dd {
	background: #FED;
	padding-inline: 2.5ch;
	margin-inline-start: -2.5ch;
	margin-inline-end: -2ch;
	scroll-margin-block-start: 4em;
}

p.cases {
	white-space: pre-wrap;
	margin-block: 0 1em;
	margin-inline: 1em;
	text-indent: 0;
}

a.xref {
	white-space: nowrap;
}

sup {
	font-size: 75%;
	line-height: 0.5;
}

main aside {
	border-block: 2px solid;
	padding-block: 2em;
	margin-block: 4em;
}

@media (min-width: 32em) {
	main aside {
		padding-inline: 2em;
	}
}

main aside h4 {
	margin-block: 2em 0.25em;
	font-style: italic;
	font-size: inherit;
	font-size: 105%;
	transform: none;
}

main aside figure {
	margin-block: 2em;
}

main aside em {
	margin-inline-end: 1ch;
}

.double {
	columns: 2;
}

/* ----------------------------------------------
	Figures
   ---------------------------------------------- */

figure {
	margin-block: 2em;
	margin-inline: 0;
	text-align: center;
	font-size: 95%;
}

figure img,
figure svg {
	max-width: 100%;
	display: block;
	height: auto;
}

figure.wide {
	margin-block: 3em;
}

figure.wide :is(img, svg) {
	margin-inline: calc((90vw - min(90vw, 42em)) / -2);
	max-width: 85vw;
}

figure .halfwidth {
	max-width: 50%;
	margin-inline: auto;
}

figure figcaption {
	padding: 0.5em;
	text-align: justify;
	text-align-last: center;
}

figure p {
	text-indent: 0;
}

figure :is(h4, h5, h6) {
	font-size: 1em;
	font-style: normal;
	font-weight: bold;
	margin-block: 0;
	padding: 0.5em;
}

@media (min-width: 30em) {
	figure {
		margin-inline: 1em;
	}

	figure figcaption {
		display: grid;
		grid-template-columns: max-content auto;
		justify-content: center;
		gap: 0.75em;
		padding-inline: 1.25em;
	}
}

/* Equation figures */

figure.numbered.equation {
	display: grid;
	grid-template-columns: auto min-content;
	align-items: center;
	margin-block: 0;
}

figure.numbered.equation mjx-container {
	grid-row: 1;
	grid-column: 1;
}

figure.numbered.equation figcaption {
	display: block;
	padding: 0;
	/*    grid-row: 1;
    grid-column: 2;*/
}

/* Table figures */

figure.table {
	margin-inline: auto;
	max-width: 100%;
}

figure.wide.table {
	margin-block: 3em;
	margin-inline: calc((90vw - min(90vw, 42em)) / -2);
	max-width: 100vw;
}

figure.wide.table table {
	margin-inline: auto;
}

figure.table figcaption,
figure.table caption {
	font-weight: 600;
}

figure.table figcaption {
	display: block;
	font-size: 110%;
}

figure.table figcaption+figcaption {
	padding: 0;
}

figure.table table {
	margin-inline: auto;
	border-spacing: 1em 0;
	padding-block: 0.5em;
	border-collapse: separate;
	font-feature-settings: "tnum" 1;
	font-variant: tabular-nums;
}

figure.table thead th {
	font-weight: normal;
	padding-block: 0.25em 0.5em;
}

figure.table :is(tbody, tbody[class]) th {
	font-weight: normal;
	text-align: left;
}

figure.table thead th:not(:empty) {
	border-bottom: 1px solid;
}

figure.table :is(tbody, tfoot) th {
	text-align: left;
}

figure.table tbody tr:first-child>* {
	padding-block-start: 0.5em;
}

figure.table tbody tr:last-child>* {
	padding-block-end: 0.5em;
}

figure.table thead th {
	vertical-align: bottom;
}

figure.table tbody td {
	padding-inline: 1.5em 0.5em;
	text-indent: -1em;
	line-height: 1.1;
	vertical-align: middle;
}

figure.table .upper {
	vertical-align: top;
}

figure.table .middle {
	vertical-align: middle;
}

figure.table .lower {
	vertical-align: bottom;
}

figure.table .text {
	padding-block: 0.5em;
}

figure.table .left {
	text-align: left;
}

figure.table .flush :is(th, td) {
	text-indent: 0;
	padding-inline-start: 0;
}

figure.table .right {
	text-align: right;
}

figure.table .center {
	text-align: center;
}

figure.table td.sum {
	border-top: 1px solid;
}

figure.table {
	--offset: 0ch;
}

figure.table .lpf {
	transform: translateX(calc(0.25ch + var(--offset)));
}

figure.table .lp1 {
	transform: translateX(calc(0.5ch + var(--offset)));
}

figure.table .lp2 {
	transform: translateX(calc(1ch + var(--offset)));
}

figure.table .lp3 {
	transform: translateX(calc(1.5ch + var(--offset)));
}

figure.table .lp4 {
	transform: translateX(calc(2ch + var(--offset)));
}

figure.table .lp5 {
	transform: translateX(calc(2.5ch + var(--offset)));
}

figure.table .rp1 {
	transform: translateX(calc(-0.5ch + var(--offset)));
}

figure.table .rp2 {
	transform: translateX(calc(-1ch + var(--offset)));
}


figure.table ul {
	margin: 0;
	padding: 0;
	text-align: left;
	list-style: none;
}

figure.table ul ul {
	padding-inline-start: 2.5em;
}

figure.table table.bordered {
	border-collapse: collapse;
	border-spacing: 0;
	border-block: 1px solid;
}

figure.table table.bordered caption {
	padding-block: 1em 2em;
}

figure.table table.bordered :is(td, th) {
	border-inline: 1px solid #999;
	padding-block: 0.5em;
}

figure.table table.bordered tr> :is(th, td):first-child {
	border-inline-start: 0;
	padding-inline-start: 1.1em;
}

figure.table table.bordered tr> :is(th, td):not(:first-child) {
	text-indent: 0;
	padding: 0.75em;
}

figure.table table.bordered tr.subrow> :is(th, td) {
	padding-block: 0 0.125em;
}

figure.table table.bordered tr.subrow> :first-child {
	padding-inline-start: 2em;
}

figure.table table.bordered tr.subrow+tr.subrow> :is(th, td) {
	padding-block-end: 0.5em;
}

figure.table table.bordered tr> :is(th, td):last-child {
	border-inline-end: 0;
	padding-inline-end: 0;
}

figure.table table.bordered tr.divide :is(td, th) {
	border-top: 1px solid #666;
}

figure.table table.bordered .compressed tr.divide :is(td, th) {
	padding-block-end: 0;
}

figure.table table.bordered tbody tr:first-child :is(td, th) {
	border-top: 3px double;
}

figure.table table.bordered [colspan] {
	text-align: center;
}

figure.table table.bordered [rowspan] {
	vertical-align: middle;
}

/* bibliography */

section.biblio>ol {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 90%;
}

@media (min-width: 32em) {
	section.biblio>ol {
		columns: 2;
		gap: 1.5em;
	}
}

section.biblio li {
	text-indent: -1em;
	padding-inline-start: 1em;
	break-inside: avoid;
}

section.biblio span.authors {
	font-variant: small-caps;
	font-weight: 500;
}

section.biblio span.authors span {
	font-variant: normal;
}

/* footnotes/endnotes */

sup [href]:any-link {
	padding-block: 1.5em;
	padding-inline: 2em;
	margin-inline: -1.75em -2em;
	position: relative;
	z-index: 1;
}

.endnotes {
	font-size: 90%;
}

.endnotes ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.endnotes li {
	margin-block: 0.33em;
	padding-inline-start: 0.75em;
	text-indent: -0.75em;
}

.endnotes li:nth-of-type(9)~li {
	margin-inline-start: -0.33em;
	padding-inline-start: 1.1em;
	text-indent: -1.1em;
}

.endnotes li:target {
	position: fixed;
	bottom: 0;
	top: auto;
	padding-block: 2em 4em;
	padding-inline: 2em;
	margin-inline: -1.1em auto;
	border-top: 1px solid;
	background: #FFF;
	box-shadow: 0 0 3em 3em #FFF;
	box-sizing: border-box;
	width: min(100%, 100vw);
	max-width: min(45em, 100vw);
	animation: fnSlide 333ms forwards ease-out;
}

@keyframes fnSlide {
	from {
		max-height: 0;
		bottom: -8rem;
	}

	to {
		max-height: 67vh;
		bottom: 0rem;
	}
}

@media (min-width: 45rem) {
	.endnotes li:target {
		margin-inline: auto;
	}
}

.endnotes li .close {
	display: none;
	visibility: hidden;
	font: bold 1em sans-serif;
	text-decoration: none;
	color: inherit;
	background: #FED;
	padding-block: 0.33em 0.15em;
	padding-inline: 0.5em;
	text-indent: 0;
	border: 1px solid;
}

.endnotes li:target .close {
	display: block;
	visibility: visible;
	position: absolute;
	top: -1px;
	right: 0;
}

.endnotes li:target .backjump {
	display: none;
	visibility: hidden;
}

.backjump {
	margin-inline-start: 0.5ch;
}

.backjump,
.backjump a {
	white-space: nowrap;

	@media (min-width: 42rem) {
		.endnotes li:target {
			width: 42rem;
		}
	}
}

@media print {

	/* All your print styles go here */
	nav {
		display: none !important;
	}
}