@import url(fonts/fonts.css);

:root {
  --background: #f8f8f8;
  --other-bg-1: #f0f0f0;
  --text: #383838;
  --primary: #aeaece;
  --secondary: #9090c0;
  --other-one: #606060;
  --other-two: #a07040;
  --link: #804040;
  --button: #c0c0c08f;
  --popup-bg: #ffffff;
  --faulty-text: #ff0000;
  --faulty-bg: #ffff00;

  --code-bg: #f5f5f5;
  --code-text: #383838;
  --code-keyword: #6a4b8c; /* Roxo SICP */
  --code-string: #9050a0; /* Roxo mais intenso */
  --code-comment: #808080; /* Cinza neutro */
  --code-number: #c45a20; /* Laranja terra */
  --code-operator: #606060; /* Cinza escuro */
  --code-builtin: #7d5c9e; /* Roxo claro */
  --code-function: #4060a0; /* Azul adaptado */
  --code-meta: #508050; /* Verde discreto */
  --code-variable: #383838; /* Texto base */
  --code-link: #804040; /* Vermelho vinho */
}

.dark-theme {
  --background: #181818;
  --other-bg-1: #202020;
  --text: #e0e0e0;
  --primary: #6b6b9b;
  --secondary: #58589b;
  --other-one: #b0b0b0;
  --other-two: #d48c5c;
  --link: #d08080;
  --button: #6060608f;
  --popup-bg: #282828;
  --faulty-text: #ff8080;
  --faulty-bg: #804000;

  --code-bg: #202020;
  --code-text: #e0e0e0;
  --code-keyword: #9d7dc2; /* Roxo claro */
  --code-string: #b070c0; /* Roxo pastel */
  --code-comment: #909090; /* Cinza claro */
  --code-number: #e87d40; /* Laranja vibrante */
  --code-operator: #b0b0b0; /* Cinza médio */
  --code-builtin: #a885d0; /* Roxo lavanda */
  --code-function: #6080c0; /* Azul suave */
  --code-meta: #70a070; /* Verde musgo */
  --code-variable: #e0e0e0;
  --code-link: #d08080; /* Rosa suave */
}

/* Generated rules from HTML.pm centralized here */
a.summary-letter {
  text-decoration: none;
}
div.display {
  margin-left: 0em;
}
div.example {
  margin-left: 0em;
}
div.indentedblock {
  margin-left: 0em;
}
div.lisp {
  margin-left: 0em;
}
div.smalldisplay {
  margin-left: 0em;
}
div.smallexample {
  margin-left: 0em;
}
div.smallindentedblock {
  margin-left: 0em;
}
div.smalllisp {
  margin-left: 0em;
}
kbd {
  font-style: oblique;
}

pre.display {
  font-family: inherit;
}
pre.format {
  font-family: inherit;
}
pre.menu-comment {
  font-family: serif;
}
pre.menu-preformatted {
  font-family: serif;
}
span.nocodebreak {
  white-space: nowrap;
}
span.nolinebreak {
  white-space: nowrap;
}
span.roman {
  font-family: serif;
  font-weight: normal;
}
span.sansserif {
  font-family: sans-serif;
  font-weight: normal;
}
ul.no-bullet {
  list-style: none;
}

html {
  font-family: "Linux Libertine O", serif;
  font-size: 170%;
  color: var(--text);
  line-height: 130%;
  /* 'liga' turns on ligatures, 'ss06' picks alternate ampersand */
  -moz-font-feature-settings: "liga" 1, "ss06";
  -ms-font-feature-settings: "liga" 1, "ss06";
  -webkit-font-feature-settings: "liga", "ss06";
  -o-font-feature-settings: "liga", "ss06";
  font-feature-settings: "liga", "ss06";
  scroll-behavior: smooth;
}

@media (min-width: 481px) and (max-width: 720px) {
  html {
    font-size: 140%;
  }
  blockquote {
    margin-left: 1em;
    margin-right: 1em;
  }
  ul.no-bullet {
    padding-left: 1em;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 120%;
  }
  blockquote {
    margin-left: 0.5em;
    margin-right: 0.5em;
  }
  ul.no-bullet {
    padding-left: 0.6em;
  }
}

body {
  background-color: var(--background);
  margin: 0 auto;
  max-width: 100dvw !important;
}

section {
  margin: 1em auto;
  width: 67ex;
  max-width: 88%;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Linux Biolinum O", sans-serif;
  margin-top: 1.6em;
  margin-bottom: 1rem;
  line-height: 125%;
}

h1,
h2.chapter {
  margin-top: 4em;
  margin-bottom: 2em;
}

h2.unnumbered {
  margin-top: 2.5em;
}

h3.section {
  margin-top: 2em;
}

strong {
  font-family: "Linux Biolinum O", sans-serif;
}

h1 {
  font-size: 1.88rem;
}

h1.titlefont {
  margin-top: 5em;
  margin-bottom: 1em;
  line-height: 120%;
}

/* Hide the Info style node menu that has been
   made redundant by table of contents */
h1.node-heading,
h1.node-heading + table.menu,
a[name="Top"] + nav.header {
  display: none;
}

h2 {
  font-size: 1.57rem;
  line-height: 110%;
}

h3 {
  font-size: 1.31rem;
}

h4 {
  font-size: 1.1rem;
}
h4 code {
  font-size: 0.88rem;
}

h5 {
  font-size: 1rem;
}
h5 code {
  font-size: 0.82rem;
}

.chapnum {
  display: inline-block;
  font-weight: normal;
  font-size: 6.7em;
  color: var(--primary);
  height: 1ex;
  margin-top: 0.3ex;
  margin-bottom: 0.5ex;
}

.chaptitle {
  display: inline-block;
  width: 78%;
  margin-left: 1ex;
}

@media (max-width: 960px) {
  .chaptitle {
    width: 64%;
    margin-left: 0.5em;
  }
}

.secnum {
  display: inline-block;
  color: var(--secondary);
  margin-right: 0.8em;
  vertical-align: top;
}

.sectitle {
  display: inline-block;
  max-width: 85%;
  vertical-align: top;
}
@media (max-width: 480px) {
  .sectitle {
    max-width: 100%;
  }
  h1,
  h2,
  h3,
  h4,
  h5 {
    line-height: 110%;
  }
}

pre,
code,
tt,
samp {
  font-family: "Inconsolata LGC", "DejaVu Sans Mono", monospace;
  font-size: 0.8rem;
}

pre,
pre code,
pre var {
  font-size: 0.77rem;
  line-height: 150%;
}

.lisp .MathJax {
  color: var(--other-one);
}

.roman .MathJax {
  color: var(--other-two);
}

p,
table.menu,
div.lisp {
  margin-top: 1em;
  margin-bottom: 1em;
}

/* Allow hyphenation */
p,
ol,
ul {
  -ms-hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}
/* But not in navigation bar, imprint, contents, and references */
nav p,
a#References ~ p,
h1 ~ p,
.shortcontents ul,
.contents ul {
  -ms-hyphens: none;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  hyphens: none;
}

a#UTF ~ p > i:last-child {
  display: block;
  margin-top: 0.8em;
  margin-bottom: 1.6em;
}

a[href] {
  color: var(--link);
  text-decoration: none;
}

a[href] > sup {
  font-size: 78%;
  vertical-align: top;
  position: relative;
  top: -0.4ex;
  margin: -2ex;
  padding: 2ex;
}

a[href]:-webkit-any-link > sup {
  top: -1ex;
}

nav.header p {
  font-family: "Linux Biolinum O", sans-serif;
  font-size: 0.9rem;
  padding: 0.5em;
  margin: 0;
  background-color: var(--other-bg-1);
}

nav.header a[href] {
  margin: -1.5ex;
  padding: 1.5ex;
}

nav.header:last-of-type {
  margin-top: 2em;
}

span.roman {
  font-family: "Linux Libertine O", serif;
  font-size: 0.96rem;
}

figure {
  width: 100%;
  margin-top: 2em;
  margin-bottom: 1.2em;
  text-align: center;
  margin-left: 0;
  margin-right: 0;
}

figcaption {
  display: table;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5em;
  padding-right: 1.5em;
  min-width: 10em;
  margin-top: 1em;
}

figcaption p {
  text-align: left;
  margin: 0;
}

#footnote_popup {
  background-color: var(--popup-bg);
  padding: 0 3ex;
  width: 100%;
  -webkit-box-shadow: 4px 4px 22px rgba(0, 0, 0, 0.5);
  box-shadow: 4px 4px 22px rgba(0, 0, 0, 0.5);
  z-index: 12;
}

@media (min-width: 481px) and (max-width: 960px) {
  #footnote_popup {
    padding-left: 3.6ex;
  }
}

@media (max-width: 480px) {
  #footnote_popup {
    padding-left: 4ex;
  }
}

#footnote_popup a.footnote_backlink {
  display: none;
}

td > a[href*="#Exercise-"],
td > a[href*="#Figure-"] {
  margin-left: 1ex;
  margin-right: 1ex;
}

section > hr:nth-last-child(2) {
  margin-top: 2em;
}

div.subtitle {
  margin-bottom: 1em;
  text-align: left;
}

div.subtitle > abbr {
  font-size: 1.2rem;
  letter-spacing: 0.07rem;
  word-spacing: 0.07rem;
}

table.menu td {
  width: auto;
  vertical-align: top;
}

h2 ~ p:first-of-type:first-line,
abbr {
  font-family: "Linux Libertine O", serif;
  letter-spacing: 0.04em;
  -moz-font-feature-settings: "onum", "c2sc", "smcp";
  -ms-font-feature-settings: "onum", "c2sc", "smcp";
  -webkit-font-feature-settings: "onum", "c2sc", "smcp";
  -o-font-feature-settings: "onum", "c2sc", "smcp";
  font-feature-settings: "onum", "c2sc", "smcp";
}

h2 ~ p:first-of-type:first-letter {
  float: left;
  margin-top: 0.33rem;
  margin-right: 0.04em;
  margin-bottom: -0.15em;
  margin-left: -0.15ex;
  padding-left: 0;
  line-height: 0.83em;
  font-family: "Linux Libertine O", serif;
  text-transform: uppercase;
  font-weight: normal;
  font-size: 3rem;
  color: var(--secondary);
}

h2 + blockquote {
  margin-top: 3em;
  margin-bottom: 3em;
}

h2.unnumbered + blockquote {
  margin-top: 2em;
  margin-bottom: 2em;
}

/* Next three blocks are adapted from:
 * http://stackoverflow.com/questions/11374059/make-an-html-svg-object-also-a-clickable-link
 * http://jsfiddle.net/WEbGd/
 */
a.cover {
  position: relative;
  z-index: 1;
}

a.cover figure {
  margin-top: 1em;
  margin-bottom: 1em;
  -webkit-box-shadow: 2px 3px 20px rgba(0, 0, 0, 0.5);
  box-shadow: 2px 3px 20px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

a.cover object {
  position: relative;
  z-index: -1;
  width: 100%;
  height: auto;
  background-color: #fbfbfb;
}

/* Italic correction */
var {
  padding-right: 0.16ex;
}

/* MathML fonts */
mtext {
  font-family: STIXGeneral;
}

pre math {
  font-size: 0.94rem;
}
code math {
  font-size: 1rem;
}
/* Allow linebreaks in math and inline code */
math {
  white-space: normal;
}
math[display="block"] {
  margin: 1em 0;
}

/* Adapted from http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css?raw=1 */
mtd {
  padding-right: 0.5em;
  padding-left: 0.5em;
  padding-bottom: 0ex;
  padding-top: 0ex;
}
mtable[columnalign="right center left"] mtd {
  padding-right: 0.1em;
  padding-left: 0.1em;
}
/* turn off the spacing at the periphery of boundary cells */
mtr:first-child > mtd {
  padding-top: 0ex;
}
mtr:last-child > mtd {
  padding-bottom: 0ex;
}
mtd:first-child {
  padding-left: 0.2em;
}
mtd:last-child {
  padding-right: 0.2em;
}

/* Match x-height of roman to italic (STIX fonts) */
mtext,
mi[mathvariant="normal"],
mi[_moz-math-font-style="normal"] {
  font-size: 98%;
}
math *[mathvariant="monospace"] {
  font-size: 0.8rem;
  font-family: "Inconsolata LGC", monospace;
}

.faulty {
  color: var(--faulty-text);
  background-color: var(--faulty-bg);
}

a#References ~ p {
  -moz-font-feature-settings: "onum", "ss06";
  -ms-font-feature-settings: "onum", "ss06";
  -webkit-font-feature-settings: "onum" 1, "ss06" 1;
  -o-font-feature-settings: "onum", "ss06";
  font-feature-settings: "onum", "ss06";
}

@media (max-width: 960px) {
  html {
    line-height: 126%;
  }

  pre,
  pre code,
  pre var {
    line-height: 140%;
  }

  h2 ~ p:first-of-type:first-letter {
    font-size: 2.9em;
  }
}

.jump {
  font-family: "DejaVu-Arrows";
  font-size: 2rem;
  font-weight: bold;
  position: fixed;
  /* display: none; */ /* uncomment for epub */
  right: 0;
  text-align: center;
}

.jump a[href] {
  color: var(--button);
  margin: -1.5ex;
  padding: 1.5ex;
}

.top {
  top: 0;
  padding: 0.7ex 0ex;
}

.bottom {
  bottom: 0;
  padding: 0.4ex 0ex;
}

/*[ @Jhonfs ]*/
figure {
  max-width: 100% !important;
  width: 100% !important;
}

object {
  max-width: 100% !important;
  width: 100% !important;
  object-fit: contain !important;
}

figure svg {
  max-width: 100% !important;
}

/* Icons */
.icon_theme::before {
  font-family: "Icons";
  content: "󰔎";
}

.icon_github::before {
  font-family: "Icons";
  content: "";
}

.icon_download::after {
  font-family: "Icons";
  content: "";
  font-size: 120%;
}

.icon_cc::before {
  font-family: "Icons";
  content: "";
}

.icon_by::before {
  font-family: "Icons";
  content: "";
}

.icon_sa::before {
  font-family: "Icons";
  content: "";
}

/* Button Theme */

#button-light {
  display: block;
  margin: 0;
  padding: 0.3rem;
  width: max-content;
  height: max-content;
  border: none;
  background-color: transparent;
  color: var(--button);
  cursor: pointer;

  position: fixed;
  top: calc(50% - 0.95rem);
  left: 0;

  transition: all 0.4s ease-in-out;
}

#button-light:hover {
  padding-left: 1rem;
  border-radius: 0 5px 5px 0;
  color: var(--background);
  background-color: var(--code-link);
  box-shadow: 0px 0px 3px black;
}

#button-light .icon_theme {
  font-size: 1.3rem;
}
