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

html {
  font-display: swap;
  font-family: 'PT Serif',sans-serif;
  font-size: 15px;
}

body {
  color: #101010;
  line-height: 1.5;
}

header {
  display: block;
  padding: 1rem;
}

article {
  counter-reset: h2 h3 h4 figure note table;
  margin: 0 auto;
  max-width: 960px;
  min-width: 300px;
  padding: 0 0.25rem 3rem 0.25rem;
  width: 100%;
}

nav ol {
  counter-reset: nav-section;
  list-style-type: none;
  padding-left: 1.5rem;
}

nav li::before {
  content: counters(nav-section, ".") " ";
  counter-increment: nav-section;
}

section > h2 {
  counter-increment: h2;
  counter-reset: h3 h4;
  position: relative;
}

section > h3 {
  counter-increment: h3;
  counter-reset: h4;
  position: relative;
}

section > h4 {
  counter-increment: h4;
  position: relative;
}

section > h2::before,
section > h3::before,
section > h4::before {
  position: absolute;
  right: 100%;
  white-space: pre;
}

section > h2::before {
  content: counter(h2) " ";
}
section > h3::before {
  content: counter(h2) "." counter(h3) " ";
}
section > h4::before {
  content: counter(h2) "." counter(h3) "." counter(h4) " ";
}

h1, h2, h3, h4 {
  font-weight: normal;
  line-height: 1.1em;
}

h1 {
  font-size: 3rem;
  margin-top: 6rem;
}

h2 {
  font-size: 2rem;
  margin-top: 4.5rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 3rem;
}

h4 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

p, ul {
  margin: 1.5rem 0;
}

p > small {
  color: #424242;
  font-size: 1rem;
}

p > small::before {
  color: #424242;
  content: ' [';
  display: inline;
}

p > small::after {
  color: #424242;
  content: ']';
  display: inline;
}

a {
  color: #f44336;
}

a:active,
a:hover {
  color: #ff8a80;
}

a:visited {
  color: #d32f2f;
}

code, pre {
  font-display: swap;
  font-family: 'Fira Mono',monospace;
  font-size: 0.9em;
}

code {
  background: #f0f0f0;
  border-radius: 2px;
  padding: 0 0.25em;
}

section > pre {
  clear: right;
  margin: 1.5rem 0;
}

figure {
  clear: right;
  margin-bottom: 3rem;
  padding-top: 1.5rem;
}

figure.example {
  padding-top: 3rem;
}

figure.example > ul {
  list-style: none;
  margin: 0;
  padding-right: 320px;
  position: relative;
  width: 100%;
}

figure.example > ul > li {
  margin: 0;
  position: relative;
}

figure.example > ul > li > span {
  bottom: 100%;
  font-size: 90%;
  left: 0;
  position: absolute;
}

figure.example > ul > li.src {
  height: 440px;
}

figure.example > ul > li.src > pre,
section > pre {
  background: #f0f0f0;
  border-radius: 4px;
  height: 440px;
  overflow: auto;
  padding: 0 0.25em;
}

figure.example > ul > li.live {
  height: 200px;
  position: absolute;
  right: 0;
  top: 0;
  width: 300px;
}

figure.example > ul > li.svg {
  height: 200px;
  position: absolute;
  right: 0;
  top: 240px;
  width: 300px;
}

figcaption {
  color: #424242;
  font-size: 0.9rem;
}

figcaption::before {
  display: inline;
  font-style: italic;
}

figure.example > figcaption::before {
  content: "Fig. " counter(figure) ": ";
  counter-increment: figure;
}

figure.table > figcaption::before {
  content: "Tbl. " counter(table) ": ";
  counter-increment: table;
}

svg {
  /* Some versions of IE allow the SVG contents to overflow the image bounds. */
  overflow: hidden;
}

ul > li {
  margin-left: 1.5em;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  line-height: 1.25;
  padding: 0.25rem 0.5rem;
  vertical-align: top;
}

th {
  border-bottom: 1px solid #656565;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid #e0e0e0;
}

@media (min-width: 640px) {
  html {
    font-size: 16px;
  }
  p, ul {
    width: 60%;
  }
  p > small {
    counter-increment: note;
  }
  p > small > span {
    clear: right;
    display: inline;
    font-size: 0.9rem;
    float: right;
    line-height: 1.2;
    margin-right: -66%;
    margin-top: 0.2rem;
    position: relative;
    width: 50%;
  }
  p > small::before {
    content: counter(note);
    font-size: 75%;
    line-height: 1;
    vertical-align: top;
  }
  p > small > span::before {
    content: counter(note) ": ";
    position: absolute;
    right: 100%;
    white-space: pre;
  }
  p > small::after {
    display: none;
  }
  figcaption {
    float: right;
    line-height: 1.2;
    margin-top: 0.25rem;
    position: relative;
    width: 30%;
  }
  figcaption::before {
    font-style: normal;
    position: absolute;
    right: 100%;
    white-space: pre;
  }
}

@media (min-width: 800px) {
  html {
    font-size: 17px;
  }
}

@media (max-width: 639px) {
  figure.example > ul {
    padding-right: 0;
  }
  figure.example > ul > li.src {
    height: 240px;
  }
  figure.example > ul > li.src > pre {
    height: 240px;
  }
  figure.example > ul > li.live,
  figure.example > ul > li.svg {
    margin-top: 2rem;
    position: relative;
    right: auto;
    top: auto;
  }
}
