:root {
  --emerald: #33a358;
  --gold: #ffd700;
  --amethyst: #8244c1;
  --cosmic-latte: #fffdf9;
  --galaxy-blue: #2e3a6a;
  --coral: #ff7f50;
}

@media (color-gamut: p3) {
  :root {
    --emerald: color(display-p3 0.2 0.64 0.35);
    --gold: color(display-p3 1 0.84 0);
    --amethyst: color(display-p3 0.51 0.26 0.76);
    --cosmic-latte: color(display-p3 1 0.99 0.98);
    --galaxy-blue: color(display-p3 0.28 0.23 0.42);
    --coral: color(display-p3 1 0.5 0.32);
  }
}

:root {
  --bg: var(--cosmic-latte);
  --fg: var(--galaxy-blue);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--galaxy-blue);
    --fg: var(--cosmic-latte);
  }

  grabbable-cat {
    text-shadow:
    /* White */ 0 0 3px #fff, 0 0 5px #fff, 0 0 7px #fff,
      /* Gold */ 0 0 11px var(--gold), 0 0 13px var(--gold),
      0 0 17px var(--gold), 0 0 21px var(--gold), 0 0 23px var(--gold);
  }
}

html {
  font-size: 100%;
}

p {
  margin-bottom: 1ch;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 3ch 0 1.38ch;
  font-weight: 400;
  line-height: 1.3;
}

h1 {
  margin-top: 0;
  font-size: 2.441rem;
}

h2 {
  font-size: 1.953rem;
}

h3 {
  font-size: 1.563rem;
}

h4,
blockquote {
  font-size: 1.25rem;
}

small,
.text_small {
  font-size: 0.8rem;
}

.squiggle {
  display: block;
  margin: 0 0 2.5ch;
  stroke: var(--gold);
}

.under-construction {
  display: inline-block;
  cursor: help;
}

code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
}

html {
  font-weight: 200;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa,
    Manjari, "Arial Rounded MT", "Arial Rounded MT Bold", Calibri,
    source-sans-pro, sans-serif;
  font-weight: 400;
  line-height: 1.75;
}

main {
  max-width: 70ch;
  padding: 2.5ch 0.5ch;
  margin: auto;
}

pre {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
}

blockquote {
  margin-left: 0;
  padding-left: 1.25ch;
  font-family: "Segoe Print", "Bradley Hand", Chilanka, TSCu_Comic, casual,
    cursive;
}

details > summary {
  list-style-type: none;
  cursor: zoom-in;
}

details[open] > summary {
  cursor: zoom-out;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "▶";
  color: var(--emerald);
  font-weight: bold;
  display: inline-block;
  width: 1ch;
  padding-right: 1ch;
}

details[open] > summary::before {
  content: "▼";
}

fieldset {
  border-radius: 0.5ch;
  border: 0.25ch solid var(--amethyst);
}

legend {
  font-weight: bold;
}

a {
  color: var(--amethyst);
  font-weight: bold;
  text-decoration: none;
  border-bottom: 0.125ch solid;
}

p {
  margin: 0;
  margin-bottom: 1ch;
  padding: 0;
}

h1 {
  color: var(--emerald);
  font-weight: 800;
}

h1 span,
.squiggle {
  position: relative;
  z-index: 9001;
}

h2 {
  font-weight: 400;
}

h3 {
  font-weight: 400;
}

ul {
  margin: 0;
  margin-bottom: 3.5ch;
  padding-left: 2ch;
}

ul ul {
  padding-left: 2.5ch;
}

li > a {
  font-weight: 400;

  & img {
    display: inline;
    margin: 0;
    height: 1.2ch;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  border-style: hidden;
}

th {
  font-weight: 400;
  text-align: right;
}

thead th {
  font-weight: 800;
  text-align: left;
}

th,
td {
  padding: 0.5ch 1.5ch;
  border: 1px solid;
}

td {
  font-family: "Segoe Print", "Bradley Hand", Chilanka, TSCu_Comic, casual,
    cursive;
}

.grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(calc(35ch - 1ch), 100%), 1fr)
  );
  gap: 1ch;
  margin-bottom: 2ch;
}

.grid > figure {
  margin: 0 0 1ch 0;
}

img {
  display: block;
  margin: 0 auto 1ch;
  max-width: 100%;
}

figure {
  margin: 3ch auto;
}

figure.left {
  clear: both;
  float: left;
  margin: 0 1.5ch;
  width: 50%;
}

@media (max-width: 800px) {
  figure.left {
    margin: 3ch auto;
    width: 100%;
  }
}

figure img {
  border: 1px solid;
}

figcaption {
  margin-top: 1ch;
  font-weight: bold;
}

dt {
  font-weight: bold;
}

footer {
  margin-top: 5ch;
  padding-top: 2.5ch;
  border-top: 0.5ch solid var(--coral);
  text-align: center;
}

.box {
  margin: 0.5ch;
  padding: 1ch;
  border-radius: 0.25ch;
  border: 1px solid var(--emerald);
  width: calc(100% - 3ch);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#footnotes {
  padding-top: 1ch;
  border-top: 1px dotted var(--coral);
}

.footnote-ref {
  vertical-align: super;
  font-size: 50%;
}

hr {
  border: none;
  border-top: 1px dotted var(--coral);
}
