/*!
 * LaTeX.css (https://latex.vercel.app/)
 * Modified from the original LaTeX.css by Vincent Dörig (https://vincent.doerig.dev/)
 * Source: https://github.com/vincentdoerig/latex-css
 * Licensed under MIT (https://github.com/vincentdoerig/latex-css/blob/master/LICENSE)
*/

@font-face {
  font-family: "Garamond";
  src: url("fonts/EBGaramond-Medium.ttf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Garamond";
  src: url("fonts/EBGaramond-Bold.ttf") format("opentype");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: "Garamond";
  src: url("fonts/EBGaramond-MediumItalic.ttf") format("opentype");
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: "Garamond";
  src: url("fonts/EBGaramond-BoldItalic.ttf") format("opentype");
  font-weight: bold;
  font-style: italic;
}

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --merah: #F4564E;
  --merahtua: #89313E;
  --biru: #60BBE5;
  --birutua: #412F66;
  --hijau: #59CC78;
  --hijautua: #366D5B;
  --kuning: #FFD56B;
  --jingga: #FBA15F;
  --ungu: #8C5FBF;
  --lavender: #CBA5E8;
  --merjamb: #FFB6E0;
  --body-color: hsl(0, 5%, 10%);
  --body-bg-color: hsl(210, 20%, 98%);
  --link-visited: hsl(0, 100%, 33%);
  --link-focus-outline: hsl(220, 90%, 52%);
  --pre-bg-color: hsl(210, 28%, 93%);
  --kbd-bg-color: hsl(210, 5%, 100%);
  --kbd-border-color: hsl(210, 5%, 70%);
  --table-border-color: black;
  --border-width-thin: 1.36px;
  --border-width-thick: 2.27px;
  --sidenote-target-border-color: hsl(55, 55%, 70%);
  --footnotes-border-color: hsl(0, 0%, 39%);
  --text-indent-size: 1.463rem; /* In 12pt [Latin Modern font] LaTeX article
  \parindent =~ 17.625pt; taking also into account the ratio
  1pt[LaTeX] = (72 / 72.27) * 1pt[HTML], with default 12pt/1rem LaTeX.css font
  size, the identation value in rem CSS units is:
  \parindent =~ 17.625 * (72 / 72.27) / 12 = 1.463rem. */
}

.latex-dark {
  --body-color: hsl(0, 0%, 86%);
  --body-bg-color: hsl(0, 0%, 16%);
  --link-visited: hsl(196 80% 77%);
  --link-focus-outline: hsl(215, 63%, 73%);
  --pre-bg-color: hsl(0, 1%, 25%);
  --kbd-bg-color: hsl(0, 0%, 16%);
  --kbd-border-color: hsl(210, 5%, 70%);
  --table-border-color: white;
  --sidenote-target-border-color: hsl(0, 0%, 59%);
  --footnotes-border-color: hsl(0, 0%, 59%);
  --bukti-symbol-filter: invert(80%);
}

@media (prefers-color-scheme: dark) {
   .latex-dark-auto {
    --body-color: hsl(0, 0%, 86%);
    --body-bg-color: hsl(0, 0%, 16%);
    --link-visited: hsl(196 80% 77%);
    --link-focus-outline: hsl(215, 63%, 73%);
    --pre-bg-color: hsl(0, 1%, 25%);
    --kbd-bg-color: hsl(0, 0%, 16%);
    --kbd-border-color: hsl(210, 5%, 70%);
    --table-border-color: white;
    --sidenote-target-border-color: hsl(0, 0%, 59%);
    --footnotes-border-color: hsl(0, 0%, 59%);
    --bukti-symbol-filter: invert(80%);
  }
}

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
ul[class],
ol[class],
li,
figure,
figcaption,
dl,
dd {
  margin: 0;
}

/* Make default font-size 1rem and add smooth scrolling to anchors */
html {
  font-size: 1rem;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: 'Garamond', Georgia, Cambria, 'Times New Roman', Times, serif;
  line-height: 1.8;

  min-height: 100vh;
  overflow-x: hidden;
  margin: 0 auto;
  margin-top: 4em;
  padding: 1rem 1.25rem;

  counter-reset: figcaption theorem definition sidenote-counter;

  color: var(--body-color);
  background-color: var(--body-bg-color);

  text-rendering: optimizeLegibility;

  /* Allow automatic hyphenation for all text in the document */
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
}

body > * {
  max-width: 100ch;
  margin-left: auto;
  margin-right: auto;
}

/* Justify all paragraphs */
p {
  text-align: justify;
  margin-top: 1rem;
}

/* Indents paragraphs like in LaTeX documents*/
.indent-pars p {
  text-indent: var(--text-indent-size);
}

.indent-pars p.no-indent,
p.no-indent {
  text-indent: 0;
}

.indent-pars ol p,
.indent-pars ul p {
  text-indent: 0;
}

.indent-pars h2 + p,
.indent-pars h3 + p,
.indent-pars h4 + p {
  text-indent: 0;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make links red */
a,
a:visited {
  color: var(--link-visited);
}

a:focus {
  outline-offset: 2px;
  outline: 2px solid var(--link-focus-outline);
}

/* Make images easier to work with */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Prevent textarea from overflowing */
textarea {
  width: 100%;
}

/* Natural flow and rhythm in articles by default */
article > * + * {
  margin-top: 1em;
}

/* Navbar */
.fixed-nav-bar { 
  display: flex;
  position: fixed; 
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  z-index: 9999;
  top: 0; 
  left: 0; 
  right: 0;
  width: 100vw;
  height: 60px; 
  background-color: #434343; 
  justify-content: space-between; 
  align-items: center; 
  padding: 0 1.5rem;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .fixed-nav-bar {
    padding: 0 0.5rem;
    height: 50px;
  }
  
  body {
    margin-top: 2.5em; 
  }
}

.nav-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.nav-button:hover {
  border-radius: 1cm;
  opacity: 0.4;
}

.nav-spacer {
  width: 86px;
}

/* Burger Button Styles */
.burger-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  color: white;
}

.burger-button:hover {
  border-radius: 1cm;
  opacity: 0.4;
}

.burger-button svg rect {
  fill: currentColor;
  transition: transform 0.3s ease;
}

/* TOC Sidebar */
.toc-sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background: var(--body-bg-color);
  box-shadow: -2px 0 12px rgba(0,0,0,0.2);
  padding: 1rem;
  transition: right 0.3s ease;
  z-index: 10000;
}

.toc-sidebar[aria-hidden="false"] {
  right: 0;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

.overlay.active {
  opacity: 1;
  pointer-events: all;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 2rem;
  background: none;
  border: none;
  color: var(--body-color);
  font-size: 2rem;
  cursor: pointer;
  padding: 0 0.5rem;
}

/* Enable counters for TOC numbering */
#toc-list {
  counter-reset: section;
  padding-left: 0; /* Remove default list padding */
}

#toc-list > li {
  list-style: none;
}

#toc-list > li > a {
  display: inline; /* Keep the link inline */
  text-decoration: none; /* Optional: to remove underlining */
}

#toc-list > li:before {
  counter-increment: section;
  content: counter(section) ". ";
  margin-right: 5px; /* Optional: Adjust spacing between the number and text */
}

#toc-list ol {
  counter-reset: subsection;
  padding-left: 20px; /* Indentation for subsections */
}

#toc-list ol > li {
  list-style: none;
}

#toc-list ol > li > a {
  display: inline; /* Keep the link inline */
}

#toc-list ol > li:before {
  counter-increment: subsection;
  content: counter(section) "." counter(subsection) " ";
  margin-right: 5px; /* Optional: Adjust spacing between the number and text */
}


/* Styles for inline code or code snippets */
code,
pre,
kbd {
  font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
    monospace;
  font-size: 85%;
  hyphens: none;
}
pre {
  padding: 1rem 1.4rem;
  max-width: 100%;
  overflow: auto;
  border-radius: 4px;
  background: var(--pre-bg-color);
}
pre code {
  font-size: 95%;
  position: relative;
}
kbd {
  background: var(--kbd-bg-color);
  border: 1px solid var(--kbd-border-color);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 75%;
}

/* Better tables */
table:not(.borders-custom) {
  border-collapse: collapse;
  border-spacing: 0;
  width: auto;
  max-width: 100%;
  border-top: var(--border-width-thick) solid var(--table-border-color);
  border-bottom: var(--border-width-thick) solid var(--table-border-color);
  /* display: block; */
  overflow-x: auto; /* does not work because element is not block */
  /* white-space: nowrap; */
  counter-increment: caption;
}
/* add bottom border on column table headings  */
table:not(.borders-custom) tr > th[scope='col'] {
  border-bottom: var(--border-width-thin) solid var(--table-border-color);
}
/* add right border on row table headings  */
table:not(.borders-custom) tr > th[scope='row'] {
  border-right: var(--border-width-thin) solid var(--table-border-color);
}
table:not(.borders-custom) > tbody > tr:first-child > td,
table:not(.borders-custom) > tbody > tr:first-child > th {
  border-top: var(--border-width-thin) solid var(--table-border-color);
}
table:not(.borders-custom) > tbody > tr:last-child > td,
table:not(.borders-custom) > tbody > tr:last-child > th {
  border-bottom: var(--border-width-thin) solid var(--table-border-color);
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  line-height: 1.1;
}
/* Table caption */
caption {
  text-align: left;
  font-size: 0.923em;
  /* border-bottom: 2pt solid #000; */
  padding: 0 0.25em 0.25em;
  width: 100%;
  margin-left: 0;
}

caption::before {
  content: 'Table ' counter(caption) '. ';
  font-weight: bold;
}

/* allow scroll on the x-axis */
.scroll-wrapper {
  overflow-x: auto;
}

/* if a table is wrapped in a scroll wrapper,
  the table cells shouldn't wrap */
.scroll-wrapper > table td {
  white-space: nowrap;
}

/* Table custom borders */
table.borders-custom {
  border-collapse: collapse;
  border-spacing: 0;
  width: auto;
  max-width: 100%;
  overflow-x: auto;
  counter-increment: caption;
}

.border-top-thick {
  border-top: var(--border-width-thick) solid var(--table-border-color);
}
.border-right-thick {
  border-right: var(--border-width-thick) solid var(--table-border-color);
}
.border-bottom-thick {
  border-bottom: var(--border-width-thick) solid var(--table-border-color);
}
.border-left-thick {
  border-left: var(--border-width-thick) solid var(--table-border-color);
}

.border-top-thin {
  border-top: var(--border-width-thin) solid var(--table-border-color);
}
.border-right-thin {
  border-right: var(--border-width-thin) solid var(--table-border-color);
}
.border-bottom-thin {
  border-bottom: var(--border-width-thin) solid var(--table-border-color);
}
.border-left-thin {
  border-left: var(--border-width-thin) solid var(--table-border-color);
}

/* Table column alignment */
.col-1-l tr > :nth-child(1),
.col-2-l tr > :nth-child(2),
.col-3-l tr > :nth-child(3),
.col-4-l tr > :nth-child(4),
.col-5-l tr > :nth-child(5),
.col-6-l tr > :nth-child(6),
.col-7-l tr > :nth-child(7),
.col-8-l tr > :nth-child(8),
.col-9-l tr > :nth-child(9),
.col-10-l tr > :nth-child(10),
.col-11-l tr > :nth-child(11),
.col-12-l tr > :nth-child(12) {
  text-align: left;
}
.col-1-c tr > :nth-child(1),
.col-2-c tr > :nth-child(2),
.col-3-c tr > :nth-child(3),
.col-4-c tr > :nth-child(4),
.col-5-c tr > :nth-child(5),
.col-6-c tr > :nth-child(6),
.col-7-c tr > :nth-child(7),
.col-8-c tr > :nth-child(8),
.col-9-c tr > :nth-child(9),
.col-10-c tr > :nth-child(10),
.col-11-c tr > :nth-child(11),
.col-12-c tr > :nth-child(12) {
  text-align: center;
}
.col-1-r tr > :nth-child(1),
.col-2-r tr > :nth-child(2),
.col-3-r tr > :nth-child(3),
.col-4-r tr > :nth-child(4),
.col-5-r tr > :nth-child(5),
.col-6-r tr > :nth-child(6),
.col-7-r tr > :nth-child(7),
.col-8-r tr > :nth-child(8),
.col-9-r tr > :nth-child(9),
.col-10-r tr > :nth-child(10),
.col-11-r tr > :nth-child(11),
.col-12-r tr > :nth-child(12) {
  text-align: right;
}

/* Format figure captions (based on table captions) */
figure {
  counter-increment: figcaption;
}
figcaption {
  text-align: center;
  font-size: 0.923em;
  padding: 0.25em 0.25em 0;
  width: 100%;
  margin-left: 0;
}
figcaption::before {
  content: 'Gambar ' counter(figcaption) '. ';
  font-weight: bold;
}

/* Center align the title */
h1:first-child {
  text-align: center;
  font-size: 2.5em;
}

/* Nested ordered list for ToC */
nav ol {
  counter-reset: item;
  list-style: none;
  padding-left: 0;
}

nav ol > li {
  display: block;
  padding-left: 2rem; /* Base indentation */
}

nav ol > li::before {
  content: counters(item, '.') '. ';
  counter-increment: item;
  padding-right: 0.85rem;
}

/* Nested lists for H2s */
nav ol ol > li {
  padding-left: 3rem; /* More indentation for H2s */
}



/* Center definitions (most useful for display equations) */
dl dd {
  text-align: center;
}

/* Theorem */
.theorem {
  counter-increment: theorem;
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.theorem::before {
  content: 'Teorema ' counter(theorem) '. ';
  font-weight: bold;
  font-style: normal;
}

/* Proposisi */
.proposisi {
  counter-increment: theorem;
  display: block;
  margin: 12px 0;
  font-style: italic;
}

.proposisi::before {
  content: 'Proposisi ' counter(theorem) '. ';
  font-weight: bold;
  font-style: normal;
}

/* Contoh */
.contoh {
  counter-increment: theorem;
  display: block;
  margin: 12px 0;
  font-style: italic;
}
.contoh::before {
  content: 'Contoh ' counter(theorem) '. ';
  font-weight: bold;
  font-style: normal;
}

/* bukti */
details.bukti {
  margin: 1em 0;
}

details.bukti > summary {
  font-style: italic;
  list-style: none;
  cursor: pointer;
  padding: 0.5em;
  background: #2d2d2d;
  border-radius: 4px;
}

details.bukti > summary:empty:before {
  content: 'Bukti';
}

details.bukti > summary::-webkit-details-marker {
  display: none;
}

details.bukti > summary::after {
  content: "▼";
  float: right;
  transition: transform 0.2s;
}

details.bukti[open] > summary::after {
  transform: rotate(180deg);
}

.bukti-content {
  padding: 1em;
  margin-top: 0.5em;
  background-color: #2d2d2d;
}


/* Definition */
.definition {
  counter-increment: theorem;
  display: block;
  margin: 12px 0;
  font-style: normal;
}
.definition::before {
  content: 'Definisi ' counter(theorem) '. ';
  font-weight: bold;
  font-style: normal;
}

/* Center align author name, use small caps and add vertical spacing  */
.author {
  margin: 0.85rem 0;
  font-variant-caps: small-caps;
  text-align: center;
}

/* Sidenotes */

.sidenote {
  font-size: 0.8rem;
  float: right;
  clear: right;
  width: 18vw;
  margin-right: -20vw;
  margin-bottom: 1em;
  text-indent: 0;
}

.sidenote.left {
  float: left;
  margin-left: -20vw;
  margin-bottom: 1em;
  text-indent: 0;
}

/* (WIP) add border when a sidenote is clicked on */
.sidenote:target {
  border: var(--sidenote-target-border-color) 1.5px solid;
  padding: 0 .5rem;
  scroll-margin-block-start: 10rem;
}

/* sidenote counter */
.sidenote-number {
  counter-increment: sidenote-counter;
}

.sidenote-number::after,
.sidenote::before {
  position: relative;
  vertical-align: baseline;
}

/* add number in main content */
.sidenote-number::after {
  content: counter(sidenote-counter);
  font-size: 0.7rem;
  top: -0.5rem;
  left: 0.1rem;
}

/* add number in front of the sidenote */
.sidenote-number ~ .sidenote::before {
  content: counter(sidenote-counter) ' ';
  font-size: 0.7rem;
  top: -0.5rem;
}

label.sidenote-toggle:not(.sidenote-number) {
  display: none;
}

/* sidenotes inside blockquotes are indented more */
blockquote .sidenote {
  margin-right: -24vw;
  width: 18vw;
}


label.sidenote-toggle {
  display: inline;
  cursor: pointer;
}

input.sidenote-toggle {
  display: none;
}

@media (max-width: 1050px) {
  label.sidenote-toggle:not(.sidenote-number) {
    display: inline;
  }
  .sidenote {
    display: none;
  }
  .sidenote-toggle:checked + .sidenote {
    display: block;
    margin: 0.5rem 1.25rem 1rem 0.5rem;
    float: left;
    left: 1rem;
    clear: both;
    width: 95%;
  }
  /* tweak indentation of sidenote inside a blockquote */
  blockquote .sidenote {
    margin-right: -25vw;
    width: 16vw;
  }
}

/* Make footnote text smaller and left align it (looks bad with long URLs) */
.footnotes p {
  text-align: left;
  line-height: 1.5;
  font-size: 85%;
  margin-bottom: 0.4rem;
}
.footnotes {
  border-top: 1px solid var(--footnotes-border-color);
}

/* Center title and paragraph */
.abstract,
.abstract p {
  text-align: center;
  margin-top: 0;
}
.abstract {
  margin: 2.25rem 0;
}
.abstract > h2 {
  font-size: 1rem;
  margin-bottom: -0.2rem;
}

/* Prevent line breaks inside an element */
.whitespace-nowrap {
  white-space: nowrap;
}

/* Heading typography */
h1 {
  font-size: 1.7rem;
  line-height: 3.25rem;
  margin-top: 2.5rem;
  margin-bottom: 0.625rem;
}

h2 {
  font-size: 1.4rem;
  line-height: 2rem;
  margin-top: 3rem;
}

h3 {
  font-size: 1.2rem;
  margin-top: 2.5rem;
}

h4 {
  font-size: 1.1rem;
  margin-top: 2rem;
}

h5 {
  font-size: 1rem;
  margin-top: 1.8rem;
}

h6 {
  font-size: 1rem;
  font-style: italic;
  font-weight: normal;
  margin-top: 2.5rem;
}

h3,
h4,
h5,
h6 {
  line-height: 1.625rem;
}

h1 + h2 {
  margin-top: 1.625rem;
}

h2 + h3,
h3 + h4,
h4 + h5 {
  margin-top: 0.8rem;
}

h5 + h6 {
  margin-top: -0.8rem;
}

h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.8rem;
}

button {
  background-color: #414141;
  color: var(--body-color);
  padding: 1px 1px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 20px;
}
button:hover {
  background-color: #717171;
}

.MathJax { 
  font-size: 1em !important; 
}

figure {
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 0;
}

figure svg {
  height: auto;
}