$tldr-border: 1px solid #333;
$tldr-color: #e8e8d1;
$tldr-label-color: #fff696;
$table-bg: lighten($color-bg, 2%);
$table-bg-alt: lighten($table-bg, 2%);
$table-border-color: $color-very-light-border;
$toc-border: 1px solid #333;
$toc-color: #d1e3e8;
$toc-label-color: #96ccff;
$caption-color: #bfb1bf;

.meta {
  font-family: $iosevka;
  font-size: $text-small;
}

.tldr,
.toc {
  border: $tldr-border;
  padding: 5pt 10pt;
  margin-top: 14pt;
  padding-top: 11pt;
  font-family: $iosevka;
  position: relative;
  font-size: 11pt;
  color: $tldr-color;
  line-height: 1.6;

  @media (max-width: $screen-width) {
    border-left: 0;
    border-right: 0;
  }

  &:before {
    color: $tldr-label-color;
    content: "TL;DR";
    font-weight: bold;
    position: absolute;
    font-size: 8pt;
    left: 4pt;
    top: -8pt;
    border: $tldr-border;
    background-color: $color-bg;
    padding: 1pt 5pt;
  }
}

.content {
  table {
    border-collapse: collapse;
    background-color: $table-bg;
    td,
    th {
      padding: 5pt 10pt;
      border: 1px solid $table-border-color;
      font-size: 11pt;
      line-height: 1.5;
    }
    tr:nth-child(even) {
      background-color: $table-bg-alt;
    }
    th {
      font-family: $iosevka;
    }
  }
  figure {
    margin: 0;
    padding-top: 1rem;
  }
  figure a,
  figure a:visited,
  figure a:hover {
    background: none;
  }
  figure img {
    max-width: 100%;
  }
  figcaption p {
    text-align: center;
    font-style: italic;
    padding-left: 5pt;
    color: $caption-color;
    margin-top: 0;
  }
}

.toc {
  --link-color: #f591e6;
  &:before {
    color: $toc-label-color;
    content: "Table of contents";
    border: $toc-border;
    background-color: $color-bg;
  }
  ul {
    margin: 0;
    padding-left: 0;
    list-style-type: none;
  }
  ul li::before {
    content: "├─ ";
    font-family: "Courier", monospace;
  }
  ul li:last-child::before {
    content: "└─ ";
  }
  ul li ul li::before {
    content: "│ ├─ ";
  }
  ul li ul li:last-child::before {
    content: "│ └─ ";
  }
  ul li ul li a {
    --link-color: #a991f5;
  }
  ul li:last-child ul li:last-child::before {
    content: "  └─ ";
  }
}