:root {
  color-scheme: light dark;
  font-size: 16px;
}

/* Light Mode */

:root {
  --bg-img: url("/common/stars5-inverted-still.png");
  --back: #fff;
  --fore: #222;
  --low: #eee;
  --contrast: #000;
  --internal: #060;
  --external: #229;
  --link-thickness: 2.5px;
}

/* Dark Mode */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-img: url("/common/stars5-still.png");
    --back: #000;
    --fore: #bbb;
    --low: #222;
    --contrast: #fff;
    --internal: #6d6;
    --external: #0cd;
    --link-thickness: auto;
  }
}

:target {
  outline: 2px dotted red;
}

html {
  background-image: var(--bg-img);
  background-repeat: repeat;
  background-attachment: fixed;
}

body {
  min-height: 100vh;
  max-width: 65ch;
  margin: auto;
  padding: 2ch;
  line-height: 1.4;
  background-color: var(--back);
  color: var(--fore);
}

header {
  text-align: center;

  h1 {
    font-family: serif;
    font-style: italic;

    a:any-link {
      color: var(--fore);
      text-decoration: none;
    }
  }
}

.warning {
  border: 2px solid red;
  border-radius: 1ch;
  padding: 1ch;
}

code {
  background-color: var(--low);
  color: var(--contrast);
  padding: 0.1ch 0.3ch;
  border-radius: 4px;
}

strong {
  color: var(--contrast);
}

li {
  margin: 1ch 0;
}

figure {
  text-align: center;

  img {
    background-color: white;
  }
}

img {
  width: 100%;
  height: auto;
}

.thumb {
  max-width: 120px;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

thead {
  border-bottom: 1px solid var(--low);
}

tbody tr {
  border-top: 1px solid var(--low);
}

th,
td {
  padding: 8px;
}

footer {
  margin: 6ch 0;
  border-top: 2px solid var(--fore);
  border-radius: 8px;
  padding: 0 1ch;
}

.badges :any-link:has(img) {
  text-decoration: none;
}

.badges img,
.badge {
  margin: 4px;
  width: 176px;
  max-width: 100%;
  image-rendering: pixelated;
}

:any-link {
  color: var(--internal);
  text-decoration-thickness: var(--link-thickness);

  &[href^="http://"],
  &[href^="https://"] {
    color: var(--external);
  }
}

#article-backlinks {
  font-variant: small-caps;
  text-decoration: double underline;
}

.term {
  display: inline-block;
}

/* Formatting Glossary */
dt {
  font-weight: bold;
  color: var(--contrast);
}
dd {
  margin: 0.5rem 1rem;
}

math {
  color: var(--contrast);
  font-size: 121%;
}
