  .quarto-content img {
    max-width: min(50%, 42rem);
    width: auto;
    height: auto;
    cursor: zoom-in;
  }

  .quarto-content .quarto-figure-left,
  .quarto-content .quarto-float-fig.quarto-float-left {
    float: left;
    margin: 0.15rem 0.85rem 0.55rem 0;
    max-width: min(50%, 42rem);
  }

  .quarto-content .quarto-figure-right,
  .quarto-content .quarto-float-fig.quarto-float-right {
    float: right;
    margin: 0.15rem 0 0.55rem 0.85rem;
    max-width: min(50%, 42rem);
  }

  .quarto-content .quarto-figure-left img,
  .quarto-content .quarto-float-fig.quarto-float-left img,
  .quarto-content .quarto-figure-right img,
  .quarto-content .quarto-float-fig.quarto-float-right img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }

  .quarto-content .quarto-figure-left figcaption,
  .quarto-content .quarto-float-fig.quarto-float-left figcaption,
  .quarto-content .quarto-figure-right figcaption,
  .quarto-content .quarto-float-fig.quarto-float-right figcaption {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .quarto-content .clay-wrap-figure {
    float: left;
    margin: 0.15rem 0.85rem 0.55rem 0;
  }

  .quarto-content .clay-wrap-figure img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .quarto-content .clay-wrap-figure figcaption {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.3;
    font-style: italic;
  }

  .quarto-content .float-clear {
    clear: both;
  }

  figure.left {
    float: left;
    width: 200px;
    margin: 0 1rem 1rem 0;
  }

  .quarto-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    padding: 1rem;
  }

  .quarto-image-lightbox.is-open {
    display: flex;
  }

  .quarto-image-lightbox img {
    width: auto;
    max-width: 96vw;
    max-height: 96vh;
    height: auto;
    object-fit: contain;
    cursor: zoom-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  }

  .quarto-image-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: 0;
    background: rgba(0, 0, 0, 0.08);
    color: #111;
    font-size: 2rem;
    line-height: 1;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    cursor: pointer;
  }

  .quarto-image-lightbox__close:hover {
    background: rgba(0, 0, 0, 0.16);
  }

  .callout-inline,
  .blue-callout-inline,
  .green-callout-inline {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    border-radius: 8px;
    padding: 0.08em 0.35em;
  }

  .callout-inline--blue,
  .blue-callout-inline {
    background: #eaf4ff;
    border: 1px solid #b8d9ff;
  }

  .callout-inline--green,
  .green-callout-inline {
    background: #e7f8ec;
    border: 1px solid #9bd7ad;
  }

  .callout-inline--yellow,
  .yellow-callout-inline {
    background: #fff7d6;
    border: 1px solid #e6cf75;
  }

  .callout-inline--red,
  .red-callout-inline {
    background: #fdebec;
    border: 1px solid #e9a8ad;
  }

  /* Semantic callout modes by class family. */
  .callout.callout-defn,
  .callout.callout-thm,
  .callout.callout-prop,
  .callout.callout-lemma,
  .callout.callout-cor,
  .callout.callout-example,
  .callout.callout-exercise,
  .callout.callout-question {
    --bs-callout-margin-top: 1rem;
    --bs-callout-margin-bottom: 1rem;
  }

  .callout.callout-defn .callout-icon-container,
  .callout.callout-thm .callout-icon-container,
  .callout.callout-prop .callout-icon-container,
  .callout.callout-lemma .callout-icon-container,
  .callout.callout-cor .callout-icon-container,
  .callout.callout-example .callout-icon-container,
  .callout.callout-exercise .callout-icon-container,
  .callout.callout-question .callout-icon-container {
    display: none !important;
  }

  .callout.callout-defn {
    border-left: 0.36rem solid #1f3a68 !important;
    border-color: #9eb8df !important;
    background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 78%);
  }

  .callout.callout-defn .callout-title {
    color: #18345f;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .callout.callout-thm,
  .callout.callout-prop,
  .callout.callout-lemma,
  .callout.callout-cor {
    border-left: 0.36rem solid #0a6a43 !important;
    border-color: #96d7bb !important;
    background: linear-gradient(180deg, #f1fbf5 0%, #ffffff 78%);
  }

  .callout.callout-thm .callout-title,
  .callout.callout-prop .callout-title,
  .callout.callout-lemma .callout-title,
  .callout.callout-cor .callout-title {
    color: #0b5a3a;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .callout.callout-example {
    border-left: 0.36rem solid #8a4f00 !important;
    border-color: #f0cb91 !important;
    background: linear-gradient(180deg, #fff8ec 0%, #ffffff 78%);
  }

  .callout.callout-example .callout-title {
    color: #7a4700;
    font-weight: 700;
  }

  .callout.callout-exercise {
    border-left: 0.36rem solid #6a1f3b !important;
    border-color: #e5a8c1 !important;
    background: linear-gradient(180deg, #fff2f7 0%, #ffffff 78%);
  }

  .callout.callout-exercise .callout-title {
    color: #61203a;
    font-weight: 700;
  }

  .callout.callout-question {
    border-left: 0.36rem solid #005f73 !important;
    border-color: #9fd6de !important;
    background: linear-gradient(180deg, #edfafd 0%, #ffffff 78%);
  }

  .callout.callout-question .callout-title {
    color: #0b4f61;
    font-weight: 700;
  }

  .mermaid,
  .mermaid svg {
    direction: ltr;
  }
  .mermaid .node rect,
  .mermaid .node circle,
  .mermaid .node ellipse,
  .mermaid .node polygon,
  .mermaid .cluster rect,
  .mermaid .label,
  .mermaid foreignObject {
    filter: none !important;
    box-shadow: none !important;
  }

  .mermaid g.stopNode rect,
  .mermaid .stopNode rect {
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  }

  .mermaid-auto-tabset {
    margin: 1rem 0;
  }

  .mermaid-auto-tabset .nav-tabs {
    display: inline-flex;
    margin-bottom: 0.35rem;
    border-bottom: 0;
    gap: 0;
    border: 1px solid #1f211d;
    background: #f7f3e8;
  }

  .mermaid-auto-tabset .nav-item {
    margin-bottom: 0;
  }

  .mermaid-auto-tabset .nav-tabs .nav-link {
    font-size: 0.7rem;
    line-height: 1;
    padding: 0.28rem 0.52rem;
    border: 0;
    border-right: 1px solid #1f211d;
    border-radius: 0;
    color: #1f211d;
    background: transparent;
    text-transform: uppercase;
    letter-spacing: 0.045em;
  }

  .mermaid-auto-tabset .nav-tabs .nav-item:last-child .nav-link {
    border-right: 0;
  }

  .mermaid-auto-tabset .nav-tabs .nav-link:hover,
  .mermaid-auto-tabset .nav-tabs .nav-link:focus {
    color: #ffffff;
    background: #245a73;
  }

  .mermaid-auto-tabset .nav-tabs .nav-link.active {
    color: #ffffff;
    background: #d94b35;
  }

  .mermaid-auto-tabset .tab-pane pre {
    margin-top: 0;
  }

  .glossary-link {
    text-decoration-style: dotted;
    text-underline-offset: 0.15em;
    cursor: help;
  }

  .reading-stats {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #d7dde2;
    font-size: 0.92rem;
    color: #5b6670;
    text-align: center;
    letter-spacing: 0.02em;
  }

  .reading-stats__inner {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
  }

  .reading-stats__time {
    font-weight: 600;
    color: #42515f;
  }

  .reading-stats__nav {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
  }

  .reading-stats__link {
    color: #2f5e88;
    text-decoration: none;
    border-bottom: 1px solid rgba(47, 94, 136, 0.3);
  }

  .reading-stats__link:hover,
  .reading-stats__link:focus {
    color: #1f4464;
    border-bottom-color: rgba(31, 68, 100, 0.55);
  }

  .reading-stats__sep {
    color: #95a2ae;
  }

  body {
    counter-reset: definition-counter theorem-counter example-counter exercise-counter question-counter;
  }

  .callout.callout-defn {
    counter-increment: definition-counter;
  }

  .callout.callout-thm,
  .callout.callout-prop,
  .callout.callout-lemma,
  .callout.callout-cor {
    counter-increment: theorem-counter;
  }

  .callout.callout-example {
    counter-increment: example-counter;
  }

  .callout.callout-exercise {
    counter-increment: exercise-counter;
  }

  .callout.callout-question {
    counter-increment: question-counter;
  }

  .callout.callout-defn .callout-title-container::before {
    content: "📘 Definition " counter(definition-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-thm .callout-title-container::before {
    content: "★ Theorem " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-prop .callout-title-container::before {
    content: "★ Proposition " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-lemma .callout-title-container::before {
    content: "★ Lemma " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-cor .callout-title-container::before {
    content: "★ Corollary " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-example .callout-title-container::before {
    content: "🧪 Example " counter(example-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-exercise .callout-title-container::before {
    content: "✎ Exercise " counter(exercise-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout.callout-question .callout-title-container::before {
    content: "❓ Question " counter(question-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  /* Support custom callout families authored without a base callout class. */
  .callout[data-callout-family="defn"],
  .callout[data-callout-family="thm"],
  .callout[data-callout-family="prop"],
  .callout[data-callout-family="lemma"],
  .callout[data-callout-family="cor"],
  .callout[data-callout-family="example"],
  .callout[data-callout-family="exercise"],
  .callout[data-callout-family="question"] {
    --bs-callout-margin-top: 1rem;
    --bs-callout-margin-bottom: 1rem;
  }

  .callout[data-callout-family="defn"] .callout-icon-container,
  .callout[data-callout-family="thm"] .callout-icon-container,
  .callout[data-callout-family="prop"] .callout-icon-container,
  .callout[data-callout-family="lemma"] .callout-icon-container,
  .callout[data-callout-family="cor"] .callout-icon-container,
  .callout[data-callout-family="example"] .callout-icon-container,
  .callout[data-callout-family="exercise"] .callout-icon-container,
  .callout[data-callout-family="question"] .callout-icon-container {
    display: none !important;
  }

  .callout[data-callout-family="defn"] {
    border-left: 0.36rem solid #1f3a68 !important;
    border-color: #9eb8df !important;
    background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 78%);
    counter-increment: definition-counter;
  }

  .callout[data-callout-family="defn"] .callout-title {
    color: #18345f;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .callout[data-callout-family="thm"],
  .callout[data-callout-family="prop"],
  .callout[data-callout-family="lemma"],
  .callout[data-callout-family="cor"] {
    border-left: 0.36rem solid #0a6a43 !important;
    border-color: #96d7bb !important;
    background: linear-gradient(180deg, #f1fbf5 0%, #ffffff 78%);
    counter-increment: theorem-counter;
  }

  .callout[data-callout-family="thm"] .callout-title,
  .callout[data-callout-family="prop"] .callout-title,
  .callout[data-callout-family="lemma"] .callout-title,
  .callout[data-callout-family="cor"] .callout-title {
    color: #0b5a3a;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .callout[data-callout-family="example"] {
    border-left: 0.36rem solid #8a4f00 !important;
    border-color: #f0cb91 !important;
    background: linear-gradient(180deg, #fff8ec 0%, #ffffff 78%);
    counter-increment: example-counter;
  }

  .callout[data-callout-family="example"] .callout-title {
    color: #7a4700;
    font-weight: 700;
  }

  .callout[data-callout-family="exercise"] {
    border-left: 0.36rem solid #6a1f3b !important;
    border-color: #e5a8c1 !important;
    background: linear-gradient(180deg, #fff2f7 0%, #ffffff 78%);
    counter-increment: exercise-counter;
  }

  .callout[data-callout-family="exercise"] .callout-title {
    color: #61203a;
    font-weight: 700;
  }

  .callout[data-callout-family="question"] {
    border-left: 0.36rem solid #005f73 !important;
    border-color: #9fd6de !important;
    background: linear-gradient(180deg, #edfafd 0%, #ffffff 78%);
    counter-increment: question-counter;
  }

  .callout[data-callout-family="question"] .callout-title {
    color: #0b4f61;
    font-weight: 700;
  }

  .callout[data-callout-family="defn"] .callout-title-container::before {
    content: "📘 Definition " counter(definition-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="thm"] .callout-title-container::before {
    content: "★ Theorem " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="prop"] .callout-title-container::before {
    content: "★ Proposition " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="lemma"] .callout-title-container::before {
    content: "★ Lemma " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="cor"] .callout-title-container::before {
    content: "★ Corollary " counter(theorem-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="example"] .callout-title-container::before {
    content: "🧪 Example " counter(example-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="exercise"] .callout-title-container::before {
    content: "✎ Exercise " counter(exercise-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  .callout[data-callout-family="question"] .callout-title-container::before {
    content: "❓ Question " counter(question-counter) ": ";
    font-weight: 700;
    margin-right: 0.15rem;
  }

  /* Fallback rendering for custom family blocks authored without native callout syntax. */
  .callout-defn:not(.callout),
  .callout-thm:not(.callout),
  .callout-prop:not(.callout),
  .callout-lemma:not(.callout),
  .callout-cor:not(.callout),
  .callout-example:not(.callout),
  .callout-exercise:not(.callout),
  .callout-question:not(.callout) {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid transparent;
    border-left-width: 0.36rem;
    border-radius: 0.375rem;
  }

  .callout-defn:not(.callout) {
    border-left-color: #1f3a68;
    border-color: #9eb8df;
    background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 78%);
    counter-increment: definition-counter;
  }

  .callout-thm:not(.callout),
  .callout-prop:not(.callout),
  .callout-lemma:not(.callout),
  .callout-cor:not(.callout) {
    border-left-color: #0a6a43;
    border-color: #96d7bb;
    background: linear-gradient(180deg, #f1fbf5 0%, #ffffff 78%);
    counter-increment: theorem-counter;
  }

  .callout-example:not(.callout) {
    border-left-color: #8a4f00;
    border-color: #f0cb91;
    background: linear-gradient(180deg, #fff8ec 0%, #ffffff 78%);
    counter-increment: example-counter;
  }

  .callout-exercise:not(.callout) {
    border-left-color: #6a1f3b;
    border-color: #e5a8c1;
    background: linear-gradient(180deg, #fff2f7 0%, #ffffff 78%);
    counter-increment: exercise-counter;
  }

  .callout-question:not(.callout) {
    border-left-color: #005f73;
    border-color: #9fd6de;
    background: linear-gradient(180deg, #edfafd 0%, #ffffff 78%);
    counter-increment: question-counter;
  }

  .callout-defn:not(.callout)::before,
  .callout-thm:not(.callout)::before,
  .callout-prop:not(.callout)::before,
  .callout-lemma:not(.callout)::before,
  .callout-cor:not(.callout)::before,
  .callout-example:not(.callout)::before,
  .callout-exercise:not(.callout)::before,
  .callout-question:not(.callout)::before {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
  }

  .callout-defn:not(.callout)::before {
    content: "📘 Definition " counter(definition-counter) ": " attr(title);
    color: #18345f;
  }

  .callout-thm:not(.callout)::before {
    content: "★ Theorem " counter(theorem-counter) ": " attr(title);
    color: #0b5a3a;
  }

  .callout-prop:not(.callout)::before {
    content: "★ Proposition " counter(theorem-counter) ": " attr(title);
    color: #0b5a3a;
  }

  .callout-lemma:not(.callout)::before {
    content: "★ Lemma " counter(theorem-counter) ": " attr(title);
    color: #0b5a3a;
  }

  .callout-cor:not(.callout)::before {
    content: "★ Corollary " counter(theorem-counter) ": " attr(title);
    color: #0b5a3a;
  }

  .callout-example:not(.callout)::before {
    content: "🧪 Example " counter(example-counter) ": " attr(title);
    color: #7a4700;
  }

  .callout-exercise:not(.callout)::before {
    content: "✎ Exercise " counter(exercise-counter) ": " attr(title);
    color: #61203a;
  }

  .callout-question:not(.callout)::before {
    content: "❓ Question " counter(question-counter) ": " attr(title);
    color: #0b4f61;
  }

  pre[data-lang],
  .mermaid[data-lang] {
    position: relative;
    padding-bottom: 1.5rem;
  }

  pre[data-lang]::after,
  .mermaid[data-lang]::after {
    content: attr(data-lang);
    position: absolute;
    right: 0.5rem;
    bottom: 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #666;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 0.2rem;
    padding: 0 0.3rem;
    pointer-events: none;
  }
