/*

  BookML: bookdown flavoured GitBook port for LaTeXML
  Copyright (C) 2021-23 Vincenzo Mantova <v.l.mantova@leeds.ac.uk>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <https://www.gnu.org/licenses/>.

*/
/* from bookdown 'style.css' */
/* disabled in BookML
p.caption {
  color: #777;
  margin-top: 10px;
} */
p code {
  white-space: inherit; }

pre {
  word-break: normal;
  word-wrap: normal; }

pre code {
  white-space: inherit; }

p.flushright {
  text-align: right; }

blockquote > p:last-child {
  text-align: right; }

blockquote > p:first-child {
  text-align: inherit; }

.header-section-number {
  padding-right: .2em;
  font-weight: 500; }

.level1 .header-section-number {
  display: inline-block;
  border-bottom: 3px solid; }

.level1 h1 {
  border-bottom: 1px solid; }

h1, h2, h3, h4, h5, h6 {
  font-weight: normal; }

h1.title {
  font-weight: 700; }

.smallcaps {
  font-variant: small-caps; }

.book .book-body .page-wrapper .page-inner section.normal strong {
  font-weight: 600; }

/* BookML tweaks */
/* skip to content */
.bml-skip-to-content {
  display: block;
  padding: 0.5em;
  position: absolute;
  z-index: -999;
  left: -999px;
  top: -999px;
  font-weight: bold;
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  font-size: large;
  text-decoration: underline; }
  .bml-skip-to-content, .bml-skip-to-content:visited, .bml-skip-to-content:active {
    background-color: #fff;
    color: #3B78B5; }
  .book.color-theme-1 .bml-skip-to-content, .book.color-theme-1 .bml-skip-to-content:visited {
    background-color: #f3eacb;
    border-color: #7e888b;
    color: #704214; }
  .book.color-theme-2 .bml-skip-to-content, .book.color-theme-2 .bml-skip-to-content:visited {
    background-color: #2d3143;
    border-color: #272a3a;
    color: #c1c6d7; }
  .bml-skip-to-content:focus, .bml-skip-to-content:active {
    left: 50%;
    top: 0;
    z-index: 999;
    transform: translateX(-50%);
    outline: auto; }

/* Disable sidebar if there is no table of contents */
.book.bml-no-navtoc:not(.with-search) .book-body, .book.bml-no-navtoc:not(.with-search) .book-header.fixed {
  left: 0; }

.book.bml-no-navtoc:not(.with-search) .book-summary, .book.bml-no-navtoc:not(.with-search) .book-header > a:first-of-type {
  display: none; }

/* Disable search bar if not active */
.book .book-summary .book-search {
  display: none; }

.book.with-search .book-summary .book-search {
  display: unset; }

/* Disable bottom border on titles below level 1 */
.level1 .level2 .header-section-number, .level1 h2 .header-section-number, .level1 h3 .header-section-number, .level1 h4 .header-section-number, .level1 h5 .header-section-number, .level1 h6 .header-section-number {
  border-bottom: revert; }

/* Fix paragraph size */
.book .book-body .page-wrapper .page-inner section.normal.ltx_paragraph .ltx_title_paragraph {
  font-size: 100%; }

.book .book-body .page-wrapper .page-inner section.normal.ltx_paragraph .ltx_title + .ltx_para + .ltx_para {
  margin-top: .85em; }

/* Remove bottom margin from chapter/appendix tags */
.ltx_title_appendix .ltx_tag,
.ltx_title_chapter .ltx_tag {
  margin-bottom: 0; }

/* <h6> is used for theorems, avoid the default faint gitbook colour */
.book .book-body .page-wrapper .page-inner section.normal h6, .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
  color: inherit; }

.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
  color: #fffffa; }

/* Disable section padding */
.book .book-body .page-wrapper .page-inner section {
  padding: 0px; }

/* Disable header number padding */
.header-section-number {
  padding-right: 0; }

/* Ensure the paragraphs are scrollable if necessary */
.ltx_para {
  overflow-x: auto;
  overflow-y: visible; }

/* ...except in a few places */
.ltx_item .ltx_para {
  overflow-x: revert;
  overflow-y: revert; }

/* Fix odd overlap between toolbar and body */
@media (max-width: 600px) {
  .book .book-body.fixed {
    top: 50px; } }

/* Adjust colours in sepia and night modes */
.book.color-theme-1 object[type="image/svg+xml" i], .book.color-theme-1 iframe[src$=".svg" i], .book.color-theme-1 img {
  filter: sepia(40%); }

.book.color-theme-2 object[type="image/svg+xml" i], .book.color-theme-2 iframe[src$=".svg" i], .book.color-theme-2 img {
  filter: invert(100%) saturate(70%) hue-rotate(180deg); }
  .book.color-theme-2 object[type="image/svg+xml" i].bml_no_invert, .book.color-theme-2 iframe[src$=".svg" i].bml_no_invert, .book.color-theme-2 img.bml_no_invert {
    filter: saturate(70%); }

/* do not apply filters twice, nor apply it to MathJax */
.book.color-theme-1 mjx-container object[type="image/svg+xml" i], .book.color-theme-1 mjx-container iframe[src$=".svg" i], .book.color-theme-1 mjx-container img, .book.color-theme-2 mjx-container object[type="image/svg+xml" i], .book.color-theme-2 mjx-container iframe[src$=".svg" i], .book.color-theme-2 mjx-container img {
  filter: revert; }

/* Fix <dt> margin (a GitBook bug?) */
.book .book-body .page-wrapper .page-inner section.normal dl dt {
  margin-top: 0; }

/* Tweak listings */
.ltx_listing {
  background-color: #f7f7f7;
  margin: 0 0 1.275em;
  padding: .85em 1em; }

.book.color-theme-1 .ltx_listing {
  background-color: #fdf6e3; }

.book.color-theme-2 .ltx_listing {
  background-color: #2d3143; }

/* Remove indentation on paragraphs */
.ltx_title_abstract + .ltx_p {
  text-indent: 0em !important; }

/* WCAG 2.1 AA 1.4.3: Contrast + link contrast from WCAG 2.0 */
.book .book-body .page-wrapper .page-inner section.normal a,
.ltx_note_mark {
  color: #3B78B5; }

.book .book-summary ul.summary li a:hover, .book .book-summary ul.summary li.active > a {
  color: #0073D1; }

/* make focus visible */
.book .book-summary ul.summary li a:hover, .book .book-summary ul.summary li a:focus-visible {
  text-decoration: underline; }

/* set left/right buttons to same color as the text, for better visibility */
.book .book-body .navigation {
  color: #333; }

.book.color-theme-1 .book-body .navigation {
  color: #704214; }

.book.color-theme-2 .book-body .navigation {
  color: #bdcadb; }

.book .book-body .page-wrapper .page-inner section.normal {
  color: #292929; }

.book .book-summary ul.summary li span {
  opacity: 0.8;
  filter: revert; }

.book .book-header .btn,
.dropdown-menu .buttons .button {
  color: #717171; }

/* Force LaTeX table borders over GitBook */
/* double in top borders is to win the border conflict resolution */
.ltx_border_t {
  border-top: 1px double !important; }

.ltx_border_r {
  border-right: 1px solid !important; }

.ltx_border_b {
  border-bottom: 1px solid !important; }

.ltx_border_l {
  border-left: 1px solid !important; }

.ltx_border_tt {
  border-top: 3px double !important; }

.ltx_border_rr {
  border-right: 3px double !important; }

.ltx_border_bb {
  border-bottom: 3px double !important; }

.ltx_border_ll {
  border-left: 3px double !important; }

.ltx_border_T {
  border-top: 1px double gray; }

.ltx_border_R {
  border-right: 1px solid gray; }

.ltx_border_B {
  border-bottom: 1px solid gray; }

.ltx_border_L {
  border-left: 1px solid gray; }

.book .book-body .page-wrapper .page-inner section.normal table tr:last-child td {
  border-bottom-width: 1px; }

/* Adjust and uniformise equation styling */
.book .book-body .page-wrapper .page-inner section.normal table td.ltx_eqn_cell, .book .book-body .page-wrapper .page-inner section.normal table th.ltx_eqn_cell {
  padding: 0.85em 0;
  line-height: normal; }

.book .book-body .page-wrapper .page-inner section.normal table tr > td:first-child.ltx_eqn_eqno {
  padding-left: 0.85em;
  line-height: normal; }

.book .book-body .page-wrapper .page-inner section.normal table tr > td:last-child.ltx_eqn_eqno {
  padding-right: 0.85em;
  line-height: normal; }

.ltx_equation.ltx_eqn_div {
  border-top: solid 1px #ddd;
  border-bottom: solid 1px #ddd;
  margin-bottom: 0.85em;
  max-width: 100%;
  min-height: 2.75em;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.85em; }
  .ltx_equation.ltx_eqn_div + .ltx_equation.ltx_eqn_div {
    border-top: none; }
  .ltx_runin + .ltx_para .ltx_equation.ltx_eqn_div, .ltx_runin + .ltx_para p .ltx_equation.ltx_eqn_div, .ltx_runin + p .ltx_equation.ltx_eqn_div {
    margin-top: 0.85em; }
  .book.color-theme-1 .ltx_equation.ltx_eqn_div {
    background-color: #fdf6e3;
    border-color: #f5d06c; }
  .book.color-theme-2 .ltx_equation.ltx_eqn_div {
    background-color: #2d3143;
    border-color: #3b3f54; }

mjx-container[jax="CHTML"][display="true"],
mjx-container[jax="SVG"][display="true"] {
  margin: 0 !important; }

/* lxFooter */
.bml_footer {
  border-top: solid 1px;
  margin-top: 0.85em;
  padding-top: 0.85em; }

/* do not resize images */
.book .book-body .page-wrapper .page-inner section.normal img {
  max-width: unset; }

/* adjust listings */
.book .book-body .page-wrapper .page-inner section.normal div.ltx_listing {
  /* set anchor for download button */
  position: relative;
  width: 100%;
  max-width: 100%;
  /* restore initial LaTeXML style */
  /* disable spaces */
  /* unset bookdown font size, restore spaces */
  /* adjust position of download button */ }
  .book .book-body .page-wrapper .page-inner section.normal div.ltx_listing.ltx_framed_rectangle {
    border-style: solid;
    border-width: 1px; }
  .book .book-body .page-wrapper .page-inner section.normal div.ltx_listing > pre {
    white-space: normal;
    margin: 0;
    padding: 0; }
  .book .book-body .page-wrapper .page-inner section.normal div.ltx_listing > pre > code {
    font-size: inherit;
    white-space: normal;
    display: block; }
  .book .book-body .page-wrapper .page-inner section.normal div.ltx_listing > .ltx_listing_data {
    margin-left: -100%; }

/* typeset line numbers within container */
.ltx_lst_numbers_left .ltx_listingline .ltx_tag {
  position: initial;
  display: inline-block;
  margin-left: 0;
  width: 1.7em; }

.book .book-body .page-wrapper .page-inner section.normal code.ltx_lstlisting {
  font-size: inherit;
  white-space: pre; }
  .book .book-body .page-wrapper .page-inner section.normal code.ltx_lstlisting::after, .book .book-body .page-wrapper .page-inner section.normal code.ltx_lstlisting::before {
    content: none; }

.bml-overflow-wrapper {
  max-width: 100%;
  width: 100%;
  overflow: auto; }

/* fix standard LaTeXML footnotes */
.ltx_note_content {
  padding-left: 1em; }
  .ltx_note_content .ltx_note_mark {
    position: relative;
    left: auto;
    top: -.5em; }
  .book.color-theme-1 .ltx_note_content {
    background-color: #fdf6e3;
    border-color: #f5d06c; }
  .book.color-theme-2 .ltx_note_content {
    background-color: #2d3143;
    border-color: #3b3f54;
    box-shadow: 5px 5px 10px black; }
  .ltx_note_content > .ltx_tag.ltx_tag_note {
    display: none; }

/* Disable certain bookdown styles that mess up SVGs generated by LaTeXML */
svg:not(:root)[overflow="visible"] {
  overflow: visible; }

svg foreignObject {
  letter-spacing: initial;
  line-height: initial;
  text-align: initial;
  text-size-adjust: initial; }

/* Adjust SVGs generated by LaTeXML to always match the font size */
.book.font-size-0 {
  --bml-font-size: 9; }

.book.font-size-1 {
  --bml-font-size: 8; }

.book.font-size-2 {
  --bml-font-size: 12; }

.book.font-size-3 {
  --bml-font-size: 16.5; }

.book.font-size-4 {
  --bml-font-size: 30; }
