* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;  
  
  --text-color: #111;
  --text-color-light: #7a7a7a;
  --text-color-pale: #ddddda;
  --back-color: #fff;
  --link-color: #d83c00; 
}

@media only screen and (prefers-color-scheme: dark) {
  * {
    --text-color: #eeeeea;
    --text-color-light: #acacaa;
    --text-color-pale: #000;
    --back-color: #1c1c1a;
    --link-color: gold; 
  }
}

body {
  font: 18.5px / 1.5 system-ui, "Segoe UI", sans-serif;
  color: var(--text-color);
  background: var(--back-color);
  padding: 5vw 4vw;
}

body > * {
  max-width: 34em; /* column width */
  margin:0 auto;
}

/* Show & hide sections */

section, section:target ~ section:last-of-type {
  display: none;
  padding: 0;
}

section:target, section:last-of-type {
  display: block;
  scroll-margin-top: 100vh;
}

/* tabindex="0" */

section:focus {
  outline: 0;
}

/* Vertical spacing */

section * + * {
  margin-top: .9em;
}

/* Main */

main {
  padding-top: 1.8em;
  padding-bottom: 2.1em;
}

/* Footer */

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  color: var(--text-color-light);
}


/* Table of contents */

ul.toc {
  overflow: hidden;
}

ul.toc * + * {
  margin: 0;
}

ul.toc li {
  color: var(--text-color-light);
  position: relative;
  display: flex;
  align-items: flex-end;
  margin: 0;
}

ul.toc li + li {
  margin: .25em 0 0 0;
}

ul.toc li a {
  color: var(--text-color);
  flex: 1;
}

ul.toc li a span {
  background: var(--back-color);
  padding-inline-end: .3em;
}

ul.toc li time {
  order: 1;
  white-space:nowrap;
  z-index: 1;
  padding-inline-start:.3em;
  background: var(--back-color);
}

ul.toc li a:after {
  width: 100%;
  font-size: .55em;
  position: absolute;
  bottom: .4em;
  white-space: nowrap;
  content:
  ' . . . . . . . . . . . . . . . . . . . . . .'
  ' . . . . . . . . . . . . . . . . . . . . . .'
  ' . . . . . . . . . . . . . . . . . . . . . .'
  ' . . . . . . . . . . . . . . . . . . . . . .'
  ' . . . . . . . . . . . . . . . . . . . . . .'
  ' . . . . . . . . . . . . . . . . . . . . . .';
}

/* General */

a {
  color: var(--link-color);
  text-decoration: none;
  text-underline-offset: 1px;
  overflow-wrap: break-word;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration: underline;  
  }
}

a[href*="//"]:after, a[href^="mailto:"]:after {
  display: inline-block;
  font-size: .8em;
  content: "\2197"; /* top right arrow: ↗ */
}

/* Headings */

header h1 a {
  font-weight: normal;
  display: block;
}

section h1 {
  margin-bottom: 1em;
}

h1, h2, h3, h4, strong, b, dt {
  font-size: 1em;
  font-weight: bold;
}

* + h2, * + h3, * + h4 {
  margin-top: 1.4em;
}

h3 {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .9em;
  font-weight: normal;
}

/* Lists */

li, dd {
  margin-inline-start: 1.25em;
}

li + li, li ol, li ul {
  margin-top: .2em;
}

.footnotes li {
  margin-top:.5em;
  max-width:95%;
}

/* Images */

img {
  display: block;
  max-width: 100%;
  min-height:4em;
  height: auto;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 .05em .4em var(--text-color-pale);
  background: rgba(0,0,0,.025);
}

img:after { /* style offline images */
  content: attr(alt);
  display: grid;
  align-content:center;
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: .865em;
  text-align: center;
  border:1px dashed var(--text-color-light);
  background-color: var(--back-color);
}

figure {
  padding: 1.5em 1.2em;
}

figcaption {
  color: var(--text-color-light);
  text-align: center;
}

figcaption a {
  color: var(--text-color);
  text-decoration: underline;
}

figcaption, small, .footnotes {
  font-size: .865em;
}

/* Other elements */

blockquote {
  font-family: "Iowan Old Style", Constantia, Georgia, serif;
  font-size: 1.025em;
  font-variant-numeric: oldstyle-nums;
  padding: .4em 1.2em;
}

abbr[title] {
  text-decoration: none;
  cursor: help;
}

a abbr[title] {
  cursor: pointer;
  color: inherit;
}

hr {
  border: 0;
  height: 0;
  border-bottom: 1px solid;
  opacity: .1;
  margin: 1.4em 0;
}

sup {
  line-height: 1;
  font-size: .75em;
}

code, kbd {
  font-family: ui-monospace, SFMono-Regular, 'Cascadia Code', Menlo, monospace;
  overflow-wrap: break-word;
  font-size:.95em;
  color: var(--text-color-light);
}

kbd {
  box-shadow:0 .5px 1px;
  border-radius:2px;
  padding:.1em .325em .075em;
  margin: 0 .1em;
}

pre {
  overflow: auto;
  padding: .5em .85em .6em;
  background: rgba(0,0,0,.025);  
  border-radius: 4px;
  margin: 1em 0;
}

pre code {
  position: relative;
  display:block;
  overflow-wrap: normal;
}

pre code:after {
  content: attr(class);
  position: absolute;
  right: -.6em;
  top: -.3em;
  text-transform: uppercase;
  font-size: .7em;
  color: var(--text-color-light);
}

/* Tables */

table {
  border-collapse: collapse;
  font-size: .9em;
  width: 100%;
  margin: 1.5em 0;
}

thead th {
  text-align: start;
  border-bottom: 1px solid;
}

th, td {
  padding: .4em .6em;
  border: 1px dotted var(--text-color-pale);
}

/* Disable footnotes #links */

sup a {
  color: currentColor;
  pointer-events: none;
}

a.footnote-backref {
  display: none;
}

/* Smaller screens */

@media only screen and (max-width: 500px) {
  body {
    font-size: 16px;
  }
  footer small {
    font-size: 1em;
  }
  blockquote, figure {
    padding:2vw 4vw;
  }
  ul.toc li + li {
    margin-top:.4em;
  }
  footer small:first-of-type {
    left: -1000vw;
    height: 0;
    overflow: hidden;
    position: absolute;
  }
}

/* Print */

@media print {
  * {
    --back-color: #fff;
  } 
  section {    
    page-break-after: always;
    page-break-inside: avoid;
    break-inside: avoid;
    display: block;
    padding: 2em 0;
  }
  section * {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  footer {
    display: none;
  }
}
