body {
  --deco-h: 0;
  --deco-s: 58%;
  --deco-l: 28%;
  --deco-foreground: hsl(var(--deco-h), var(--deco-s), var(--deco-l));
  --deco-foreground-light:
          hsl(var(--deco-h), var(--deco-s), calc(var(--deco-l) + 8%));
  --border-secondary: #ddd;
  --background: #fbfbfb;
  --button-border-color: var(--deco-foreground);
  --button-color-active: var(--deco-foreground);
  margin: 0;
  font-family: sans-serif;
  background: var(--background);
}

a[target="_blank"]:after {
  content: "⇗";
  color: #887;
  font-size: smaller;
}

button {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  font-size: medium;
  border-radius: 4px;
  background-color: var(--button-bg);
  border-width: 2px;
  border-style: solid;
  border-color: var(--button-border-color);
  caret-color: transparent;
}

button:active {
  color: var(--button-color-active);
  outline-offset: -4px;
  outline-style: solid;
  outline-color: var(--button-color-active);
}

button:focus-visible {
  outline-width: 2px;
  outline-style: solid;
  outline-color: color-mix(in srgb, var(--background-item-marked), green 30%);
  outline-offset: -4px;
}

h1, h2 {
  font-weight: normal;
}

h1 {
  font-size: 180%;
  font-variant: small-caps;
}

key {
  color: blue;
  border: 1px solid gray;
  border-radius: 5px;
  padding: 1px 2px;
  font-size: smaller;
  background-color: #efeeef;
  white-space: nowrap;
}

code {
  /* https://stackoverflow.com/a/36540436/2954288 */
  font-family: monospace, monospace; 
  color: #262;
  font-size: 1.1em;
}

dt {
  margin-top: 1ex;
}

li {
  margin: 0.5ex 0;
}

a[href] {
  text-decoration: none;
}
a:visited[href] {
  color: var(--deco-foreground);
}

a:link[href] {
  color: var(--deco-foreground-light);
}

/* Mostly intended to be used by images. */
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.hidden {
  display: none;
}

.sitetoc-button {
  padding: 3px;
  width: 40px;
  height: 40px;
}

.offButton {
  position: absolute;
  right: 0;
  cursor: w-resize;
}

.onButton {
  cursor: e-resize;
}

.sitetoc-button div {
  width: 0;
  height: 0;
  border-bottom: 12px solid transparent;
  border-top: 12px solid transparent;
  margin: 0 auto;
}

.offButton div {
  border-right: 16px solid black;
}

.onButton div {
  border-left: 16px solid black;
}

.l1 {
  cursor: pointer;
}

.niceborder, .header, .article, .footer {
  border: solid var(--deco-foreground);
}

.header {
  position: relative;
  padding: 0.4ex 0;
  margin-bottom: 1ex;
  border-width: 0 0 2px 0;
}

.header h1 {
  margin: 0;
  text-align: center;
}
.header .about {
  font-size: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
}
.middle {
  display: flex;
  flex-direction: row;
  column-gap: 1ex;
  margin-bottom: 10em;
}

.sitetoc {
  position: relative; /** allow positioning of children **/
  margin: 0 3px;
  min-width: 10ch;
  max-width: 30ch;
}

.sitetoc h1 {
  margin-bottom: 0.2em;
}

.sitetoc .sitetoc {
  margin-left: 1ex;
}

.sitetoc div {
  word-wrap: anywhere;
}

.sitetoc a.l0::before {
  color: black;
  content: '•';
  margin-right: 2px;
}

.sitetoc a.l0 {
  display: block;
}

.directory {
  margin-top: 4px;
}

.footer {
  position: fixed;
  bottom: 0;
  width: calc(100% - 4px);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  border-width: 2px 0 0 0;
  background: var(--background);
}

.sitetoc:not(.hidden) + .article .onButton {
  display: none;
}

.article h1 {
  margin-bottom: 0.3em;
  margin-top: 0.3em;
}

.article {
  margin: 0 auto;
  border-width: 0;
  background: #fff;
  position: relative;
  max-width: 48em;
  padding: 0 5px 1em 5px;
  width: 0;
  flex-basis: 100%;
}

.article .date, .article .update {
  float: right;
  margin: 3px 0;
  border: 0;
  font-size: smaller;
  color: #444;
}

.article .update::before {
  content: 'updated: ';
}

.preview {
  cursor: pointer;
  position: relative;
  max-height: 20em;
  min-height: 4em;
  overflow: hidden;
}

.preview:not(:last-child) {
  border-bottom: 1px solid grey;
}

.preview[contentloaderror] {
  padding: 0.5em 0;
}

.preview:not([contentloaderror])::after {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 30%;
  width: 100%;
  content: "";
  background: linear-gradient(to top,
     rgba(255, 255, 255, 1) 20%,
     rgba(255, 255, 255, 0) 80%
  );
  pointer-events: none; /* so the text is still selectable */
}

.definition {
  margin: 1ex 0 1ex 2ex;
}

.definition::before {
  content: "Definition: ";
  font-style: italic;
}

/**
  Forces a scrollable area for formulas that are too wide. A crucial
  additional ingredient is that the flex item conainer (.article) has
  a width set to zero and a flex-basis for some useful width.
*/
mjx-container {
  overflow-x: auto;
  min-width: 0 !important;
}

.scrollable mjx-math[display] {
  padding: 5px !important;
  border: 1px solid #ddd;
}

/* Try to fix stupid scroll appearing
 * on many multi-line equations needlessly.
 */
mjx-container[jax="CHTML"][display="true"] {
  --comment: "Fix stupid scroll on multiline formulas with padding.";
  padding: 3px 0;
}

.scrollable {
  padding-bottom: 4px;
}

.zutaten div {
  display: flex;
  gap: 0.8ex;
  line-height: 1.5em;
}
.zutaten div span:first-child {
  width: 8em;
  text-align: right;
}

pre {
  /* https://stackoverflow.com/a/36540436/2954288 */
  font-family: monospace, monospace;
  padding: 4px 0 4px 2px;
  margin: 0;
  overflow-x: scroll;
}

/* special rule to override .hljs default rule */
pre[class*=lang-] {
  background: var(--background) !important;
}

.tootbutton {
  vertical-align: bottom;
  margin-top: 3px;
}

.tootbutton > svg {
  width: 20px;
  height: 20px;
  padding: 2px 2px 2px 0;
  vertical-align: middle;
}
