@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;1,400&family=Literata:ital,wght@0,300;0,500;1,300;1,500&display=block');

:root {
  --font-ratio: 0.5844907407;
  --ideal-font-size: calc(66vw / (60 * var(--font-ratio)));
  --font-size: clamp(14px, var(--ideal-font-size), 18px);
  --ideal-col-width: calc(var(--font-size) * 60 * var(--font-ratio));
  --col-width: min(100vw - 4rem, var(--ideal-col-width));
  --gutter: calc((100vw - var(--col-width)) / 2);
}

html,
body {
  background: #f0f0f6;
  color: #202010;
  font-family: Literata, serif;
  font-kerning: normal;
  font-size: var(--font-size);
  font-weight: 300;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(1px + 100vh);
  margin: 0 2em;
}

h1 {
  font-size: 150%;
}

h2 {
  font-size: 120%;
}

h3,
h4,
h5 {
  font-size: 100%;
}

h1,
h2,
h3 {
  padding-top: 1.7em;
  margin: 0 0 0.85em;
}

h4,
h5 {
  padding-top: 1em;
  margin: 0 0 0.85em;
}

h1,
h2,
h3,
h4,
h5,
th,
strong {
  font-weight: 500;
}

body > * {
  margin: 2rem 0 2rem;
  max-width: var(--col-width);
  width: 100%;
}

footer {
  margin-block-start: auto;
}

pre,
code {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
}

pre[data-code-block] {
  background: #00000008;
  font-size: max(12px, 80%);
  line-height: 1.4;
  width: fit-content;
  min-width: 60%;
  max-width: min(100ch, 100vw - 5rem);
  padding: 0.5rem;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
  overflow: auto;
}

pre[data-code-block][data-lang*="sh"] span[data-line]:before {
  content: '❯ ';
  color: #40102030;
  user-select: none;
}

:not(pre) > code {
  color: #802040;
  background: #80204008;
  padding: 0 0.1em;
  margin: 0 -0.1em;
  border-radius: 0.4em;
}

a > code {
  color: #204080;
  background: #20408008;
}

a {
  color: #0864a7;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a[data-anchor] {
  color: inherit;
}

hr {
  margin: 2rem 4rem;
  border: none;
  border-bottom: solid 2px #00000011;
}

img {
  max-width: 100%;
  margin: 0 auto;
}

figure {
  box-sizing: border-box;
  max-width: 100%;
  margin: 1em auto;
  padding: 0 1em;
}

figcaption {
  text-align: center;
}

ol,
ul {
  padding-inline-start: 2em;
  margin: 1em 0;
}

ul > li::marker {
  font-size: 70%;
}

li[data-checked] {
  list-style: none;
  position: relative;
}

li[data-checked] > input[type='checkbox'] {
  position: absolute;
  height: 1.8em;
  vertical-align: middle;
  top: 0;
  left: -2.1em;
}

li > p {
  margin: 0.5em 0;
}

li > ol,
li > ul {
  margin: 0;
}

blockquote {
  margin: 1em 0;
  border-inline-start: solid 2px #00000011;
  padding: 0 1em;
}

table {
  border-collapse: collapse;
  margin: 0 auto;
}

.table-wrapper {
  width: fit-content;
  max-width: 100vw;
  min-width: calc(100% + 2rem + var(--gutter));
  -webkit-overflow-scrolling: touch;
  overflow: auto;
  margin: 0 -2rem 0 calc(-1 * var(--gutter));
  padding: 0 2rem 0 var(--gutter);
  box-sizing: border-box;
}

th,
td {
  border: solid 1px #dddddd;
  padding: 0.25em 0.75em;
}

th {
  background: #00000008;
}

td {
  background: #ffffff28;
}

a[data-footnote-ref] {
  font-variant: tabular-nums;
  font-feature-settings: 'tnum';
  line-height: 0;
}

a[data-footnote-ref] sup {
  font-size: 65%;
}

a[data-footnote-ref] sup:before {
  content: '[';
}

a[data-footnote-ref] sup:after {
  content: ']';
}

a[data-footnote-ref]:target {
  animation: 2s highlight;
}

section[data-footnotes] {
  font-size: max(12px, 80%);
  margin-block-start: 3rem;
}

section[data-footnotes] ol {
  margin: 0;
  max-width: fit-content;
  padding-inline-start: 1.5em;
}

section[data-footnotes] li {
  margin: 1em 0;
}

section[data-footnotes] li:target {
  animation: 2s highlight;
}

section[data-footnotes] li > p {
  display: inline;
}

@keyframes highlight {
  50% {
    background: rgb(255, 255, 0, 1);
  }

  to {
    background: transparent;
  }
}

/* Page specific */
header img {
  height: 1.15em;
  position: absolute;
  top: 2em;
}

@media (min-width: 1100px) {
  header img {
    position: fixed;
    left: 2em;
  }
}

.entrylog {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.timestamp {
  margin: 0;
  opacity: 0.4;
  font-size: max(12px, 80%);
  margin-inline-start: 1rem;
}

@media (max-width: 530px) {
  .timestamp .p3 {
    display: none;
  }
}

@media (max-width: 460px) {
  .timestamp .p2 {
    display: none;
  }
}

@media (max-width: 420px) {
  .timestamp .p1 {
    display: none;
  }
}

h1:first-child span:before {
  content: '/';
  color: #00000044;
}

.linkedlist {
  display: flex;
  margin: 1em -1.18em 2em;
  flex-wrap: wrap-reverse;
}

.linkedlist > .prev {
  margin-top: 1em;
  margin-right: 1.18em;
}

.linkedlist > .next {
  margin-top: 1em;
  margin-left: auto;
  text-align: right;
}

.linkedlist > .prev:before {
  content: '← ';
}

.linkedlist > .next:after {
  content: ' →';
}

.license {
  font-size: max(12px, 80%);
  line-height: 2;
  text-align: center;
  margin-block-start: 2rem;
}

.license img {
  height: 1em;
  margin: -0.25em 0 0 0.25em;
  opacity: 0.65;
  vertical-align: middle;
}

/* component specific */

.yt-player {
  margin: 1rem 0;
  position: relative;
  padding-top: calc(100% / var(--aspectRatio, calc(16 / 9)));
  width: 100%;
}

.yt-player iframe {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
}
