* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

:root {
  --spacing-unit: 0.25rem;
  --footer-border: hsl(0 0 40%);

  --foreground: hsl(230deg 20% 5%);
  --background: hsl(49deg 20% 97%);

  --link: hsl(from var(--foreground) h 80% 40%);
  --visited: hsl(from var(--foreground) h 70% 20%);
  --link-hover: hsl(205deg 90% 30%);
  --link-active: hsl(0deg 90% 40%);

  --transition-short: 0.3s;
  --transition-medium: 0.6s;

  --scale: 1.5;
  --size-base: 1rem;
  --size-s-1: calc(var(--size-base) / var(--scale));
  --size-l-1: calc(var(--size-base) * var(--scale));
  --size-l-2: calc(var(--size-l-1) * var(--scale));
  --size-l-3: calc(var(--size-l-2) * var(--scale));
}

html {
  color: var(--foreground);
  background: var(--background);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
}

@media (min-width: 1000px) {
  html {
    font-size: 120%;
  }
}

body {
  margin: 0 auto;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  min-height: 100svh;
  line-height: 1.6;
  padding: calc(var(--spacing-unit) * 2);
}

/* The problem with implementing dark mode is that every experiment
   needs to remember to support it or undo it, so I just don’t
   implement it. */
/* @media (prefers-color-scheme: dark) { */
/*   html { */
/*     color: var(--background); */
/*     background: var(--foreground); */
/*   } */
/* } */

body > main {
  margin-bottom: 1em;
  max-width: 45em;
}

footer {
  margin-top: auto;
  text-align: right;
  margin-left: auto;
  padding: calc(var(--spacing-unit) * 2);
  border-top: 1px var(--footer-border) solid;
  width: 100%;
}

.htmx-indicator {
  display: none;
  transition: display var(--transition-short) ease-out allow-discrete;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}

.source-listing {
  padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 4);
  border: 1px solid;
  margin: 2lh 0;
  transition: border-width var(--transition-short);
}

.source-listing:open {
  border-width: 0.1em;
}

.source-listing > summary {
  cursor: pointer;
  max-width: max-content;
  margin: 0 auto;
  font-size: var(--size-l-1);
  font-weight: bold;
}

.source-listing:open > summary {
  margin-bottom: 1lh;
}

.source-listing > div > pre {
  white-space: pre-wrap;
}

main {
  margin-left: auto;
  margin-right: auto;
}

h1 {
  font-size: var(--size-l-2);
  text-align: center;
}

.toc {
  font-size: var(--size-l-1);
  padding: 0 1em 0 2em;
}

:link,
:visited {
  text-underline-offset: 0.15em;
  transition: text-decoration-thickness var(--transition-short) ease-out,
    color var(--transition-short) ease-out;
}

:is(:link, :visited):is(:hover, :focus-within) {
  text-decoration-thickness: 0.1em;
  color: var(--link-hover);
}

:is(:link, :visited):active {
  color: var(--link-active);
}

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

:visited {
  color: var(--visited);
}

abbr {
  font-feature-settings: "c2sc";
}
