* { box-sizing: border-box; }

header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: rows;
  font-style: italic;
  padding-bottom: 32px;

  & > h1 {
    grid-column: span 2;
    font-size: 38px;
    letter-spacing: -2px;
    text-transform: uppercase;
  }
  & > :is(.author, .written) {
    font-size: 16px;
    & > :is(a[rel="author"], time) {
      font-weight: bold;
    }
  }

  & > .author {
    & > a[rel="author"] {
    }
  }
  & > .written {
    text-align: right;
    & > time {
      font-weight: bold;
    }
  }
}

article {
  padding: 0 16px;
  font-size: 18px;
  & > main :is(p, summary, ol, ul, quote) {
    line-height: 1.6;
  }
  padding-bottom: 64px;

  :is(&, main, section, summary) > :is(h2, h3) {
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-style: italic;

    & > .heading-id {
      letter-spacing: initial;
      font-weight: 900;
      font-family: monospace;
      color: red;
    }
  }
}

@media (min-width: 632px) {
  article {
    width: 600px;
    margin: 0 auto;
  }
}

@media print {
  article {
    width: 100%;
    padding: 32px;
    margin: 0 auto;
    box-sizing: border-box;
  }

}

.aside-anchor {
  top: 16px;

  .aside {
    box-sizing: border-box;
    padding: 16px;
    border: dashed 2px black;
    top: 0;
    & > :first-child { margin-top: 0 }
    & > :last-child { margin-bottom: 0 }
  }
}

@media (min-width: 1300px) {
  .aside-anchor {
    height: 0;
    margin: 0 auto;
    position: sticky;
    margin-bottom: var(--margin-bottom);

    .aside {
      position: absolute;
      width: calc(((100vw - 600px) / 2) - 32px);
      max-width: max-content;
      margin-left: calc(100% + 16px);
      margin-top: 0;
      margin-bottom: 0;
      z-index: 1;
    }
  }
}

#table-of-contents {
  #table-of-contents-title {
    font-size: 16px;
    margin-top: 0;
    font-weight: bold;
    text-transform: uppercase;
  }
  .table-of-contents-list {
    padding-left: 0;
  }
  .table-of-contents-item {
    text-transform: uppercase;
    font-size: 12px;
    list-style: none;
    display: grid;
    grid-gap: 4px;
    grid-template-columns: auto 1fr auto;

    > .dots {
      height: 0.8em;
      border-bottom: 2px dotted black;
      min-width: 16px;
    }
    > .title-num {
      font-family: monospace;
    }
  }
}

@media print {
  #table-of-contents { display: none; }
}

figure {
  math {
    font-size: 24px;
  }
  img {
    max-width: 100%;
  }
  figcaption {
    padding-top: 16px;
    font-size: small;
    text-align: center;
  }
  &.twoimages {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 16px;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    & > img { grid-column: span 1; }
    & > figcaption { grid-column: span 2; }
  }

  &.simple-margin {
    box-sizing: border-box;
    margin: 18px auto 0;
  }
}

.two-columns {
  display: grid;
  grid-template-columns: auto auto;
  grid-gap: 16px;
  justify-content: space-around;
}

footer {
  padding-top: 32px;
  & > p {
    line-height: 1.6;
    font-size: small;
  }
}

:is(ul, ol) > li + li {
  margin-top: 0.5em;
}

quote {
  display: block;
  padding-left: 16px;
  border-left: 2px black solid;
  letter-spacing: 0.005em;
  font-size: 14px;
  font-style: italic;
  color: #444;
}

details {
  padding-left: 16px;
  border-left: 4px solid #666;
  & > summary {
    color: #0000ff;
    text-decoration: underline;
    cursor: pointer;
  }
  & > quote {
    margin-top: 8px;
  }
  & + details {
    margin-top: 16px;
  }
}

.question-toplevel {
  font-size: 14px;
  padding: 16px;
  border: 2px dashed #333;
  color: #333;
}
