html, body { 
  padding: 0;
  margin: 0;
}

body {
  font-family: 'Charter', 'Bitstream Charter', 'Charter BT', Georgia, serif;
  font-size: 20px;
  line-height: 1.45;
  color: black;
  background: white;
}

article {
  margin: 0 auto;
  max-width: 35em;
  padding: 2em 1em 5em;
  position: relative;
  overflow-wrap: break-word;
}

footer.edition-footer {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid #ddd;
  font-size: 75%;
  color: #888;
  text-align: center;
}

footer.edition-footer a {
  color: #888;
}

nav {
  display: block;
  height: 0;
  text-align: right;
}

nav a {
  font-size: 80%;
  color: #aaa !important;
  text-decoration: none !important;
}

nav button {
  background: transparent;
  color: #aaa;
  border: none;
  cursor: pointer;
}

nav button.help {
  display: none;
}

div.popup {
  position: fixed;
  left: 0; right: 0; top: 0; bottom: 0;
  border-radius: 3px;
  max-width: min(35rem, 90%);
  height: fit-content;
  box-sizing: content-box;
  margin: auto;
  border: 1px solid #4ab;
  padding: 0 1.5em 1em;
  background: white;
  max-height: 90%;
  overflow-y: auto;
  overflow-x: hidden;
  outline: 1000px solid #ffffffbb;
}

a.subtlelink {
  color: black !important;
  text-decoration: none !important;
}

pre {
  padding: 5px 0 5px 15px;
  line-height: 1.35;
  margin: 1rem 0;
  max-width: 100%;
  overflow-x: auto;
  color: black;
}

p:hover a.p_ident:after, pre:hover a.c_ident:after, h2:hover a.h_ident:after, h3:hover a.i_ident:after {
  content: "¶";
  font-family: 'Charter', Georgia, serif;
  color: #888;
  font-size: 17px;
  position: absolute;
  right: -10px;
}

@media screen and (max-width: 800px) {
  p:hover a.p_ident:after, pre:hover a.c_ident:after, h2:hover a.h_ident:after, h3:hover a.i_ident:after {
    right: 5px;
  }

  blockquote p:hover a.p_ident:after {
    right: -15px;
  }
}


code, pre {
  font-size: 18px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

code {
  padding: 0 2px;
}

h1, h2, h3 {
  font-family: 'Charter', Georgia, serif;
  font-weight: 700;
  margin: 1rem 0;
}

h1 {
  font-size: 130%;
}
h2 {
  font-size: 115%;
}
h3 {
  font-size: 100%;
}

pre.snippet, p, h2, h3 {
  margin-right: -30px;
  padding-right: 30px;
}

@media screen and (max-width: 800px) {
  pre.snippet, p, h2, h3 {
    margin-right: 0;
    padding-right: 0;
  }
}

a, a:visited, a:active {
  text-decoration: none;
  color: #467;
}

a:hover {
  text-decoration: underline;
}

ol {
  margin: 1em 0;
  padding: 0;
  counter-reset: li;
}

ol li {
  margin: 0 0 0 40px;
  padding: 0;
  list-style: none;
  position: relative;
}

ol li:before {
  content: counter(li) ".";
  counter-increment: li;
  position: absolute;
  width: 2em;
  text-align: right;
  left: -2.5em; top: 1px;
  font-size: 90%;
}

ol li p {
  margin: 0;
}

.chap_num {
  font-size: 60%;
  color: #aaa;
  margin-top: -.7em;
  display: block;
}

blockquote {
  margin: 0 0 0 3em;
  padding: 0;
  position: relative;
  font-size: 85%;
}

blockquote p {
  color: #333;
}

blockquote:before {
  content: '“';
  position: absolute;
  left: -.5em;
}

blockquote p:last-of-type:after {
  content: '”';
}

blockquote footer {
  position: relative;
  margin-left: 1em;
}

p + footer {
  margin-top: -.5em;
}

blockquote footer cite {
  font-style: italic;
}

blockquote footer:before {
  content: '—';
  position: absolute;
  left: -1em;
}

/* Syntax highlighting (classes emitted by src/render_html.mjs) */
.tok-keyword {color: #506}
.tok-atom {color: #106}
.tok-number {color: #042}
.tok-definition {color: #009}
.tok-variableName2 {color: #027}
.tok-typeName {color: #072}
.tok-comment {color: #740}
.tok-string {color: #700}
.tok-string2 {color: #c40}
.tok-invalid {color: #f00}
.tok-meta {color: #555}

figure {
  max-width: 640px;
  margin: 0 30px;
}

figure.chapter {
  text-align: center;
  margin: 3em 0 2em;
}

figure.chapter img {
  max-width: 75%;
}

figure.framed img {
  border-radius: 50%;
  border: 4px double #666;
}

figure.square-framed img {
  border-radius: 30px;
  border: 4px double #666;
}

span.keyname { font-variant: small-caps }

@media screen and (max-width: 500px) {
  figure {
    margin: 0;
  }
}

figure img {
  max-width: 100%;
}

figure.diagram {
  margin: 2em 0;
}

figure.diagram pre.mermaid-diagram {
  font-size: 14px;
  background: #fafafa;
  border: 1px solid #ddd;
}

p.diagram-note {
  font-size: 80%;
  color: #666;
  margin-top: 0.5em;
}

details.solution { color: #156 }
details summary { cursor: pointer }
details[open] summary { display: none }

td {
  vertical-align: top;
}

td + td {
  padding-left: 1em;
}

table {
  margin-left: 15px;
}

sub, sup {
  line-height: 1;
}

sub {
  font-size: 60%;
}

sup {
  font-size: 70%;
}
