/**
 * (c) 2013 Rob Wu <rob@robwu.nl>
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * Style sheet to support prettified CSS.
 * Syntax highlighting for prism.js.
 * Tokens defined at https://prismjs.com/tokens
 *
 * Additionally, this sheet provides the following:
 * - Line numbers always fit
 * - Light stripes
 * - Highlight on hover
 */

@media (prefers-color-scheme: light) {
  /**
   * Light theme based on https://github.com/LukeAskew/prism-github
   * with modifications to minimize use of unnecessary expensive selectors.
   *
   * For more info on Github's colors, see
   * https://github.com/Rob--W/crxviewer/issues/40#issuecomment-4763398080
   *
   * Assumes a light background color (white).
   */
  .token.comment,
  .token.prolog,
  .token.doctype,
  .token.cdata {
    color: #969896;
  }
  .token.punctuation,
  .token.string,
  .token.atrule,
  .token.attr-value {
    color: #183691;
  }
  .token.property,
  .token.tag {
    color: #63a35c;
  }
  .token.boolean,
  .token.number {
    color: #0086b3;
  }
  .token.selector,
  .token.attr-name,
  .token.keyword,
  .token.regex,
  .token.important {
    color: #a71d5d;
  }
  .token.operator,
  .token.entity,
  .token.url {
    color: #a71d5d;
  }

  .namespace {
    opacity: 0.7;
  }

  /* Not part of prism theme, but to help with keeping track of lines in source code */
  .odd-code-line {
    background: #F7F7F7;
  }
  li:hover {
    background: #EEE;
  }
}

@media (prefers-color-scheme: dark) {
  /**
   * prism.js's Tomorrow Night theme from
   * https://github.com/PrismJS/prism/blob/b8180e334ec391b034f4b599beaef771be985f0f/src/themes/tomorrow.css
   * which in turn is based on https://github.com/chriskempson/tomorrow-theme
   *
   * Assumes a light background color (theme originally defined for #2d2d2d,
   * but in practice we use the default Canvas in dark theme, i.e. black).
   */
  .token.comment,
  .token.block-comment,
  .token.prolog,
  .token.doctype,
  .token.cdata {
    color: #999;
  }

  .token.punctuation {
    color: #ccc;
  }

  .token.tag,
  .token.attr-name,
  .token.namespace,
  .token.deleted {
    color: #e2777a;
  }

  .token.function-name {
    color: #6196cc;
  }

  .token.boolean,
  .token.number,
  .token.function {
    color: #f08d49;
  }

  .token.property,
  .token.class-name,
  .token.constant,
  .token.symbol {
    color: #f8c555;
  }

  .token.selector,
  .token.important,
  .token.atrule,
  .token.keyword,
  .token.builtin {
    color: #cc99cd;
  }

  .token.string,
  .token.char,
  .token.attr-value,
  .token.regex,
  .token.variable {
    color: #7ec699;
  }

  .token.operator,
  .token.entity,
  .token.url {
    color: #67cdcc;
  }

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

  .token.entity {
    cursor: help;
  }

  .token.inserted {
    color: green;
  }

  /* Not part of prism theme, but to help with keeping track of lines in source code */
  .odd-code-line {
    background: #1d1d1d;
  }
  li:hover {
    background: #2d2d2d;
  }
}

/*
 * Set the left margin depending on the total number of lines
 * Current set-up = <1ch space before> <linenumber> <dot> <1ch space after>
 */
.linenums     > ol { padding-left: 0; margin: 0; }
.linenumsltE1 > ol { padding-left: 2.2rem; }
.linenumsltE2 > ol { padding-left: 2.7rem; }
.linenumsltE3 > ol { padding-left: 3.2rem; }
.linenumsltE4 > ol { padding-left: 3.7rem; }
.linenumsltE5 > ol { padding-left: 4.2rem; }
.linenumsltE6 > ol { padding-left: 4.7rem; }
.linenumsltE7 > ol { padding-left: 5.2rem; }
.linenumsltE8 > ol { padding-left: 5.7rem; }
.linenumsltE9 > ol { padding-left: 6.2rem; }
/* 999,999,999 lines, want more...? */
