:root {
  --complimentary: #815205;
  --text: black;
  --text-dim: #444;
  --link: #3366cc;
  --link-visited: #795cb2;
  --background: #ffffff;
  --code-background: #f8f9fa;
  --code-border: #eaecf0;
  --code-hl: #e6e6e6;
  --border-general: #cccfd4;
  --table-th: #e1e5ea;
  --table-tr: #edeff2;
  --toc-background: #f9f9f9;
  --toc-border: #aaa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --complimentary: #815205;
    --text: #d8d8d8;
    --text-dim: #a7a7a7;
    --link: #8cb4ff;
    --link-visited: #876dba;
    --background: #1b1b1b;
    --code-background: #272727;
    --code-border: transparent;
    --code-hl: #5a5a5a;
    --border-general: #495057;
    --table-th: #414141;
    --table-tr: #343434;
    --toc-background: #343434;
    --toc-border: #495057;
  }
}

/* TODO: add iframe margins */

html {
  color: var(--text);
  background-color: var(--background);
  scroll-behavior: smooth;
}

body {
  margin: auto;
  padding: 1em 1em 2em 1em;
}

.main-icon {
  filter: invert(85%);
}

@media (prefers-color-scheme: dark) {
  .main-icon {
    filter: invert(30%);
  }
}

@media screen and (max-width: 1000px) {
  .main-icon {
    display: none;
  }
}

@media screen and (min-width: 760px) {
  body {
    margin: auto;
    max-width: 68vw;
  }
}

@media screen and (min-width: 1150px) {
  body {
    margin: auto;
    max-width: 62vw;
  }
}

p {
  margin: 0.5em 0;
}

h1 {
  font-family: "Linux Libertine", "Georgia", "Times", serif;
  font-weight: 600;
  margin-bottom: 2px;
}

h2 {
  margin-bottom: 0.5em;
  margin-top: 1.4em;
  border-bottom: 1px solid var(--border-general);
  font-weight: normal;
  font-size: 1.5em;
  font-family: "Linux Libertine", "Georgia", "Times", serif;
}

.section-title {
  text-align: left;
}

h3 {
  font-size: 1.2em;
  margin-bottom: 0.7em;
  padding-bottom: 0;
}

h4 {
  font-size: 1.1em;
  margin-bottom: 0;
  padding-bottom: 0;
}


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

a:hover {
  text-decoration: underline;
}

a:visited {
  color: var(--link-visited);
}

.toc a:visited {
  color: var(--link);
}

.menu a:visited {
  color: var(--link);
}

img {
  max-height: 70vh;
  margin: 0.8em 0;
}

.imgp {
  margin: auto;
  text-align: center;
}

figure {
  margin: auto;
  text-align: center;
}

/* header and footer areas */
.menu {
  padding: 0;
  background-color: var(--background);
}

@media screen and (min-width: 1150px) {
  .menu {
    left: 20px;
    padding: 0px 4px 0px 14px;
    z-index: 9999;
    border-left: 10px solid var(--complimentary);
  }
}

.menu li {
  display: inline-block;
}

.article-meta,
.menu a {
  margin-right: 0.9em;
  text-decoration: none;
  border-radius: 5px;
}

.menu a:hover {
  text-decoration: underline;
}

.article-meta {
  text-align: left;
}

@media screen and (min-width: 1150px) {
  .menu {
    text-align: left;
  }
}

.title {
  font-size: 1em;
}

footer a {
  text-decoration: none;
}

hr {
  border-style: dashed;
  color: var(--text-dim);
}

/* code */
.highlight div,
pre {
  background-color: var(--code-background) !important;
  padding: 0.7em;
  overflow-x: auto;
  margin: 0px;
  border: 1px solid var(--code-border);
  line-height: 1.2;
}

/* TODO: Remove this */
.output pre {
  color: #9a3412;
}

.highlight {
  margin: 0.8em 0;
}

.highlight div pre {
  border: 0px;
  padding: 0px 5px;
  margin: 0px;
  box-shadow: 0px 0px 0px;
}

code {
  background: var(--code-background);
  border-radius: 5%;
  padding: 1px 4px;
  border: 1px solid var(--code-border);
}

pre code {
  border: none;
  background: none;
  padding-left: 0px;
  padding-right: 0px;
  margin: 0px;
  font-size: 0.82em !important;
  tab-size: 4;
}

/* misc elements */
img,
iframe,
video {
  max-width: 100%;
}

main {
  hyphens: none;
}

blockquote {
  overflow: hidden;
  margin: 1em 0;
  padding: 0 40px;
  line-height: 1.6;
}

table {
  border-collapse: collapse;
  display: block;
  overflow: auto;
}

@media screen and (min-width: 760px) {
  table {
    display: table !important;
  }
}

table thead th {
  border: 1px solid var(--border-general);
}

th,
td {
  padding: 4px 8px;
  border: 1px solid rgb(200, 200, 200);
  border: 1px solid var(--border-general);
}

th {
  background-color: var(--table-th);
}

tr {
  background-color: var(--table-tr);
}

@media screen and (min-width: 1150px) {
  #tableOfContentContainer {
    position: fixed;
    left: 20px;
    max-width: 15vw;
    width: 16vw;
  }
}

.toc {
  background: var(--toc-background) none repeat scroll 0 0;
  border: 1px solid var(--toc-border);
  display: table;
  font-size: 95%;
  margin-bottom: 1em;
  padding: 0.4em 1.5em 0.4em 0.2em;
  width: auto;
  margin-top: auto;
}

@media screen and (min-width: 1150px) {
  .toc {
    padding: 0;
    background-color: transparent;
    font-size: 80%;
    line-height: 1.3;
    border-right: 0px;
    border-top: 0px;
    border-bottom: 0px;
    border-left: 0px;
  }

  #TableOfContents li {
    max-width: 13vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media screen and (min-width: 1150px) {
  .toc-position-absolute {
    position: absolute;
  }
}

.toc li,
.toc ul,
.toc ul li {
  list-style: outside none none !important;
}

/* h2 in toc has 20px padding and h1 should be the title and shouldn't be present in toc */

@media screen and (min-width: 1150px) {
  #TableOfContents {
    margin-left: -32px;
  }
}

#TableOfContents ul {
  padding-left: 20px;
}

.toc h3 {
  margin-left: 20px;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  font-weight: normal;
}

.date {
  color: var(--text-dim);
  padding-top: 0.1em;
  font-size: 90%;
}

#subtitle {
  margin-top: 0;
  padding-top: 0px;
  margin-bottom: 30px;
  font-size: 0.9em;
}

#subtitle a:visited {
  color: var(--link);
}

.datesub {
  font-weight: normal;
  color: var(--text-dim);
}

#tags {
  font-weight: normal;
  color: var(--text-dim);
}

.post-list {
  color: var(--complimentary);
  padding-left: 1em;
}

@media screen and (min-width: 760px) {
  .post-list {
    max-width: 60vw;
  }

  .home-content {
    max-width: 60vw;
  }
}

@media screen and (max-width: 760px) {
  .katex {
    font-size: 1.05em !important;
  }
}

.bold-post-in-list {
  font-weight: bold;
}

figcaption {
  color: var(--text-dim);
  text-align: center;
}

figcaption h4 {
  margin-top: 0px;
  font-weight: normal;
}

blockquote {
  margin-left: 1em;
  margin-right: 1em;
}

blockquote p {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

/* Two images side by side shortcode */
.side-by-side-parent {
  display: block;
}

@media screen and (min-width: 760px) {
  .side-by-side-parent {
    display: flex;
  }
}

.side-by-side-child {
  padding: 2px;
}

.active-toc {
  font-weight: bold;
}

/*  TODO: what is this? I can't remember))) */
.ln {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  margin-right: 14px;
  /* color: rgb(150, 150, 150); */
}

.hl {
  background-color: var(--code-hl);
  outline-style: solid;
  outline-color: var(--code-hl);
  outline-width: 2px;
}

details {
  padding: 0 0 0 14px;
  border-left: 2px dashed var(--border-general);
}

.footnotes {
  margin-top: 60px;
}

#search-input {
  width: 30%;
}

#search-input {
  width: 80%;
}

@media screen and (min-width: 900px) {
  #search-input {
    width: 40%;
  }
}

@media screen and (min-width: 1150px) {
  #search-input {
    width: 30%;
  }
}

/* Main page search */
input {
  background-color: var(--background);
  color: var(--text);
  border-color: var(--border-general);
  padding: 4px;
  border-radius: 4px;
}

#results {
  padding-left: 16px;
}

.terms {
  padding-left: 16px;
}
