@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans-VariableFont_wdth,wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Math";
  src: url("fonts/NotoSansMath-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Fira Math";
  src: url("fonts/FiraMath-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "New Computer Modern Math";
  src: url("fonts/NewCMMath-Book.otf") format("opentype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

:root {
  --bg: #fafafa;
  --paper: #fff;
  --ink: #1f2328;
  --muted: #687076;
  --line: #d8dee4;
  --line-strong: #afb8c1;
  --accent: #0b7285;
  --accent-ink: #07535f;
  --accent-soft: #e7f5f7;
  --blue: #2563eb;
  --gold: #8a5a12;
  --mono: "Cascadia Mono", "Fira Code", Consolas, monospace;
  --sans: "Noto Sans", "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --math:
    "Noto Sans Math",
    "Fira Math",
    "New Computer Modern Math",
    math;
  --topbar-height: 3.5rem;
  --left-width: 18rem;
  --right-width: 16rem;
  --content-width: 46rem;
  scrollbar-gutter: stable;
}

[data-theme="dark"] {
  --bg: #10130f;
  --paper: #161a15;
  --ink: #ecefe9;
  --muted: #a8afa4;
  --line: #343b33;
  --line-strong: #4b544a;
  --accent: #80cbc4;
  --accent-ink: #b2dfdb;
  --accent-soft: #18312f;
  --blue: #8bb8ff;
  --gold: #e0b15f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[id] {
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.68 var(--sans);
  text-align: justify;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.16em;
}

[data-theme="dark"] a {
  color: var(--accent);
}

math .math-link {
  color: var(--accent-ink);
  text-decoration-line: underline;
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

[data-theme="dark"] math .math-link {
  color: var(--accent);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.topbar-title {
  color: var(--ink);
  font: 720 0.95rem/1.2 var(--sans);
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
}

.icon-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  color: currentColor;
}

[data-theme="dark"] .icon {
  filter: invert(1);
}

.layout {
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr) var(--right-width);
  gap: 2rem;
  align-items: start;
  min-height: calc(100vh - var(--topbar-height));
  padding: 0 1.6rem 2.5rem;
}

.sidebar-left,
.sidebar-right {
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  width: var(--left-width);
  padding: 1.35rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--muted);
}

.sidebar-left {
  left: 1.6rem;
}

.sidebar-right {
  right: 1.6rem;
  width: var(--right-width);
}

.content {
  grid-column: 2;
  width: min(100%, var(--content-width));
  justify-self: center;
  padding: 2.45rem 0 0;
}

.global-nav ul,
.local-toc ul {
  text-align: left;
  list-style: none;
  margin: 0;
  padding: 0;
}

.global-nav .nav-item {
  position: relative;
}

.global-nav a {
  display: block;
  padding: 0.2rem 0.6rem 0.2rem calc(0.6rem + var(--depth, 0) * 0.82rem);
  border-left: 2px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.36;
  text-decoration: none;
}

.global-nav .has-children>a {
  padding-right: 2rem;
}

.nav-collapse-toggle {
  position: absolute;
  top: 0.08rem;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-collapse-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 0.28rem solid transparent;
  border-right: 0.28rem solid transparent;
  border-bottom: 0.38rem solid currentColor;
}

.is-collapsed>.nav-collapse-toggle::before {
  border-top: 0.38rem solid currentColor;
  border-bottom: 0;
}

.nav-collapse-toggle:hover,
.nav-collapse-toggle:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  outline: none;
}

.local-toc li {
  position: relative;
  padding: 0.1rem 0.48rem 0.1rem calc(0.48rem + var(--toc-depth, 0) * 0.72rem);
  border-left: 2px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.76rem;
  line-height: 1.28;
  text-align: left;
}

.local-toc li:has(a[href]) {
  cursor: pointer;
}

.local-toc a,
.local-toc span {
  display: inline;
  padding: 0;
  border-left: 0;
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.global-nav a:hover,
.local-toc li:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}

.global-nav .active>a {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 78%, transparent);
  font-weight: 700;
}

.local-toc h2 {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font: 760 0.72rem/1.2 var(--sans);
  letter-spacing: 0;
  text-transform: uppercase;
}

.toc-theorem a,
.toc-theorem span {
  color: inherit;
  font-size: 0.74rem;
}

.local-toc .toc-theorem {
  padding-left: calc(1.05rem + var(--toc-depth, 0) * 0.72rem);
  position: relative;
  font-size: 0.74rem;
}

.toc-theorem::before {
  content: "-";
  position: absolute;
  top: 0.1rem;
  left: calc(0.48rem + var(--toc-depth, 0) * 0.72rem);
  color: var(--accent);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.86rem;
  text-align: left;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-align: left;
  line-height: 1.18;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 1.25rem;
  padding-bottom: 0.78rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(2.05rem, 4vw, 3.05rem);
  font-weight: 760;
}

h2 {
  margin: 2.1rem 0 0.75rem;
  padding-bottom: 0.42rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.55rem;
}

h2:first-child {
  margin-top: 0;
  font-size: clamp(1.95rem, 3.7vw, 2.55rem);
}

h3 {
  margin: 1.65rem 0 0.5rem;
  font-size: 1.13rem;
}

.page-title {
  margin: 0 0 1.35rem;
  padding-bottom: 0.72rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(2.15rem, 4.3vw, 3.2rem);
  font-weight: 760;
  line-height: 1.12;
}

.page-source-heading {
  display: none;
}

.content>.page-title+h1,
.content>.page-title+h2,
.content>.page-title+h3,
.content>.page-title+h4,
.content>.page-title+h5,
.content>.page-title+h6,
.content>.page-title+section[role="doc-bibliography"]>h2:first-child {
  display: none;
}

.local-toc h2,
.local-toc h2:first-child {
  margin: 0 0 0.45rem;
  padding: 0;
  border: 0;
  color: var(--muted);
  font: 760 0.68rem/1.2 var(--sans);
  letter-spacing: 0;
  text-transform: uppercase;
}

p {
  margin: 0 0 1em;
  text-align: justify;
  hyphens: auto;
}

.cover {
  padding-top: clamp(1rem, 8vh, 5rem);
}

.cover .course,
.cover .date,
.cover .authors {
  color: var(--ink);
  font-family: var(--sans);
  text-align: left;
}

.cover h1 {
  max-width: 12ch;
  border: 0;
  padding: 0;
  margin-bottom: 1rem;
  font-size: clamp(3rem, 9vw, 5.4rem);
}

.cover .abstract {
  max-width: 42rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.cover .recommendation {
  font-size: 0.85rem;
  max-width: 42rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--gold);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  font: 700 0.9rem var(--sans);
  text-decoration: none;
}

.button-secondary {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.not-found-copy {
  max-width: 34rem;
  color: var(--muted);
  text-align: left;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

math {
  font-family: var(--math);
}

.todo-callout {
  margin: 1.15rem 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid #d59b00;
  border-left-width: 4px;
  background: #fff8d8;
  color: #5c4300;
  text-align: left;
}

[data-theme="dark"] .todo-callout {
  border-color: #dcae32;
  background: #3c3010;
  color: #ffe69a;
}

.todo-page {
  text-align: left;
}

.todo-summary,
.todo-empty {
  color: var(--muted);
  text-align: left;
}

.todo-list {
  display: grid;
  gap: 0.75rem;
  margin: 1.35rem 0 0;
  padding: 0;
  list-style: none;
}

.todo-list-item {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid #d59b00;
  background: var(--paper);
}

.todo-list-description {
  display: inline;
}

.todo-list-item>a {
  font-weight: 400;
}

.thm-box {
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  background: var(--paper);
}

.thm-head {
  margin: 0 0 0.42rem;
  font: 760 0.95rem/1.35 var(--sans);
  text-align: left;
}

.thm-definition,
.thm-problem {
  border-left-color: var(--blue);
}

.thm-example {
  border-left-color: var(--gold);
}


.thm-remark,
.thm-claim {
  border-left-color: var(--muted);
}

.thm-proof {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line-strong);
}

.proof-head {
  color: var(--accent-ink);
  margin-bottom: 0;
}

.reference-list-entry {
  display: block;
  position: relative;
  margin: 0 0 0.35rem;
  line-height: 1.45;
}

.reference-list-entry::after {
  content: "";
  display: block;
  clear: both;
}

.pdf-reference-data {
  display: none;
}

.reference-list-link {
  color: var(--ink);
  text-decoration: none;
}

.reference-list-title {
  font-weight: 650;
  white-space: normal;
}

.reference-list-caption {
  font-weight: 400;
}

.reference-list-end {
  display: inline-block;
  width: 0;
  height: 1em;
  vertical-align: baseline;
}

.reference-list-dots {
  display: inline;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--sans);
  white-space: nowrap;
}

.reference-list-page {
  font-variant-numeric: tabular-nums;
  float: right;
  white-space: nowrap;
}

.reference-list-pdf {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.92em;
  text-decoration: none;
}

.typst-multi-label-list {
  display: none
}

.ref-with-tooltip {
  cursor: pointer;
}

.ref-tooltip {
  position: fixed;
  z-index: 40;
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 0.65rem 1.6rem rgba(0, 0, 0, 0.14);
  font: 700 0.75rem/1.2 var(--sans);
}

.ref-tooltip[hidden] {
  display: none;
}

.ref-tooltip a,
.ref-tooltip button {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  justify-content: center;
  padding: 0.28rem;
  border-radius: 3px;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ref-tooltip a:hover,
.ref-tooltip a:focus,
.ref-tooltip button:hover,
.ref-tooltip button:focus {
  background: var(--accent-soft);
  color: var(--ink);
  outline: none;
}

.ref-tooltip .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.ref-preview {
  position: fixed;
  top: calc(var(--topbar-height) + 0.85rem);
  right: 1rem;
  z-index: 45;
  width: fit-content;
  max-width: calc(var(--content-width) - 2rem);
  max-height: calc(100vh - var(--topbar-height) - 1.7rem);
  overflow: auto;
  padding: 1.2rem;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--paper) 97%, transparent);
  box-shadow: 0 0.85rem 2rem rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
  text-align: justify;
  cursor: auto;
  touch-action: none;
  resize: both;
}

.ref-preview-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: color-mix(in srgb, var(--paper) 78%, black 22%);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.ref-preview:hover .ref-preview-close,
.ref-preview:focus-within .ref-preview-close {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.ref-preview-close:hover,
.ref-preview-close:focus-visible {
  background: color-mix(in srgb, var(--accent) 78%, black 22%);
  border-color: color-mix(in srgb, var(--accent) 88%, white 12%);
  color: white;
}

.ref-preview[hidden] {
  display: none;
}

.ref-preview.dragging {
  cursor: grabbing;
  user-select: none;
}

.ref-preview-content {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.ref-preview-frame {
  display: block;
  width: 100%;
  height: min(32rem, calc(100vh - var(--topbar-height) - 4rem));
  border: 0;
  border-radius: 2px;
  background: var(--paper);
}

.ref-preview-content> :first-child {
  margin-top: 0;
}

.ref-preview-content> :last-child {
  margin-bottom: 0;
}

.ref-preview-content .thm-box,
.ref-preview-content .thm-proof {
  margin: 0;
}


.display-math {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  align-items: center;
  position: relative;
  width: 100%;
  overflow: visible;
  margin: 0.72rem auto 0.95rem;
}

.display-math>.equation-scroll {
  grid-column: 1;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}

.equation-scroll>math[display="block"] {
  min-width: 100%;
  width: max-content;
  max-width: none;
  overflow: visible;
  text-align: center;
}

.display-math>.equation-tag-layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  overflow: visible;
  z-index: 1;
  pointer-events: none;
}

.display-math>.equation-tag-anchor {
  grid-column: 2;
  align-self: center;
  width: 0;
  height: 0;
  overflow: hidden;
}

.display-math .equation-tag-holder {
  display: none;
}

.equation-tag-group {
  position: absolute;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1;
  transform: translateY(-50%);
}

.equation-tag-group>.equation-tag,
.equation-tag-group>.eq-tag {
  display: inline-block;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
}

.equation-tag-space {
  display: inline-block;
}

.qed-symbol {
  float: right;
}

math[display="block"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0.72rem auto 0.95rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  text-align: center;
}

.display-math>.equation-scroll>math[display="block"] {
  margin: 0;
  overflow: visible;
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  color: var(--muted);
  font-size: 0.92rem;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.page-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 2.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.page-nav-card {
  display: grid;
  min-height: 4.6rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  text-decoration: none;
}

.page-nav-card:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--paper) 90%, var(--accent-soft));
}

.page-nav-kicker {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-nav-title {
  align-self: end;
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.25;
}

.page-nav-arrow {
  color: var(--accent-ink);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1;
}

.nav-prev {
  text-align: left;
}

.nav-next {
  text-align: right;
}

.page-nav-spacer {
  min-height: 4.6rem;
}

section[role="doc-endnotes"] {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.6;
}

section[role="doc-endnotes"] ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

section[role="doc-endnotes"] li {
  margin: 0.35rem 0;
  padding-left: 0;
}

section[role="doc-endnotes"] sup[role="doc-backlink"] {
  margin-right: 0.35rem;
  color: var(--accent-ink);
  font-size: 0.78em;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.36);
}

.sidebar-backdrop.visible {
  display: block;
}

#sidebar-toggle-left,
#sidebar-toggle-right {
  display: none;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: var(--left-width) minmax(0, 1fr);
  }

  .content {
    grid-column: 2;
  }

  .sidebar-right {
    display: none;
  }

  #sidebar-toggle-right {
    display: inline-flex;
  }

  .sidebar-right.open {
    display: block;
    position: fixed;
    z-index: 16;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    width: min(21rem, 85vw);
    max-height: none;
    padding: 1rem;
    background: var(--paper);
    border-left: 1px solid var(--line);
  }

  .ref-preview {
    min-width: min(15rem, calc(100vw - 2rem));
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 1rem 2rem;
  }

  .sidebar-left {
    display: none;
  }

  #sidebar-toggle-left {
    display: inline-flex;
  }

  .sidebar-left.open {
    display: block;
    position: fixed;
    z-index: 16;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: min(21rem, 85vw);
    max-height: none;
    padding: 1rem;
    background: var(--paper);
    border-right: 1px solid var(--line);
  }

  .content {
    grid-column: 1;
    padding-top: 1.5rem;
  }

  .page-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-nav-spacer {
    display: none;
  }

}

figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

figure svg {
  max-width: 100%;
  height: auto !important;
}

.figure-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  justify-content: center;
  align-items: flex-start;
  margin: 1.5rem 0;
}

.figure-wrapper>figure {
  flex: 1 0 auto;
  width: fit-content;
  max-width: 100%;
  margin: 0;
}

[data-theme="dark"] figure svg {
  filter: invert(1) hue-rotate(180deg);
}

@media print {

  .topbar,
  .sidebar-left,
  .sidebar-right,
  .page-nav,
  .sidebar-backdrop,
  .ref-tooltip,
  .ref-preview,
  .typst-multi-label-list {
    display: none !important;
  }

  details.thm-proof {
    display: block;
  }

  details.thm-proof>* {
    display: block;
  }

  .layout {
    display: block;
  }

  .content {
    width: auto;
  }
}
