/* The main css for the site.  This is a mix of styling from
   Latex.css by Vincent Doerig, and Writ.css by Curtis McEnroe */
/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --body-color: black;
  --body-bg-color: hsl(210, 20%, 98%);
  --link-visited: hsl(240, 100%, 47%);
  --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;
  --sidenote-target-border-color: hsl(55, 55%, 70%);
  --footnotes-border-color: hsl(0, 0%, 39%);
  --text-indent-size: 1.463rem; /* In 12pt [Latin Modern font] LaTeX article
  \parindent =~ 17.625pt; taking also into account the ratio
  1pt[LaTeX] = (72 / 72.27) * 1pt[HTML], with default 12pt/1rem LaTeX.css font
  size, the identation value in rem CSS units is:
  \parindent =~ 17.625 * (72 / 72.27) / 12 = 1.463rem. */
}

.latex-dark {
  --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%);
}

@media (prefers-color-scheme: dark) {
   .latex-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%);
  }
}

/* CSS reset */
body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
figcaption,
dl,
dd {
  margin: 0;
  padding: 0;
}

/* Add smooth scrolling to anchors */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Set font defaults and body width */
body {
  font-family: Palatino, Georgia, Lucida Bright, Book Antiqua, serif;
  font-size: 1rem;
  line-height: 1.5;

  overflow-x: hidden;
  max-width: 90ch;
  margin: 0 auto;
  position: relative;

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

  text-rendering: optimizeLegibility;
}

main {
  margin-left: 1em;
  margin-right: 1em;
  margin-bottom: 3em;
}

/* Vertical Spacing */

h1, h2, h3, h4, h5, h6 { margin: 1rem 0.5rem 0 0.5rem; }

p, ul, ol, dl, table, blockquote, pre { margin: 0.5em 0 0; }

ul ul, ol ol, ul ol, ol ul { margin-top: 0; }

/* With p margin, like a skipped line */
hr { margin: 1.5em 0 0; }

/* Font sizes */

h1, h2, h3, h4, h5, h6 { font-weight: normal; }

/* Minor third */
/* h1 { font-size: 2.488em; } // shifted */
h1 { font-size: 2.074em; }
h2 { font-size: 1.728em; }
h3 { font-size: 1.44em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1em; }
h6 { font-size: 1em; }

small { font-size: 0.833em; }

/* Lists */
ul, ol, dd { padding: 0 0 0 3ch; }

/* Links */
a {
  text-decoration: none;
}

a,
a:visited {
  color: var(--link-visited);
}

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

/* Make images easier to work with */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Prevent textarea from overflowing */
textarea {
  width: 100%;
}

.center > * {
  margin-left: auto;
  margin-right: auto;
}
