%markdown {
  h1 {
    margin-bottom: 0.25rem;

    @media (min-width: 901px) {
      font-size: 3rem;
    }

    @media (max-width: 900px) {
      font-size: 2rem;
    }

    + h2 {
      margin-top: 2rem;
    }
  }

  h2 {
    @media (min-width: 901px) {
      font-size: 2rem;
    }

    @media (max-width: 900px) {
      font-size: 1.5rem;
    }

    + h3 {
      margin-top: 1rem;
    }
  }

  h3 {
    @media (min-width: 901px) {
      font-size: 1.5rem;
    }

    @media (max-width: 900px) {
      font-size: 1.25rem;
    }
  }

  h4 {
    letter-spacing: 0.05rem;
    text-transform: uppercase;

    @media (min-width: 901px) {
      font-size: 1.25rem;
    }

    @media (max-width: 900px) {
      font-size: 1.15rem;
    }
  }

  h5 {
    font-size: 1rem;
  }

  sub,
  sup {
    @include font-mono;
  }

  blockquote {
    left: 2px;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    position: relative;

    @media (min-width: 601px) {
      width: 70%;
      padding: 0.5rem 0 0.05rem 2rem;

      font-size: 1.5rem;
      margin-left: 15%;
    }

    @media (max-width: 600px) {
      padding: 0.5rem 0 0.05rem;
      font-size: 1.25rem;
    }

    @media (min-width: 376px) and (max-width: 600px) {
      width: 90%;
      margin-left: 5%;
    }

    p {
      font-size: inherit;
      line-height: inherit;
    }

    &::before {
      @include font-serif;
      width: 150px; height: 100px;
      top: 3rem; left: -2rem;

      color: rgba($lbry-teal-3, 0.2);
      content: "\201C";
      font-size: 20rem;
      line-height: 0.5;
      position: absolute;
    }
  }

  p,
  ol,
  ul,
  table {
    code {
      padding: 0.3rem 0.5rem;

      background-color: $lbry-black;
      border-radius: 3px;
      color: $lbry-white;
      font-size: 60%;
      letter-spacing: 0.05rem;
      vertical-align: middle;

      @media (max-width: 900px) {
        top: -1px;
        position: relative;
      }
    }
  }

  p,
  ol,
  ul,
  table,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    + h2 {
      margin-top: 2rem;
    }

    + h3,
    + h4,
    + h5 {
      margin-top: 1.5rem;
    }
  }

  p,
  ol,
  ul:not(.component--glossary-toc) {
    margin-bottom: 1rem;
    position: relative;

    @media (min-width: 901px) {
      font-size: 1.25rem;
      line-height: 1.6;
    }

    @media (max-width: 900px) {
      font-size: 1.05rem;
      line-height: 1.55;
    }
  }

  ol,
  ul {
    padding-top: 0.5rem;

    li:not(:last-of-type) {
      margin-bottom: 0.25rem;
    }
  }

  ol {
    padding-left: 0.1rem;

    li {
      list-style-type: decimal;
    }
  }

  ul {
    padding-left: 0.25rem;

    li {
      list-style-type: disc;
    }
  }

  img {
    display: block;
    margin-right: auto;
    margin-bottom: 1rem;
    margin-left: auto;
  }

  p {
    margin-right: 2px;
    margin-left: 2px;

    img {
      float: right;
    }
  }

  a:not(.__button-black):not(.button) {
    @include underline($lbry-teal-3, $lbry-white);
    color: $lbry-teal-3;

    code {
      background-color: $lbry-teal-3;
      text-shadow: none;
    }
  }

  pre {
    font-size: 1rem;
  }

  h2,
  h3,
  h4,
  h5 {
    + table {
      margin-top: 0.5em;
    }
  }

  table {
    width: 100%;

    background-color: $lbry-white;
    border: 1px solid $lbry-gray-1;
    border-spacing: 0;
    margin-bottom: 2rem;
    position: relative;

    @media (max-width: 1030px) {
      display: inline-grid;

      thead {
        display: none;
      }

      tbody,
      tr,
      td {
        display: block;
      }

      tbody tr:last-of-type td:not(:last-of-type) {
        border-bottom: 1px solid $lbry-gray-1;
      }
    }

    thead {
      background-color: $lbry-black;
      color: $lbry-white;
      cursor: default;
      position: relative;

      tr {
        position: relative;
        z-index: 1;
      }

      &:not(*:root)::after {
        z-index: -1;
      }

      &::after {
        width: calc(100% + 2px); height: calc(100% + 2px);
        top: -1px; left: -1px;

        background-color: $lbry-black;
        content: "";
        position: absolute;
        z-index: 0;
      }
    }

    tbody {
      line-height: 1.55;
    }

    tr:nth-of-type(even) {
      background-color: $lbry-gray-1;

      a:not(.__button-black):not(.button) { // "dirty" override but necessary
        @include underline($lbry-teal-3, $lbry-gray-1);
      }
    }

    th,
    td {
      padding: 0.5rem 1rem;
      user-select: text;
    }

    th {
      font-size: 0.8rem;
      letter-spacing: 0.1rem;
      text-transform: uppercase;
    }

    tbody tr:not(:last-of-type) td {
      border-bottom: 1px solid $lbry-gray-1;
    }

    td {
      font-size: 1rem;
    }
  }
}
