@import url("https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic");
@import url("https://fonts.googleapis.com/css2?family=League+Gothic&display=swap");

html,
body {
  background-color: #fdf6e3;
  color: #657b83;
  font-family: "Lato", sans-serif;
}

:root {
  --bs-body-bg: #fdf6e3;
  --bs-body-color: #657b83;
  --bs-link-color: #268bd2;
  --bs-link-hover-color: #2aa198;
  --bs-border-color: #93a1a1;

  --quarto-body-bg: #fdf6e3;
  --quarto-body-color: #657b83;
  --quarto-border-color: #93a1a1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #586e75;
  font-family: "League Gothic", "Lato", sans-serif;
  text-transform: uppercase;
  font-weight: normal;
}

a {
  color: #268bd2;
}

a:hover {
  color: #2aa198;
}

code,
pre,
kbd,
samp {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

/* Inline code: inherit text color (avoid default blue/purple).
   Keep code blocks (inside <pre>) styled by the syntax highlighter/theme. */
.reveal :not(pre) > code,
main.content :not(pre) > code {
  color: inherit !important;
}

/* Reduce code block font size in slides */
.reveal pre code,
.reveal div.sourceCode,
.reveal pre.sourceCode,
.reveal code.sourceCode {
  font-size: 0.75em !important;
  line-height: 1.4;
}

/* Override for code blocks inside list items to match top-level code blocks.
   Top-level code blocks: 0.75em of slide base ≈ 21px. Use absolute value. */
.reveal .code-default-size pre code,
.reveal .code-default-size div.sourceCode,
.reveal .code-default-size pre.sourceCode,
.reveal .code-default-size code.sourceCode {
  font-size: 18px !important;
}

/* Indent guides overlay (drawn by indent-guides.js) */
.reveal pre.sourceCode {
  position: relative;
}

.reveal pre.sourceCode > code {
  position: relative;
  z-index: 1;
}

.reveal pre.sourceCode > .indent-guides {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.reveal h1,
.reveal h2 {
  text-align: center;
}

/* Reduce h3 size in slides, but not inside callouts (already styled) */
.reveal .slide h3:not(.callout-tip h3) {
  font-size: 0.9em;
}

/* Add top margin to h3 only when not immediately after a heading */
.reveal .slide p + h3,
.reveal .slide ul + h3,
.reveal .slide ol + h3,
.reveal .slide pre + h3,
.reveal .slide figure + h3,
.reveal .slide .cell + h3 {
  margin-top: 1em;
}

/* Center all figures/images in RevealJS slides */
.reveal .slide figure,
.reveal .slide .cell-output-display,
.reveal .slide p:has(> img) {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.reveal .slide figure > figcaption {
  margin-top: 0.35em;
  margin-bottom: 0.9em;
  text-align: center;
  font-size: 0.6em;
}

.reveal .slide figure img,
.reveal .slide .cell-output-display img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto !important;
}

p,
.reveal .slide ul li,
.reveal .slide ol li,
.reveal dt,
.reveal dd,
.reveal table {
  font-size: 28px;
  /* Adjust the font size as needed */
}

/* Make inline code in definition list terms bold to match the term styling */
.reveal dt code {
  font-weight: 700 !important;
}

/* Add vertical gap after callout boxes */
.reveal .callout {
  margin-bottom: 1.5em !important;
}

/* Pseudocode blocks: add breathing room above the box */
.reveal .pseudocode-container {
  margin-top: 0.6em;
}

/* Homepage: make the Weeks list match the intro text size. */
main.content p,
main.content ul li,
main.content ol li {
  font-size: 20px;
}

.reveal p:not(.subtitle) {
  text-align: justify;
}

/* Reduce the vertical gap between a paragraph and a list that immediately follows.
   (E.g., "In the code below:" followed by bullet points.) */
.reveal .slides section p + ul,
.reveal .slides section p + ol {
  margin-top: 0.075em !important;
}

.reveal .slides section p:has(+ ul),
.reveal .slides section p:has(+ ol) {
  margin-bottom: 0.15em !important;
}

.reveal .slides section p + ul li:first-child,
.reveal .slides section p + ol li:first-child {
  margin-top: 0 !important;
}

/* Reduce vertical gaps between list items in slides.
   Quarto often wraps list item text in a <p>, which can introduce extra margin. */
.reveal .slides section li > p {
  margin: 0 !important;
}

.reveal .slides section ul li,
.reveal .slides section ol li {
  margin: 0.15em 0 !important;
}

.reveal .footer p {
  text-align: inherit;
}

/* Footer + slide counter: match sizing and strengthen color. */
.reveal .footer,
.reveal .slide-number {
  font-size: 19.8px !important;
  line-height: 1.15 !important;
  color: #586e75 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

.reveal .footer p {
  font-size: 19.8px !important;
  line-height: 1.15 !important;
  color: #586e75 !important;
  margin: 0 !important;
}

.reveal .footer * {
  color: #586e75 !important;
}

.reveal .slide-number a {
  color: #586e75 !important;
}

.reveal .slide-number {
  font-size: 19.8px !important;
  line-height: 1.15 !important;
  opacity: 1 !important;
}

.reveal .slide-number * {
  color: #586e75 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

.reveal dd {
  margin-bottom: 0.5em;
}

.center-video {
  display: flex;
  justify-content: center;
  align-items: center;
  height: auto;
  padding-top: 1em;
  /* Adjust padding as needed */
}

.center-video iframe {
  width: 60%;
  height: auto;
  aspect-ratio: 16 / 9;
  /* Maintain aspect ratio */
}

img {
  text-align: center;
}

.small-font {
  font-size: 32px;
  /* Adjust the font size as needed */
}

.reveal code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 1em;
}

/* Inline code (not code blocks): slightly heavier for readability */
.reveal :not(pre) > code {
  font-weight: 500;
  font-size: 0.95em;
}

@supports (font-size-adjust: 0.5) {
  .reveal :not(pre) > code {
    font-size-adjust: 0.5;
  }
}

div#refs {
  list-style-type: disc;
  padding-left: 20px;
}

div#refs div.csl-entry {
  display: list-item;
}

.inline-pseudocode {
  font-family: "Times New Roman", Times, serif;
  font-variant: small-caps;
  font-size: 1.1em;
  /* Adjust the size as needed */
}

.nowrap {
  white-space: nowrap;
}

/* Title slide layout: logo above author/date/title (no overlap). */
.reveal section#title-slide {
  display: flex !important;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.reveal section#title-slide::before {
  content: "";
  display: block;
  width: min(85%, 840px);
  height: clamp(220px, 34vh, 420px);
  margin: 0 0 0.9rem 0;
  background-image: url("logo.svg");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: contain;
}

.reveal section#title-slide h1.title {
  order: 1;
  margin: 0.25rem 0 0.75rem 0;
  font-size: 1.25em;
}

/* Print/PDF: increase heading hierarchy so h1 stands out more than h2. */
html.print-pdf .reveal h1 {
  font-size: 1.6em;
}

html.print-pdf .reveal h2 {
  font-size: 1.2em;
}

html.print-pdf .reveal section#title-slide h1.title {
  font-size: 1.8em;
}

/* Print/PDF: stabilize pseudocode line heights (MathJax can change row metrics). */
html.print-pdf .reveal .algorithmic,
html.print-pdf .reveal .algorithmic table,
html.print-pdf .reveal .algorithmic tr,
html.print-pdf .reveal .algorithmic td,
html.print-pdf .reveal .algorithmic th {
  line-height: 1.15 !important;
}

html.print-pdf .reveal .algorithmic td,
html.print-pdf .reveal .algorithmic th {
  vertical-align: middle !important;
}

html.print-pdf .reveal .algorithmic .MathJax,
html.print-pdf .reveal .algorithmic .mjx-chtml,
html.print-pdf .reveal .algorithmic .mjx-math {
  display: inline-block !important;
  vertical-align: middle !important;
  line-height: 1.15 !important;
}

/* Print/PDF: normalize MathJax table rows used by algorithmic environments. */
html.print-pdf .reveal .pseudocode-container mjx-container[jax="CHTML"] {
  display: block !important;
}

html.print-pdf .reveal .pseudocode-container mjx-table {
  border-spacing: 0 !important;
  line-height: 1.15 !important;
}

html.print-pdf .reveal .pseudocode-container mjx-tr {
  height: 1.15em !important;
  line-height: 1.15em !important;
}

html.print-pdf .reveal .pseudocode-container mjx-td {
  padding: 0 !important;
  vertical-align: middle !important;
  line-height: 1.15 !important;
}

/* Print/PDF: center level-1 title slides (excluding the cover title-slide). */
html.print-pdf .reveal .slides section.title-slide:not(#title-slide) {
  display: block !important;
  text-align: center;
  padding-top: 35vh !important;
  height: auto !important;
  color: #000 !important; /* Ensure text is visible */
}

html.print-pdf .reveal .slides section.title-slide:not(#title-slide) h1 {
  margin: 0 !important;
}

.reveal section#title-slide .quarto-title-authors {
  order: 2;
  margin: 0;
}

.reveal section#title-slide .quarto-title-author-name {
  margin: 0;
}

.reveal section#title-slide .date {
  order: 3;
  margin: 0.25rem 0 0 0;
}

/* Shrink slide titles (section headings) globally. */
.reveal .slides section.slide h2 {
  font-size: 1.1em;
}

html.print-pdf .reveal .slides section.slide h2 {
  font-size: 1.2em;
}

/* Print/PDF: add vertical gap between paragraphs. */
html.print-pdf .reveal .slides section p,
body.print-pdf .reveal .slides section p {
  display: block;
  margin-top: 0 !important;
  margin-bottom: 0.5em !important;
  padding: 0 !important;
}

html.print-pdf .reveal .slides section p:last-child,
body.print-pdf .reveal .slides section p:last-child {
  margin-bottom: 0 !important;
}

/* Print/PDF: prevent list markers from clipping and tighten sizes. */
html.print-pdf .reveal .slides section ul,
html.print-pdf .reveal .slides section ol {
  list-style-position: outside;
  padding-left: 1.5em !important;
  margin-left: 0.5em !important;
}

html.print-pdf .reveal .slide ul li,
html.print-pdf .reveal .slide ol li {
  line-height: 1.4;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Print/PDF: hide speaker notes overlay. */
html.print-pdf .reveal aside.notes,
html.print-pdf .reveal .speaker-notes-pdf,
html.print-pdf .reveal .slide-notes,
html.print-pdf .reveal .notes,
html.print-pdf .reveal .speaker-notes {
  display: none !important;
}

/* Print/PDF: hide menubar and other navigation elements. */
html.print-pdf .reveal .menubar,
html.print-pdf .reveal .slide-menu-wrapper,
html.print-pdf .reveal .reveal-menu,
html.print-pdf .reveal .controls,
html.print-pdf .reveal .progress {
  display: none !important;
}

/* Print/PDF: hide indent guides (keep them in HTML only). */
html.print-pdf .indent-guides,
html.print-pdf .indent-guide {
  display: none !important;
}

/* Print/PDF: show slide numbers (override inline style). */
html.print-pdf .reveal .slide-number,
html.print-pdf .reveal .slide-number-pdf {
  display: block !important;
  position: absolute !important;
  bottom: 8px !important;
  right: 12px !important;
  font-size: 14px !important;
  color: #657b83 !important;
  background: transparent !important;
}

@media print {
  .reveal .slides section.title-slide:not(#title-slide) {
    display: block !important;
    text-align: center;
    padding-top: 35vh !important;
    height: auto !important;
    color: #000 !important;
  }

  .reveal .slides section.title-slide:not(#title-slide) h1 {
    margin: 0 !important;
  }

  .reveal .slides section ul,
  .reveal .slides section ol {
    list-style-position: outside;
    padding-left: 1.5em !important;
    margin-left: 0.5em !important;
    overflow: visible !important;
  }

  .reveal .slide ul li,
  .reveal .slide ol li {
    line-height: 1.4;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Print/PDF: preserve Quarto column layouts. */
  .reveal .columns {
    display: flex !important;
    flex-direction: row !important;
    gap: min(4vw, 1.5em) !important;
    align-items: flex-start !important;
  }

  .reveal .column {
    flex: auto !important;
    min-width: 0 !important;
  }

  /* Print/PDF: hide speaker notes. */
  .reveal aside.notes,
  .reveal .speaker-notes-pdf,
  .reveal .slide-notes,
  .reveal .notes,
  .reveal .speaker-notes {
    display: none !important;
  }

  /* Print/PDF: hide menubar and navigation. */
  .reveal .menubar,
  .reveal .slide-menu-wrapper,
  .reveal .reveal-menu,
  .reveal .controls,
  .reveal .progress {
    display: none !important;
  }

  /* Print/PDF: show slide numbers (override inline style). */
  .reveal .slide-number,
  .reveal .slide-number-pdf {
    display: block !important;
    position: absolute !important;
    bottom: 8px !important;
    right: 12px !important;
    font-size: 14px !important;
    color: #657b83 !important;
    background: transparent !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

.exercise-slide {
  background-color: #cbd5e8 !important;
  color: #073642 !important;
}

/* On exercise slides, make code blocks blend into the slide background. */
.reveal .slides section.exercise-slide pre,
.reveal .slides section.exercise-slide pre code,
.reveal .slides section.exercise-slide div.sourceCode,
.reveal .slides section.exercise-slide pre.sourceCode,
.reveal .slides section.exercise-slide code.sourceCode {
  background-color: transparent !important;
  box-shadow: none !important;
}

.reveal .slides section.exercise-slide pre {
  border: none !important;
}

/* Keep exercise slide headings consistent with exercise slide text color. */
.reveal .slides section.exercise-slide h1,
.reveal .slides section.exercise-slide h2,
.reveal .slides section.exercise-slide h3,
.reveal .slides section.exercise-slide h4,
.reveal .slides section.exercise-slide h5,
.reveal .slides section.exercise-slide h6 {
  color: inherit !important;
}

.brwhite-background {
  background: radial-gradient(ellipse at center, #fdf6e3 0%, #fdf6e3 70%, #002b36 100%) !important;
}

.solution-slide {
  background-color: #b3e2cd !important;
  color: #073642 !important;
}

/* Keep solution slide headings consistent with solution slide text color. */
.reveal .slides section.solution-slide h1,
.reveal .slides section.solution-slide h2,
.reveal .slides section.solution-slide h3,
.reveal .slides section.solution-slide h4,
.reveal .slides section.solution-slide h5,
.reveal .slides section.solution-slide h6 {
  color: inherit !important;
}

/* On solution slides, make code blocks blend into the slide background. */
.reveal .slides section.solution-slide pre,
.reveal .slides section.solution-slide pre code,
.reveal .slides section.solution-slide div.sourceCode,
.reveal .slides section.solution-slide pre.sourceCode,
.reveal .slides section.solution-slide code.sourceCode {
  background-color: transparent !important;
  box-shadow: none !important;
}

.reveal .slides section.solution-slide pre {
  border: none !important;
}

.ps-comment {
  color: #dc322f !important;
}

.small-text {
  font-size: 0.5em !important;
}

.centered-text {
  text-align: center !important;
}

html:not(.print-pdf) .reveal .centered-text,
html:not(.print-pdf) .reveal .centered-text p {
  text-align: center !important;
}

/* Booktabs-style tables */
.reveal .booktabs {
  margin: 0.8em 0;
}

.reveal .booktabs table {
  border-collapse: collapse;
  border-top: 2px solid #657b83;
  border-bottom: 2px solid #657b83;
}

.reveal .booktabs th {
  border-bottom: 1px solid #657b83;
  text-align: left;
  padding: 0.2em 0.8em;
}

.reveal .booktabs td {
  border-bottom: none;
  padding: 0.2em 0.8em;
}

/* Alternating row stripes */
.reveal .booktabs tbody tr:nth-child(odd) {
  background-color: rgba(101, 123, 131, 0.1);
}

.reveal .booktabs tbody tr:nth-child(even) {
  background-color: transparent;
}

/* Row title column (left separator) */
.reveal .booktabs .row-title {
  border-right: 1px solid #657b83;
}

/* Summary column (right separator) */
.reveal .booktabs .summary-col {
  border-left: 1px solid #657b83;
}

/* Heap operations table: control column widths + full-height separator */
.reveal .heap-ops-table table {
  width: 100%;
  margin: 0;
  table-layout: fixed;
}

/* Operation column: 50% wider (vs a 30% baseline) + vertical rule */
.reveal .heap-ops-table th:nth-child(1),
.reveal .heap-ops-table td:nth-child(1) {
  width: 32%;
  border-right: 1px solid #657b83;
}

.reveal .heap-ops-table td:nth-child(1) {
  font-variant: small-caps;
}

.reveal .heap-ops-table th:nth-child(2),
.reveal .heap-ops-table td:nth-child(2) {
  width: 58%;
}

.reveal .heap-ops-table th:nth-child(3),
.reveal .heap-ops-table td:nth-child(3) {
  width: 10%;
  border-left: 1px solid #657b83;
}

/* Home button for slide navigation */
.reveal .home-button {
  position: fixed;
  top: 50px;
  left: 16px;
  z-index: 30;
  background: #002b36;
  color: #fdf6e3 !important;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none !important;
  font-family: "Lato", sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.reveal .home-button:hover {
  opacity: 1;
  color: #fdf6e3 !important;
}

.reveal .home-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
