@import url("fonts.css");

* {
  box-sizing: border-box;
}

:root {
  --body: Charter, serif;
  --code: "Source Code", monospace;
  --head: Inter, sans-serif;

  color-scheme: dark light;
  font: 18px var(--body);
  line-height: 1.3;
  overflow-wrap: break-word;
}

blockquote, details {
  border-inline-start: 0.2em solid;
  margin-inline: 0;
  padding-inline-start: 1.3em;
}

body {
  margin: auto;
  max-width: 90ch;
  padding: 1em;
}

canvas {
  width: 100%;
}

code {
  overflow-wrap: anywhere;
  line-height: 1em;
}

code, pre {
  font-family: var(--code);
}

footer {
  border-top: 1px dotted;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--head);
  overflow-wrap: break-word;
}

h1 { font-size: 3.052rem; }
h2 { font-size: 2.441rem; }
h3 { font-size: 1.953rem; }
h4 { font-size: 1.563rem; }
h5 { font-size: 1.250rem; }
h6 { font-size: 1.000rem; }

hr {
  border: none;
  border-bottom: 1px solid;
  margin: 2em auto;
  max-width: 50ch;
}

button, input, textarea {
  font-family: var(--body);
  font-size: inherit;
}

menu {
  list-style-type: none;
  column-gap: 1em;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
}

nav time {
  font-variant-numeric: tabular-nums;
  font-weight: 200;
}

pre {
  border: 1px dotted;
  border-radius: 3px;
  overflow: auto;
  padding: 1em;
  position: relative;
}

pre ins, pre del {
  display: inline-block;
  position: relative;
  text-decoration: none;
  width: 100%;
}

pre s {
  text-decoration: underline wavy red;
}

pre del { background-color: #ffb8d1; }
pre ins { background-color: #a9fdac; }

pre ins::before, pre del::before {
  left: -0.85em;
  position: absolute;
}

pre del::before { content: "-"; }
pre ins::before { content: "+"; }

pre .lang {
  font: 0.75em var(--body);
  position: absolute;
  right: 0.5em;
  top: 0.5em;
  user-select: none;
}

/* Tables and such */

div:has(> table) {
  overflow-x: auto;
  width: 100%;
}

table {
  border-collapse: collapse;
}

:is(td, th):not(:last-child) {
  border-right: 1px dotted;
}

thead tr, tbody tr:not(:last-child) {
  border-bottom: 1px dotted;
}

td input {
  border: none;
  width: 7em;
}

.two {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr 1fr;
  margin: 0 -80px;
}

@media (max-width: 140ch) {
  .two {
    display: block;
    margin: 0;
  }
}

/* Floating sidenotes ------------------------------------------------------- */

/* 160ch > 90ch + 35% + 1.5em */
/* Only float them to the left when the screen is big enough */
@media (min-width: 160ch) {
  .note, aside {
    clear: left;
    float: left;
    margin-left: calc(-35% - 1.5em);
    width: 35%;
  }
}

/* For smaller devices, keep them as inline block elements */
@media (max-width: 160ch) {
  .note {
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
}

.note, aside {
  border-right: 0.2em solid;
  display: block;
  font-size: 0.8em;
  padding-right: 1.3em;
  text-align: right;
}

