/* https://cdnjs.com/libraries/highlight.js */
@import url("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/github.min.css")
  (prefers-color-scheme: light);
@import url("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/github-dark.min.css")
  (prefers-color-scheme: dark);

:root {
  --main-width: 800px;
  --padding-width: 40px;
}

html {
  scroll-padding-top: 20px;
}

/* https://github.com/sindresorhus/github-markdown-css/blob/main/github-markdown.css */
body {
  padding-bottom: 1rem;
}

#navbar-box,
#content-box {
  box-sizing: border-box;
  min-width: 200px;
  max-width: calc(var(--main-width) + var(--padding-width) * 2);
  margin: 0 auto;
  padding: 0 var(--padding-width);
}

#navbar-box {
  display: flex;
  justify-content: space-between;
  color: var(--fgColor-muted) !important;
}

@media (max-width: 767px) {
  #navbar-box,
  #content-box {
    padding: 0 20px;
  }
}

#navbar {
  background-color: var(--bgColor-neutral-muted) !important;
  padding: 0.2rem 0;
}

#navbar-box svg {
  /* vertical-align: middle; */
  vertical-align: -0.16em;
  fill: var(--fgColor-muted);
}

#sponsor {
  fill: var(--color-prettylights-syntax-entity) !important;
}

.nav-link {
  color: var(--fgColor-default) !important;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--fgColor-accent) !important;
}

/* self links */
h1 > a.self-link,
h2 > a.self-link,
h3 > a.self-link,
h4 > a.self-link,
h5 > a.self-link,
h6 > a.self-link {
  color: var(--fgColor-default);
}

h1 > a.self-link:hover,
h2 > a.self-link:hover,
h3 > a.self-link:hover,
h4 > a.self-link:hover,
h5 > a.self-link:hover,
h6 > a.self-link:hover {
  text-decoration: none;
}

/* Borrowed from github-markdown.css */
h1 > a.self-link:hover::after,
h2 > a.self-link:hover::after,
h3 > a.self-link:hover::after,
h4 > a.self-link:hover::after,
h5 > a.self-link:hover::after,
h6 > a.self-link:hover::after {
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.2em;
  content: " ";
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
}

/* header and footer */
#header {
  margin: 1rem 0;
}

#footer {
  font-size: smaller;
  text-align: center;
  color: var(--fgColor-muted) !important;
}

.footnote-title {
  margin-bottom: 1rem;
}

/* article */
.author,
.date {
  text-align: right;
}

/* Message boxes. Borrows from bootstrap's document */
main .note,
main .warning,
main .footnote {
  border: 1px solid var(--borderColor-default);
  background-color: var(--bgColor-muted);
  padding: 0.5rem 1rem 0;
  margin-bottom: 1rem;
  color: inherit;
  border-left: 0.25em solid var(--borderColor-default);
}

main .note {
  border-left-color: var(--borderColor-accent-emphasis);
}

main .warning {
  border-left-color: var(--borderColor-danger-emphasis);
}

main .footnote {
  border-left-color: var(--borderColor-default);
}

@media (prefers-color-scheme: dark) {
  main img[src*="svg"] {
    background-color: var(--fgColor-default);
  }
}

#main img {
  height: auto;
}

#content-box {
  display: flex;
  justify-content: center;
}

#main {
  flex: 1;
  overflow-x: auto;
}

table {
  width: auto !important;
}

pre, code {
  overflow-x: auto !important;
  max-width: var(--main-width) !important;
}
