/**
 * @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-left-margin: 50px;
  --page-right-margin: 50px;
  --page-top-margin: 30px;
  --page-bottom-margin: 20px;

  --interactive-margin: 30px;
}

/* 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;
  --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;
  --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%;
  /* height: 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: calc(var(--pages_container_width) / 2);
  min-width: calc(var(--pages_container_width) / 2);
  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-block;
}

.toc_link[level="0"] {
  font-weight: bold;
}
.toc_link[level="1"] {
  padding-left: 1em;
}
.toc_link[level="2"] {
  padding-left: 2em;
}
.toc_link[level="3"] {
  padding-left: 3em;
}
.toc_link[level="4"] {
  padding-left: 4em;
}

.toc_link {
  --dotted-color: var(--text-color);
  --tmp-over-color: var(--toc-over-color);
  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: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.67em 0;
  color: var(--h1-color);
  font-size: 160%;
  font-weight: bold;
}
h2 {
  margin: 0.7em 0;
  color: var(--h2-color);
  font-size: 140%;
  font-weight: bold;
}
h3 {
  margin: 1em 0;
  color: var(--h3-color);
  font-size: 125%;
  font-weight: bold;
}
h4 {
  color: var(--h4-color);
  margin: 1.33en 0;
  font-size: 110%;
}
p {
  margin: 0.9em 0;
}
ol, ul {
  margin: 1em 0 1em 0;
  padding: 0 0 0 2.26em;
  line-height: 1.21;
}
ul ul,
ul ol,
ol ul,
ol ol {
  margin-top: 0;
  margin-bottom: 0;
}
code {
  margin: 0;
  padding: 0;
}

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

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

.image_link {
  position: relative;
  display: block;
  cursor: pointer;
}

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

iframe {
  border: none;
  background-size: 1px 1px;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url("img/interactive.svg");
}

video {
  display: block;
  margin: 0.6em 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 {
  position: relative;
  margin: 0 auto;
  padding: calc(var(--interactive-margin) / 2) 0;
  -webkit-overflow-scrolling: touch;
  overflow-y: scroll;
  transform: translate3d(0,0,0);
}

.interactive2 {
  position: relative;
  margin: 0 auto;
  padding: calc(var(--interactive-margin) / 2) 0;
  -webkit-overflow-scrolling: touch;
  overflow-y: scroll;
  transform: translate3d(0,0,0);
}

figure {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

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

.popup_bib_info {
  --m: 200px;
  position: fixed;
  left: var(--m);
  right: var(--m);
  min-height: 35px;
  top: 5px;
  display: none;
  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: -2em;
  padding-left: 2em;
}
.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 {
  align-items: center;
  display: flex;
}
#btn_dark, #btn_light {
  outline: none;
  border: none;
  width: 35px;
  height: 35px;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: 80%;
  background-position: center;
}

.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;
}
.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 */
/* this is necessary for the ipad */
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");
}

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

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


/* 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.2vmax;
    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[show="true"] * {
    display: none;
  }

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

  #pages_container .page:nth-child(odd) {
    border-right: 1px solid var(--page-separation-color);
  }
}

/* Style for print */
@media print {
  @page {
    margin: 0cm;
    size: 640px 825px;
  }

  body {
    width: 640px;
    height: 825px;
  }

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

  iframe {
    background-size: contain;
  }

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

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

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