@use '@vizality' as vz;

.vz-markdown {
  $base: &;
  &-header {
    &-h1,
    &-h2,
    &-h3,
    &-h4,
    &-h5,
    &-h6 {
      margin-top: 24px;
      margin-bottom: 16px;
      font-weight: 600;
      line-height: 1.25;
    }
    &-h1,
    &-h2 {
      padding-bottom: 10px;
      border-bottom: 1px solid var(--background-modifier-accent);
    }
    &-h6 {
      text-transform: uppercase;
    }
    &:hover {
      #{$base}-anchor-icon {
        visibility: visible;
      }
    }
  }
  &-anchor {
    float: left;
    padding-right: 4px;
    margin-left: -20px;
    line-height: 1;
    &-icon {
      color: var(--header-secondary);
      visibility: hidden;
      vertical-align: middle;
      display: inline-block;
    }
  }
  &-hr {
    height: 4px;
    padding: 0;
    margin: 12px 0;
    background-color: var(--background-modifier-accent);
    border: 0;
  }
  &-blockquote {
    padding: 0 16px;
    opacity: .8;
    border-left: 4px solid var(--interactive-muted);
  }
  &-ul,
  &-ol {
    padding-left: 32px;
    & & {
      margin-top: 0;
      margin-bottom: 0;
    }
    #{$base}-checkbox {
      margin: 0 0 10px -26px;
    }
  }
  &-ul {
    list-style: disc;
    & & {
      list-style-type: circle;
    }
    & & & {
      list-style-type: square;
    }
  }
  &-ol {
    list-style-type: decimal;
    & & {
      list-style-type: circle;
    }
  }
  &-li {
    &.task-list-item {
      list-style-type: none;
    }
  }
  &-table {
    display: table;
    width: 100%;
    overflow: hidden;
    border-spacing: 0;
    border-radius: 4px;
    color: var(--text-normal);
    border: 1px solid var(--background-tertiary);
  }
  &-thead {
    display: table-header-group;
    vertical-align: middle;
    border-color: inherit;
    text-transform: uppercase;
    font-size: 12px;
    > #{$base}-tr {
      background: var(--background-tertiary);
    }
  }
  &-tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit;
    background: var(--background-secondary);
    &:nth-child(2n) {
      background-color: var(--background-secondary-alt);
    }
  }
  &-td,
  &-th {
    display: table-cell;
    vertical-align: inherit;
    text-align: left;
    padding: 8px 13px;
    &.vz-align-right {
      text-align: right;
    }
  }
  &-th {
    font-weight: 600;
  }
  &-tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit;
  }
  &-ol,
  &-ul {
    padding-left: 32px;
  }
  &-image {
    cursor: pointer;
    margin: 20px 0;
    height: auto !important;
    max-width: 100%;
    width: fit-content !important;
    display: inline-block;
    img {
      height: auto !important;
      max-width: 100%;
      width: auto !important;
      position: relative;
      border-radius: 3px;
    }
  }
  /*
   * We have this because we don't have the markup wrapper
   * in markdown, which Discord uses to style inline code
   */
  &-code {
    line-height: 1.5;
    &-inline {
      width: auto;
      height: auto;
      padding: .2em;
      margin: -.2em 0;
      border-radius: 3px;
      text-indent: 0;
      border: none;
      white-space: pre-wrap;
      background: var(--background-secondary);
    }
  }
  &-p {
    margin: 0 0 16px;
  }
  &-strong {
    font-weight: 600;
  }
  &-em {
    font-style: italic;
  }
  &-blockquote,
  &-details,
  &-dl,
  &-p,
  &-pre,
  &-table,
  &-ul,
  &-ol {
    line-height: 1.5;
    margin-top: 0;
    margin-bottom: 16px;
  }
  &-blockquote > :last-child {
    margin-bottom: 0;
  }
  &-blockquote > :first-child {
    margin-top: 0;
  }
  &-content-loading {
    @include vz.size(100%);
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
