/* https://github.com/richleland/pygments-css/blob/master/monokai.css */

/*
* Monokai Colors
*/
$monokai-bg: #272822;
$monokai-border: #555;
$monokai-text-color: #f8f8f2;
$monokai-line-num-color: rgba(255, 255, 255, 0.3);
$monokai-line-num-color-new: #707565;
$monokai-line-num-color-old: #7e736f;
$monokai-line-empty-bg: #49483e;
$monokai-line-empty-border: darken($monokai-line-empty-bg, 15%);
$monokai-diff-border: #808080;
$monokai-highlight-bg: #ffe792;
$monokai-over-bg: #9f9ab5;
$monokai-expanded-bg: #3e3e3e;

$monokai-new-bg: rgba(166, 226, 46, 0.1);
$monokai-new-idiff: rgba(166, 226, 46, 0.15);

$monokai-old-bg: rgba(254, 147, 140, 0.15);
$monokai-old-idiff: rgba(254, 147, 140, 0.2);

$monokai-hll: #49483e;
$monokai-c: #75715e;
$monokai-err-color: #960050;
$monokai-err-bg: #1e0010;
$monokai-k: #66d9ef;
$monokai-l: #ae81ff;
$monokai-n: #f8f8f2;
$monokai-o: #f92672;
$monokai-p: #f8f8f2;
$monokai-cm: #75715e;
$monokai-cp: #75715e;
$monokai-c1: #75715e;
$monokai-cs: #75715e;
$monokai-kc: #66d9ef;
$monokai-kd: #66d9ef;
$monokai-kn: #f92672;
$monokai-kp: #66d9ef;
$monokai-kr: #66d9ef;
$monokai-kt: #66d9ef;
$monokai-ld: #e6db74;
$monokai-m: #ae81ff;
$monokai-s: #e6db74;
$monokai-na: #a6e22e;
$monokai-nb: #f8f8f2;
$monokai-nc: #a6e22e;
$monokai-no: #66d9ef;
$monokai-nd: #a6e22e;
$monokai-ni: #f8f8f2;
$monokai-ne: #a6e22e;
$monokai-nf: #a6e22e;
$monokai-nl: #f8f8f2;
$monokai-nn: #f8f8f2;
$monokai-nx: #a6e22e;
$monokai-py: #f8f8f2;
$monokai-nt: #f92672;
$monokai-nv: #f8f8f2;
$monokai-ow: #f92672;
$monokai-w: #f8f8f2;
$monokai-mf: #ae81ff;
$monokai-mh: #ae81ff;
$monokai-mi: #ae81ff;
$monokai-mo: #ae81ff;
$monokai-sb: #e6db74;
$monokai-sc: #e6db74;
$monokai-sd: #e6db74;
$monokai-s2: #e6db74;
$monokai-se: #ae81ff;
$monokai-sh: #e6db74;
$monokai-si: #e6db74;
$monokai-sx: #e6db74;
$monokai-sr: #e6db74;
$monokai-s1: #e6db74;
$monokai-ss: #e6db74;
$monokai-bp: #f8f8f2;
$monokai-vc: #f8f8f2;
$monokai-vg: #f8f8f2;
$monokai-vi: #f8f8f2;
$monokai-il: #ae81ff;
$monokai-gu: #75715e;
$monokai-gd: #f92672;
$monokai-gi: #a6e22e;

.code.monokai {
  // Line numbers
  .line-numbers,
  .diff-line-num {
    background-color: $monokai-bg;
  }

  .diff-line-num,
  .diff-line-num a {
    color: $monokai-line-num-color;
  }

  // Code itself
  pre.code,
  .diff-line-num {
    border-color: $monokai-border;
  }

  &,
  pre.code,
  .line_holder .line_content {
    background-color: $monokai-bg;
    color: $monokai-text-color;
  }

  // Diff line
  .line_holder {
    &.match .line_content {
      @include dark-diff-match-line;
    }

    td.diff-line-num.hll:not(.empty-cell),
    td.line_content.hll:not(.empty-cell) {
      background-color: $monokai-line-empty-bg;
      border-color: $monokai-line-empty-border;
    }

    .diff-line-num.new,
    .line_content.new {
      @include diff_background($monokai-new-bg, $monokai-new-idiff, $monokai-diff-border);

      &::before,
      a {
        color: $monokai-line-num-color-new;
      }
    }

    .diff-line-num.old,
    .line_content.old {
      @include diff_background($monokai-old-bg, $monokai-old-idiff, $monokai-diff-border);

      &::before,
      a {
        color: $monokai-line-num-color-old;
      }
    }

    .diff-line-num {
      &.is-over,
      &.hll:not(.empty-cell).is-over {
        background-color: $monokai-over-bg;
        border-color: darken($monokai-over-bg, 5%);

        a {
          color: darken($monokai-over-bg, 15%);
        }
      }
    }

    .line_content.match {
      @include dark-diff-match-line;
    }

    &:not(.diff-expanded) + .diff-expanded,
    &.diff-expanded + .line_holder:not(.diff-expanded) {
      > .diff-line-num,
      > .line_content {
        border-top: 1px solid $black;
      }
    }

    &.diff-expanded {
      > .diff-line-num,
      > .line_content {
        background: $monokai-expanded-bg;
        border-color: $monokai-expanded-bg;
      }
    }
  }

  // highlight line via anchor
  pre .hll {
    background-color: $monokai-hll !important;
  }

  // Search result highlight
  span.highlight_word {
    background-color: $monokai-highlight-bg !important;
    color: $black !important;
  }

  // Links to URLs, emails, or dependencies
  .line a {
    color: $monokai-k;
  }

  .hll { background-color: $monokai-hll; }
  .c { color: $monokai-c; } /* Comment */
  .err { color: $monokai-err-color; background-color: $monokai-err-bg; } /* Error */
  .k { color: $monokai-k; } /* Keyword */
  .l { color: $monokai-l; } /* Literal */
  .n { color: $monokai-n; } /* Name */
  .o { color: $monokai-o; } /* Operator */
  .p { color: $monokai-p; } /* Punctuation */
  .cm { color: $monokai-cm; } /* Comment.Multiline */
  .cp { color: $monokai-cp; } /* Comment.Preproc */
  .c1 { color: $monokai-c1; } /* Comment.Single */
  .cs { color: $monokai-cs; } /* Comment.Special */
  .ge { font-style: italic; } /* Generic.Emph */
  .gs { font-weight: bold; } /* Generic.Strong */
  .kc { color: $monokai-kc; } /* Keyword.Constant */
  .kd { color: $monokai-kd; } /* Keyword.Declaration */
  .kn { color: $monokai-kn; } /* Keyword.Namespace */
  .kp { color: $monokai-kp; } /* Keyword.Pseudo */
  .kr { color: $monokai-kr; } /* Keyword.Reserved */
  .kt { color: $monokai-kt; } /* Keyword.Type */
  .ld { color: $monokai-ld; } /* Literal.Date */
  .m { color: $monokai-m; } /* Literal.Number */
  .s { color: $monokai-s; } /* Literal.String */
  .na { color: $monokai-na; } /* Name.Attribute */
  .nb { color: $monokai-nb; } /* Name.Builtin */
  .nc { color: $monokai-nc; } /* Name.Class */
  .no { color: $monokai-no; } /* Name.Constant */
  .nd { color: $monokai-nd; } /* Name.Decorator */
  .ni { color: $monokai-ni; } /* Name.Entity */
  .ne { color: $monokai-ne; } /* Name.Exception */
  .nf { color: $monokai-nf; } /* Name.Function */
  .nl { color: $monokai-nl; } /* Name.Label */
  .nn { color: $monokai-nn; } /* Name.Namespace */
  .nx { color: $monokai-nx; } /* Name.Other */
  .py { color: $monokai-py; } /* Name.Property */
  .nt { color: $monokai-nt; } /* Name.Tag */
  .nv { color: $monokai-nv; } /* Name.Variable */
  .ow { color: $monokai-ow; } /* Operator.Word */
  .w { color: $monokai-w; } /* Text.Whitespace */
  .mf { color: $monokai-mf; } /* Literal.Number.Float */
  .mh { color: $monokai-mh; } /* Literal.Number.Hex */
  .mi { color: $monokai-mi; } /* Literal.Number.Integer */
  .mo { color: $monokai-mo; } /* Literal.Number.Oct */
  .sb { color: $monokai-sb; } /* Literal.String.Backtick */
  .sc { color: $monokai-sc; } /* Literal.String.Char */
  .sd { color: $monokai-sd; } /* Literal.String.Doc */
  .s2 { color: $monokai-s2; } /* Literal.String.Double */
  .se { color: $monokai-se; } /* Literal.String.Escape */
  .sh { color: $monokai-sh; } /* Literal.String.Heredoc */
  .si { color: $monokai-si; } /* Literal.String.Interpol */
  .sx { color: $monokai-sx; } /* Literal.String.Other */
  .sr { color: $monokai-sr; } /* Literal.String.Regex */
  .s1 { color: $monokai-s1; } /* Literal.String.Single */
  .ss { color: $monokai-ss; } /* Literal.String.Symbol */
  .bp { color: $monokai-bp; } /* Name.Builtin.Pseudo */
  .vc { color: $monokai-vc; } /* Name.Variable.Class */
  .vg { color: $monokai-vg; } /* Name.Variable.Global */
  .vi { color: $monokai-vi; } /* Name.Variable.Instance */
  .il { color: $monokai-il; } /* Literal.Number.Integer.Long */
  .gu { color: $monokai-gu; } /* Generic.Subheading & Diff Unified/Comment? */
  .gd { color: $monokai-gd; } /* Generic.Deleted & Diff Deleted */
  .gi { color: $monokai-gi; } /* Generic.Inserted & Diff Inserted */
}