/* Style for the footnote reference */
/*h1 {*/
/*    color: #003B71 !important;*/
/*}*/
label{
    text-indent: 0em;
}
span{
    text-indent: 0em;
}
p.admonition-title{
    text-indent: 0em;
}
p {
  text-indent: 0em;
}

/*
 * Follow strict Chinese line-breaking rules throughout every Chinese page.
 * Closing punctuation such as commas, full stops, semicolons, colons,
 * question marks, exclamation marks and closing brackets stays with the
 * preceding text instead of starting a new line.  `word-break: normal` also
 * prevents a theme or browser fallback from introducing aggressive breaks.
 */
html:lang(zh) body {
  line-break: strict;
  word-break: normal;
}

/*
 * Keep an atomic inline item and its following closing punctuation together.
 * Sphinx adds this wrapper around inline code and other short atomic items.
 * Hyperlinks and formulas use the separate breakable treatment below.
 */
html:lang(zh) .bd-article .cjk-punctuation-unit {
  display: inline-block;
  white-space: nowrap;
}

/*
 * Put the word-joiner inside a breakable link or formula as well.  Chromium
 * can otherwise ignore a joiner that begins the following text node when the
 * preceding MathJax container itself supplies a line-breaking opportunity.
 */
html:lang(zh) .bd-article .cjk-bind-closing-punctuation::after {
  content: "\2060";
}

/*
 * Use Times New Roman for Latin text in the main course content.  Characters
 * that are not provided by Times New Roman, including Chinese characters,
 * continue to use the theme's existing fallback fonts.
 */
.bd-article {
  --course-prose-font-family: "Times New Roman", var(--pst-font-family-base);
  font-family: var(--course-prose-font-family);
}

/* The theme assigns a separate font family to headings and figure captions. */
.bd-article :is(h1, h2, h3, h4, h5, h6, figcaption, .sidebar-title) {
  font-family: var(--course-prose-font-family);
}

/*
 * Keep the course name prominent while displaying the parenthetical note
 * below it in a smaller font.  ``pre-line`` preserves the newline supplied
 * by ``html_theme_options["logo"]["text"]`` in conf.py.
 */
.navbar-brand .logo__title {
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-line;
}

.navbar-brand .logo__title::first-line {
  font-size: 1.25rem;
}

/*
 * Keep the course-home link and the e-mail action independent.  The address
 * remains ordinary selectable text, while a click anywhere on its compact
 * row opens the system mail composer with the recipient already filled in.
 */
.navbar-brand .course-logo-home {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.navbar-brand .course-logo-email {
  position: relative;
  z-index: 1;
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.18rem 0.32rem;
  border-radius: 0.4rem;
  color: var(--pst-color-text-muted);
  cursor: text;
  font-size: 0.78rem;
  line-height: 1.35;
  text-decoration: none;
  user-select: text;
  -webkit-user-select: text;
}

.navbar-brand .course-logo-email:hover {
  color: var(--pst-color-primary);
  background: color-mix(in srgb, var(--pst-color-primary) 9%, transparent);
  text-decoration: none;
}

.navbar-brand .course-logo-email:focus-visible {
  outline: 2px solid var(--pst-color-primary);
  outline-offset: 2px;
}

.navbar-brand .course-logo-email__icon {
  flex: 0 0 auto;
  cursor: pointer;
  font-size: 0.88rem;
}

.navbar-brand .course-logo-email__address {
  min-width: 0;
  cursor: text;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

/* Keep every link to the gradient-clipping definition visually prominent. */
a.reference.internal[href$="#gradient-clipping"] {
  font-weight: 700;
}

/* Make third-level section headings visibly smaller than second-level ones. */
.bd-article h3 {
  font-size: 1.6rem;
}

/* Keep code-related elements in the theme's monospace font. */
.bd-article :is(code, pre, kbd, samp) {
  font-family: var(--pst-font-family-monospace);
}

/* Program code should retain its ordinary line-breaking behavior. */
html:lang(zh) body :is(code, pre, kbd, samp) {
  line-break: auto;
}

/* Display the website record numbers on one centered line at page bottom. */
.bd-footer-content .extra_footer,
.bd-footer-content .site-record-number {
  width: 100%;
  text-align: center;
}

/* -------------------------------------------------------------------------
 * Course reading interface
 * ------------------------------------------------------------------------- */

/* Keep the page calm and readable without changing the theme's color system. */
.bd-article {
  --course-radius: 0.65rem;
  --course-soft-shadow: 0 0.18rem 0.7rem rgb(31 35 40 / 8%);
  font-size: 1rem;
  line-height: 1.78;
}

/* Establish a clearer, but still compact, heading hierarchy. */
.bd-article h1 {
  margin-bottom: 1.45rem;
  font-size: clamp(2rem, 2.3vw, 2.55rem);
  line-height: 1.25;
  letter-spacing: 0.015em;
  overflow-wrap: anywhere;
}

.bd-article h2 {
  margin-top: 2.8rem;
  margin-bottom: 1.05rem;
  padding-bottom: 0.42rem;
  border-bottom: 1px solid var(--pst-color-border);
  font-size: clamp(1.6rem, 1.8vw, 2rem);
  line-height: 1.35;
}

.bd-article h3 {
  margin-top: 2.1rem;
  margin-bottom: 0.85rem;
  font-size: clamp(1.28rem, 1.45vw, 1.48rem);
  line-height: 1.4;
}

.bd-article h4 {
  margin-top: 1.65rem;
  font-size: 1.15rem;
  line-height: 1.45;
}

.bd-article :is(p, ul, ol, dl) {
  margin-bottom: 0.9rem;
}

/*
 * Use full justification for continuous course prose.  The two text-justify
 * values cover both the older Edge implementation and the current CSS Text
 * spelling; unsupported values are ignored by the browser.  The last line of
 * a paragraph remains aligned with its logical starting edge.
 */
html:lang(zh) .bd-article :where(p:not(.admonition-title), li, dd) {
  text-align: justify;
  text-align-last: start;
  text-justify: inter-ideograph;
  text-justify: inter-character;
  line-break: strict;
  word-break: normal;
  hyphens: none;
}

/* Titles are labels rather than continuous prose and should not be stretched. */
.bd-article :is(.admonition-title, .rubric) {
  text-align: start;
  text-align-last: start;
}

/* Compact interface elements and table cells are labels, not prose. */
html:lang(zh) .bd-article :where(
  table,
  .course-home-hero,
  .course-home-grid,
  .course-quiz-set,
  .binary-eval-quiz-set
) :where(p, li, dd) {
  text-align: start;
  text-align-last: auto;
}

/*
 * MathJax 4 splits long inline formulas at TeX-approved locations.  Keep the
 * outer Sphinx span non-atomic, but do not override white-space on the
 * generated CHTML container: MathJax needs its own rule to keep accents,
 * fractions, roots and similar structures together.
 */
.bd-article span.math {
  display: inline;
  white-space: normal;
}

.bd-article :is(ul, ol) {
  padding-left: 1.55rem;
}

.bd-article li + li {
  margin-top: 0.28rem;
}

/* Make links easy to recognize while preserving the existing blue palette. */
.bd-article a:not(.headerlink, .image-reference) {
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.17em;
  text-decoration-skip-ink: auto;
}

.bd-article a:not(.headerlink, .image-reference):hover {
  text-decoration-thickness: 0.12em;
}

.bd-article a:focus-visible,
.bd-sidebar a:focus-visible,
.bd-header button:focus-visible,
.bd-header-article button:focus-visible {
  border-radius: 0.2rem;
  outline: 3px solid var(--pst-color-primary);
  outline-offset: 3px;
}

/* Present figures as one visual unit and keep large media responsive. */
.bd-article figure {
  box-sizing: border-box;
  max-width: 100%;
  margin-top: 1.35rem;
  margin-bottom: 1.85rem;
  padding: 0.75rem 0.75rem 0.55rem;
  border: 1px solid var(--pst-color-border);
  border-radius: var(--course-radius);
  background: var(--pst-color-background);
  box-shadow: var(--course-soft-shadow);
}

.bd-article figure :is(img, video, svg),
.bd-article > video,
.bd-article section > video {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: 0.35rem;
}

/* A neutral white image mat keeps transparent mathematical diagrams legible
 * when the surrounding interface is in dark mode. */
html[data-theme="dark"] .bd-article figure img {
  padding: 0.3rem;
  border: 1px solid var(--course-border);
  background: #eef1f4;
}

html[data-theme="dark"] label.margin-toggle {
  color: var(--course-link-strong);
}

/*
 * Place desktop sidenotes entirely in the secondary sidebar.  Their width is
 * tied to the same theme variable as the “目录” column, while the number at
 * the start of the sidenote replaces the duplicate reference number that the
 * theme otherwise leaves inside the article text.
 */
.bd-article span.sidenote {
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: strict;
}

.bd-article span.sidenote a {
  white-space: normal;
  overflow-wrap: anywhere;
}

.bd-article span.sidenote .cjk-punctuation-unit {
  display: inline;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media screen and (min-width: 1200px) {
  .bd-article .cjk-punctuation-unit:has(> span.sidenote) {
    display: contents;
    white-space: normal;
  }

  .bd-article label.margin-toggle[for^="sidenote-role-"] {
    display: none;
  }

  .bd-article span.sidenote {
    clear: right;
    float: right;
    width: var(--pst-sidebar-secondary);
    margin: 0 calc(0px - var(--pst-sidebar-secondary) - 2rem) 0 0;
    padding: 0 1.35rem 0 1.35rem;
    position: relative;
  }

  .bd-article span.sidenote > sup:first-child {
    position: absolute;
    top: 0.28em;
    left: 0;
    width: 1rem;
    line-height: 1;
    text-align: left;
  }
}

.bd-article > video,
.bd-article section > video {
  width: 100%;
  margin-block: 1.35rem 1.85rem;
  border: 1px solid var(--pst-color-border);
  box-shadow: var(--course-soft-shadow);
}

.bd-article figcaption {
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--pst-color-border);
  color: var(--pst-color-text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

/* Give notes and other teaching modules consistent spacing and softer edges. */
.bd-article .admonition {
  margin-block: 1.55rem;
  border-radius: var(--course-radius);
  box-shadow: var(--course-soft-shadow);
}

.bd-article .admonition > .admonition-title {
  padding-block: 0.7rem;
  font-size: 1rem;
  line-height: 1.45;
}

.bd-article .admonition > :not(.admonition-title) {
  margin-right: 1.1rem;
  margin-left: 1.1rem;
}

.bd-article .admonition > :last-child {
  margin-bottom: 1rem;
}

/* Code and literal output should read as bounded blocks, not loose page text. */
.bd-article div.highlight,
.bd-article .literal-block-wrapper,
.bd-article .jupyter_container {
  margin-block: 1.25rem;
  border: 1px solid var(--pst-color-border);
  border-radius: var(--course-radius);
  box-shadow: var(--course-soft-shadow);
  overflow: hidden;
}

/* Avoid double borders where a code block already sits inside a wrapper. */
.bd-article :is(.literal-block-wrapper, .jupyter_container) div.highlight {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.bd-article div.highlight pre,
.bd-article pre {
  margin: 0;
  padding: 1rem 1.1rem;
  line-height: 1.55;
  tab-size: 4;
}

.bd-article :not(pre) > code.literal {
  padding: 0.1em 0.34em;
  border: 1px solid var(--pst-color-border);
  border-radius: 0.3rem;
}

/* Tables stay legible on small screens instead of widening the whole page. */
.bd-article .table-wrapper,
.bd-article div.table,
.bd-article .pst-scrollable-table-container,
.bd-article table.docutils {
  max-width: 100%;
}

.bd-article .table-wrapper,
.bd-article div.table,
.bd-article .pst-scrollable-table-container {
  margin-block: 1.35rem;
  overflow-x: auto;
  border: 1px solid var(--pst-color-border);
  border-radius: var(--course-radius);
  box-shadow: var(--course-soft-shadow);
}

.bd-article :is(table.docutils, table.table) {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.bd-article :is(table.docutils, table.table) th {
  background: var(--pst-color-surface);
  font-weight: 650;
}

.bd-article :is(table.docutils, table.table) :is(th, td) {
  padding: 0.62rem 0.78rem;
  vertical-align: top;
}

/* Keep long equations inside the reading column on narrow displays. */
.bd-article :is(.math-wrapper, section > div.math) {
  max-width: 100%;
  margin-block: 1.15rem;
  padding-bottom: 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Sidebar navigation gains clearer current-location and hover feedback. */
.bd-sidebar-primary .nav-link,
.bd-sidebar-secondary .toc-entry a {
  border-radius: 0.35rem;
  transition: background-color 120ms ease, color 120ms ease;
}

.bd-sidebar-primary .nav-link:hover,
.bd-sidebar-secondary .toc-entry a:hover {
  background: var(--pst-color-surface);
}

.bd-sidebar-primary .nav-link.active,
.bd-sidebar-secondary .toc-entry a.active {
  background: var(--pst-color-surface);
  color: var(--pst-color-primary);
  font-weight: 650;
}

/* Make previous/next chapter navigation feel like a clear page boundary. */
.prev-next-area a {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--pst-color-border);
  border-radius: var(--course-radius);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.prev-next-area a:hover {
  border-color: var(--pst-color-primary);
  background: var(--pst-color-surface);
}

/* Keep the footer metadata discreet and comfortably separated from content. */
.bd-footer-content .extra_footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pst-color-border);
  color: var(--pst-color-text-muted);
  font-size: 0.88rem;
}

@media (max-width: 959.98px) {
  .bd-article {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .bd-article h1 {
    margin-top: 0.35rem;
  }
}

@media (max-width: 575.98px) {
  .bd-article {
    padding-right: 1rem;
    padding-left: 1rem;
    font-size: 0.98rem;
    line-height: 1.72;
  }

  .bd-article h1 {
    font-size: 1.8rem;
  }

  .bd-article h2 {
    margin-top: 2.25rem;
    font-size: 1.48rem;
  }

  .bd-article h3 {
    font-size: 1.23rem;
  }

  .bd-article figure {
    padding: 0.5rem 0.5rem 0.45rem;
  }

  .bd-article .admonition > :not(.admonition-title) {
    margin-right: 0.85rem;
    margin-left: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-sidebar-primary .nav-link,
  .bd-sidebar-secondary .toc-entry a,
  .prev-next-area a {
    transition: none;
  }
}

@media print {
  .bd-article :is(figure, .admonition, div.highlight, .literal-block-wrapper,
    .jupyter_container, .table-wrapper, div.table,
    .pst-scrollable-table-container),
  .bd-article > video,
  .bd-article section > video {
    box-shadow: none;
  }
}

/* -------------------------------------------------------------------------
 * Lively academic accents
 *
 * The reading pages remain quiet; color and motion are concentrated on the
 * landing page and navigation so the site feels welcoming without becoming
 * distracting during long-form study.
 * ------------------------------------------------------------------------- */

:root,
html[data-theme="light"] {
  --course-hero-start: #eef5ff;
  --course-hero-end: #f6efff;
  --course-hero-glow-a: rgb(81 127 255 / 18%);
  --course-hero-glow-b: rgb(167 92 255 / 14%);
  --course-accent-1: #3567d4;
  --course-accent-2: #7645d8;
  --course-accent-3: #c94455;
  --course-accent-4: #986400;
  --course-accent-5: #087d7d;
  --course-accent-6: #3f55b8;
  --course-accent-7: #167749;
  --course-accent-8: #a83f78;
}

html[data-theme="dark"] {
  --course-hero-start: #14233a;
  --course-hero-end: #251d39;
  --course-hero-glow-a: rgb(91 143 255 / 17%);
  --course-hero-glow-b: rgb(177 114 255 / 14%);
  --course-accent-1: #7aa6ff;
  --course-accent-2: #aa83ff;
  --course-accent-3: #ff858c;
  --course-accent-4: #f1b451;
  --course-accent-5: #4bc1bd;
  --course-accent-6: #8296ff;
  --course-accent-7: #5cc58e;
  --course-accent-8: #e588bb;
}

/* Give the course identity and quick links a little warmth. */
.bd-sidebar-primary .navbar-brand {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--pst-color-primary) 24%, var(--course-border));
  background:
    radial-gradient(circle at 88% 8%, var(--course-hero-glow-b), transparent 34%),
    linear-gradient(145deg, var(--course-hero-start), var(--course-hero-end));
}

.bd-sidebar-primary .navbar-brand::after {
  position: absolute;
  right: -1.5rem;
  bottom: -1.7rem;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--course-hero-glow-a);
  content: "";
  pointer-events: none;
}

.bd-sidebar-primary .navbar-icon-links .nav-link {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.bd-sidebar-primary .navbar-icon-links .nav-link::after {
  position: absolute;
  inset: auto -0.6rem -1.15rem;
  z-index: -1;
  height: 2rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.08;
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(1) .nav-link {
  color: var(--course-accent-1);
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(2) .nav-link {
  color: var(--course-accent-3);
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(3) .nav-link {
  color: var(--course-accent-5);
}

.bd-sidebar-primary a.reference.internal:hover,
.bd-sidebar-secondary .toc-entry > .nav-link:hover {
  transform: translateX(0.12rem);
}

/* A welcoming hero replaces the plain introductory box on the landing page. */
.bd-article .course-home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0.15rem 0 1.8rem;
  padding: 1.45rem 1.5rem 1.35rem;
  border: 1px solid color-mix(in srgb, var(--pst-color-primary) 22%, var(--course-border));
  border-radius: 1.15rem;
  background: linear-gradient(135deg, var(--course-hero-start), var(--course-hero-end));
  box-shadow: var(--course-shadow-sm);
}

.bd-article .course-home-hero::before,
.bd-article .course-home-hero::after {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.bd-article .course-home-hero::before {
  top: -4.4rem;
  right: -2.8rem;
  width: 11rem;
  height: 11rem;
  background: var(--course-hero-glow-a);
}

.bd-article .course-home-hero::after {
  right: 7.5rem;
  bottom: -5.5rem;
  width: 9rem;
  height: 9rem;
  background: var(--course-hero-glow-b);
}

.bd-article .course-home-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.65rem;
  padding: 0.28rem 0.68rem;
  border: 1px solid color-mix(in srgb, var(--pst-color-primary) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--course-panel) 70%, transparent);
  color: var(--course-link-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.bd-article .course-home-kicker::before {
  width: 0.45rem;
  height: 0.45rem;
  margin-inline-end: 0.42rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--course-accent-1), var(--course-accent-2));
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--course-accent-1) 14%, transparent);
  content: "";
}

.bd-article .course-home-hero .course-home-lead {
  max-width: 43rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--pst-color-text-base);
  font-size: 1.02rem;
}

.bd-article .course-home-features > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.bd-article .course-home-features > ul > li {
  margin: 0;
  padding: 0.3rem 0.68rem;
  border: 1px solid color-mix(in srgb, var(--course-border-strong) 72%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--course-panel) 68%, transparent);
  color: var(--pst-color-text-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.bd-article .course-home-features > ul > li::before {
  margin-inline-end: 0.3rem;
  color: var(--course-accent-5);
  content: "\2713";
  font-weight: 800;
}

.bd-article .course-home-actions {
  margin-top: 1rem;
}

.bd-article .course-home-actions > p {
  margin: 0;
}

.bd-article .course-home-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.58rem 0.9rem;
  border-radius: 0.62rem;
  background: linear-gradient(135deg, #2f5fd0, #6842c2);
  color: #ffffff;
  box-shadow: 0 0.35rem 0.85rem rgb(79 125 243 / 20%);
  font-weight: 700;
  text-decoration: none !important;
  transition: box-shadow 170ms ease, transform 170ms ease;
}

.bd-article .course-home-actions a::after {
  content: "\2192";
}

.bd-article .course-home-actions a:hover {
  box-shadow: 0 0.55rem 1.1rem rgb(79 125 243 / 28%);
  transform: translateY(-1px);
}

/* Each module gets a restrained identity color and a compact number badge. */
.bd-article .course-home-grid {
  counter-reset: course-module;
}

.bd-article .course-home-grid > ul {
  gap: 1.05rem;
}

.bd-article .course-home-grid > ul > li {
  --module-accent: var(--course-accent-1);
  counter-increment: course-module;
  overflow: hidden;
  padding: 1.15rem 1.15rem 1.05rem 4.15rem;
  border-color: color-mix(in srgb, var(--module-accent) 24%, var(--course-border));
  border-radius: 0.95rem;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--module-accent) 8%, transparent), transparent 43%),
    var(--course-panel);
  transition: border-color 180ms ease, box-shadow 180ms ease,
    transform 180ms ease;
}

.bd-article .course-home-grid > ul > li:nth-child(2) { --module-accent: var(--course-accent-2); }
.bd-article .course-home-grid > ul > li:nth-child(3) { --module-accent: var(--course-accent-3); }
.bd-article .course-home-grid > ul > li:nth-child(4) { --module-accent: var(--course-accent-4); }
.bd-article .course-home-grid > ul > li:nth-child(5) { --module-accent: var(--course-accent-5); }
.bd-article .course-home-grid > ul > li:nth-child(6) { --module-accent: var(--course-accent-6); }
.bd-article .course-home-grid > ul > li:nth-child(7) { --module-accent: var(--course-accent-7); }
.bd-article .course-home-grid > ul > li:nth-child(8) { --module-accent: var(--course-accent-8); }

.bd-article .course-home-grid > ul > li::before {
  position: absolute;
  top: 1.05rem;
  left: 1.05rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.72rem;
  background: color-mix(in srgb, var(--module-accent) 16%, var(--course-panel));
  color: var(--module-accent);
  content: counter(course-module, decimal-leading-zero);
  font-family: var(--pst-font-family-base);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--module-accent) 20%, transparent);
}

.bd-article .course-home-grid > ul > li::after {
  color: var(--module-accent);
}

.bd-article .course-home-grid > ul > li:hover,
.bd-article .course-home-grid > ul > li:focus-within {
  border-color: color-mix(in srgb, var(--module-accent) 68%, var(--course-border));
  box-shadow: 0 0.65rem 1.4rem color-mix(in srgb, var(--module-accent) 14%, transparent);
  transform: translateY(-0.18rem);
}

.bd-article .course-home-grid > ul > li > p:first-child a {
  color: var(--module-accent);
}

/* Stretch the heading link across the card without changing document
 * semantics; the description remains selectable text. */
.bd-article .course-home-grid > ul > li > p:first-child a::after {
  position: absolute;
  inset: 0;
  content: "";
}

.bd-article .course-home-grid > ul > li:has(a:focus-visible) {
  outline: 3px solid var(--module-accent);
  outline-offset: 3px;
}

/* Keep long reading pages calmer, but make section markers less mechanical. */
.bd-article h2::after {
  width: 4.4rem;
  background: linear-gradient(90deg, var(--course-accent-1), var(--course-accent-2));
}

@media (max-width: 575.98px) {
  .bd-article .course-home-hero {
    padding: 1.1rem 1rem 1.05rem;
    border-radius: 0.9rem;
  }

  .bd-article .course-home-hero::before {
    top: -5rem;
    right: -4rem;
  }

  .bd-article .course-home-grid > ul > li {
    padding: 1rem 0.95rem 0.95rem 3.8rem;
  }

  .bd-article .course-home-grid > ul > li::before {
    top: 0.95rem;
    left: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-sidebar-primary a.reference.internal,
  .bd-sidebar-secondary .toc-entry > .nav-link,
  .bd-article .course-home-actions a,
  .bd-article .course-home-grid > ul > li {
    transition: none;
    transform: none;
  }
}

@media print {
  .bd-article .course-home-hero,
  .bd-article .course-home-grid > ul > li {
    background: #ffffff;
    box-shadow: none;
  }
}

/* -------------------------------------------------------------------------
 * Professional course shell
 *
 * This final layer supplies one shared visual system for the page chrome and
 * reading components.  It intentionally builds on the theme's semantic
 * colors, so warnings, notes, links, and syntax highlighting retain their
 * established meaning in both light and dark modes.
 * ------------------------------------------------------------------------- */

:root,
html[data-theme="light"] {
  --course-canvas: #f4f7fb;
  --course-panel: #ffffff;
  --course-panel-soft: #f8fafc;
  --course-panel-hover: #eef4ff;
  --course-border: #dde5f0;
  --course-border-strong: #c9d4e3;
  --course-muted: #64748b;
  --course-brand-soft: #eaf2ff;
  --course-link-strong: #0b5fc6;
  --course-shadow-xs: 0 1px 2px rgb(15 23 42 / 5%);
  --course-shadow-sm: 0 0.3rem 1rem rgb(15 23 42 / 7%);
  --course-shadow-md: 0 0.8rem 2rem rgb(15 23 42 / 8%);
}

html[data-theme="dark"] {
  --course-canvas: #0b1017;
  --course-panel: #111720;
  --course-panel-soft: #0f151d;
  --course-panel-hover: #182334;
  --course-border: #2a3545;
  --course-border-strong: #3a485c;
  --course-muted: #9aa9bc;
  --course-brand-soft: #17263d;
  --course-link-strong: #73a9f3;
  --course-shadow-xs: 0 1px 2px rgb(0 0 0 / 22%);
  --course-shadow-sm: 0 0.3rem 1rem rgb(0 0 0 / 24%);
  --course-shadow-md: 0 0.8rem 2rem rgb(0 0 0 / 28%);
}

html {
  scrollbar-color: var(--course-border-strong) transparent;
}

body,
.bd-container,
.bd-container__inner,
.bd-main {
  background: var(--course-canvas);
}

::selection {
  background: var(--course-brand-soft);
  color: inherit;
}

/* The rst_prolog defines MathJax macros through an empty display equation.
 * Keep the definitions available to MathJax but remove their blank page slot. */
.bd-article > .math:first-child {
  display: none !important;
}

/* Reading surface and sticky article toolbar. */
.bd-article-container,
.bd-header-article {
  background: var(--course-panel);
}

.bd-content {
  background: var(--course-canvas);
}

.bd-article-container {
  border-inline: 1px solid var(--course-border);
  box-shadow: var(--course-shadow-xs);
}

.bd-header-article {
  border-bottom: 1px solid var(--course-border);
  box-shadow: 0 0.2rem 0.7rem rgb(15 23 42 / 4%);
}

@supports (backdrop-filter: blur(0.75rem)) {
  .bd-header-article {
    background: color-mix(in srgb, var(--course-panel) 92%, transparent);
    backdrop-filter: blur(0.75rem) saturate(135%);
  }
}

.bd-header-article .header-article__inner {
  padding-inline: 0.55rem;
}

.bd-header-article .btn {
  min-width: 2.2rem;
  min-height: 2.2rem;
  margin-block: 0.36rem;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  color: var(--course-muted);
  transition: color 140ms ease, background-color 140ms ease,
    border-color 140ms ease, transform 140ms ease;
}

.bd-header-article .btn:hover {
  border-color: var(--course-border);
  background: var(--course-panel-hover);
  color: var(--pst-color-primary);
}

.bd-header-article .btn:active {
  transform: translateY(1px);
}

.bd-header-article .btn:focus-visible {
  border-color: var(--pst-color-primary);
  outline: 3px solid var(--pst-color-primary);
  outline-offset: 2px;
  box-shadow: none;
}

/* Primary navigation: course identity, shortcuts, search, and chapter tree. */
.bd-sidebar-primary {
  border-inline-end: 1px solid var(--course-border);
  background: var(--course-panel-soft);
}

.bd-sidebar-primary .navbar-brand {
  box-sizing: border-box;
  width: 100%;
  margin-block: 0.45rem 0.8rem;
  padding: 0.78rem 0.7rem;
  border: 1px solid var(--course-border);
  border-radius: 0.78rem;
  background: var(--course-panel);
  box-shadow: var(--course-shadow-xs);
  transition: border-color 140ms ease, box-shadow 140ms ease,
    transform 140ms ease;
}

.bd-sidebar-primary .navbar-brand:hover {
  border-color: var(--course-border-strong);
  box-shadow: var(--course-shadow-sm);
  transform: translateY(-1px);
}

.navbar-brand .logo__title {
  color: var(--pst-color-text-base);
  text-align: center;
}

.bd-sidebar-primary .navbar-icon-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  margin-block: 0.25rem 0.9rem;
}

.bd-sidebar-primary .navbar-icon-links .nav-item {
  display: flex;
  justify-content: center;
}

.bd-sidebar-primary .navbar-icon-links .nav-link {
  flex-direction: column;
  gap: 0.08rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.05rem;
  min-height: 3.05rem;
  padding: 0;
  border: 1px solid var(--course-border);
  border-radius: 0.68rem;
  background: var(--course-panel);
  color: var(--course-muted);
  box-shadow: var(--course-shadow-xs);
  font-size: 0.7rem;
  line-height: 1.2;
}

.bd-sidebar-primary .navbar-icon-links .nav-link svg {
  font-size: 1rem;
}

.bd-sidebar-primary .navbar-icon-links .nav-link:hover {
  border-color: var(--course-border-strong);
  background: var(--course-panel-hover);
  color: var(--pst-color-primary);
}

.bd-sidebar-primary .search-button-field {
  min-height: 2.55rem;
  border: 1px solid var(--course-border-strong);
  border-radius: 0.68rem;
  background: var(--course-panel);
  box-shadow: var(--course-shadow-xs);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.bd-sidebar-primary .search-button-field:hover {
  border-color: var(--pst-color-primary);
  box-shadow: 0 0 0 0.18rem var(--course-brand-soft);
}

.bd-sidebar-primary .caption-text {
  color: var(--course-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.bd-sidebar-primary a.reference.internal {
  display: block;
  margin-block: 0.06rem;
  padding: 0.34rem 0.55rem;
  border-inline-start: 3px solid transparent;
  border-radius: 0 0.46rem 0.46rem 0;
  line-height: 1.45;
  text-decoration: none;
  transition: color 130ms ease, background-color 130ms ease,
    border-color 130ms ease;
}

.bd-sidebar-primary a.reference.internal:hover {
  background: var(--course-panel-hover);
  color: var(--course-link-strong);
}

.bd-sidebar-primary li.current > a.reference.internal,
.bd-sidebar-primary a.reference.internal.current {
  border-inline-start-color: var(--pst-color-primary);
  background: var(--course-brand-soft);
  color: var(--course-link-strong);
  font-weight: 700;
}

/* Keep ancestor chapters visible without competing with the current page. */
.bd-sidebar-primary li.current.has-children > a.reference.internal:not(.current) {
  border-inline-start-color: transparent;
  background: transparent;
  color: var(--course-link-strong);
  font-weight: 700;
}

/* Secondary navigation is visually quieter but keeps location unmistakable. */
.bd-sidebar-secondary {
  border-inline-start: 1px solid var(--course-border);
  background: var(--course-panel-soft);
}

.bd-sidebar-secondary .page-toc {
  color: var(--course-muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bd-sidebar-secondary .toc-entry > .nav-link {
  margin-block: 0.06rem;
  padding: 0.34rem 0.65rem;
  border-inline-start: 2px solid transparent;
  border-radius: 0 0.42rem 0.42rem 0;
  line-height: 1.42;
  text-decoration: none;
}

.bd-sidebar-secondary .toc-entry > .nav-link:hover {
  border-inline-start-color: var(--course-border-strong);
  background: var(--course-panel-hover);
}

.bd-sidebar-secondary .toc-entry > .nav-link.active {
  border-inline-start-color: var(--pst-color-primary);
  background: var(--course-brand-soft);
  color: var(--course-link-strong);
  font-weight: 700;
}

/* Article hierarchy and long-form reading details. */
.bd-article {
  --course-radius: 0.72rem;
  --course-soft-shadow: var(--course-shadow-sm);
  padding-bottom: 2.5rem;
}

.bd-article > h1:first-of-type,
.bd-article > section:first-of-type > h1:first-child {
  padding-inline-start: 0.9rem;
  border-inline-start: 0.28rem solid var(--pst-color-primary);
}

.bd-article h2 {
  position: relative;
  border-bottom-color: var(--course-border);
}

.bd-article h2::after {
  position: absolute;
  bottom: -1px;
  inset-inline-start: 0;
  width: 3.75rem;
  height: 2px;
  border-radius: 999px;
  background: var(--pst-color-primary);
  content: "";
}

.bd-article h3 {
  color: var(--pst-color-text-base);
}

.bd-article blockquote {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-inline-start: 0.24rem solid var(--pst-color-primary);
  border-radius: 0 0.62rem 0.62rem 0;
  background: var(--course-panel-soft);
  color: var(--pst-color-text-muted);
}

.bd-article figure,
.bd-article div.highlight,
.bd-article .literal-block-wrapper,
.bd-article .jupyter_container,
.bd-article .table-wrapper,
.bd-article div.table,
.bd-article .pst-scrollable-table-container {
  border-color: var(--course-border);
  box-shadow: var(--course-shadow-sm);
}

.bd-article .admonition {
  box-shadow: var(--course-shadow-sm) !important;
}

.bd-article figure,
.bd-article .admonition {
  background: var(--course-panel);
}

.bd-article .admonition {
  overflow: hidden;
}

.bd-article .admonition > .admonition-title {
  border-bottom: 1px solid var(--course-border);
}

.bd-article :not(pre) > code.literal {
  border-color: var(--course-border);
  background: var(--course-panel-soft);
}

.bd-article :is(table.docutils, table.table) th {
  border-bottom: 1px solid var(--course-border-strong);
  background: var(--course-brand-soft);
}

.bd-article :is(table.docutils, table.table) tbody tr:nth-child(even) {
  background: var(--course-panel-soft);
}

.bd-article :is(table.docutils, table.table) tbody tr {
  transition: background-color 120ms ease;
}

.bd-article :is(table.docutils, table.table) tbody tr:hover {
  background: var(--course-panel-hover);
}

.bd-article caption {
  margin-bottom: 0.6rem;
  color: var(--pst-color-text-muted);
  font-size: 0.92rem;
  font-weight: 650;
}

/* The landing page is a course portal rather than a second copy of the full
 * table of contents.  These cards preserve ordinary Sphinx links and remain
 * fully usable without JavaScript. */
.bd-article .course-home-lead {
  max-width: 48rem;
  margin: 0.2rem 0 1.8rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--course-border);
  border-inline-start: 0.28rem solid var(--pst-color-primary);
  border-radius: 0 0.72rem 0.72rem 0;
  background: var(--course-panel-soft);
  color: var(--pst-color-text-muted);
}

.bd-article .course-home-lead > :last-child {
  margin-bottom: 0;
}

.bd-article .course-home-grid > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bd-article .course-home-grid > ul > li {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 1.05rem 1.05rem 0.95rem;
  border: 1px solid var(--course-border);
  border-radius: 0.78rem;
  background: var(--course-panel);
  box-shadow: var(--course-shadow-xs);
  transition: border-color 150ms ease, box-shadow 150ms ease,
    transform 150ms ease;
}

.bd-article .course-home-grid > ul > li::after {
  position: absolute;
  top: 1.1rem;
  inset-inline-end: 1rem;
  color: var(--course-muted);
  content: "\2192";
  font-family: var(--pst-font-family-base);
  font-size: 1.05rem;
  transition: color 150ms ease, transform 150ms ease;
}

.bd-article .course-home-grid > ul > li:hover {
  border-color: var(--pst-color-primary);
  box-shadow: var(--course-shadow-sm);
}

.bd-article .course-home-grid > ul > li:focus-within,
.bd-article .course-home-grid > ul > li:has(a:focus-visible) {
  border-color: var(--pst-color-primary);
  box-shadow: var(--course-shadow-sm);
}

.bd-article .course-home-grid > ul > li:hover::after {
  color: var(--pst-color-primary);
  transform: translateX(0.18rem);
}

.bd-article .course-home-grid > ul > li > p:first-child {
  margin: 0 1.8rem 0.45rem 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.42;
}

.bd-article .course-home-grid > ul > li > p:first-child a {
  text-decoration: none;
}

.bd-article .course-home-grid > ul > li > p:last-child {
  margin: 0;
  color: var(--pst-color-text-muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

/* Clear completion boundary between chapters and discreet site metadata. */
.prev-next-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 3.4rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--course-border);
}

.prev-next-area a {
  float: none !important;
  width: auto;
  max-width: none;
  min-height: 4.3rem;
  border-color: var(--course-border);
  background: var(--course-panel-soft);
  box-shadow: var(--course-shadow-xs);
}

.prev-next-area > a.right-next {
  justify-content: flex-end;
  text-align: right;
}

.prev-next-area > a.right-next .prev-next-info {
  margin-left: auto;
  text-align: right;
}

.prev-next-area > a.right-next .prev-next-info > p {
  text-align: right;
}

.prev-next-area > .right-next:only-child {
  grid-column: 2;
  width: min(100%, 24rem);
  justify-self: end;
}

.prev-next-area a:hover {
  border-color: var(--pst-color-primary);
  background: var(--course-brand-soft);
  box-shadow: var(--course-shadow-sm);
}

.bd-footer-content {
  border-top: 1px solid var(--course-border);
  background: var(--course-canvas);
}

.bd-footer-content a {
  color: inherit;
  text-underline-offset: 0.16em;
}

@media (max-width: 959.98px) {
  .bd-article-container {
    border-inline: 0;
    box-shadow: none;
  }

  .bd-sidebar-primary,
  .bd-sidebar-secondary {
    background: var(--course-panel);
  }
}

@media (max-width: 575.98px) {
  .bd-header-article .header-article__inner {
    padding-inline: 0.25rem;
  }

  .bd-header-article .btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin-block: 0.12rem;
  }

  .bd-article > h1:first-of-type,
  .bd-article > section:first-of-type > h1:first-child {
    padding-inline-start: 0.7rem;
    border-inline-start-width: 0.22rem;
  }

  .prev-next-area {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .prev-next-area > .right-next:only-child {
    grid-column: auto;
    width: 100%;
    justify-self: stretch;
  }

  .bd-article .course-home-grid > ul {
    grid-template-columns: 1fr;
  }

  .bd-article .course-home-lead {
    margin-bottom: 1.25rem;
    padding: 0.85rem 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-header-article .btn,
  .bd-sidebar-primary .navbar-brand,
  .bd-sidebar-primary a.reference.internal,
  .bd-sidebar-secondary .toc-entry > .nav-link,
  .bd-article :is(table.docutils, table.table) tbody tr {
    transition: none;
  }

  .bd-article .course-home-grid > ul > li,
  .bd-article .course-home-grid > ul > li::after {
    transition: none;
    transform: none;
  }
}

@media print {
  body,
  .bd-container,
  .bd-container__inner,
  .bd-main,
  .bd-content,
  .bd-article-container {
    background: #ffffff;
  }

  .bd-article-container {
    border: 0;
    box-shadow: none;
  }
}

/* Final lively overrides must follow the professional shell rules above. */
.bd-sidebar-primary .navbar-brand {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--pst-color-primary) 24%, var(--course-border));
  background:
    radial-gradient(circle at 88% 8%, var(--course-hero-glow-b), transparent 34%),
    linear-gradient(145deg, var(--course-hero-start), var(--course-hero-end));
}

.bd-sidebar-primary .navbar-icon-links .nav-link .sr-only {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  font-size: 0.65rem;
  line-height: 1.15;
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(1) .nav-link {
  border-color: color-mix(in srgb, var(--course-accent-1) 25%, var(--course-border));
  background: color-mix(in srgb, var(--course-accent-1) 7%, var(--course-panel));
  color: var(--course-accent-1);
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(2) .nav-link {
  border-color: color-mix(in srgb, var(--course-accent-3) 25%, var(--course-border));
  background: color-mix(in srgb, var(--course-accent-3) 7%, var(--course-panel));
  color: var(--course-accent-3);
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(3) .nav-link {
  border-color: color-mix(in srgb, var(--course-accent-5) 25%, var(--course-border));
  background: color-mix(in srgb, var(--course-accent-5) 7%, var(--course-panel));
  color: var(--course-accent-5);
}

.bd-article > h1:first-of-type,
.bd-article > section:first-of-type > h1:first-child {
  border-inline-start-color: transparent;
  background: linear-gradient(
    180deg,
    var(--course-accent-1),
    var(--course-accent-2)
  ) left center / 0.28rem 72% no-repeat;
}

.bd-article h2::after {
  width: 4.4rem;
  background: linear-gradient(90deg, var(--course-accent-1), var(--course-accent-2));
}

.bd-article .course-home-grid > ul > li {
  border-color: color-mix(in srgb, var(--module-accent) 24%, var(--course-border));
  border-radius: 0.95rem;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--module-accent) 8%, transparent), transparent 43%),
    var(--course-panel);
  padding: 1.15rem 1.15rem 1.05rem 4.15rem;
  transition: border-color 180ms ease, box-shadow 180ms ease,
    transform 180ms ease;
}

.bd-article .course-home-grid > ul > li:hover,
.bd-article .course-home-grid > ul > li:focus-within,
.bd-article .course-home-grid > ul > li:has(a:focus-visible) {
  border-color: color-mix(in srgb, var(--module-accent) 68%, var(--course-border));
  box-shadow: 0 0.65rem 1.4rem color-mix(in srgb, var(--module-accent) 14%, transparent);
  transform: translateY(-0.18rem);
}

.bd-article .course-home-grid > ul > li::after {
  color: var(--module-accent);
}

.bd-article .course-home-grid > ul > li > p:first-child a {
  color: var(--module-accent);
}

@media (max-width: 575.98px) {
  .bd-article .course-home-grid > ul > li {
    padding: 1rem 0.95rem 0.95rem 3.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-article .course-home-grid > ul > li:hover,
  .bd-article .course-home-grid > ul > li:focus-within,
  .bd-article .course-home-grid > ul > li:has(a:focus-visible),
  .bd-article .course-home-actions a:hover {
    transform: none;
  }
}

/* -------------------------------------------------------------------------
 * Minimal reading theme
 *
 * Keep one restrained blue accent throughout the site.  This final layer
 * deliberately removes the earlier decorative gradients and deep shadows,
 * and supplies a neutral dark palette instead of the theme's purple-heavy
 * defaults.  Semantic colours remain available for notes, warnings, quiz
 * answers, and errors.
 * ------------------------------------------------------------------------- */

:root,
html[data-theme="light"] {
  --pst-color-primary: #2f649c;
  --pst-color-primary-bg: #eaf1f8;
  --pst-color-secondary: #496f96;
  --pst-color-secondary-bg: #edf2f7;
  --pst-color-link: #285f99;
  --pst-color-link-hover: #1f4e80;
  --pst-color-table-row-hover-bg: #edf3f8;
  --course-canvas: #f6f7f9;
  --course-panel: #ffffff;
  --course-panel-soft: #f8f9fb;
  --course-panel-hover: #f0f4f8;
  --course-border: #e1e5ea;
  --course-border-strong: #cbd2da;
  --course-muted: #687381;
  --course-brand-soft: #eaf1f8;
  --course-link-strong: #285f99;
  --course-button-bg: #2f649c;
  --course-button-hover: #255681;
  --course-figure-tint: #f4f7fb;
  --course-figure-shadow: 0 0.5rem 1.25rem rgb(31 41 55 / 10%);
  --course-shadow-xs: none;
  --course-shadow-sm: none;
  --course-shadow-md: none;
  --course-hover-shadow: 0 0.22rem 0.65rem rgb(31 41 55 / 8%);
  --course-hero-start: #f7f9fb;
  --course-hero-end: #f7f9fb;
  --course-hero-glow-a: transparent;
  --course-hero-glow-b: transparent;
  --course-accent-1: #32689f;
  --course-accent-2: #32689f;
  --course-accent-3: #32689f;
  --course-accent-4: #32689f;
  --course-accent-5: #32689f;
  --course-accent-6: #32689f;
  --course-accent-7: #32689f;
  --course-accent-8: #32689f;
}

html[data-theme="dark"] {
  --pst-color-primary: #8ab4df;
  --pst-color-primary-bg: #202e3d;
  --pst-color-secondary: #9ab8d4;
  --pst-color-secondary-bg: #222c36;
  --pst-color-accent: #a9c3dc;
  --pst-color-accent-bg: #253340;
  --pst-color-info: #8bb7e5;
  --pst-color-info-bg: #202f3e;
  --pst-color-warning: #ddb77a;
  --pst-color-warning-bg: #393022;
  --pst-color-success: #86c7a4;
  --pst-color-success-bg: #20352b;
  --pst-color-danger: #e09a9a;
  --pst-color-danger-bg: #3a2729;
  --pst-color-text-base: #d8dee6;
  --pst-color-text-muted: #a5aebb;
  --pst-color-heading: #e7ebf0;
  --pst-color-inline-code: #d7b6d2;
  --pst-color-inline-code-links: #9cc5e8;
  --pst-color-background: #15191e;
  --pst-color-on-background: #1b2026;
  --pst-color-surface: #222830;
  --pst-color-on-surface: #e2e7ed;
  --pst-color-border: #343c46;
  --pst-color-border-muted: #2a3139;
  --pst-color-table: #dfe5eb;
  --pst-color-table-heading-bg: #252c34;
  --pst-color-table-row-zebra-high-bg: #1b2026;
  --pst-color-table-row-zebra-low-bg: #20262d;
  --pst-color-table-row-hover-bg: #293441;
  --pst-color-table-inner-border: #343c46;
  --pst-color-link: #8ab4df;
  --pst-color-link-hover: #b1cdea;
  --course-canvas: #15191e;
  --course-panel: #1b2026;
  --course-panel-soft: #181d22;
  --course-panel-hover: #232b34;
  --course-border: #343c46;
  --course-border-strong: #46515e;
  --course-muted: #a5aebb;
  --course-brand-soft: #202e3d;
  --course-link-strong: #8ab4df;
  --course-button-bg: #315f89;
  --course-button-hover: #3a6d9b;
  --course-figure-tint: #1e252d;
  --course-figure-shadow: 0 0.5rem 1.3rem rgb(0 0 0 / 28%);
  --course-shadow-xs: none;
  --course-shadow-sm: none;
  --course-shadow-md: none;
  --course-hover-shadow: 0 0.22rem 0.7rem rgb(0 0 0 / 20%);
  --course-hero-start: #1b2026;
  --course-hero-end: #1b2026;
  --course-hero-glow-a: transparent;
  --course-hero-glow-b: transparent;
  --course-accent-1: #8ab4df;
  --course-accent-2: #8ab4df;
  --course-accent-3: #8ab4df;
  --course-accent-4: #8ab4df;
  --course-accent-5: #8ab4df;
  --course-accent-6: #8ab4df;
  --course-accent-7: #8ab4df;
  --course-accent-8: #8ab4df;
  color-scheme: dark;
}

/* Flat, compact page chrome. */
.bd-article {
  --course-radius: 0.45rem;
  --course-soft-shadow: none;
}

.bd-article-container,
.bd-header-article,
.bd-sidebar-primary .navbar-brand,
.bd-sidebar-primary .navbar-icon-links .nav-link,
.bd-sidebar-primary .search-button-field,
.bd-article :is(figure, .admonition, div.highlight, .literal-block-wrapper,
  .jupyter_container, .table-wrapper, div.table,
  .pst-scrollable-table-container),
.prev-next-area a {
  box-shadow: none !important;
}

.bd-header-article {
  background: var(--course-panel);
  backdrop-filter: none;
}

.bd-sidebar-primary .navbar-brand {
  border-color: var(--course-border);
  border-radius: 0.5rem;
  background: var(--course-panel);
}

.bd-sidebar-primary .navbar-brand::after,
.bd-sidebar-primary .navbar-icon-links .nav-link::after {
  display: none;
}

.bd-sidebar-primary .navbar-brand:hover {
  border-color: var(--course-border-strong);
  box-shadow: none;
  transform: none;
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(n) .nav-link {
  border-color: var(--course-border);
  border-radius: 0.48rem;
  background: var(--course-panel);
  color: var(--course-muted);
  transition: border-color 120ms ease, background-color 120ms ease,
    color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.bd-sidebar-primary .navbar-icon-links .nav-item:nth-child(n) .nav-link:hover {
  border-color: var(--course-border-strong);
  background: var(--course-panel-hover);
  color: var(--course-link-strong);
  box-shadow: var(--course-hover-shadow);
  transform: translateY(-1px);
}

.bd-sidebar-primary a.reference.internal:hover,
.bd-sidebar-secondary .toc-entry > .nav-link:hover {
  transform: none;
}

.bd-article > h1:first-of-type,
.bd-article > section:first-of-type > h1:first-child {
  border-inline-start-color: var(--pst-color-primary);
  background: none;
}

.bd-article h2::after {
  width: 3.25rem;
  background: var(--pst-color-primary);
}

/* The home page retains hierarchy without decorative glows or rainbow cards. */
.bd-article .course-home-hero {
  padding: 1.15rem 1.25rem;
  border-color: var(--course-border);
  border-radius: 0.58rem;
  background: var(--course-panel-soft);
  box-shadow: none;
}

.bd-article .course-home-hero::before,
.bd-article .course-home-hero::after,
.bd-article .course-home-kicker::before {
  display: none;
}

.bd-article .course-home-kicker {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--course-link-strong);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.bd-article .course-home-features > ul > li {
  padding: 0.22rem 0.55rem;
  border-color: var(--course-border);
  background: var(--course-panel);
  font-weight: 600;
}

.bd-article .course-home-features > ul > li::before {
  color: var(--course-link-strong);
}

.bd-article .course-home-actions a {
  border: 1px solid var(--course-button-bg);
  border-radius: 0.45rem;
  background: var(--course-button-bg);
  color: #ffffff;
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease,
    box-shadow 120ms ease, transform 120ms ease;
}

.bd-article .course-home-actions a:hover {
  border-color: var(--course-button-hover);
  background: var(--course-button-hover);
  box-shadow: var(--course-hover-shadow);
  transform: translateY(-1px);
}

.bd-article .course-home-grid > ul {
  gap: 0.8rem;
}

.bd-article .course-home-grid > ul > li {
  --module-accent: var(--pst-color-primary) !important;
  padding: 1rem 1rem 0.9rem 3.75rem;
  border-color: var(--course-border);
  border-radius: 0.55rem;
  background: var(--course-panel);
  box-shadow: none;
  transition: border-color 120ms ease, background-color 120ms ease,
    box-shadow 120ms ease, transform 120ms ease;
}

.bd-article .course-home-grid > ul > li::before {
  top: 0.95rem;
  left: 0.9rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  background: var(--course-brand-soft);
  color: var(--course-link-strong);
  box-shadow: none;
}

.bd-article .course-home-grid > ul > li::after,
.bd-article .course-home-grid > ul > li > p:first-child a {
  color: var(--course-link-strong);
}

.bd-article .course-home-grid > ul > li:hover,
.bd-article .course-home-grid > ul > li:focus-within,
.bd-article .course-home-grid > ul > li:has(a:focus-visible) {
  border-color: var(--course-border-strong);
  background: var(--course-panel-hover);
  box-shadow: var(--course-hover-shadow);
  transform: translateY(-1px);
}

.prev-next-area a {
  transition: border-color 120ms ease, background-color 120ms ease,
    box-shadow 120ms ease, transform 120ms ease;
}

.prev-next-area a:hover {
  border-color: var(--course-border-strong);
  background: var(--course-panel-hover);
  box-shadow: var(--course-hover-shadow) !important;
  transform: translateY(-1px);
}

/* Reading components use borders and spacing instead of elevation. */
.bd-article figure,
.bd-article .admonition,
.bd-article div.highlight,
.bd-article .literal-block-wrapper,
.bd-article .jupyter_container,
.bd-article .table-wrapper,
.bd-article div.table,
.bd-article .pst-scrollable-table-container,
.prev-next-area a {
  border-radius: 0.45rem;
}

.bd-article .admonition {
  border-color: var(--course-border);
}

.bd-article .admonition > .admonition-title {
  border-bottom-color: var(--course-border);
}

html[data-theme="dark"] .bd-article .admonition,
html[data-theme="dark"] .bd-article figure,
html[data-theme="dark"] .course-quiz,
html[data-theme="dark"] .binary-eval-quiz {
  background: var(--course-panel);
}

html[data-theme="dark"] .bd-article :not(pre) > code.literal {
  border-color: var(--course-border);
  background: #222830;
  color: #d7dce3;
}

html[data-theme="dark"] .highlight,
html[data-theme="dark"] .highlight pre,
html[data-theme="dark"] div[class*="highlight-"] {
  background: #181d22;
}

html[data-theme="dark"] .bd-article blockquote {
  background: #181d22;
}

/* Give figures a little visual identity without competing with the diagram. */
.bd-article figure {
  position: relative;
  overflow: hidden;
  padding: 0.9rem 0.9rem 0.7rem;
  border-color: var(--course-border);
  border-radius: 0.62rem;
  background: linear-gradient(
    180deg,
    var(--course-figure-tint) 0,
    var(--course-panel) 32%
  );
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

.bd-article figure::before {
  position: absolute;
  top: -1px;
  left: 1.15rem;
  width: 3.8rem;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: var(--pst-color-primary);
  content: "";
  transition: width 160ms ease, background-color 160ms ease;
}

.bd-article figure :is(img, video, svg) {
  border-radius: 0.45rem;
}

.bd-article figure figcaption {
  position: relative;
  margin-top: 0.8rem;
  padding-top: 0.85rem;
  border-top: 0;
  color: var(--course-muted);
  font-weight: 600;
  transition: color 160ms ease;
}

.bd-article figure figcaption::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(7rem, 24%);
  height: 1px;
  background: var(--course-border-strong);
  content: "";
  transform: translateX(-50%);
}

html[data-theme="dark"] .bd-article figure {
  background: linear-gradient(
    180deg,
    var(--course-figure-tint) 0,
    var(--course-panel) 34%
  );
}

/* Subtle hover feedback for section headings and teaching callouts. */
.bd-article :is(h1, h2, h3) {
  transition: color 140ms ease, transform 140ms ease;
}

.bd-article h2::after {
  transition: width 140ms ease, background-color 140ms ease;
}

.bd-article .admonition {
  transition: border-color 140ms ease, box-shadow 140ms ease,
    transform 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .bd-article :is(h1, h2, h3):hover {
    color: var(--course-link-strong);
    transform: translateY(-1px);
  }

  .bd-article h2:hover::after {
    width: 4.1rem;
  }

  .bd-article .admonition:hover {
    border-color: var(--course-border-strong);
    box-shadow: var(--course-hover-shadow) !important;
    transform: translateY(-1px);
  }

  .bd-article figure:hover {
    border-color: color-mix(
      in srgb,
      var(--pst-color-primary) 52%,
      var(--course-border)
    );
    box-shadow: var(--course-figure-shadow) !important;
    transform: translateY(-2px);
  }

  .bd-article figure:hover::before {
    width: 6rem;
  }

  .bd-article figure:hover figcaption {
    color: var(--course-link-strong);
  }
}

@media (max-width: 575.98px) {
  .bd-article .course-home-hero {
    border-radius: 0.5rem;
  }

  .bd-article .course-home-grid > ul > li {
    padding: 0.9rem 0.85rem 0.85rem 3.45rem;
  }

  .bd-article .course-home-grid > ul > li::before {
    top: 0.85rem;
    left: 0.8rem;
  }

  .bd-article figure {
    padding: 0.7rem 0.65rem 0.58rem;
    border-radius: 0.52rem;
  }

  .bd-article figure::before {
    left: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-sidebar-primary .navbar-icon-links .nav-link,
  .bd-article .course-home-actions a,
  .bd-article .course-home-grid > ul > li,
  .bd-article :is(h1, h2, h3),
  .bd-article h2::after,
  .bd-article .admonition,
  .bd-article figure,
  .bd-article figure::before,
  .bd-article figure figcaption,
  .prev-next-area a {
    transition: none;
  }

  .bd-sidebar-primary .navbar-icon-links .nav-link:hover,
  .bd-article .course-home-actions a:hover,
  .bd-article .course-home-grid > ul > li:hover,
  .bd-article :is(h1, h2, h3):hover,
  .bd-article .admonition:hover,
  .bd-article figure:hover,
  .prev-next-area a:hover {
    transform: none;
  }
}
