:root {
  --background-colour: #fcfcfc;
  --blue-4: #1c71d8;
  --dark-1: #77767b;
  --dark-3: #504e55;
  --dark-4: #3d3846;
  --light-4: #deddda;
}

body {
  margin: 1em auto;
  line-height: 1.5;
  padding: 0.125em 1em;
  background-color: var(--background-colour);
  color: var(--dark-3);
}

@media (max-width:600px) {
  body {
    padding: 0 1em;
  }
}

a {
  text-decoration: none;
  color: var(--blue-4);
}

a:hover {
  text-decoration: underline;
}

code {
  color: var(--dark-4);
  background-color: var(--light-4);
}

blockquote {
  padding-left: 1em;
  margin-left: 0.5em;
  line-height: 1.9em;
  border-left: 8px solid var(--light-4);
}

pre {
  background-color: var(--light-4);
  padding: 0.5em 0.8em;
  border-radius: 0.25em;
  overflow-x: auto;
}

pre:hover, pre:focus {
  width: min-content;
}

p code, div code, li code {
  padding: 0.2em;
  border-radius: 0.25em;
}

blockquote p {
  font-style: italic;
  color: var(--dark-4);
}

ul.contains-task-list {
  list-style-type: none;
  padding-inline-start: 0px;
}

ul.contains-task-list > li > ul > li {
  padding-left: 30px;
}

li.task-list-item {
  margin-bottom: 0.3em;
}

li input[type="checkbox"] {
  margin-right: 0.5em;
}

/* Selectors are: Any text immediately within the div, elements within the div (codespan, link), the checkbox itself */
li:has(> input[type="checkbox"]:checked) > div, li:has(> input[type="checkbox"]:checked) > div *, li > input[type="checkbox"]:checked {
  color: var(--dark-1);
  text-decoration: line-through;
}

li:has(> input[type="checkbox"]:checked) > div > a {
  text-decoration: line-through underline;
}

input[type="checkbox"] {
  appearance: none;
  margin: 0;
  font: inherit;
  color: currentColor;
  width: 1.25em;
  height: 1.25em;
  border: 0.15em solid currentColor;
  border-radius: 0.3em;
  transform: translateY(0.075em);
  display: inline-grid;
  place-content: center;
}

input[type="checkbox"]::before {
  content: "";
  width: 0.8em;
  height: 0.8em;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em var(--background-colour);
  transform-origin: bottom left;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
  background-color: currentColor;
}

input[type="checkbox"]:checked::before {
  transform: rotate(12deg) scale(1) translateY(-0.1em) translateX(-0.1em)
}

table {
  width: calc(100% - 50px);
  table-layout: auto;
  margin-top: 2em;
  margin-bottom: 2em;
  border-radius: 0.25em;
  border-collapse: collapse;
  border-style: hidden;
  box-shadow: 0 0 0 1px var(--light-4);
}

table td, table th {
  padding: 0.35em 0.5em;
  text-align: left;
  border: 1px solid var(--light-4);
}

table th {
  font-weight: bold;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-colour: #1e1e1e;
    --blue-2: #62a0ea;
    --dark-2: #5e5c64;
    --dark-4-mono: #464646;
    --light-3: #f6f5f4;
    --light-5: #c0bfbc;
  }

  body {
    color: var(--light-5);
  }

  code {
    color: var(--light-3);
    background-color: var(--dark-4-mono);
  }

  pre {
    background-color: var(--dark-4-mono);
  }

  blockquote {
    border-left: 8px solid var(--dark-2);
  }

  blockquote p {
    color: var(--light-3);
  }

  a {
    color: var(--blue-2);
  }

  table {
    box-shadow: 0 0 0 1px var(--dark-4-mono);
  }

  table td, table th {
    border: 1px solid var(--dark-4-mono);
  }
}
