/* code block */
div[class*='language-'] {
  $lineNumbersWrapperWidth = 36px;
  $codePadding = 16px;
  $lineHeight = 24px;
  position: relative;
  overflow: hidden;
  margin: 1.2em 0;
  border: 1px dashed var(--separator-color);
  border-radius: 8px;
  color: var(--fg-color-1);
  font-family: var(--font-mono);

  &::before {
    position: absolute;
    top: 5px;
    right: 10px;
    display: block;
    padding: 4px 8px;
    color: var(--fg-color-3);
    font-size: 12px;
    line-height: 1;
  }

  pre, pre[class*='language-'] {
    position: relative;
    z-index: 1;
    overflow: auto;
    margin: 0;
    padding: $codePadding;
    border: none;
    background: transparent;
    line-height: $lineHeight;
    scroll-bar();

    code {
      margin: 0;
      padding: 0;
      border-radius: 0;
      vertical-align: top;
    }
  }

  .highlight-lines {
    position: absolute;
    top: 0;
    left: 0;
  }

  &.line-numbers-mode {
    pre {
      margin-left: $lineNumbersWrapperWidth;
    }
  }

  .line-numbers-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    padding: $codePadding 0;
    width: $lineNumbersWrapperWidth;
    height: 100%;
    line-height: $lineHeight;

    br {
      display: none;
    }

    .line-number {
      display: block;
      text-align: center;
    }
  }

  &:not(.line-numbers-mode) {
    .line-numbers-wrapper {
      display: none;
    }
  }
}

for lang in $codeLang {
  div{'[class~="language-' + lang + '"]'} {
    &:before {
      content: '' + lang;
    }
  }
}

.token.punctuation, .token.operator {
  color: var(--fg-color-1);
}

.token.comment, .token.prolog, .token.doctype, .token.cdata {
  color: slategray;
}

.token.function, .token.deleted, .language-autohotkey {
  color: #ff3b7b;
}

.token.selector, .token.keyword, .language-autohotkey, .token.entity {
  color: #4da4fb;
}

.token.attr-name, .token.boolean, .token.number, .token.variable, .token.constant, .token.symbol {
  color: #c991e6;
}

.token.string, .token.url .token.atrule, .token.inserted {
  color: #fd971f;
}

.token.property, .token.class-name, .token.tag, .token.builtin, .token.regex, .token.important {
  color: #00B3A4;
}

.token.namespace {
  opacity: 0.7;
}

.token.important, .token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}
