html {
  --ui-deg: 45deg;
}

body {
  font: 1em/1.35 Cambria, Times, serif;
  -webkit-hyphens: auto;
  hyphens: auto;
}

[href]:any-link {
  text-underline-offset: 0.2em;
}

/* TOC */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 100vw;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: repeat(2, auto);
  gap: 0 0.5em;
  transition-duration: 500ms;
  color: hsl(var(--ui-deg), 80%, 10%);
  background: hsl(var(--ui-deg), 60%, 99%);
  border-block-end: 1px solid gray;
  z-index: 1945;
  transition-duration: 333ms;
  transition-property: color, background, box-shadow;
}

nav:hover,
nav:focus-within {
  box-shadow: 0 0 3em 3em #FFF;
  color: black;
  background: hsl(var(--ui-deg), 60%, 95%);
}

nav>p {
  grid-row: 1;
  grid-column: 2;
  text-align: center;
  font-weight: 500;
  margin-block-end: -1px;
  padding-block: 0.5em;
  text-indent: 0;
}

nav>a[class] {
  justify-self: stretch;
  padding: 0.5em;
  z-index: 1949;
}

nav>a.prev {
  grid-row: 1;
  grid-column: 1;
  white-space: nowrap;
}

nav>a.prev::before {
  content: "< ";
}

nav>a.next {
  grid-row: 1;
  grid-column: 3;
  text-align: end;
  white-space: nowrap;
}

nav>a.next::after {
  content: " >";
}

nav div {
  grid-row: 3;
  grid-column: 1 / -1;
  height: 0;
  padding: 0;
  justify-self: center;
}

nav p:hover~div,
nav p:focus-within~div,
nav div:hover,
nav div:focus-within {
  padding-block: 1em;
  height: auto;
  opacity: 1;
}

nav ol {
  margin: 1em auto;
  padding-inline: 2.5em 0.5em;
  list-style-type: upper-roman;
}

nav ol.appendix {
  list-style-type: upper-alpha;
}

nav ol li {
  break-inside: avoid;
}

nav p span {
  display: none;
}

@media (min-width: 42rem) {
  nav>p {
    grid-column: 2;
    background:
      linear-gradient(currentColor, currentColor) 50% 100% / 50em 1px no-repeat;
  }

  nav>a[class] {
    grid-row: 1;
  }

  nav>a.next {
    grid-column: 3;
  }

  nav div {
    grid-column: 2;
  }

  nav p span {
    display: inline;
  }

  nav ol {
    columns: 2;
    gap: 4em;
    padding: 0;
    transform: translateX(2em);
  }

  nav div .currentPage [href]:any-link::before {
    margin-right: 0.5ch;
  }
}

nav ul {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul li+li {
  list-style: square;
}

nav div [href] {
  display: block;
}

nav [href]:hover {
  background: #0002;
  background: hsla(var(--ui-deg), 60%, 50%, 0.2);
}

nav div [href]:local-link {
  font-weight: 900;
}

nav [href]:any-link {
  color: currentColor;
  text-decoration-style: dotted;
}

nav div [href]:visited {
  color: #555;
}

nav div .currentPage {
  font-weight: 900;
}

nav div .currentPage [href]:any-link {
  color: #000;
  text-decoration-style: solid;
}

main {
  max-width: 40em;
  margin: 0 auto;
  padding-inline: 0.5em;
}

main section {
  margin: 4em 0 2em;
}

main *:is(h1, h2) {
  text-align: center;
}

main *:is(h1, h2, h3) {
  font-weight: normal;
  transform: scaleY(0.9);
  margin-block: 1.5em 0.25em;
}

main h1 {
  margin-block: 2.5em 1em;
  font-size: 2.25em;
}

main ul li {
  list-style: none;
  text-indent: -4ch;
  padding-left: 4ch;
  margin-block-end: 1em;
}

p {
  margin: 0;
  text-align: justify;
}

p,
p[id],
[id] p:first-child,
aside>p {
  text-indent: 1em;
}

blockquote p {
  text-indent: 0;
}

a.xref {
  white-space: nowrap;
}

sup {
  font-size: 75%;
  line-height: 0.5;
}

@keyframes fnSlide {
  from {
    max-height: 0;
    bottom: -8rem;
  }

  to {
    max-height: 67vh;
    bottom: 0rem;
  }
}

/* ----------------------------------------------
    Figures
     ---------------------------------------------- */

figure {
  margin-block: 2em;
  margin-inline: 0;
  text-align: center;
  font-size: 95%;
}

figure img,
figure svg {
  max-width: 100%;
  margin: 0 auto;
  display: block;
  height: auto;
}

figure.wide {
  margin-block: 3em;
}

figure.wide :is(img, svg) {
  margin-inline: calc((90vw - min(90vw, 42em)) / -2);
  max-width: 85vw;
}

figure .halfwidth {
  max-width: 50%;
  margin-inline: auto;
}

figure figcaption {
  padding: 0.5em;
  text-align: justify;
  text-align-last: center;
}

figure p {
  text-indent: 0;
}

figure :is(h4, h5, h6) {
  font-size: 1em;
  font-style: normal;
  font-weight: bold;
  margin-block: 0;
  padding: 0.5em;
}

@media (min-width: 30em) {
  figure {
    margin-inline: 1em;
  }

  figure figcaption {
    padding: 0.5em;
    text-align: justify;
    text-align-last: center;
  }
}