// https://github.com/chriskempson/tomorrow-theme
$highlight-theme = hexo-config('codeblock.highlight_theme');

@import 'theme';
@import 'diff';

@import 'copy-code' if (hexo-config('codeblock.copy_button.enable'));

// Placeholder: $code-block
$code-block {
  background: $highlight-background;
  color: $highlight-foreground;
  line-height: $line-height-code-block;
  margin: 0 auto 20px;
}

pre, code {
  font-family: $code-font-family;
}

code {
  word-wrap();
  background: $code-background;
  border-radius: $code-border-radius;
  color: $code-foreground;
  padding: 2px 4px;
}

pre {
  @extend $code-block;
  overflow: auto;
  padding: 10px;

  code {
    background: none;
    color: $highlight-foreground;
    font-size: $table-font-size;
    padding: 0;
    text-shadow: none;
  }
}

.highlight {
  @extend $code-block;

  *::selection {
    background: $highlight-selection;
  }

  pre {
    border: 0;
    margin: 0;
    padding: 10px 0;
  }

  table {
    border: 0;
    margin: 0;
    width: auto;
  }

  td {
    border: 0;
    padding: 0;
  }

  figcaption {
    background: $code-background;
    border-bottom: 1px solid #e9e9e9;
    color: $highlight-foreground;
    line-height: 1em;
    margin: 0;
    padding: .5em;
    clearfix();

    a {
      color: $highlight-foreground;
      float: right;

      &:hover {
        border-bottom-color: $highlight-foreground;
      }
    }
  }

  .gutter pre {
    background-color: $highlight-gutter.bg-color;
    color: $highlight-gutter.color;
    padding-left: 10px;
    padding-right: 10px;
    text-align: right;
  }

  .code pre {
    background-color: $highlight-background;
    padding-left: 10px;
    width: 100%;
  }
}

.gutter {
  disable-user-select();
}

.gist table {
  width: auto;

  td {
    border: 0;
  }
}

pre {
  // For diff highlight
  .deletion {
    background: $highlight-deletion;
  }

  .addition {
    background: $highlight-addition;
  }

  .meta {
    color: $highlight-yellow;
    disable-user-select();
  }

  .comment {
    color: $highlight-comment;
  }

  .variable, .attribute, .tag, .name, .regexp, .ruby .constant, .xml .tag .title, .xml .pi, .xml .doctype, .html .doctype, .css .id, .css .class, .css .pseudo {
    color: $highlight-red;
  }

  .number, .preprocessor, .built_in, .builtin-name, .literal, .params, .constant, .command {
    color: $highlight-orange;
  }

  .ruby .class .title, .css .rules .attribute, .string, .symbol, .value, .inheritance, .header, .ruby .symbol, .xml .cdata, .special, .formula {
    color: $highlight-green;
  }

  .title, .css .hexcolor {
    color: $highlight-aqua;
  }

  .function, .python .decorator, .python .title, .ruby .function .title, .ruby .title .keyword, .perl .sub, .javascript .title, .coffeescript .title {
    color: $highlight-blue;
  }

  .keyword, .javascript .function {
    color: $highlight-purple;
  }
}
