:root {
  --bg: #aaa;
  --text: #111;
  --muted: #111;
  --accent: #ddd;
  /* --link: #1a4f8a; */
  --link: #123012;
  --border: #888;
  --code-bg: #bbb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --text: #aaa;
    --muted: #aaa;
    --accent: #ddd;
    --border: #2a2a2a;
    /* --link: #7ab3e8; */
    --link: #7a9c6c;
    --code-bg: #1a1a1a;
  }
}

[data-theme="light"] {
  --bg: #aaa;
  --text: #111;
  --muted: #111;
  --accent: #ddd;
  --link: #123012;
  --border: #888;
  --code-bg: #bbb;
}

[data-theme="dark"] {
  --bg: #111;
  --text: #aaa;
  --muted: #aaa;
  --accent: #ddd;
  --border: #2a2a2a;
  --link: #7a9c6c;
  --code-bg: #1a1a1a;
}

@font-face {
  font-family: "CommitMono";
  src: url("CommitMono VariableFont.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
}

body {
  font-family: "CommitMono", monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  max-width: 66ch;
  margin: 0;
  padding: clamp(1rem, 4vw, 1.5rem) clamp(1rem, 4vw, 1.5rem);
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss03", "ss04", "ss05";
}

h1 {
  font-size: 1.5rem;
  font-weight: 400;
}

h2 {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

p {
  font-size: 0.75rem;
  line-height: 1rem;
}

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

img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  /* outline: 1px solid var(--border); */
  /* outline-offset: 4px; */
}

button {
  font: inherit;
}

ul {
  list-style-type: none;
  padding-left: 0;
}

ul li {
  font-size: 0.75rem;
  line-height: 1rem;
  margin-left: 2ch;
  max-width: 54ch;
  width: fit-content;
}

ul li::before {
  content: "• ";
  position: absolute;
  margin-left: -2ch;
}

header {
  margin-bottom: 2.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

section+section {
  margin-top: 2rem;
}

section h2 {
  text-transform: uppercase;
}

footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  color: var(--muted);
}

.links {
  font-size: 0.75rem;
  line-height: 1.33;
}

.links a {
  color: var(--link);
}

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.theme-toggle[hidden] {
  display: flex;
}

.image-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.image-button img {
  display: block;
}

.image-dialog {
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100vw - 3rem);
  max-height: calc(100dvh - 3rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.image-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.image-dialog img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--border);
}

.dialog-close {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .image-button {
    cursor: default;
  }

  .image-dialog {
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .dialog-close {
    top: 0.5rem;
    right: 0.5rem;
    transform: none;
  }
}
