body, html { height: 100%; }
body {
  /* https://www.grputland.com/2012/08/font-stacks-that-look-similar-in.html#geo20120806 */
  font-family: Georgia, "Bitstream Charter", "Charis SIL", Utopia, "URW Bookman L", serif;
  margin: 0;
}
body > div {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

a {
  color: #138;
  text-decoration-style: dotted;
}
a:visited { color: #511; }
a:active { text-decoration-style: solid; }

summary {
  text-decoration: dotted underline;
  cursor: pointer;
}

hr {
  border: none;
  height: 2px;
  background: radial-gradient(black, transparent 70%);
}

h1:first-child { margin-top: 0; }

iframe[src*=youtube],
iframe[src*=vimeo] {
  width: 600px;
  height: 337px;
}

img {
  max-width: 100%;
  border: 1px solid #ddd;
  margin: 10px 0;
}

table, th, td { border: none; }
th { text-align: left; }

pre { overflow: auto; }

:target {
  padding-left: 10px;
  margin-left: -10px;
  background-color: #fff8d3;
  border-left: 1px solid #ddd;
}

/* Sphinx image alignment classes */
.align-left { float: left; }
.align-right { float: right; }

ul.articles {
  padding: 0;
  list-style: none;
  text-indent: hanging 1em;
}
p.attribution { font-style: italic; font-size: small; }

body > div > header {
  position: relative;
  width: 100%;
  margin-left: 0;
  font-family:
    /* https://www.grputland.com/2012/08/font-stacks-that-look-similar-in.html#helv20120806 */
    Tahoma, "Droid Sans", Verdana, sans-serif;
}
body > div > header > hgroup {
  max-width: 300px;
  text-align: right;
}
body > div > header > hgroup h1 {
  margin: 0;
  letter-spacing: -2px;
}
body > div > header a,
body > div > header a:visited { color: black; }
body > div > header > hgroup h1 + p { margin-top: 0; }

body > div > header > nav {
  position: absolute;
  right: 0;
  top: 10px;
  text-align: right;
  height: 100%;
}

body > div > header { margin-top: 10px; }
body > div > header > nav { margin-right: 10px; }
body > div > header > nav:focus-within {
  padding-left: 40px;
  background:
    /* cover site title on narrow screens */
    linear-gradient(120deg, transparent, white 60px)
}
body > div > header form[action="/search"] { text-align: right; }

body > div > header form[action="/search"] label > input,
body > div > header form[action="/search"] label + button { display: inline-block; }
body > div > header form[action="/search"] label:not(:focus-within) {
  text-decoration: dotted underline /* match <a> */;
  cursor: pointer;
}
body > div > header form[action="/search"] label:not(:focus-within) > input,
body > div > header form[action="/search"] label:not(:focus-within) + button {
  position: fixed;
  margin-left: 9999px /* offscreen */;
}

body > div > main {
  width: 600px;
  max-width: calc(100% - 35px);
  margin: auto;
  flex-grow: 1;
  padding-left: 70px; /* enough space for the hanging h1, for narrow screens */;
}

body > div > footer { padding-bottom: 10px; }
body > div > footer > address {
  width: 300px /* match site header */;
  max-width: 100%;
  text-align: right;
}
@media (max-width: 420px) {
  body > div > footer > address {
    text-align: center;
  }
}

article h1,
article h2,
article h3,
article h4,
article h5 {
  margin-left: -2em;
  overflow: visible;
  white-space: nowrap;
}
@media (max-width: 700px) {
  article h1,
  article h2,
  article h3,
  article h4,
  article h5 {
    margin-left: -1em;
  }
  body > div > main { padding-left: 35px; }
}
article > header { margin-top: 40px; }
article > header > * {
  margin-top: 0;
  margin-bottom: 0;
}
article > header > small {
  font-style: italic;
  color: gray;
}
article > header { margin-bottom: 10px; }
article > header + p { text-indent: 0; }

article p { margin: 0; }
article p + p { text-indent: 40px; }
article footer p,
article table p,
article blockquote p {
  text-indent: 0;
  margin-bottom: 3px;
}
article h2 { margin-bottom: 5px; }

article blockquote {
  margin-left: -13px;
  padding-left: 10px;
  border-left: 3px solid black;
  font-style: italic;
}
article blockquote em { font-style: normal; }
article blockquote blockquote {
  margin-left: 0;
  border: none;
}
article > footer hr {
  margin-left: -150px;
  padding-left: 150px;
  padding-right: 50px;
}
article > footer > details { margin-top: 10px; }
article > footer > details:not(:open) { margin-bottom: 5px; }
article > footer > details > p { margin-top: 10px; }
article > footer blockquote {
  border: none;
  padding: 5px 0;
  margin: 5px 0;
  font-style: unset;
}
article > footer > details > p:last-child { font-style: italic; }
article > footer > details > p:last-child em { font-style: normal; }


body > div:not([data-path="index.html"]) > header > hgroup > p {
  font-family: wingdings, fantasy;
  font-size: small;
}
[data-path^="tag/"] > header > hgroup > p {
  font-family: webdings, cursive;
}

[data-path="index.html"] > main {
  display: flex;
  max-width: none;
  width: 100%;
  padding: 0;
}
[data-path="index.html"] > main ol,
[data-path="index.html"] > main ul {
  padding: 0;
  list-style: none;
}
[data-path="index.html"] > main > nav {
  width: 300px /* match site hgroup */;
  max-width: 33%;
  margin-left: 10px;
  text-align: right;
}
[data-path="index.html"] > main > nav + .gutter {
  width: 70px;
  max-width: 10%;
}
[data-path="index.html"] > main > nav + * { flex-grow: 1; }

[data-path="pages/reading-list.html"] td > p { width: 200px; }
[data-path="pages/reading-list.html"] td:first-child { text-align: left; }
[data-path="pages/reading-list.html"] td { text-align: center; }
[data-path="pages/reading-list.html"] td:last-child { text-align: right; }
