/*

  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/>.

*/
/* Responsive margins are based on the simple rule 1.5% ~ 1em */
/* Reduce margins on lists and ensure consistent positioning of the tags */
/* TODO: this only works for ltr text, implement rtl alternative */
.ltx_itemize, .ltx_enumerate {
  margin-left: 0;
  padding-left: max(min(3.75%, 2.5em), 1.5em) !important;
  /* typical UA default is 40px = 2.5em */ }

li.ltx_item .ltx_tag {
  box-sizing: border-box;
  min-width: max(min(3.75%, 2.5em), 1.5em);
  /* same as padding-left */
  margin-left: min(max(-3.75%, -2.5em), -1.5em); }

ul.ltx_itemize > li.ltx_item > .ltx_tag {
  padding-right: max(min(1.05%, 0.7em), 0.4em);
  /* this seems the closest to default UA <ul>'s */ }

ol.ltx_enumerate > li.ltx_item > .ltx_tag {
  padding-right: max(min(0.5%, 0.3em), 0.2em);
  /* this seems the closest to default UA <ol>'s */ }

/* tweak margins within list items */
.book .book-body .page-wrapper .page-inner section.normal li.ltx_item > .ltx_para > .ltx_p {
  margin-bottom: 0em; }

/* Reduce margins on listings and ensure content fits the container */
.ltx_listing {
  margin-right: 0;
  max-width: 100%;
  width: 100%; }

/* Enlarge blockquote's */
.ltx_quote {
  width: 100%;
  max-width: 100%; }

/* Ensure that oversized figures are scrollable */
.ltx_figure {
  overflow-x: auto;
  overflow-y: visible; }

/* Reduce margins smoothly on small screens */
.ltx_abstract {
  margin-left: min(6%, 4em);
  margin-right: min(6%, 4em); }

dl.ltx_description dd {
  margin-left: min(7.5%, 5em); }

.ltx_toclist {
  padding-inline-start: min(3.75%, 2.5em);
  padding-left: min(3.75%, 2.5em) !important; }

/* Force no indentation */
.ltx_p {
  text-indent: 0em !important; }

/* Remove margins from first/last paragraphs in other containers */
/* The list of containers is likely not exhaustive */
td > .ltx_p:first-child,
th > .ltx_p:first-child {
  margin-top: 0 !important; }

td > .ltx_p:last-child,
th > .ltx_p:last-child {
  margin-bottom: 0 !important; }

/* Use flex for non-aligned equations */
.ltx_equation.ltx_eqn_div {
  display: flex;
  align-items: center;
  width: 100%;
  /* leqno */
  /* reqno */ }
  .ltx_equation.ltx_eqn_div > span:not(.ltx_tag) {
    flex: 1;
    text-align: center;
    display: block;
    width: 100%; }
  .ltx_equation.ltx_eqn_div > span:first-child.ltx_tag {
    width: 100%;
    margin-right: -100%; }
  .ltx_equation.ltx_eqn_div > span:last-child.ltx_tag {
    width: 100%;
    margin-left: -100%; }

/* Improve alignment of numbers in all tags (enumerate, equation numbers, ...) */
.ltx_tag {
  font-variant-numeric: tabular-nums; }
