/*
 * Styles for markup that pandoc emits and Python-Markdown did not: fenced code blocks
 * highlighted by skylighting (pandoc's built-in highlighter) and citeproc bibliographies.
 * syntax.css still covers Pygments markup (.highlight); the token colours below reuse its
 * palette so that code blocks look the same as before the switch to pandoc.
 */

/* Code blocks. Mirrors ".highlight pre code" in syntax.css, for every fenced block: pandoc
 * wraps highlighted blocks in div.sourceCode and leaves plain ones as bare pre > code. */
pre > code {
  display: block;
  white-space: pre;
  overflow-x: auto;
  word-wrap: normal;
  padding: 0.6rem;
}

div.sourceCode {
  margin-bottom: 1rem;
  border-radius: 4px;
}

pre.sourceCode {
  margin-bottom: 0;
}

/* Skylighting's own structural rules, as pandoc's standalone template emits them. Lower
   specificity first so stylelint's no-descending-specificity is satisfied; the cascade is the
   same either way because the selectors differ in specificity, not in order. */
code.sourceCode > span {
  color: inherit;
  text-decoration: inherit;
}

pre > code.sourceCode {
  position: relative;
}

pre > code.sourceCode > span {
  display: inline-block;
  line-height: 1.25;
}

pre > code.sourceCode > span:empty {
  height: 1.2em;
}

@media print {
  pre > code.sourceCode {
    white-space: pre-wrap;
  }

  pre > code.sourceCode > span {
    text-indent: -5em;
    padding-left: 5em;
  }
}

/* Token classes, with syntax.css's Pygments colours. */
code span.al { color: #a00; font-weight: bold; }              /* Alert          <- Error           */
code span.an { color: #999; font-style: italic; }             /* Annotation     <- Comment         */
code span.at { color: #4f9fcf; }                              /* Attribute      <- Name.Attribute  */
code span.bn { color: #f60; }                                 /* BaseN          <- Literal.Number  */
code span.bu { color: #366; }                                 /* BuiltIn        <- Name.Builtin    */
code span.cf { color: #069; }                                 /* ControlFlow    <- Keyword         */
code span.ch { color: #c30; }                                 /* Char           <- String.Char     */
code span.cn { color: #360; }                                 /* Constant       <- Name.Constant   */
code span.co { color: #999; }                                 /* Comment        <- Comment         */
code span.cv { color: #999; font-style: italic; }             /* CommentVar     <- Comment         */
code span.do { color: #c30; font-style: italic; }             /* Documentation  <- String.Doc      */
code span.dt { color: #078; }                                 /* DataType       <- Keyword.Type    */
code span.dv { color: #f60; }                                 /* DecVal         <- Literal.Number  */
code span.er { color: #a00; background-color: #faa; }         /* Error          <- Error           */
code span.fl { color: #f60; }                                 /* Float          <- Literal.Number  */
code span.fu { color: #c0f; }                                 /* Function       <- Name.Function   */
code span.im { color: #069; }                                 /* Import         <- Keyword         */
code span.in { color: #999; font-style: italic; }             /* Information    <- Comment         */
code span.kw { color: #069; }                                 /* Keyword        <- Keyword         */
code span.op { color: #555; }                                 /* Operator       <- Operator        */
code span.ot { color: #069; }                                 /* Other          <- Keyword         */
code span.pp { color: #099; }                                 /* Preprocessor   <- Comment.Preproc */
code span.sc { color: #c30; }                                 /* SpecialChar    <- String.Escape   */
code span.ss { color: #fc3; }                                 /* SpecialString  <- String.Symbol   */
code span.st { color: #c30; }                                 /* String         <- String.Double   */
code span.va { color: #033; }                                 /* Variable       <- Name.Variable   */
code span.vs { color: #c30; }                                 /* VerbatimString <- String.Other    */
code span.wa { color: #999; font-style: italic; }             /* Warning        <- Comment         */

/* Bibliographies from pandoc's citeproc. With a numeric CSL style each entry is a
 * .csl-left-margin ("[1]") followed by a .csl-right-inline, laid out as a hanging list. */
div#refs {
  margin-bottom: 1rem;
}

div.csl-entry {
  display: flex;
  margin-bottom: 0.5rem;
}

div.csl-left-margin {
  flex: none;
  min-width: 2.5em;
}

div.csl-right-inline {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

/* Author-date styles use a hanging indent instead of the two columns. */
.hanging-indent div.csl-entry {
  display: block;
  margin-left: 2em;
  text-indent: -2em;
}

/* Inline citation markers, e.g. [1], link to their entry. */
span.citation a {
  text-decoration: none;
}
