/* Use the site theme for text. Keep wide content inside the reading column. */
.course-note {
  min-width: 0;
  overflow-wrap: anywhere;
}

.course-note p {
  text-wrap: pretty;
}

.course-note h2,
.course-note h3,
.course-note h4 {
  scroll-margin-top: 80px;
  text-wrap: balance;
}

.note-toc {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--global-border-color);
  border-radius: 4px;
}

.note-toc summary {
  cursor: pointer;
  font-weight: 600;
}

.note-toc ul {
  margin-top: 16px;
  margin-bottom: 0;
}

.course-note a:focus-visible,
.note-toc summary:focus-visible,
.note-table:focus-visible {
  outline: 2px solid var(--global-link-color);
  outline-offset: 4px;
}

/* Inline formulas must not break the surrounding sentence into blocks. */
.note-math {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
}

.note-math svg {
  display: inline-block !important;
  max-width: none;
}

.note-equation,
.note-table {
  max-width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  padding: 8px 0;
}

.note-equation svg {
  margin-inline: auto;
  max-width: none;
}

.course-note .note-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.note-table table {
  margin: 0;
  width: 100%;
}

.course-note img {
  display: block;
  height: auto;
  max-width: 100%;
  margin: 16px auto;
  background: #ffffff;
}

.course-note pre {
  white-space: pre;
  overflow-x: auto;
}

.note-pagination {
  margin-top: 32px;
}

.note-source {
  margin-top: 16px;
  font-size: 14px;
  line-height: 20px;
}

/* Keep the article width comfortable and reuse the same outline on mobile. */
.note-body { min-width: 0; font-size: 18px; line-height: 28px; }
.note-body p { margin-bottom: 24px; }
.note-body pre { padding: 16px; border: 1px solid var(--global-border-color); border-radius: 8px; }
.note-body pre, .note-body pre code { background: var(--global-code-background-color); color: var(--global-code-text-color); font-size: 14px; line-height: 20px; }
.note-body .note-equation { margin: 24px 0; padding: 12px 0; }
.note-pagination { display: flex; flex-wrap: wrap; gap: 16px; padding: 24px 0; }
.note-pagination br { display: none; }
.note-pagination a { font-size: 14px; line-height: 20px; }
.note-breadcrumb { font-size: 14px; line-height: 20px; }
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 15;
  padding: 8px 12px;
  border: 1px solid var(--global-border-color);
  border-radius: 8px;
  background: var(--global-bg-color);
  color: var(--global-text-color);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}
.back-to-top:hover { border-color: var(--global-link-color); }
.back-to-top[hidden] { display: none; }
@media (min-width: 1280px) {
  .course-note { display: grid; grid-template-columns: minmax(0, 1fr) 192px; gap: 32px; align-items: start; }
  .note-breadcrumb { grid-column: 1 / -1; }
  .note-body { grid-column: 1; grid-row: 2; }
  .note-outline { grid-column: 2; grid-row: 2; position: sticky; top: 96px; max-height: calc(100vh - 128px); overflow-y: auto; }
  .note-outline .note-toc { border: 0; padding: 0; margin: 0; }
  .note-outline summary { pointer-events: none; list-style: none; font-size: 14px; line-height: 20px; }
  .note-outline summary::-webkit-details-marker { display: none; }
  .note-outline ul { list-style: none; padding: 0; }
  .note-outline li { margin: 0 0 4px; }
  .note-outline a { display: block; padding: 4px 8px; color: var(--global-text-color); font-size: 12px; line-height: 16px; text-decoration: none; border-radius: 4px; }
  .note-outline a.toc-subsection { padding-left: 16px; }
  .note-outline a:hover, .note-outline a[aria-current="location"] { background: var(--global-footer-bg-color); color: var(--global-link-color); }
}
@media (max-width: 639px) {
  .note-body { font-size: 16px; line-height: 24px; }
  .back-to-top { right: 16px; bottom: 16px; }
}
