/*!
 * LaTeX.css (https://latex.now.sh/)
 *
 * Source: https://github.com/vincentdoerig/latex-css
 * Licensed under MIT (https://github.com/vincentdoerig/latex-css/blob/master/LICENSE)
*/

/* If you want to load additional fonts from google, do so here*/
/*@import url('https://fonts.googleapis.com/css2?family=Open+Sans&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap');*/

/* Adam custom rules */
.TEX-SSI{
  /* Sans serif italic should always be bold */
  font-weight:bold;
}


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

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
ul[class],
ol[class],
li,
figure,
figcaption,
dl,
dd {
  margin: 0;
}

/* Make default font-size 1rem and add smooth scrolling to anchors */
html {
  font-size: 1rem;
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.8;

  max-width: 80ch;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0 auto;
  padding: 2rem 1.25rem;

  /*counter-reset: theorem;
  counter-reset: definition;
  counter-reset: example;*/

  color: hsl(0, 5%, 10%);
  background-color: hsl(210, 20%, 98%);

  text-rendering: optimizeLegibility;
}

/* Justify and hyphenate all paragraphs */
p {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
}
p:not(:last-child) {
  margin-bottom:1em;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make links red */
a,
a:visited {
  color: #a00;
}

a:focus {
  outline-offset: 2px;
  outline: 2px solid hsl(220, 90%, 52%);
}

/* Make images easier to work with */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Prevent textarea from overflowing */
textarea {
  width: 100%;
}

/* Natural flow and rhythm in articles by default */
article > * + * {
  margin-top: 1em;
}

/* Styles for inline code or code snippets */
code,
pre,
kbd {
  font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
    monospace;
  font-size: 85%;
}
pre {
  padding: 1rem 1.4rem;
  max-width: 100%;
  overflow: auto;
  border-radius: 4px;
  background: hsl(210, 28%, 93%);
}
pre code {
  font-size: 95%;
  position: relative;
}
kbd {
  background: hsl(210, 5%, 100%);
  border: 1px solid hsl(210, 5%, 70%);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 75%;
}

/* Better tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: auto;
  max-width: 100%;
  border-top: 2.27px solid black;
  border-bottom: 2.27px solid black;
  /* display: block; */
  overflow-x: auto; /* does not work because element is not block */
  /* white-space: nowrap; */
  counter-increment: caption;
}
/* add bottom border on column table headings  */
table tr > th[scope='col'] {
  border-bottom: 1.36px solid black;
}
/* add right border on row table headings  */
table tr > th[scope='row'] {
  border-right: 1.36px solid black;
}
table > tbody > tr:first-child > td,
table > tbody > tr:first-child > th {
  border-top: 1.36px solid black;
}
table > tbody > tr:last-child > td,
table > tbody > tr:last-child > th {
  border-bottom: 1.36px solid black;
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  line-height: 1.1;
}
/* Table caption */
caption {
  text-align: left;
  font-size: 0.923em;
  /* border-bottom: 2pt solid #000; */
  padding: 0 0.25em 0.25em;
  width: 100%;
  margin-left: 0;
}

table caption::before {
  content: 'Table ' counter(caption) '. ';
  font-weight: bold;
}

table caption {
	caption-side:bottom
}

table.imageTable caption::before {
	content: 'Figure ' attr(data-number) ': ';
	font-size: 1rem;
	font-weight: normal;
}

table.imageTable caption {
	text-align:center;
	font-size: 1rem;
	font-weight: normal;
}

figcaption::before {
	content: 'Figure ' attr(data-number) ': ';
}

/* allow scroll on the x-axis */
.scroll-wrapper {
  overflow-x: auto;
}

/* if a table is wrapped in a scroll wrapper,
  the table cells shouldn't wrap */
.scroll-wrapper > table td {
  white-space: nowrap;
}

/* Center align the title */
h1:first-child {
  text-align: center;
}

/* Nested ordered list for ToC */
nav ol {
  counter-reset: item;
  padding-left: 2rem;
}
nav li {
  display: block;
}
nav li:before {
  /*content: counters(item, '.') ' ';
  counter-increment: item;
  padding-right: 0.85rem;*/
}

/* Center definitions (most useful for display equations) */
dl dd {
  text-align: center;
}

/* Theorem */
.theorem {
/*  counter-increment: theorem;*/
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.theorem::before {
/*  content: 'Theorem ' counter(theorem) '. ';*/
  content: 'Theorem ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Lemma */
.lemma {
/*  counter-increment: theorem;*/
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.lemma::before {
/*  content: 'Lemma ' counter(theorem) '. ';*/
  content: 'Lemma ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Proof */
.proof {
  display: block;
  margin: 12px 0;
  font-style: normal;
  position: relative;
}
.proof::before {
  content: 'Proof. ' attr(title);
  font-style: italic;
}
.proof:after {
  content: '◾️';
  position: absolute;
  right: -12px;
  bottom: -2px;
}

/* Definition */
.definition {
/*  counter-increment: definition;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.definition::before {
/*  content: 'Definition ' counter(definition) '. ';*/
  content: 'Definition ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Other environments to be added here */

/* Framed */
.framed {
    display: block;
    margin: 12px 0;
    font-style: normal;
	border: 1px solid black;
	padding: 0px 10px 10px 10px;
}

/* Example */
.example {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.example::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Example ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Example with QED */
.exampleqed {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
  position: relative;
}
.exampleqed::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Example ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

.exampleqed::after{
    content: '▲';
    position: absolute;
    right: -12px;
    bottom: -2px;
}

/* Exercise */
.exercise {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.exercise::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Exercise ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Proposition */
.proposition {
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.proposition::before {
/*  content: 'Lemma ' counter(theorem) '. ';*/
  content: 'Proposition ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Corollary */
.corollary {
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.corollary::before {
/*  content: 'Corollary ' counter(theorem) '. ';*/
  content: 'Corollary ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Remark */
.remark {
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.remark::before {
/*  content: 'Lemma ' counter(theorem) '. ';*/
  content: 'Remark ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Solution */
.solution {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.solution::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Solution ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Problem */
.problem {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.problem::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Problem ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Problem */
.question {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.question::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Question ' attr(data-number) '. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Solution */
.bonussolution {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.bonussolution::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Bonus Solution. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Problem */
.bonusproblem {
/*  counter-increment: example;*/
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.bonusproblem::before {
/*  content: 'Example ' counter(example) '. ';*/
  content: 'Bonus Problem. ' ;
  font-weight: bold;
  font-style: normal;
}

/* Center align author name, use small caps and add vertical spacing  */
.author {
  margin: 0.85rem 0;
  font-variant-caps: small-caps;
  text-align: center;
}

/* Make footnote text smaller and left align it (looks bad with long URLs) */
.footnotes p {
  text-align: left;
  line-height: 1.5;
  font-size: 85%;
  margin-bottom: 0.4rem;
}
.footnotes {
  border-top: 1px solid hsl(0, 0%, 39%);
}

/* Center title and paragraph */
.abstract,
.abstract p {
  text-align: center;
  margin-top: 0;
}
.abstract {
  margin: 2.25rem 0;
}
.abstract > h2 {
  font-size: 1rem;
  margin-bottom: -0.2rem;
}

.center {
	text-align: center;
}

.center img {
	margin: auto;
}

/* Format the LaTeX symbol correctly (a higher up, e lower) */
.latex span:nth-child(1) {
  text-transform: uppercase;
  font-size: 0.75em;
  vertical-align: 0.28em;
  margin-left: -0.48em;
  margin-right: -0.15em;
  line-height: 1ex;
}

.latex span:nth-child(2) {
  text-transform: uppercase;
  vertical-align: -0.5ex;
  margin-left: -0.1667em;
  margin-right: -0.125em;
  line-height: 1ex;
}

/* Heading typography */
h1 {
  font-size: 2.5rem;
  line-height: 3.25rem;
  margin-bottom: 1.625rem;
}

h2 {
  font-size: 1.7rem;
  line-height: 2rem;
  margin-top: 3rem;
}

h3 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
}

h4 {
  font-size: 1.2rem;
  margin-top: 2rem;
}

h5 {
  font-size: 1rem;
  margin-top: 1.8rem;
}

h6 {
  font-size: 1rem;
  font-style: italic;
  font-weight: normal;
  margin-top: 2.5rem;
}

h3,
h4,
h5,
h6 {
  line-height: 1.625rem;
}

h1 + h2 {
  margin-top: 1.625rem;
}

h2 + h3,
h3 + h4,
h4 + h5 {
  margin-top: 0.8rem;
}

h5 + h6 {
  margin-top: -0.8rem;
}

h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.8rem;
}

@media only screen and (max-width: 650px) {
	/* Sideways scrolling for maths */
	.math.display > span {
		overflow-x: scroll;
		overflow-y: hidden;
	}

	.math.inline > span {
		overflow-x: visible;
		max-width: 100%;
	}
}
