:root {
  --theme-color-background: #ffffff;
  --theme-color-dark-background: #0b0b0b;
  --theme-color-dark-code-background: #151515;
  --theme-color-dark-code-border: #2a2a2a;
  --theme-color-dark-foreground: #e0e0e0;
  --theme-color-dark-header-background: #111111;
  --theme-color-dark-header-foreground: #a8a8a8;
  --theme-color-dark-header-link: #f2f2f2;
  --theme-color-dark-link: #f0f0f0;
  --theme-color-dark-link-hover-background: #242424;
  --theme-color-dark-menu-background: #171717;
  --theme-color-dark-menu-border-bottom: #2a2a2a;
  --theme-color-dark-menu-foreground: #e8e8e8;
  --theme-color-dark-menu-border-top: #222222;
  --theme-color-dark-menu-hover-background: #242424;
  --theme-color-dark-nav-border: #2a2a2a;
  --theme-color-dark-nav-hover-background: #242424;
  --theme-color-dark-table-border: #333333;
  --theme-color-foreground: #111111;
  --theme-color-header-background: #f5f5f5;
  --theme-color-header-foreground: #444444;
  --theme-color-header-link: #111111;
  --theme-color-link: #0000cc;
  --theme-color-link-hover-background: #eeeeee;
  --theme-color-menu-background: #eeeeee;
  --theme-color-menu-border-bottom: #bbbbbb;
  --theme-color-menu-border-top: #cccccc;
  --theme-color-menu-foreground: #111111;
  --theme-color-menu-hover-background: #dddddd;
  --theme-color-nav-border: #c8c8c8;
  --theme-color-nav-hover-background: #eeeeee;
  --theme-color-table-border: #000000;
}

html {
  overflow-y: scroll;
}

body {
  background-color: var(--theme-color-background, #fff);
  color: var(--theme-color-foreground, #000);
  font-family: sans-serif;
  margin: 0;
  padding: 0;
}

a {
  color: var(--theme-color-link, #005386);
}

a:hover,
a:focus-visible {
  background-color: var(--theme-color-link-hover-background, #eeeeee);
}

blockquote,
pre {
  overflow-x: auto;
}

blockquote {
  border-left: 1px dotted var(--theme-color-nav-border, #ccc);
  margin: 1em 0;
  padding: 0.1em 0 0.1em 1em;
}

blockquote p {
  margin: 0;
}

pre,
code {
  font-family: monospace;
  margin: 0;
}

pre {
  overflow-x: auto;
  padding: 0.75em 1em;
  white-space: pre;
}

pre code {
  font: inherit;
}

figure {
  margin: 1em 0;
}

figcaption {
  color: var(--theme-color-header-foreground, #555);
  font-size: 0.9em;
  margin-top: 0.4em;
}

audio,
img,
video {
  height: auto;
  max-width: 100%;
}

table {
  border: 1px solid var(--theme-color-table-border, #000);
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
}

th,
td {
  border: 1px solid var(--theme-color-table-border, #000);
  padding: 0.35em 0.55em;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: bold;
}

details {
  margin: 1em 0;
}

summary {
  cursor: pointer;
}

h1 {
  font-size: 1.4em;
  margin: 1em 1ex 0.5ex 0;
}

h2 {
  font-size: 1.3em;
  margin: 1em 1ex 0.5ex 0;
}

h3 {
  font-size: 1em;
  margin: 1em 1ex 0.5ex 0;
}

h4 {
  font-size: 0.9em;
  margin: 1em 1ex 0.5ex 0;
}

#header a,
#menu a,
#footer a {
  text-decoration: none;
}

#menu {
  background-color: var(--theme-color-menu-background, #17a);
  border-bottom: 1px solid var(--theme-color-menu-border-bottom, #069);
  border-top: 1px solid var(--theme-color-menu-border-top, #ccc);
  clear: both;
  color: var(--theme-color-menu-border-bottom, #069);
  overflow: hidden;
  padding: 0.7ex;
}

#menu a {
  color: var(--theme-color-menu-foreground, #fff);
  padding: 0.5ex 1ex;
}

#menu a:hover,
#menu a:focus-visible {
  background-color: var(--theme-color-menu-hover-background, #069);
}

#header {
  background-color: var(--theme-color-header-background, #eee);
  clear: both;
  color: var(--theme-color-header-foreground, #555);
  font-size: 1.78em;
  padding: 0.7ex 0.7ex 0.7ex 0.7em;
}

#headerLink {
  color: var(--theme-color-header-link, #17a);
  margin-left: 5px;
}

#headerSubtitle {
  font-size: 0.75em;
  font-style: italic;
  margin-left: 1em;
}

#main,
#footer {
  box-sizing: border-box;
  max-width: 75ch;
  margin: 0;
  padding: 1.5em 1.5em 1.5em 2em;
  line-height: 1.5;
}

#footer {
  color: var(--theme-color-header-foreground, #555);
  margin: 0;
  padding: 0 1.5em 1.5em;
}

#logo img {
  display: inline;
  filter: none;
  height: auto;
  max-width: none;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--theme-color-dark-background, #0b0b0b);
    color: var(--theme-color-dark-foreground, #e0e0e0);
  }

  a {
    color: var(--theme-color-dark-link, #f0f0f0);
  }

  a:hover,
  a:focus-visible {
    background-color: var(--theme-color-dark-link-hover-background, #242424);
  }

  blockquote {
    background: var(--theme-color-dark-code-background, #151515);
    border-left-color: var(--theme-color-dark-nav-border, #2a2a2a);
  }

  pre {
    background: var(--theme-color-dark-code-background, #151515);
  }

  table,
  th,
  td {
    border-color: var(--theme-color-dark-table-border, #333333);
  }

  #menu {
    background-color: var(--theme-color-dark-menu-background, #171717);
    border-bottom: 1px solid var(--theme-color-dark-menu-border-bottom, #2a2a2a);
    border-top: 1px solid var(--theme-color-dark-menu-border-top, #222222);
    color: var(--theme-color-dark-menu-foreground, #e8e8e8);
  }

  #menu a {
    color: var(--theme-color-dark-menu-foreground, #e8e8e8);
  }

  #menu a:hover,
  #menu a:focus-visible {
    background-color: var(--theme-color-dark-menu-hover-background, #242424);
  }

  #header {
    background-color: var(--theme-color-dark-header-background, #111111);
    color: var(--theme-color-dark-header-foreground, #a8a8a8);
  }

  #headerLink {
    color: var(--theme-color-dark-header-link, #f2f2f2);
  }

  #headerSubtitle,
  #footer,
  figcaption {
    color: var(--theme-color-dark-header-foreground, #a8a8a8);
  }

  #logo img {
    filter: invert(1) brightness(0.9);
  }
}

@media (max-width: 700px) {
  #header {
    font-size: 1.2em;
    line-height: 1.15;
    padding: 0.4em 0.7em 0.35em;
  }

  #headerSubtitle {
    font-size: 0.66em;
    line-height: 1.2;
    margin-left: 0;
    margin-top: 0.14em;
  }

  #menu {
    line-height: 1.4;
    padding: 0.28em 0.7em;
  }

  #menu a {
    display: inline-block;
    font-size: 0.92em;
    padding: 0.08em 0.55em 0.08em 0;
  }

  #main {
    margin: 0;
    max-width: none;
    font-size: 0.98em;
    line-height: 1.42;
    padding: 0.9em 0.9em 1em;
  }

  #main p {
    margin: 0 0 0.85em;
  }

  #footer {
    padding: 0 0.9em 1em;
  }
}

@media (max-width: 420px) {
  #header {
    font-size: 1.08em;
    padding: 0.34em 0.65em 0.3em;
  }

  #headerSubtitle {
    font-size: 0.64em;
    line-height: 1.18;
  }

  #menu {
    line-height: 1.3;
    padding: 0.24em 0.65em;
  }

  #menu a {
    font-size: 0.9em;
    margin-right: 0.2em;
    padding-right: 0.38em;
  }

  #main {
    font-size: 0.95em;
    line-height: 1.38;
    padding: 0.8em 0.8em 0.9em;
  }

  #footer {
    padding: 0 0.8em 0.9em;
  }
}
