:root {
	--link-color: #3366cc;
	--visited-link-color: #0b0080;
	--cite-link-color: green;

	--pagebar-bg: #ccc;
	--pagebar-text-color: #000;

	--bg-color: #fff;
	--text-color: #222;
	--inset-box-bg: #ddd;
	--footnote-bar-color: #555;
	--table-border-color: #999;

	--footnote-popup-bg: #eee;
	--footnote-popup-border: #999;

	--page-number-color: rgba(0,0,0,0.6);
}

@font-face {
	font-family: 'crimson_pro';
	src: url('CrimsonPro-Italic.woff2') format('woff2');
	font-weight: normal;
	font-style: italic;
}

@font-face {
	font-family: 'crimson_pro';
	src: url('CrimsonPro-Regular.woff2') format('woff2');
	font-weight: normal;
	font-style: normal;
}

@font-face {
	font-family: 'crimson_pro';
	src: url('CrimsonPro-SemiBold.woff2') format('woff2');
	font-weight: 600;
	font-style: normal;
}

@font-face {
	font-family: 'crimson_pro';
	src: url('CrimsonPro-SemiBoldItalic.woff2') format('woff2');
	font-weight: 600;
	font-style: italic;
}

@media screen {
	* {
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		font-smooth: always;
	}
}

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	font-size: 18px;
}

body {
	overflow: auto;
	font-family: 'crimson_pro', serif;
	background-color: var(--bg-color);
	color: var(--text-color);
}

a:any-link {
	color: var(--link-color);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

a:visited {
	color: var(--visited-link-color);
}

a[data-cite] {
	color: var(--cite-link-color);
	text-decoration: underline;
	text-decoration-style: dotted;
}

b {
	/* fix issue where <b> tags make line on which they appear slightly taller */
	/* vertical-align: top; */
	line-height: 1;
}

p {
	margin: 0 0 0.75em 0;
}

h2 { 
	font-size: 1.3em;
	margin: 0.5em 0 0.3em;
}

h3 {
	font-size: 1.1em;
	margin: 0.5em 0 0.3em;
}

input {
	font-size: 0.8em;
	padding: 0;
	margin: 0;
}

input[type="submit"], button {
	appearance: none;
	-webkit-appearance: none;
	padding: 0 0.2em;
}

.toc li {
	margin: 0.5em 0;
}

.pagebar {
	width: 100%;
	padding: 0.25em;
	background-color: var(--pagebar-bg);
	font-family: sans-serif;
	position: fixed;
	z-index: 10;
}

#container {
	padding-top: 3em;
}

.pagebar ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pagebar ul li {
	display: block;
}

.pagebar ul a {
	color: var(--pagebar-text-color);
}

/* WK chapter titles are already h1. WL aren't. */
/* also .Head1 is used elsewhere instead of h1... */
/* WL polyfill */
.ChTitle, .Head1 {
	font-size: 1.5em;
	margin: 0.83em 0;
	font-weight: bold;
}

/* WK vs. WL */
#tab-section-container {
	max-width: 40em;
	padding-top: 2em;
	margin: 0 1em;
	padding-bottom: 5em;
}

/* WK v. WL v. CREHB? */
.cc-pagenum-begin, .pagebreak, .rs-auto-pagebreak {
	font-style: italic;
	display: block;
	font-family: sans-serif;
	font-size: 0.7em;
	/* text-indent: 0; */
	border: 0 solid var(--page-number-color);
	color: var(--page-number-color);
}

/* WL polyfill */
.pagebreak::before, .rs-auto-pagebreak::before {
	content: 'p. ';
}

.epub-casename {
	font-style: italic;
}

.epub-localToc .epub-localtoc-entry.epub-localtoc-case {
	margin-left: 1.25em;
}

/* WK v. WL */
.epub-chunkDesignation > p, .ChNum {
	font-weight: bold;
	/* to make WL act like WK */
	text-transform: uppercase;
}

/* body text styling */
main article {
	line-height: 1.6;
}

/* just paragraphs */
/* WK v. WL */
.epub-text-para, .TextParagraph {
	text-align: justify;
}

.epub-text-left {
	text-align: left;
}

.epub-text-right {
	text-align: right;
}

/* WK heuristic paragraph indent rule */
/* .epub-section .epub-text-para + .epub-text-para {
	text-indent: 2em;
} */

/* WL only - not sure about global indention for WK yet */
/* TODO */
/* .TextParagraph {
	text-indent: 2em;
} */

.epub-text-para.center {
	text-align: center;
}

.epub-blockquote {
	margin: 0 1.5em;
	line-height: 1.2;
}

/*any aside/box*/
/* .epub-feature p, .epub-text-left, .left { */
.epub-text-left, .left {
	text-align: left;
}

/* outline box stuff */
.epub-feature2 {
	margin: 1em 0;
	border: 2px solid var(--text-color);
	padding: 1em;
}

/* grey box stuff */
.epub-feature3 {
	margin: 1em 0;
	background-color: var(--inset-box-bg);
	padding: 1em;
}

.epub-feature-heading2 p {
	font-size: 1.2em;
	font-weight: bold;
	margin: 0 0 0.2em;
	line-height: 1;
}

.epub-list-reset1 {
	counter-reset: item 0;
}

.epub-epubContainer li > p {
	margin: 0 0 0.5em 0;
	line-height: 1;
}

.epub-epubContainer ol, .epub-epubContainer ul {
	margin: 0.5em 0;
}

.epub-law-heading-container {
	position: relative;
}

.epub-law-case-marker {
	float: left;
	height: 100%;
	width: 0.4em;
	background-color: var(--text-color);
	position: absolute;
	left: -1em;
}

/* WK case titles are h3. WL are not. */
/* WL polyfill */
/* also note headings... */
.CaseHead, .NoteMainHead {
	font-size: 1.17em;
	font-weight: bold;
	margin: 1em 0 0;
}

/* WL: too far from CaseHead */
.FileLine {
	margin-top: 0;
}

.epub-law-case {
	border-bottom: 5px solid var(--text-color);
	margin-bottom: 0.75em;
	padding-bottom: 0.25em;
}

.epub-small-caps {
	font-variant: small-caps;
	text-transform: lowercase;
}

/* regular small caps as applied to a mixed-case word */
.small-caps {
	font-variant: small-caps;
}

.epub-hide {
	display: none;
}

.epub-footnoteSection {
	text-align: left;
	border-top: 4px dotted var(--footnote-bar-color);
}

.epub-footnoteSection .epub-heading {
	font-size: 1.5em;
	margin: 1rem 0 0.5rem;
}

/* THIS WAS INSUFFICIENT FROM A10Y PERSPECTIVE */
/* .epub-footnotenum, .epub-footnotenum-ref, /* WK
.FootnoteReference /* WL
{
	font-size: 0.6em !important; /* bc WL hardcoded size
	line-height: 0;
	vertical-align: super;
	padding-left: 0.1em;
} */

.epub-footnotenum, .epub-footnotenum-ref,
.FootnoteReference {
	vertical-align: super;
	font-size: 0.75em;
}

.epub-footnotenum:before, .epub-footnotenum-ref:before,
.FootnoteReference a:before {
	content: '[';
	color: var(--link-color);
}

.epub-footnotenum:after, .epub-footnotenum-ref:after,
.FootnoteReference a:after {
	content: ']';
	color: var(--link-color);
}




/* .epub-footnotenum a, .epub-footnotenum-ref a, /* WK
.FootnoteReference a /* WL
{
	text-decoration: none;
} */

.epub-footnote-text {
	text-align: left;
	line-height: 1;
}

.epub-image-container {
	margin: 0 auto;
	text-align: center;
}

.epub-image-caption p {
	margin: 0;
	font-size: 0.8em;
	font-family: sans-serif;
}

.epub-heading {
	font-weight: bold;
	line-height: 1.1;
}

/* fix body link overruns */
.cc-section {
	word-wrap: break-word;
}

.epub-image-credit {
	font-size:  0.6em;
	text-align: left;
	margin: 0;
}

.epub-table-container {
	max-width: 100%;
	overflow-x: auto;
	margin: 1em 0;
	padding: 0 1px;
}

.epub-table {
	font-size:  0.8em;
	border-collapse: collapse;
	min-width: 600px;
	line-height: 1;
}

.epub-table td {
	border: 1px solid var(--table-border-color);
	padding: 0.5em;
	vertical-align: top;
}

.epub-table td p {
	text-align: left;
	margin-top: 0;
}

.epub-table td p:last-child {
	margin-bottom: 0;
}

/* e.g. in rules table */
p.right {
	text-align: right;
}

/* native TOC formatting */
.clearfix:before {
	display: table;
	content: ' ';
}

.epub-tocentry-page {
	float: right;
	text-align: right;
}

/* indentation levels of level A, B, C headings in TOC */
.epub-tableofcontents-container .epub-tocentry-ahead {
	margin-left: 2.5em;
}

.epub-tableofcontents-container .epub-tocentry-bhead {
	margin-left: 2.5em;
}

.epub-tableofcontents-container .epub-tocentry-chead {
	margin-left: 2.5em;
}

/* chapter heading is not fixed width */
.epub-tableofcontents-container .epub-tocentry-chapter-container .epub-tocentry-chapter .epub-toclabel {

}

/* fixed width heading numbers at A, B, C level */
.epub-tableofcontents-container .epub-tocentry-ahead .epub-toclabel,
.epub-tableofcontents-container .epub-tocentry-bhead .epub-toclabel,
.epub-tableofcontents-container .epub-tocentry-chead .epub-toclabel {
	float: left;
	text-align: right;
	width:  1.5em;
}

/* indentation levels of TOC headings */
.epub-tableofcontents-container .epub-tocentry-ahead {
	margin-left: 0em; /* plus 2.25em for hanging numbers */
}

.epub-tableofcontents-container .epub-tocentry-bhead {
	margin-left: 3em;
}

.epub-tableofcontents-container .epub-tocentry-chead {
	margin-left: 4.75em;
}

/* indent the TOC entries relative to their numbers to leave them hanging */
.epub-tableofcontents-container .epub-tocentry-title {
	margin-left: 2.25em;
}

/* line-height bad in TOC, space entries instead for easier understanding */
.epub-tableofcontents-container {
	line-height: 1;
}

/* too many underlines in TOC causes accessibiliity problem, ironically */
/* WK v. WL */
.epub-tableofcontents-container a,
a.toc-entry-content {
	text-decoration: inherit;
}

/* WK v. WL */
.epub-tableofcontents-container a:hover,
a.toc-entry-content:hover {
	text-decoration: underline;
}

/* WK v. WL */
.epub-tableofcontents-container .clearfix, .toc-list-content .toc-entry-container {
	margin-bottom: 0.5em;
}

/* WL uses li for toc */
.toc-entry {
	list-style: none;
}

/* WL page number for chapters */
.toc-entry-content-page-label {
	margin-left: 0.2em;
	float: right;
}

/* separate chapters */
/* WK v. WL */
.epub-tocentry-chapter-container,
.toc-list-content > .toc-entry {
	margin-bottom: 2em;
}

.epub-index-entry.epub-index-indent {
	margin-left: 2em;
}

/* makes e.g. footnotes small */
/* must hardcode for WL footnotes, no small class */
/* IGNORE SIZING ON MOBILE, TOO SMALL TO READ */
.cc-font-small, .FNPara {
	/* font-size: 0.7em; */
	font-size: 1em;
}

/* Footnote popup */
#footnote-popup {
	max-width: 64rem;
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	min-height: 5rem;
	background: var(--footnote-popup-bg);
	border-color: var(--footnote-popup-border);
	border-style: solid;
	border-width: 0;
	border-top-width: 1px;
	box-shadow: 0px 0px 10px rgba(0,0,0,0.3);
	padding: 0.5rem 1rem;
	display: none;
}

#footnote-popup.open {
	display: block;
}

#footnote-popup-close {
	height: 2rem;
	width: 2rem;
	display: block;
	background: transparent;
	font-size: 2rem;
	border: none;
	margin: 0;
	padding: 0;
	position: absolute;
	top: 0;
	right: 0;
	cursor: pointer;
	display: flex;
	justify-content: center;
	align-items: center;
	color: var(--text-color);
}

#footnote-popup-content {
	margin-right: 1rem;
	max-height: calc(min(30vh, 20em));
	overflow-y: auto;
}

/* WL */
.IndexTopicSubhead {
	margin-left: 2em;
}

/* Dumb hardcoded stuff for CREHB */
/* root size on CREHB is 9.5pt */
.Z12ptBoldCtrCaplc, .Z12ptBoldFlushCaplc, .Z14ptBoldFlushCaps, .Z14ptBoldCtrCaps {
	font-weight: bold;
}
.Z12ptBoldFlushCaplc, .Z14ptBoldFlushCaps {
	text-align: justify;
}
.Z12ptBoldCtrCaplc, .Z14ptBoldCtrCaps {
	text-align: center;
}
.Z12ptBoldCtrCaplc, .Z12ptBoldFlushCaplc {
	font-size: 1.26em;
}
.Z14ptBoldFlushCaps, .Z14ptBoldCtrCaps {
	font-size: 1.47em;
}
li.TextHanging, li.WTL2 {
	list-style-position: inside;
}
/* cite data fields inline as spans?? the work of a madman.*/
span[data-field] {
	display: none;
}
.ChTitle16pt {
	font-size: 1.6em;
	font-weight: bold;
}
.ChTitle16pt .ChTitle {
	font-size: 1em;
}
.Z12ptBoldFlushCaplc .Z12ptBoldCtrCaplc {
	font-size: 1em;
}

@media screen and (min-width: 50rem) {
	/* WK v. WL */
	#tab-section-container {
		margin-left: 5em;
		position: relative;
		padding-right: 3em; /* for page numbers */
	}
	.pagebar ul li {
		display: inline-block;
		margin-right: 0.5em;
	}
	/* pull page numbers aside */
	/* WK v. WL */
	.cc-pagenum-begin, .pagebreak, .rs-auto-pagebreak {
		width: 4em;
		position: absolute;
		right: 0;
		text-align: right;
		border-top-width: 1px;
		padding-right: 2px;
		white-space:  nowrap;
	}
	/*bigger blockquote*/
	.epub-blockquote {
		margin: 0 2em;
	}

	#footnote-popup {
		border-width: 1px;
		border-radius: 20px;
		/* margin: 0 0 0 -32rem; */
		/* left: 50%; */
		bottom: 1rem;
		left: 1rem;
		/* padding: 0.5rem 2rem; */
	}

	#footnote-popup-close {
		top: 0.1em;
		right: 0.1em;
	}
}

@media screen and (min-width: 55rem) {
	body {
		font-size: 1.2rem;
	}
}

@media screen and (min-width: 65rem) {
	body {
		font-size: 1.3rem;
	}
	.cc-font-small, .FNPara, .FootnoteReference a {
		font-size: 0.8em !important;
	}
}

/* @media screen and (min-width: 75rem) {
	body {
		font-size: 1.4rem;
	}
} */

@media (prefers-color-scheme: dark) {
	:root {
		--link-color: #5782d8;
		--visited-link-color: #6a63b3;
		--cite-link-color: lightgreen;
	
		--pagebar-bg: #000;
		--pagebar-text-color: #ccc;
	
		--text-color: #ddd;
		--bg-color: #171722;

		--inset-box-bg: rgba(255,255,255,0.1);
		--footnote-bar-color: rgba(204, 204, 204, 0.6);
		--table-border-color: #999;
	
		--footnote-popup-bg: #333342;
		--footnote-popup-border: #1c1c27;
	
		--page-number-color: rgba(204, 204, 204, 0.6); /* #ccc * 0.6 */
	}
}

@media print {
	:root {
		--page-number-color: #000;
	}
	#header {
		display: none;
	}
	#container {
		padding-top: 0;
	}
	#tab-section-container {
		padding-top: 0;
	}
}