/* Initialize counters for callouts */
body {
  counter-reset: example theorem definition algorithm;
}

/* Example callout numbering */
.callout-example {
  counter-increment: example;
  border-left: 5px solid #2d9cdb;
  background-color: #fff;
  padding: 1em 1.2em;
  margin: 1em 0;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 2px 6px 0 rgba(44,62,80,0.04);
}
.callout-example::before {
  content: "Example " counter(example) ": " attr(title);
  color: #2d9cdb;
  font-weight: bold;
  font-size: 1.1em;
  display: block;
  margin-bottom: 0.3em;
}

/* Theorem callout numbering */
.callout-theorem {
  counter-increment: theorem;
  border-left: 5px solid #e67e22;
  background-color: #fff;
  padding: 1em 1.2em;
  margin: 1em 0;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 2px 6px 0 rgba(44,62,80,0.04);
}
.callout-theorem::before {
  content: "Theorem " counter(theorem) ": " attr(title);
  color: #e67e22;
  font-weight: bold;
  font-size: 1.1em;
  display: block;
  margin-bottom: 0.3em;
}

/* Definition callout numbering */
.callout-definition {
  counter-increment: definition;
  border-left: 5px solid #27ae60;
  background-color: #fff;
  padding: 1em 1.2em;
  margin: 1em 0;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 2px 6px 0 rgba(44,62,80,0.04);
}
.callout-definition::before {
  content: "Definition " counter(definition) ": " attr(title);
  color: #27ae60;
  font-weight: bold;
  font-size: 1.1em;
  display: block;
  margin-bottom: 0.3em;
}

/* Algorithm callout numbering */
.callout-algorithm {
  counter-increment: algorithm;
  border-left: 5px solid #8e44ad;
  background-color: #fff;
  padding: 1em 1.2em;
  margin: 1em 0;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 2px 6px 0 rgba(44,62,80,0.04);
}
.callout-algorithm::before {
  content: "Algorithm " counter(algorithm) ": " attr(title);
  color: #8e44ad;
  font-weight: bold;
  font-size: 1.1em;
  display: block;
  margin-bottom: 0.3em;
}

.callout-example-body,
.callout-theorem-body,
.callout-definition-body,
.callout-algorithm-body {
  color: #444;
  font-size: 1em;
}

/* Cosmo-blue controls for expandable code, matching the course-note series. */
details.code-fold > summary {
  color: #1d5fa6;
  background-color: #eaf2fc;
  border: 1px solid #c8ddf3;
  border-radius: 0.45rem;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

details.code-fold > summary:hover,
details.code-fold[open] > summary {
  background-color: #dceafb;
}

details.code-fold > summary:focus-visible {
  outline: 2px solid #1d5fa6;
  outline-offset: 2px;
}

details.code-fold[open] > summary {
  margin-bottom: 0.5rem;
}

/* Mark printed results and figures as output, separate from folded source code. */
.cell > .cell-output,
.cell > .cell-output-display {
  background-color: #f1f6fb;
  border: 1px solid #ccdceb;
  border-left: 4px solid #5a7a9a;
  border-radius: 0.45rem;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1.25rem;
  min-width: 0;
}

.cell > .cell-output::before,
.cell > .cell-output-display::before {
  content: "Output";
  display: block;
  color: #3b5f85;
  font-family: var(--bs-body-font-family);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.cell > .cell-output pre {
  background-color: transparent;
  color: #23384b;
  border: 0;
  padding: 0;
  margin-bottom: 0;
}

.cell > .cell-output-display > :last-child,
.cell > .cell-output-display figure,
.cell > .cell-output-display figure > :last-child {
  margin-bottom: 0;
}
