:root {
  --sans-font: "Ubuntu Nerd Font", Arial, Helvetica, sans-serif;
  --mono-font: "UbuntuMono Nerd Font", monospace;
  --standard-border-radius: .8rem;

  /* Light theme */
    --bg: #FBFBFF;
    --text: #093D8D;
    --text-light: #2F2997;
    --link-text: #6872E5;
    --link-text-hover:  #32325D;
    --border: #B2AFE9;
    --border-light: #98D7F6;
    --code: #0284C7;
    --code-background: #F4F8FF;
    --preformatted: #012a4a;
    --accent: #008BDF;
    --accent-bg: #F5F5FC;
    --accent-hover: #E0E0E0;
    --accent-text: var(--bg);
    --accent-disabled: #2F5977;
    --table-border: #ECEBFA;
    --table-alternate: #F5F6FC;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1E293B;
    --text: #d0d4fc;
    --text-light: #A9AED2;
    --link-text: #83C3F3;
    --link-text-hover:  #DBEAFE;
    --border: var(--text);
    --border-light: #475569;
    --code: #A5B4FC;
    --code-background: #0F172A;
    --preformatted: #0F172A;
    --accent: #60A5FA;
    --accent-bg: #293548;
    --accent-hover: #5FA5FA7f;
    --accent-text: var(--bg);
    --accent-disabled: #476f95;
    --table-border: #263449;
    --table-alternate: #222F42;
  }

  /* Add a bit of transparency so light media isn't so glaring in dark mode */
  img,
  video {
    opacity: 0.8;
  }
}

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

textarea,
select,
input,
progress {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

html {
  font-family: var(--sans-font);
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  background-color: var(--bg);
  font-size: 1rem;
  line-height: 1.5;
  display: grid;
  grid-template-columns: 1fr min(50rem, 90%) 1fr;
  margin: 0;
}

body > * {
  grid-column: 2;
}

.button[aria-disabled="true"],
input:disabled,
textarea:disabled,
select:disabled,
button[disabled] {
  cursor: not-allowed;
  background-color: var(--accent-disabled);
  border-color: var(--accent-disabled);
  color: var(--text-light);
}

h1.title,
header > h1 {
  color: var(--accent);
}

h1 {
  font-size: 3rem;
  font-weight: lighter;
}

h2 {
  font-size: 2.6rem;
  margin-top: 3rem;
  font-weight: lighter;
}

h3 {
  font-size: 2rem;
  margin-top: 3rem;
  font-weight: lighter;
}

h4 {
  font-size: 1.44rem;
  font-weight: lighter;
}

h5 {
  font-size: 1.15rem;
  font-weight: lighter;
}

h6 {
  font-size: 0.96rem;
  font-weight: lighter;
}

p {
  margin: 1.5rem 0;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  line-height: 1.1;
}

@media only screen and (max-width: 720px) {
  h1 {
    font-size: 2.5rem;
    font-weight: lighter;
  }

  h2 {
    font-size: 2.1rem;
    font-weight: lighter;
  }

  h3 {
    font-size: 1.75rem;
    font-weight: lighter;
  }

  h4 {
    font-size: 1.25rem;
    font-weight: lighter;
  }
}

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

a:hover {
  color: var(--link-text-hover);
}

abbr[title] {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
}

aside, details, pre, progress {
  background-color: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--standard-border-radius);
  margin-bottom: 1rem;
}

article h2:first-child,
section h2:first-child,
article h3:first-child,
section h3:first-child {
  margin-top: 1rem;
}

section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1rem;
  margin: 3rem 0;
}

section + section,
section:first-child {
  border-top: 0;
  padding-top: 0;
}

section + section {
  margin-top: 0;
}

section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Tables */

table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
}

figure > table {
  width: max-content;
  margin: 0;
}

td,
th {
  padding: 0.5rem;
  padding: 1rem 1.5rem;
  border-style: solid;
  border-width: .1rem;
  border-color: var(--table-border);
  text-align: start;
}

th {
  background-color: var(--bg);
  text-transform: uppercase;
  font-weight: bold;
  font-size: small;
  border: none
}

tr:first-child > td:first-child {
  border-top-left-radius: var(--standard-border-radius);
}

tr:first-child > td:last-child {
  border-top-right-radius: var(--standard-border-radius);
}

tr:last-child > td:first-child {
  border-bottom-left-radius: var(--standard-border-radius);
}

tr:last-child > td:last-child {
  border-bottom-right-radius: var(--standard-border-radius);
}

tr > td:last-child {
  border-right-width: .15rem;
}

tr:first-child > td {
  border-top-width: .15rem;
}

tr > td:first-child {
  border-left-width: .15rem;
}

tr:last-child > td {
  border-bottom-width: .15rem;
}

tr:nth-child(even) td {
  /* Set every other cell slightly darker. Improves readability. */
  background-color: var(--table-alternate);
}

table caption {
  margin-bottom: 0.5rem;
}

ul > li::marker, ol > li::marker {
  color: var(--accent);
}

ul {
  list-style-type: disc;
}

li:has(input) {
  list-style-type: none;
}

/* Forms */

textarea,
select,
input,
button,
.button {
  font-size: inherit;
  font-family: inherit;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: var(--standard-border-radius);
  box-shadow: none;
  max-width: 100%;
  display: inline-block;
}
textarea,
select,
input {
  color: var(--text);
  background-color: var(--bg);
  border: 1px solid var(--border);
}
label {
  display: block;
}
textarea:not([cols]) {
  width: 100%;
}

/* checkbox and radio button style */
input[type="checkbox"],
input[type="radio"] {
  vertical-align: middle;
  position: relative;
  width: min-content;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
  display: inline-block;
}

input[type="radio"] {
  border-radius: 100%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  /* Creates a rectangle with colored right and bottom borders which is rotated to look like a check mark */
  content: " ";
  width: 0.18em;
  height: 0.32em;
  border-radius: 0;
  position: absolute;
  top: 0.05em;
  left: 0.17em;
  background-color: transparent;
  border-right: solid var(--bg) 0.08em;
  border-bottom: solid var(--bg) 0.08em;
  font-size: 1.8em;
  transform: rotate(45deg);
}
input[type="radio"]:checked::after {
  /* creates a colored circle for the checked radio button  */
  content: " ";
  width: 0.25em;
  height: 0.25em;
  border-radius: 100%;
  position: absolute;
  top: 0.125em;
  background-color: var(--bg);
  left: 0.125em;
  font-size: 32px;
}

img,
video {
  max-width: 100%;
  height: auto;
  border-radius: var(--standard-border-radius);
}

figure {
  margin: 0;
  display: block;
  overflow-x: auto;
}

figure > img,
figure > picture > img {
  display: block;
  margin-inline: auto;
}

blockquote {
  margin-inline-start: 2rem;
  margin-inline-end: 2rem;
  margin-block: 2rem;
  padding: 0.4rem 0.8rem;
  color: var(--text-light);
  background-color: var(--accent-bg);
  border-inline-start: none;
  border-color: var(--border);
  border-radius: var(--standard-border-radius);
  border-style: dashed;
  border-width: .1rem;
  font-style: italic;
}

cite {
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: normal;
}

code,
pre,
pre span,
kbd,
samp {
  font-family: var(--mono-font);
  color: var(--code);
}

kbd {
  color: var(--text);
  background-color: var(--code-background);
  border-color: var(--border);
  border-style: solid;
  border-width: .1rem;
}

pre {
  color: var(--text);
  padding: 1rem 1.4rem;
  max-width: 100%;
  overflow: auto;
  background-color: var(--preformatted);
  border: none
}

/* The line numbers already provide some kind of left/right padding */
pre[data-linenos] {
  padding: 1rem 0;
}
pre table td {
  padding: 0;
}
/* The line number cells */
pre table td:nth-of-type(1) {
  text-align: center;
  vertical-align: top;
  user-select: none;
}

samp,
code {
  background-color: var(--code-background);
  border-radius: .25rem;
  border-style: dashed;
  border-width: 0.05rem;
  border-color: var(--border-light);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1rem;
  padding: .25rem;
}

pre code {
  border-style: none;
  background-color: var(--preformatted);
}