:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #555555;
  --rule: #000000;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #e8e8e8;
  --muted: #9a9a9a;
  --rule: #e8e8e8;
}

[data-theme="rainbow"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #ffe066;
  --rule: #ffffff;
}

img {
  max-width: calc(100% - 2rem);
  display: block;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
  margin: 1rem 1rem;
}

img:hover {
  filter: grayscale(0%);
}

table {
  margin-left: 3ch;
  margin-right: 3ch;
  margin-bottom: 1rem;
}

td {
  padding-right: 1rem;
}

html, body {
  min-height: 100%;
}

html, body {
  background-color: var(--bg);
  color: var(--fg);
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
}

html[data-theme="rainbow"] {
  min-height: 100%;
  background:
    linear-gradient(120deg, rgba(255, 77, 109, 0.9), rgba(255, 179, 71, 0.9), rgba(124, 224, 255, 0.9), rgba(125, 255, 138, 0.9), rgba(179, 136, 255, 0.9), rgba(255, 77, 109, 0.9));
  background-size: 400% 400%;
  animation: rainbowShift 6s ease infinite;
}

html[data-theme="rainbow"] body {
  background: transparent;
}

@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body {
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  line-height: 1.4;
  margin: 2rem auto;
  max-width: 72ch;
  text-align: left;
}

a {
  color: var(--fg);
}

a:hover {
  color: var(--muted);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2rem;
  font-size: 0.95em;
}

.links a {
  margin-right: 0.5rem;
  text-decoration: none;
}

.links a:hover {
  text-decoration: underline;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--muted);
  text-decoration: underline;
}

.post-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3rem;
  white-space: nowrap;
}

.post-header .right {
  text-align: right;
}

h1 {
  font-size: 1em;
  font-weight: normal;
  text-align: center;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  margin-bottom: 3rem;
}

h2 {
  font-size: 1em;
  font-weight: normal;
  text-align: center;
  margin-bottom: 3rem;
}

p {
  margin-left: 3ch;
  margin-right: 3ch;
  margin-bottom: 1rem;
  text-align: justify;
}

ul, ol {
  margin-left: 3ch;
  margin-bottom: 1.5rem;
  padding-left: 2ch;
}

li {
  margin-bottom: 0.5rem;
}

code {
  font-family: inherit;
}

pre {
  margin-left: 3ch;
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
}

dl {
  margin-left: 3ch;
  margin-bottom: 2rem;
}

dt {
  margin-top: 1rem;
  font-weight: 600;
}

dd {
  margin-left: 0;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  text-align: justify;
}

blockquote {
  margin: 0.5rem 0 1.5rem 0;
  padding: 0.5rem 1rem;
}

.post-list {
  list-style: none;
  padding-left: 0;
  margin-left: 3ch;
}

.post-list li {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.post-list-subtitle {
  color: var(--muted);
}

.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95em;
}

@media (max-width: 600px) {
  body {
    margin: 1rem;
    font-size: 14px;
  }

  .site-header,
  .post-header {
    flex-direction: column;
    margin-bottom: 2rem;
  }

  .post-header .right {
    text-align: left;
    margin-top: 1rem;
  }

  p, ul, ol, dl, pre, .post-list {
    margin-left: 0;
    text-align: left;
  }

  dd {
    margin-left: 1ch;
  }
}
