/**
 * @author Joel Espinosa Longi
 * @licencia Atribución-CompartirIgual 4.0 Internacional  - https://creativecommons.org/licenses/by-sa/4.0/deed.es
 */

@import "loader.css";

:root {
  --pages_container_width: 1280px;
  --pages_container_height: 825px;
  --left_right_margin_pages: 30px;

  /* --page_width = --pages_container_width / 2 */
  --page_width: 640px; 

  --page-left-margin: 50px;
  --page-right-margin: 50px;
  --page-top-margin: 50px;
  --page-bottom-margin: 20px;

  --interactive-margin: 15px;
}

/* colors definition */
/* Light colors */
body {
  --book-background-color: #ecf0f1;
  --page_color: #ffffff;
  --text-color: #000000;
  --toc-text-color: #273c75;
  --toc-over-color: #cfe9fc;
  --toc-number-color: #192a56;
  --h1-color: #0089cd;
  --h2-color: #000099;
  --h3-color: #000099;
  --h4-color: #000099;
  --link-text-color: #3867d6;
  --note-color: #3867d6;
  --note-text-color: #1e272e;
  --tooltip-color: #ecf0f1;
  --tooltip-text-color: #130f40;
  --tooltip-border-color: rgba(0,0,0,0.5);
  --interactive-color: #ffffff;
  --interactive-border-color: #2ecc71;
  --image-border-color: #2ecc71;
  --page-separation-color: #e5e5e5;
  --bibliography-color: #0089cd;
  --figcaption-text: #34495e;
  --popup-bib-info-background: #c7ecee;

  --toc-button-border: #8e9091;
  --switch-background-color: #ffffff;
}
/* dark colors */
body.dark {
  --book-background-color: #34495e;
  --page_color: #1e1e1e;
  --text-color: #d4d4d4;
  --toc-text-color: #dddddd;
  --toc-over-color: #34495e;
  --toc-number-color: #bbbbbb;
  --h1-color: #358cd6;
  --h2-color: #4fb8fe;
  --h3-color: #4fb8fe;
  --h4-color: #4fb8fe;
  --link-text-color: #c39178;
  --note-color: #3867d6;
  --note-text-color: #d4d4d4;
  --tooltip-color: #30336b;
  --tooltip-text-color: #dff9fb;
  --tooltip-border-color: rgba(255,255,255,0.5);
  --interactive-color: #2c3e50;
  --interactive-border-color: #ecf0f1;
  --image-border-color: #ecf0f1;
  --page-separation-color: #4b4b4b;
  --bibliography-color: #48dbfb;
  --figcaption-text: #bcbcbc;
  --popup-bib-info-background: #30336b;

  --toc-button-border: #85929e;
  --switch-background-color: #2d3436;
}

/** reset styles */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}
/** end of reset code */

html {
  box-sizing: border-box;
  font-size: 20px;
  height: -webkit-fill-available;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  color: var(--text-color);
  --maximize-color: var(--interactive-color);
  --config-button-border: var(--toc-button-border);
  line-height: 1.24;
}
#book_container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;  
  max-height: 100vh;
  max-height: -webkit-fill-available;  
  background-color: var(--book-background-color);
}
.page {
  position: relative;
  background-color: var(--page_color);
  text-align: justify;
  width:  var(--page_width);
  min-width:  var(--page_width);
  height: var(--pages_container_height);
  padding: var(--page-top-margin) var(--page-right-margin) var(--page-bottom-margin) var(--page-left-margin);
  overflow: hidden;
}

.page_viewer {
  transform-origin: 0 0 0;
}
#pages_container {
  transition: all 0.35s;
  -webkit-transition: all 0.3s;
}

pageref {
  text-decoration: underline;
  color: var(--link-text-color);
  cursor: pointer;
}
pageref, ref {
  display: inline;
}

.toc_link {
  --dotted-color: var(--text-color);
  --tmp-over-color: var(--toc-over-color);
  display: block;
  position: relative;
  font-size: 95%;
  margin: 0;
  padding: 0.25em 0;
  cursor: pointer;
}
.toc_link::before {
  content: "";
  position: absolute;
  left: 2em;
  right: 0;
  top: 18px;
  height: 3px;
  z-index: 0;
  border-bottom: 2px dotted var(--dotted-color);
}

.toc_link[level="0"] {
  font-weight: bold;
}
.toc_link[level="0"]::before {
  left: 0;
}

.toc_link[level="1"] {
  padding-left: 1em;
}
.toc_link[level="1"]::before {
  left: 1em;
}

.toc_link[level="2"] {
  padding-left: 2em;
}
.toc_link[level="2"]::before {
  left: 2em;
}

.toc_link[level="3"] {
  padding-left: 3em;
}
.toc_link[level="3"]::before {
  left: 3em;
}

.toc_link[level="4"] {
  padding-left: 4em;
}
.toc_link[level="4"]::before {
  left: 4em;
}

.toc_link:hover,
.toc_link:hover a,
.toc_link:hover .toc_number,
.toc_link:hover a > span:first-child {
  background-color: var(--tmp-over-color);
}

.toc_link a > span:first-child {
  position: relative;
  color: var(--toc-text-color);
  background-color: var(--page_color);
  display: inline-block;
  max-width: 90%;
  padding-right: 0.2em;
  z-index: 1;
}

.toc_number {
  position: relative;
  color: var(--toc-number-color);
  background-color: var(--page_color);
  float: right;
  padding-left: 0.2em;
  z-index: 1;
}

.page_number {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  font-weight: bold;
  font-size: 80%;
  line-height: 1.2em;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.footnote {
  display: block;
  line-height: 1.24;
  margin-bottom: 0.5em;
}

.footnote::before {
  content: attr(number);
  font-weight: bold;
  position: absolute;
  display: inline;
  font-size: 70%;
  margin-top: -3px;
  right: 530px;
}

.footnote_container {
  position: absolute;
  width: calc(100% - var(--page-left-margin) - var(--page-right-margin));
  bottom: 40px;
  font-size: 75%;
  border-top: 2px solid #3c6382;
  padding: 5px 0 0 1em;
}

.footnote_ref {
  font-weight: bold;
}

/*  */
sup, sub {
  font-size: 65%;
}
b {
  font-weight: bold;
}
i {
  font-style: italic;
}
strong {
  font-weight: bold;
}
h1, h2, h3, h4, p {
  padding: 0;
}
h1 {
  margin: 0 0 0.7em 0;
  color: var(--h1-color);
  font-size: 160%;
  font-weight: bold;
}
h2 {
  margin: 0 0 0.7em 0;
  color: var(--h2-color);
  font-size: 140%;
  font-weight: bold;
}
h3 {
  margin: 0 0 0.7em 0;
  color: var(--h3-color);
  font-size: 125%;
  font-weight: bold;
}
h4 {
  color: var(--h4-color);
  margin: 0 0 1em 0;
  font-size: 110%;
}
p {
  margin: 0 0 1em 0;
}
ol, ul {
  margin: 1em 1em;
  padding: 0;
  padding-left: 4ch;
  line-height: 1.2;
}
ul ul,
ul ol,
ol ul,
ol ol {
  margin-top: 0;
  margin-bottom: 0;
}
a, code {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
pre code {
  white-space: pre-wrap;
}
code {
  margin: 0;
  padding: 0;
}
tbody, tr, th, td {
  border: inherit;
}

.note, .num_block {
  margin: 0 0 1em 0;
  padding-left: 1.5ch;
  line-height: 1.2;
}
.note {
  padding-right: 1.5ch;
  font-size: 90%;
}
.num_block_prefix {
  font-weight: bold;
  font-style: italic;
}

.image_expand {
  display: block;
  margin: 0 auto 1em auto;
  cursor: pointer;
}

.image_link {
  position: relative;
  display: block;
  cursor: pointer;
  margin: 0 auto 1em auto;
}

body.dark img,
body.dark iframe {
  filter: contrast(0.90) brightness(0.90);
}

iframe {
  border: none;
}

video {
  display: block;
  margin: 0 auto 1em auto;
}

.btn_expand, .btn_link {
  position: absolute;
  text-align: left;
  width: 30px;
  height: 30px;
  z-index: 10;
  right: 2px;
  top: 1px;
  outline: none;
  border: 1px solid var(--config-button-border);
  border-radius: 4px;
  background-color: var(--book-background-color);
  background-repeat: no-repeat;
  background-size: 75%;
  background-position: center;
  cursor: pointer;
  transform: translate3d(0,0,0);
}

.interactive {
  box-sizing: border-box;
  position: relative;
  margin: 0 auto 1em auto;
  padding: var(--interactive-margin);
  -webkit-overflow-scrolling: touch;
  overflow-y: scroll;
  transform: translate3d(0,0,0);
  
  display: flex;
  align-items: center;
  justify-content: center;
}

figure {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 0 auto 1em auto;
}

figcaption {
  text-align: center;
  font-size: 80%;
  margin-top: 0.5em;
}
.figcaption_prefix {
  font-weight: bold;
}

.popup_bib_info {
  --m: 200px;
  position: fixed;
  display: none;
  left: var(--m);
  right: var(--m);
  min-height: 35px;
  top: 5px;
  background-color: var(--popup-bib-info-background);
  padding: 0.5em 50px 0.5em 1em;
  border-radius: 5px;
  border-bottom: 1px solid var(--toc-button-border);
  color: var(--text-color);
  font-size: 85%;
}
.popup_bib_info button {
  position: absolute;
  right: 0;
  top: 0;
  width: 35px;
  height: 35px;
  border: none;
  outline: none;
  cursor: pointer;
  background-color: transparent;
  font-size: 30px;
  color: var(--text-color);
}

bibref {
  display: inline;
  position: relative;
  color: var(--bibliography-color);
  border-bottom: 1px dashed var(--bibliography-color);
  cursor: pointer;
}
bibref .popup[active] {
  display: block;
}
bibitem {
  display: block;
  padding-bottom: 1em;
  text-indent: -3.5ch;
  padding-left: 3.5ch;
}
.bibitem_title {
  font-style: italic;
  font-weight: bold;
}
.bibitem_id {
  margin-right: 0.5em;
}

#config_options {
  position: absolute;
  display: none;
  right: 5px;
  top: 40px;
  z-index: 1;
  background-color: var(--book-background-color);
  border: 1px solid var(--toc-button-border);
  border-radius: 4px;
  padding: 10px 20px;
}
#config_options div {
  padding-top: 10px;
  align-items: center;
}
#config_options div:first-child {
  padding-top: 0;
}

#config_options button {
  outline: none;
  border: none;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: 80%;
  background-position: center;
}
#config_options #dark_light_mode div {
  display: flex;
}

#btn_dark, #btn_light {
  width: 35px;
  height: 35px;
}

.switch {
  position: relative;
  -webkit-appearance: none;
  outline: none;
  width: 50px;
  height: 30px;
  background-color: var(--switch-background-color);
  border: 1px solid #D9DADC;
  border-radius: 50px;
  box-shadow: inset -20px 0 0 0 var(--switch-background-color);
  margin: 0 1em;
  cursor: pointer;
}
.switch:after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  background-color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: 2px 4px 6px rgba(0,0,0,0.4);
}
.switch:checked {
  box-shadow: inset 20px 0 0 0 #4ed164;
  border-color: #4ed164;
}
.switch:checked:after {
  left: 21px;
  box-shadow: -2px 4px 3px rgba(0,0,0,0.05);
}

/* change theme images */
body #btn_config {
  background-image: url("img/config.svg");
}
body.dark #btn_config {
  background-image: url("img/config_dark.svg");
}
body #go_to_table_of_content {
  background-image: url("img/table_of_content.svg");
}
body.dark #go_to_table_of_content {
  background-image: url("img/table_of_content_dark.svg");
}
body #close_to_table_of_content {
  background-image: url("img/cerrar.svg");
}
body.dark #close_to_table_of_content {
  background-image: url("img/cerrar_dark.svg");
}
body .btn_expand {
  background-image: url("img/ampliar.svg");
}
body.dark .btn_expand {
  background-image: url("img/ampliar_dark.svg");
}
body .btn_link {
  background-image: url("img/link.svg");
}
body.dark .btn_link {
  background-image: url("img/link_dark.svg");
}
body #btn_dark {
  background-image: url("img/moon.svg");
}
body.dark #btn_dark {
  background-image: url("img/moon_dark.svg");
}
body #btn_light {
  background-image: url("img/sun.svg");
}
body.dark #btn_light {
  background-image: url("img/sun_dark.svg");
}

/*  */
div:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
}
div:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
}
div:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
}
div:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
}
div:fullscreen .btn_expand {
  background-image: url("img/cerrar.svg");
  width: 35px;
  height: 35px;
}
div:-webkit-full-screen .btn_expand {
  background-image: url("img/cerrar.svg");
  width: 35px;
  height: 35px;
}
div:-moz-full-screen .btn_expand {
  background-image: url("img/cerrar.svg");
  width: 35px;
  height: 35px;
}
div:-ms-fullscreen .btn_expand {
  background-image: url("img/cerrar.svg");
  width: 35px;
  height: 35px;
}
body.dark div:fullscreen .btn_expand {
  background-image: url("img/cerrar_dark.svg");
  width: 35px;
  height: 35px;
}
body.dark div:-webkit-full-screen .btn_expand {
  background-image: url("img/cerrar_dark.svg");
  width: 35px;
  height: 35px;
}
body.dark div:-moz-full-screen .btn_expand {
  background-image: url("img/cerrar_dark.svg");
  width: 35px;
  height: 35px;
}
body.dark div:-ms-fullscreen .btn_expand {
  background-image: url("img/cerrar_dark.svg");
  width: 35px;
  height: 35px;
}
/*  */

.page *:first-child {
  margin-top: 0;
}

p {
  line-height: 1.225;
}
div {
  line-height: 1.18;
}
xmp {
  line-height: 1;
}

table, tr, td {
  vertical-align: top;
}
table {
  margin: 0 auto 1em 0;
}

br {
  line-height: 1em;
}

.PDF_anchor {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  /* background-image: url("img/interactive.svg"); */

  background-color: transparent !important;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}
.break {
  word-break: break-all;
}
.fullwindow {
  width: auto !important;
  height: auto !important;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
}

.tooltip_container {
  position: relative;
  display: inline;
  text-decoration: 1px underline var(--text-color);
  border-bottom: 1px solid var(--text-color);
  cursor: default;
}
.tooltip_container .tooltip {
  visibility: hidden;
  width: 200px;
  max-width: var(--page_width);
  background-color: var(--tooltip-color);
  color: var(--tooltip-text-color);
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 0 5px 6px var(--tooltip-border-color);
  position: absolute;
  z-index: 1;
  top: calc(100% + 5px);
  left: 0;
}
.tooltip_left {
  left: 0px !important;
  transform: none !important;
}
.tooltip_right {
  right: -5px !important;
  left: unset !important;
  transform: none !important;
}
.tooltip_top {
  top: unset !important;
  bottom: calc(100% + 5px) !important;
}
.tooltip_container .tooltip::before {
  content: " ";
  position: absolute;
  bottom: 100%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent var(--tooltip-color) transparent;
  left: var(--w1, 50%);
}
.tooltip_top::before {
  border-color: var(--tooltip-color) transparent transparent transparent !important;
  bottom: unset;
  top: 100%;
}
.tooltip_container:hover .tooltip {
  visibility: visible;
}


.popup {
  text-decoration: 1px underline var(--text-color);
  cursor: pointer;
}
#popup_container {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  padding: 50px;
  background-color: rgba(0,0,0,0.5);
  z-index: 1;
}
.popup_inner {
  max-height: 100%;
  width: 100%;
  background: var(--page_color);
  position: relative;
}
#popup_btn_cerrar {
  background-image: url("img/cerrar.svg");
  position: absolute;
  right: 5px;
  top: 5px;
  cursor: pointer;
  outline: none;
  border: 1px solid var(--toc-button-border);
  border-radius: 4px;
  width: 35px;
  height: 35px;
  z-index: 1;
  background-color: var(--book-background-color);
  background-repeat: no-repeat;
  background-size: 90%;
  background-position: center;
  padding: 0;
}

/* Style for screen  */
@media screen {
  body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }

  #go_to_table_of_content {
    position: absolute;
    left: 5px;
    top: 5px;
    cursor: pointer;
    outline: none;
    border: 1px solid var(--toc-button-border);
    border-radius: 4px;
    width: 35px;
    height: 35px;
    z-index: 1;
    background-color: var(--book-background-color);
    background-repeat: no-repeat;
    background-size: 90%;
    background-position: center;
    padding: 0;
  }

  #close_to_table_of_content {
    position: absolute;
    left: 5px;
    top: 5px;
    cursor: pointer;
    outline: none;
    border: 1px solid var(--toc-button-border);
    border-radius: 4px;
    width: 35px;
    height: 35px;
    z-index: 1;
    background-color: var(--book-background-color);
    background-repeat: no-repeat;
    background-size: 90%;
    background-position: center;
    padding: 0;
  }

  #btn_config {
    position: absolute;
    right: 5px;
    top: 5px;
    cursor: pointer;
    outline: none;
    border: 1px solid var(--config-button-border);
    border-radius: 4px;
    width: 35px;
    height: 35px;
    z-index: 1;
    background-color: var(--book-background-color);
    background-repeat: no-repeat;
    background-size: 80%;
    background-position: center;
    padding: 0;
  }

  #table_of_content {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;  
    max-height: 100vh;
    max-height: -webkit-fill-available; 
    background-color: var(--page_color);
    z-index: 5000;
    padding: 2.5em;
    overflow: auto;
    display: none;
    font-size: 2vmin;
  }
  #table_of_content .toc_link::before {
    top: 2vmin;
  }
  .toc_selected {
    --dotted-color: var(--toc-over-color);
    --tmp-over-color: var(--toc-text-color);

    border: 5px solid transparent;
    border-radius: 2px;
    background-color: var(--toc-text-color);
    color: var(--toc-over-color);
  }
  .toc_selected a > span:first-child,
  .toc_selected .toc_number {
    background-color: var(--toc-text-color);
    color: var(--toc-over-color);
  }

  #btn_back_page,
  #btn_next_page {
    position: absolute;
    width: 2.3vmax;
    height: 100%;
    top: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
    z-index: 1;
  }

  #btn_back_page {
    background-image: url("img/back.svg");
    left: 0;
  }

  #btn_next_page {
    background-image: url("img/next.svg");
    right: 0;
  }

  .page_viewer {
    position: absolute;
    overflow: hidden;
    height: var(--pages_container_height);
  }

  /* Style needed to help the rendering in chrome */
  .page[hide="true"] * {
    display: none;
  }

  #pages_container {
    position: absolute;
    display: flex;
    height: var(--pages_container_height);
  }

  #pages_container .page:nth-child(odd) {
    border-right: 1px solid rgba(155,100,20,0.1);
  }
  
    #pages_container .page:nth-child(even) {
    border-left: 0 solid rgba(155,100,20,0.1);
  }

  .PDF_anchor {
    display: none;
  }
}
 
/* Style for print */
@media print {
  @page {
    margin: 0cm;
    size: var(--page_width) var(--pages_container_height);
  }

  body {
    width: var(--page_width);
    height: var(--pages_container_height);
  }

  #go_to_table_of_content,
  #table_of_content,
  #btn_back_page,
  #btn_next_page,
  #btn_config,
  #config_options {
    display: none;
  }

  iframe {
    display: none;
  }

  .page {
    page-break-after: always !important;
  }

  .page_viewer {
    position: relative;
    transform: none !important;
    width: var(--page_width) !important;
    top: calc(-1 * var(--pages_container_height)) !important;
    left: 0px !important;
  }

  #pages_container {
    position: relative;
    background-color: transparent;
    left: 0px !important;
  }

  .PDF_anchor {
    display: inline-block;
  }
}
