:root {
  --paragraph-spacing: 1.2em;
}

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

html {
  font-size: 18px;
}

html, body {
  min-height: 100vh;
}

body {
  font-family: ui-serif, Charter, "Source Han Serif SC VF", serif;
  width: 85vw;
  max-width: 33em;
  margin: 0 auto;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: ui-sans-serif, sans-serif;
  font-size: inherit;
}

main {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
  flex: 1;
  gap: var(--paragraph-spacing);
}

a {
  text-decoration: none;
  color: inherit;
}

p a {
  color: #B85C5C;
}

p:lang(zh) {
  text-autospace: normal;
}

ul, ol {
  list-style: none;
}

ul p, ol p {
  margin: 0.5em auto;
}

sup {
  line-height: 0;
}

img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

blockquote {
  margin-left: 3em;
}

body > header {
  border-bottom: 4px black solid;
  text-align: right;
  padding: 4px 0;

  & > div {
    font-family: sans-serif;
    font-weight: bold;
  }
}

nav[aria-label="Site"] {
  display: flex;
  justify-content: flex-end;
  gap: 0.25em;

  & a[aria-current="page"]::after {
    content: "°" / "";
    font-weight: bold;
  }
}

article {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--paragraph-spacing);

  header {
    margin-bottom: calc(2em - var(--paragraph-spacing));

    h1, h2 {
      font-size: 1.111em;
    }
  }

  footer {
    margin-top: auto;
  }

  ol, ul {
    list-style-type: revert;
    padding-left: 3em;
  }

  #footnotes {
    display: flex;
    flex-direction: column;
    gap: var(--paragraph-spacing);

    [id^="fn."] > p:nth-of-type(1) {
      display: inline;
    }

    p {
      margin: var(--paragraph-spacing) 0;
    }
  }
}

nav[aria-label="Post"] {
  display: flex;
  flex-wrap: wrap;
  padding-top: 4em;
  gap: 1em;

  & a[rel="next"] {
    margin-left: auto;
  }
}

.section-break {
  border-top: 4px double black;
  position: relative;
  overflow: visible;
  margin: 2.5em auto;
  width: 30%;
}

.section-break::after {
  color: black;
  content: "§" / "";
  position: absolute;
  background-color: white;
  left: 50%;
  transform: translate(-50%, calc(-50% - 4px));
  padding: 4px;
}

.article-break {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin: calc(2.5em - var(--paragraph-spacing));
  font-size: 1.5em;

  & div:nth-of-type(odd) {
    transform: rotate(180deg);
  }
}

.page-break {
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-image: url("/assets/Dotted_crotchet_rest.svg");
  height: 21px;
  margin: 4em 0;
}

body > footer {
  font-style: italic;
  padding-bottom: 1em;
  text-align: center;
}

.code {
  background-color: #F7F4F2;
  padding: 1em;
  border-radius: 1em;
  overflow: auto;
}

.level-1-heading {
  font-size: 1.055em;
}

.level-2-heading {
  font-size: 1em;
}

.level-3-heading {
  font-size: 0.944em;
}

#archive {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1em;
  row-gap: 0.5em;

  li {
    display: grid;
    grid-column: 1 / span 2;
    grid-template-columns: subgrid;
    align-items: center;
  }

  time {
    color: grey;
    font-size: 90%;
  }

  li:nth-of-type(odd) time {
    grid-column: 1;
    text-align: right;
  }

  li:nth-of-type(odd) a {
    grid-column: 2;
  }

  li:nth-of-type(even) time {
    grid-column: 2;
    grid-row: 1;
  }

  li:nth-of-type(even) a {
    grid-column: 1;
    grid-row: 1;
    text-align: right;
  }
}

.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border-width: 0;
}
