/* Base styles and content styles */

@import 'variables.css';

:root {
  /* Browser default font-size is 16px, this way 1 rem = 10px */
  font-size: 62.5%;
  color-scheme: var(--color-scheme);
}

html {
  font-family: 'Open Sans', sans-serif;
  color: var(--fg);
  background-color: var(--bg);
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
}

body {
  margin: 0;
  font-size: 1.6rem;
  overflow-x: auto;
}

code {
  font-family: var(--mono-font) !important;
  font-size: var(--code-font-size);
}

/* make long words/inline code not x overflow */
main {
  overflow-wrap: break-word;
}

/* make wide tables scroll if they overflow */
.table-wrapper {
  overflow-x: auto;
}

/* Don't change font size in headers. */
h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
  font-size: unset;
}

.left {
  float: left;
}
.right {
  float: right;
}
.boring {
  opacity: 0.6;
}
.hide-boring .boring {
  display: none;
}
.hidden {
  display: none !important;
}

h2,
h3 {
  margin-top: 2.5em;
}
h4,
h5 {
  margin-top: 2em;
}

.header + .header h3,
.header + .header h4,
.header + .header h5 {
  margin-top: 1em;
}

h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before {
  display: inline-block;
  content: '»';
  margin-left: -30px;
  width: 30px;
}

/* This is broken on Safari as of version 14, but is fixed
   in Safari Technology Preview 117 which I think will be Safari 14.2.
   https://bugs.webkit.org/show_bug.cgi?id=218076
*/
:target {
  scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}

.page {
  outline: 0;
  padding: 0 var(--page-padding);
  margin-top: calc(
    0px - var(--menu-bar-height)
  ); /* Compensate for the #menu-bar-hover-placeholder */
}
.page-wrapper {
  box-sizing: border-box;
}
.js:not(.sidebar-resizing) .page-wrapper {
  transition:
    margin-left 0.3s ease,
    transform 0.3s ease; /* Animation: slide away */
}

.content {
  overflow-y: auto;
  padding: 0 5px 50px 5px;
}
.content main {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-max-width);
}
.content p {
  line-height: 1.45em;
}
.content ol {
  line-height: 1.45em;
}
.content ul {
  line-height: 1.45em;
}
.content a {
  text-decoration: none;
}
.content a:hover {
  text-decoration: underline;
}
.content img,
.content video {
  max-width: 100%;
}
.content .header:link,
.content .header:visited {
  color: var(--fg);
}
.content .header:link,
.content .header:visited:hover {
  text-decoration: none;
}

table {
  margin: 0 auto;
  border-collapse: collapse;
}
table td {
  padding: 3px 20px;
  border: 1px var(--table-border-color) solid;
}
table thead {
  background: var(--table-header-bg);
}
table thead td {
  font-weight: 700;
  border: none;
}
table thead th {
  padding: 3px 20px;
}
table thead tr {
  border: 1px var(--table-header-bg) solid;
}
/* Alternate background colors for rows */
table tbody tr:nth-child(2n) {
  background: var(--table-alternate-bg);
}

blockquote {
  margin: 20px 0;
  padding: 0 20px;
  color: var(--fg);
  background-color: var(--quote-bg);
  border-top: 0.1em solid var(--quote-border);
  border-bottom: 0.1em solid var(--quote-border);
}

kbd {
  background-color: var(--table-border-color);
  border-radius: 4px;
  border: solid 1px var(--theme-popup-border);
  box-shadow: inset 0 -1px 0 var(--theme-hover);
  display: inline-block;
  font-size: var(--code-font-size);
  font-family: var(--mono-font);
  line-height: 10px;
  padding: 4px 5px;
  vertical-align: middle;
}

:not(.footnote-definition) + .footnote-definition,
.footnote-definition + :not(.footnote-definition) {
  margin-top: 2em;
}
.footnote-definition {
  font-size: 0.9em;
  margin: 0.5em 0;
}
.footnote-definition p {
  display: inline;
}

.tooltiptext {
  position: absolute;
  visibility: hidden;
  color: #fff;
  background-color: #333;
  transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
  left: -8px; /* Half of the width of the icon */
  top: -35px;
  font-size: 0.8em;
  text-align: center;
  border-radius: 6px;
  padding: 5px 8px;
  margin: 5px;
  z-index: 1000;
}
.tooltipped .tooltiptext {
  visibility: visible;
}

.chapter li.part-title {
  color: var(--sidebar-fg);
  margin: 5px 0px;
  font-weight: bold;
}

.result-no-output {
  font-style: italic;
}

.typst-dom-page {
  width: var(--data-page-width, 100%);
  height: var(--data-page-height);
  --data-text-width: 1px;
  --data-text-height: 1px;
  margin: auto;
}

.typst-back-canvas {
  position: absolute;
  z-index: -1;
  width: var(--data-page-width, 100%);
  height: var(--data-page-height);
  pointer-events: none;
}

.typst-svg-page {
  position: absolute;
  z-index: 0;
  width: var(--data-page-width, 100%);
  height: var(--data-page-height);
}

.typst-html-semantics {
  position: absolute;
  z-index: 2;
  width: var(--data-page-width, 100%);
  height: var(--data-page-height);
  color: transparent;
  font-family: monospace;
  white-space: pre;
}

.typst-html-semantics span {
  color: transparent;
  font-family: monospace;
  transform-origin: left top;
  position: absolute;
  display: inline-block;
  left: 0;
  top: 0;
}

.typst-content-hint {
  position: absolute;
  display: inline-block;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.typst-html-semantics a {
  position: absolute;
  display: inline-block;
}

/* set transparent itself */
.typst-content-group {
  pointer-events: visible;
}

.typst-html-semantics span::-moz-selection {
  color: transparent;
  background: #7db9dea0;
}

.typst-html-semantics span::selection {
  color: transparent;
  background: #7db9dea0;
}

.typst-html-semantics *::-moz-selection {
  color: transparent;
  background: transparent;
}

.typst-html-semantics *::selection {
  color: transparent;
  background: transparent;
}

.typst-content-fallback {
  color: transparent;
  background: transparent;
}

.pseudo-link,
.typst-text {
  pointer-events: none;
}
.typst-svg-page {
  fill: none;
}
.outline_glyph path,
path.outline_glyph {
  fill: var(--glyph_fill);
  stroke: var(--glyph_stroke);
}

.outline_glyph path,
path.outline_glyph {
  transition: 0.2s fill stroke;
}

.hover .typst-text {
  --glyph_fill: #66bab7;
  --glyph_stroke: #66bab7;
}

.typst-jump-ripple,
.typst-debug-react-ripple {
  width: 0;
  height: 0;
  background-color: transparent;
  position: absolute;
  border-radius: 50%;
}
.typst-jump-ripple {
  border: 1px solid #66bab7;
}
.typst-debug-react-ripple {
  border: 1px solid #cb1b45;
}
@keyframes typst-jump-ripple-effect {
  to {
    width: 10vw;
    height: 10vw;
    opacity: 0.01;
    margin: -5vw;
  }
}
@keyframes typst-debug-react-ripple-effect {
  to {
    width: 3vw;
    height: 3vw;
    opacity: 0.01;
    margin: -1.5vw;
  }
}

.focus .typst-text {
  --glyph_fill: var(--sidebar-active);
}

a.focus {
  /* todo: remove !important */
  color: var(--sidebar-active) !important;
}

.focus .typst-text, a.focus {
  transition: 0.1s;
  transition-property: fill, stroke, color;
}