:root {
  --darkest-color: rgb(10, 5, 0);
  --darker-color: rgb(60, 55, 50);
  --dark-color: rgb(95, 85, 80);
  --ui-spacing: 1.25;
  --read-spacing: 1.5;
  --wide-gray: rgb(245, 240, 240);
  --narrow-gray: rgb(240, 233, 233);
}

.est-color {
  color: var(--darkest-color) !important
}
.er-color {
  color: var(--darker-color) !important
}
.null-color {
  color: var(--dark-color) !important
}

code {
  font-variant-ligatures: no-contextual;
}

code:not(pre code) {
  background-color: var(--wide-gray);
  padding-left: 3px;
  padding-right: 3px;
  padding-top: 1px;
  padding-bottom: 1px;
  color: black;
  border-radius: 3px;
  line-height: var(--ui-spacing);
  /* This prevents inline code from wrapping, c.f. Typst's `box`. */
  display: inline-block;
  /* These are needed if we allow code to line break. */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

pre {
  color: black;
  background-color: var(--wide-gray);
  overflow-x: auto;
  border-style: solid;
  border-radius: 3px;
  border-width: 2px;
  border-color: var(--wide-gray);
  padding-left: 0.35em;
  padding-top: 0.1em;
  padding-bottom: 0.2em;
  line-height: normal;
}

body {
  background-color: rgb(255, 255, 255);
  color: var(--darker-color);
}

h1 {
  color: var(--darkest-color);
  margin-bottom: 0.05em;
  margin-top: 1em;
}

h2,
h3,
h4,
h5,
h6 {
  color: var(--darker-color);
  margin-bottom: 0;
  margin-top: 1em;
}

/* This must be above the hn+* rules */

blockquote > p {
  margin-top: 0.7em;
  margin-bottom: 0.7em;
}

h1+*,
h2+*,
h3+*,
h4+*,
h5+*,
h6+* {
  margin-top: 0;
  padding-top: calc(var(--base-font-size) * (2/3));
}

blockquote {
  font-size: 1em;
  line-height: var(--ui-spacing);
  border-left: 4px solid var(--darkest-color);
  padding-left: 0.45em;
  margin: 0;
}

blockquote:has(p + p) {
  text-indent: 1em;
}

a:link,
a:visited {
  color: var(--darkest-color)
}

[role="doc-noteref"] {
  text-decoration: none;
  font-family: "BodySans";
}

[role="doc-noteref"] sup {
  font-size: 0.7em;
  font-style: normal;
}

[role="doc-noteref"] sup::before {
  content: "(";
  padding-left: 0.075em;
}

[role="doc-noteref"] sup::after {
  content: ")";
}

[role="doc-backlink"] {
  margin-left: 0.25em;
  text-decoration: none;
}

img {
  width: 100%;
  height: auto;
}

table {
  --padding-px-h: 0.35em;
  --padding-px-v: 0;
  border-collapse: separate;
  border-spacing: 0;
  overflow-x: auto;
}

table tr th,
table tr td {
  border-right: 2px solid var(--narrow-gray);
  border-bottom: 2px solid var(--narrow-gray);
  padding-right: var(--padding-px-h);
  padding-left: var(--padding-px-h);
  padding-top: var(--padding-px-v);
  padding-bottom: var(--padding-px-v);
}

table tr th:first-child,
table tr td:first-child {
  border-left: 2px solid var(--narrow-gray);
}

/* top row a.k.a. table header */
table tr th {
  border-top: 2px solid var(--narrow-gray);
  text-align: left;
}

/* top-left border-radius */
table tr:first-child th:first-child {
  border-top-left-radius: 3px;
}

/* top-right border-radius */
table tr:first-child th:last-child {
  border-top-right-radius: 3px;
}

/* bottom-left border-radius */
table tr:last-child td:first-child {
  border-bottom-left-radius: 3px;
}

/* bottom-right border-radius */
table tr:last-child td:last-child {
  border-bottom-right-radius: 3px;
}

math[display="block"] {
  position: relative;
  left: 0;
  right: auto;
  text-align: center;
}

footer {
  margin-top: 2rem;
}

/* This is the style for the traditional horizontal rule. */
hr:not(.thematic) {
  height: 2px;
  border: none;
  background-color: var(--narrow-gray);
}

hr.thematic {
  border: none; /* remove default line */
  text-align: center;
  margin-top: -0.55em;
  margin-bottom: -0.55em;
}

hr.thematic::before {
  font-family: "Mono";
  text-align: center;
  content: '◇◆◇';
  letter-spacing: 0.4em;
  color: var(--darker-color);
  display: block;
  transform: translate(0.2em, -0.05em);
}
