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

:root {
  --body-color: hsl(0, 5%, 10%);
  --body-bg-color: hsl(210, 20%, 98%);
  --link-visited: hsl(0, 100%, 33%);
  --link-focus-outline: hsl(220, 90%, 52%);
  --pre-bg-color: hsl(210, 28%, 93%);
  --kbd-bg-color: hsl(210, 5%, 100%);
  --kbd-border-color: hsl(210, 5%, 70%);
  --table-border-color: black;
  --border-width-thin: 1.36px;
  --border-width-thick: 2.27px;
  --sidenote-target-border-color: hsl(55, 55%, 70%);
  --footnotes-border-color: hsl(0, 0%, 39%);
}

@media (prefers-color-scheme: dark) {
   .dark-auto {
    --body-color: hsl(0, 0%, 86%);
    --body-bg-color: hsl(0, 0%, 16%);
    --link-visited: hsl(196 80% 77%);
    --link-focus-outline: hsl(215, 63%, 73%);
    --pre-bg-color: hsl(0, 1%, 25%);
    --kbd-bg-color: hsl(0, 0%, 16%);
    --kbd-border-color: hsl(210, 5%, 70%);
    --table-border-color: white;
    --sidenote-target-border-color: hsl(0, 0%, 59%);
    --footnotes-border-color: hsl(0, 0%, 59%);
    --proof-symbol-filter: invert(80%);
  }
}

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
ul[class],
ol[class],
li,
figure,
figcaption,
dl,
dd {
  margin: 0;
}

/* Make default font-size 1rem and add smooth scrolling to anchors */
html {
  font-size: 1rem;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: Georgia, Cambria, 'Times New Roman', Times, serif;
  line-height: 1.6;

  max-width: 120ch;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0 auto;
  padding: 2rem 1.25rem;

  color: var(--body-color);
  background-color: var(--body-bg-color);

  text-rendering: optimizeLegibility;
}

/* Justify all paragraphs */
p {
  text-align: justify;
  margin-top: 1rem;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make links red */
a,
a:visited {
  color: var(--link-visited);
}

a:focus {
  outline-offset: 2px;
  outline: 2px solid var(--link-focus-outline);
}

article > * + * {
  margin-top: 1em;
}

/* Center align the title */
h1:first-child {
  text-align: center;
}

/* Center align author name, use small caps and add vertical spacing  */
.author {
  margin: 0.85rem 0;
  font-variant-caps: small-caps;
  text-align: center;
}

/* Heading typography */
h1 {
  font-size: 2.5rem;
  line-height: 3.25rem;
  margin-bottom: 1.625rem;
}

h2 {
  font-size: 1.7rem;
  line-height: 2rem;
  margin-top: 3rem;
}

h3 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
}

h4 {
  font-size: 1.2rem;
  margin-top: 2rem;
}

h5 {
  font-size: 1rem;
  margin-top: 1.8rem;
}

h6 {
  font-size: 1rem;
  font-style: italic;
  font-weight: normal;
  margin-top: 2.5rem;
}

h3,
h4,
h5,
h6 {
  line-height: 1.625rem;
}

h1 + h2 {
  margin-top: 1.625rem;
}

h2 + h3,
h3 + h4,
h4 + h5 {
  margin-top: 0.8rem;
}

h5 + h6 {
  margin-top: -0.8rem;
}

h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.8rem;
}
