@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;600;700&family=Lora:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');


:root {
  --serif-font: "Lora", serif;
  --sans-serif-font: "Oswald", sans-serif;
  --tt-font: "IBM Plex Mono", monospace;
  --dataframe-font: 'IBM Plex Mono', monospace;
  --background-color: #eaf3f5;
  --text-primary-color: #010177;
  --link-color: #006699;
  --visited-link-color: #6085a6;
  --highlight-color: #1b50ebcf;
  --hover-highlight-color: #0099cc;
  --dataframe-color: steelblue;
  --table-heading: #888;
  --stderr-background: #ffecbb;
  /* Warm accent — antique gold for mathematical structures */
  --accent-gold: #c17f24;
  --accent-gold-pale: rgba(193, 127, 36, 0.09);
  --accent-gold-tint: #faf5ea;
  --accent-gold-light: #e8d0a0;
  /* Theorem/lemma cool tint */
  --theorem-bg: #f0f4f8;
  --theorem-tint: rgba(1, 1, 119, 0.06);
}

/* Override sphinx-book-theme's amber #e89217 — must match the theme's selector specificity */
html[data-theme=light],
html[data-theme=dark],
html:not([data-theme]) {
  --pst-color-link-hover: var(--link-color);
}

.search-button-field:hover {
  border-color: var(--link-color) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 102, 153, 0.4) !important;
}

body {
    background-color: var(--background-color);
    color: var(--text-primary-color);
    font-family: var(--serif-font);
}

h1, h2, h3, h4, h5, h6, .admonition-title {
    font-family: var(--sans-serif-font);
}

code, pre {
    font-family: var(--tt-font);
    text-align: left;
    line-height: 1.5;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:visited {
  color: var(--visited-link-color);
}

a.headerlink {
  color: var(--visited-link-color);
}

a.external {
  white-space: nowrap;
}

a.external::after {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.6em;
    content: "\00A0\f35d";
    display: inline-block;
    margin-left: 0.2em;
    vertical-align: middle;
}

/* Academic-style blockquotes */
blockquote {
  font-style: italic;
  font-family: var(--serif-font);
  border-left: 3px solid var(--link-color);
  margin: 1.5em 2em;
  padding: 0.5em 1em;
  background: none;
  color: var(--text-primary-color);
  border-radius: 0; /* remove rounded corners */
}

blockquote p {
  margin: 0.5em 0;
}

li a.external::after {
    margin-left: 1.5em;
}

ul {
  list-style-type: none;
  padding-left: 0;
}

ul > li > p {
  position: relative;
  padding-left: 0;
  text-indent: -0.9em;
  margin-left: 1em;
}

ul > li > p::before {
  content: "–";
  display: inline;
  margin-right: 0.2em;
  padding-right: 0.1em;
  color: var(--text-primary-color);
}

.admonition.note {
  background-color: #e8f0f8;
  border-left: 4px solid var(--text-primary-color);
}
.admonition.warning {
  background-color: #fef3c7;
  border-left: 4px solid var(--accent-gold);
}

aside.footnote {
  font-size: 80%;
}

/* Override Sphinx's yellow :target highlight (basic.css via @import in theme.css)
   with a palette-consistent teal tint. !important needed because basic.css uses
   the same specificity and !important wins regardless of load order. */
.footnote:target {
  background-color: rgba(0, 102, 153, 0.08) !important;
  border-left: 2px solid var(--link-color);
  padding-left: 0.5em;
  border-radius: 0 3px 3px 0;
}

dt:target,
span.highlighted {
  background-color: rgba(0, 102, 153, 0.12) !important;
  border-radius: 2px;
}

aside.margin {
  font-size: 70%;
}

/* Let margin notes float into the gutter (theme default) but sit ABOVE the
   pinned "On this page" (secondary) sidebar when they overlap. The theme pushes
   margin content into the same band as `.bd-sidebar-secondary`, whose opaque
   background would otherwise hide a note placed next to the top of the page.
   Raising the note's stacking context above the sidebar, plus giving it an
   opaque background, makes the note cleanly cover the TOC where they coincide
   instead of being hidden behind it. */
.bd-content aside.margin,
.bd-content div.margin,
.bd-content figure.margin,
.bd-content .margin.docutils.container,
.bd-content .cell.tag_margin,
.bd-content .cell.tag_popout,
.bd-content figure.margin-caption figcaption,
.bd-content div.figure.margin-caption figcaption {
  z-index: 1056 !important; /* above .bd-sidebar-secondary, below the page header */
  background-color: var(--background-color) !important;
}

aside.margin a.footnote-reference {
  font-size: 80%;
}

aside.footnote a.footnote-reference {
  font-size: 75%;
}

/* Compact sidebar logo — brand mark, not a hero image */
.bd-sidebar-primary .navbar-brand.logo {
  justify-content: center;
  padding-top: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(1, 1, 119, 0.12);
  margin-bottom: 0.5rem;
  width: 100%;
}

.bd-sidebar-primary .navbar-brand.logo .logo__image {
  width: 100px;
  height: auto;
  max-width: 100%;
}

/* Sidebar base styles — scrollbar hidden, scrolling happens in .bd-sidebar-scroll-area */
.bd-sidebar-primary {
    background-color: var(--background-color);
    font-family: var(--sans-serif-font);
    scrollbar-width: none; /* Firefox */
}

.bd-sidebar-primary::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}


.bd-sidebar-secondary {
    background-color: var(--background-color);
    font-family: var(--sans-serif-font);
}

.bd-header-article {
    background: var(--background);
    background-color: var(--background-color);
    font-family: var(--sans-serif-font);
}

.caption-number {
  font-style: normal !important;
}

.caption-number::after {
  content: '. ';
  margin-left: -0.2em;
}

.cell {
  margin-bottom: 0;
}

div.cell-div-container {
  margin-top: 1em;
  overflow: hidden;
}

div.cell-div-container:has(+ .plot-container) {
  float: left;
}

div.cell_input {
  margin-bottom: 0 !important;
  background-color: rgba(1, 1, 119, 0.025) !important;
  border-left: 4px solid var(--link-color) !important;
  border-top: 1px solid rgba(0, 102, 153, 0.18) !important;
  border-right: 1px solid rgba(0, 102, 153, 0.18) !important;
  border-bottom: 1px solid rgba(0, 102, 153, 0.18) !important;
  border-radius: 0 !important;
}

div.container.cell {
  margin-bottom: 0;
}

div.container.cell + p {
  margin-top: 1em;
}

figure:not(.margin) + * {
  clear: both;
}

table + * {
  clear: both;
}

figure::after {
  content: "";
  display: table;
  clear: both;
}

table::after {
  content: "";
  display: table;
  clear: both;
}

/* ensure caption in tables and figures clears floats */

figcaption {
  clear: both;
}

/* Default figure alignment: left-aligned block (overrides theme's margin:auto/center) */
figure.align-default {
  margin-left: 0;
  margin-right: auto;
}

figure.align-default figcaption {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
}

.pst-scrollable-table-container {
  margin-bottom: 2em;
}

.pst-scrollable-table-container p:first-of-type {
  clear:both;
}

py-script {
  display: none;
}

span.katex {
    display: inherit;
    font-size: 1.1em;
}

.katex-display {
    margin-top: 0;
    margin-bottom: 1rem !important;
}

/* KaTeX gives the vlist wrapper a -2px right margin, which makes the 2px
   .vlist-s spacer stick out of the shrink-to-fit box of a tag positioned at
   right: 0. Inside .katex-html (made overflow-x: auto by katex-math.css) those
   2px are enough to trigger a spurious horizontal scrollbar on every tagged
   equation, e.g. the align environment in the proof of Newton's binomial
   formula. Dropping the negative margin keeps the tag flush right without
   overflowing. */
.katex-display > .katex > .katex-html > .tag > .vlist-t2 {
    margin-right: 0;
}

/* A LaTeX result (a sympy expression, say) is rendered as a .math child of the
   cell output, whose own top margin is zeroed just below.  Without a margin of
   its own the equation would sit flush against the bottom of the code box, so
   it gets the same 1em above as below. */
.cell_output > .math {
  margin-top: 1em;
  margin-bottom: 1em !important;
}

/* …and it is left-aligned, like the code that produced it, rather than centred
   the way KaTeX sets display math (katex.css centres both .katex-display and
   the .katex inside it).  The `.output.text_latex` class is what myst-nb puts
   on a cell output carrying a text/latex mime bundle — a sympy expression, in
   practice — so prose equations and {math} directives keep their centring. */
.cell_output .output.text_latex .katex-display,
.cell_output .output.text_latex .katex-display > .katex {
  text-align: left;
}

.cell_output, .cell_output .output.stream {
  margin-top: 0 !important;
}

.cell_output pre {
  background-color: var(--background-color);
}

.admonition .cell_output pre {
  background-color: white;
}

.cell-out, .script-output {
  margin-top: 0;
  margin-bottom: 1em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  padding-left: 0.7em;
  border-left: 4px solid rgba(0, 102, 153, 0.3);
  border-right: 1px solid rgba(0, 102, 153, 0.12);
  border-bottom: 1px solid rgba(0, 102, 153, 0.12);
  font-family: var(--tt-font);
  font-size: 90%;
  white-space: pre-wrap;
}

.cell-stdout, .script-stdout {
  font-family: var(--tt-font);
  font-size: 90%;
  margin-bottom: 1em;
  margin-top: -0.3em;
  white-space: pre-wrap;
}

.cell-stderr, .script-stderr {
  font-family: var(--tt-font);
  color: var(--table-heading);
  font-size: 90%;
  background-color: var(--stderr-background);
  margin-bottom: 1em;
  margin-top: -0.5em;
  padding-bottom: 1em;
  padding-left: 1em;
  white-space: pre-wrap;
}

.cell-out:empty,
.cell-stdout:empty,
.cell-stderr:empty {
  display: none;
}

/* Inline Python result styles - styled to resemble MathJax output */
.py-inline-result {
  /* Remove background and borders for seamless integration */
  background-color: transparent;
  border: none;
  border-radius: 0;
  
  font-family: var(--serif-font);
  font-size: 100%;
  font-style: normal;
  font-weight: normal;
  
  /* Subtle styling to distinguish from regular text while maintaining elegance */
  color: var(--text-primary-color);
  letter-spacing: 0.02em;
  
  /* Inline display with slight vertical alignment */
  display: inline;
  vertical-align: baseline;
  
  /* Subtle visual cue on hover to indicate it's dynamic content */
  transition: color 0.2s ease;
}

/* Special styling for numeric results to look more mathematical */
.py-inline-result.numeric {
  font-variant-numeric: lining-nums;
}

/* Error state styling */
.py-inline-result.error {
  font-style: normal;
  color: #d32f2f;
  font-weight: 500;
}

.py-inline-result:hover {
  color: var(--link-color);
  cursor: help;
}

.py-inline-result:empty {
  display: none;
}

/* Inline Python splash style - temporary loading state */
.py-inline-splash {
  background-color: #d3d3d3; /* light gray background */
  font-family: var(--tt-font);
  padding: 2px 4px;
  border-radius: 3px;
  display: inline;
  font-size: 90%;
}

.highlight {
  background: none;
  color: inherit;
  position: relative;
  display: flex;
  flex-direction: column;
}

.highlight pre {
  border-radius: 0;
  width: 100%;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
}

/* Override pygments.css "html[data-theme] .highlight pre { line-height: 125% }"
   Same specificity (0,2,2), custom.css loads later so this wins. */
html[data-theme="light"] .highlight pre,
html[data-theme="dark"]  .highlight pre {
  line-height: 1.5;
}

.highlight-python {
  margin-bottom: 0 !important;
}

.prev-next-title {
  font-family: var(--sans-serif-font);
}

/* Subtitle ("precedente" / "successivo"): treat as a navigation label —
   same font family as the title but tiny, fully uppercased, and tracked,
   so the hierarchy reads as label → destination rather than two body lines. */
p.prev-next-subtitle {
  font-family: var(--sans-serif-font);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase !important;
  color: var(--text-primary-color);
  opacity: 0.55;
  margin-bottom: 0.2rem;
}

.prev-next-area a:hover p.prev-next-title,
.prev-next-area a:visited:hover p.prev-next-title {
  color: var(--hover-highlight-color);
  text-decoration: none;
}

a.left-prev:hover, a.right-next:hover {
  color: var(--hover-highlight-color);
}

.toc-entry a.nav-link.active:hover {
  color: var(--highlight-color);
  text-decoration: none;
}

.admonition p.admonition-title~*, div.admonition p.admonition-title~* {
    margin-left: 0.3rem;
    margin-right: 0.3rem;
}

.proof.no-number > .admonition-title  {
  visibility: hidden;
  position: relative;
}

.lemma.admonition > .admonition-title::after {
    content: "\f085";  /* Font Awesome icon code */
}

.naming.admonition > .admonition-title::after {
    content: "\f24D";  /* Font Awesome icon code */
}

.corollary.admonition > .admonition-title::after {
    content: "\f0AB";  /* Font Awesome icon code */
}

.theorem.admonition > .admonition-title::after {
    content: "\f19C";  /* Font Awesome icon code */
}

/* ── Proof block ({sds-proof} directive) ───────────────────────────────── */

.sds-proof {
  margin: 0.75em 0;
}

/* "Dimostrazione." header — italic, as in traditional mathematical typesetting */
.sds-proof-header {
  font-family: var(--serif-font);
  font-style: italic;
  font-size: 1em;
  line-height: 1.5;
  margin: 0 0 0.3em 0;
}

/* QED tombstone */
.sds-proof::after {
  content: "□";
  display: block;
  text-align: right;
  font-size: 1.1em;
  color: var(--text-primary-color);
}

.naming.admonition > .admonition-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.example.admonition {
  background-color: white;
  border-left: 4px solid var(--accent-gold);
}

.example.admonition > .admonition-title {
  background-color: var(--accent-gold-pale);
}

.example.admonition > .admonition-title::after {
    content: "\f1CE";  /* Font Awesome icon code */
}

.definition.admonition > .admonition-title::after {
    content: "\f15B";  /* Font Awesome icon code */
}

.proof.no-number > .admonition-title::after {
  visibility: visible;
}

 a:hover {
  color: var(--highlight-color);
}

nav.bd-links li > a:hover {
  color: var(--highlight-color);
  text-decoration: none;
}

table caption {
  color: var(--text-primary-color);
  caption-side: bottom;
  text-align: left;
}

table thead tr {
  border-bottom: 1px solid var(--table-heading) !important;
}

table tr {
  background-color: inherit !important;
}

/* Docutils tables (MyST markdown tables) — book design system */
/* MyST markdown tables — correct selector is table.table (Bootstrap class added by pydata theme) */
table.table:not(.dataframe) {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: 0.92em;
  /* Kill Bootstrap's outer border; only horizontal rules allowed */
  border: none !important;
  --bs-table-border-color: transparent;
}

table.table:not(.dataframe) thead tr {
  background-color: var(--text-primary-color) !important;
  border-bottom: none !important;
  border-top: none !important;
}

table.table:not(.dataframe) thead th {
  padding: 0.55em 1.2em;
  color: #d4e2f4;
  font-family: var(--sans-serif-font);
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none !important;
}

/* Math in a header must keep its case and metrics — the uppercasing and
   letter-spacing above would otherwise turn e.g. $x$ into "X". */
table.table:not(.dataframe) thead th .katex {
  text-transform: none;
  letter-spacing: normal;
}

table.table:not(.dataframe) tbody tr:nth-child(odd) {
  background-color: #ffffff !important;
}

table.table:not(.dataframe) tbody tr:nth-child(even) {
  background-color: var(--background-color) !important;
}

table.table:not(.dataframe) tbody tr:hover {
  background-color: rgba(0, 102, 153, 0.08) !important;
  transition: background-color 0.12s ease;
}

table.table:not(.dataframe) tbody tr:last-child td {
  border-bottom: 1.5px solid rgba(1, 1, 119, 0.25) !important;
}

/* All cells: only horizontal separators, zero vertical lines */
table.table:not(.dataframe) tbody td,
table.table:not(.dataframe) tbody th {
  padding: 0.45em 1.2em;
  border-top: 1px solid rgba(1, 1, 119, 0.08) !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  color: var(--text-primary-color);
}

/* Wide display math: scroll horizontally instead of overflowing the article */
div.math {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  padding-bottom: 4px;
}

table.dataframe {
  border-left: none;
  border-right: none;
  margin-bottom: 2em;
  font-size: 85%;
}

table.dataframe thead tr {
    border-bottom: 1px solid steelblue !important;
}

table.dataframe th, table.dataframe td {
  text-align: left !important;
  padding-right: 1.5em;
  color: var(--dataframe-color);
  font-family: var(--dataframe-font);
  font-size: 1em;
}

table.centered-content {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1em;
}

table.centered-content td {
  text-align: center;
}

.splash::before {
  text-align: center;
  color: var(--visited-link-color);
  font: var(--fa-font-solid);
  content: '\f254 '; /* hourglass icon */
}

.splash {
  display: flex;
  justify-content: center; /* horizontal centering */
  align-items: center;    /* vertical centering */
}

.splash::after {
  content: ' Loading...'; /* fallback text, will be replaced by JavaScript */
  color: var(--visited-link-color);
}

.fn-bracket {
  visibility: hidden;
}


.flag {
    width: 1.5em;
    margin-right: 0.2em;
}

.no-output, .hide-code {
  display: none !important;
}

.no-output + .cell-div-container .splash,
.no-output + .cell-div-container .splash::before,
.no-output + .cell-div-container .splash::after {
  display: none !important;
}

.left-align {
  text-align: left
}

/* Toggle code wrapper - common for both MyST and PyScript cells */
.toggle-code-wrapper {
    margin: 0.5rem 0;
    padding: 0;
}

/* Toggle button styled as a link */
.toggle-code-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--sans-serif-font);
    font-size: 0.8rem;
    color: var(--pst-color-link);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s;
}

.toggle-code-button:hover {
    color: var(--pst-color-link-hover);
}

.toggle-code-button:hover .button-text {
    text-decoration: underline;  /* Only underline the text on hover */
}

.toggle-code-button:focus {
    outline: none;
}

.toggle-code-button .triangle {
    /* display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.7em; */
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.7em;
    transform: rotate(0deg);
    transform-origin: center center; /* Ensure rotation happens from center */
    width: 1em; /* Fixed width to prevent size jumps */
    text-align: center;
}

.toggle-code-button.expanded .triangle {
    transform: rotate(90deg);
}

/* Hidden state - use !important to override MyST styles */
.toggle-code-content {
    display: none !important;
}

/* Expanded state - force visibility */
.toggle-code-content.expanded {
    display: block !important;
    margin-top: 0.5rem;
}

/* Force nested elements to be visible when parent is expanded */
/* .toggle-code-content.expanded .cell.docutils.container,
.toggle-code-content.expanded .cell_input.docutils.container,
.toggle-code-content.expanded .highlight-ipython3,
.toggle-code-content.expanded .highlight {
    display: block !important;
} */

/* Override tag_hide-input when toggle is expanded */
.cell.tag_hide-input .toggle-code-content.expanded,
.cell.tag_hide-input .toggle-code-content.expanded .cell_input {
    display: block !important;
}

/* Ensure the code pre element is visible */
.toggle-code-content.expanded pre {
    display: block !important;
}

/* .docutils.container {
  width: max-content
} */

/* Ensure admonition titles have proper font size */
.admonition-title {
  font-size: 1rem !important;
  font-weight: bold !important;
}

p.component-author {
  display: none;
}

/* ── Footer colophon ──────────────────────────────────────────────────────────
   Treat the copyright + license block as a book colophon: horizontal, tight,
   micro-uppercase Oswald tracking.  Two-column layout: copyright left,
   CC license right.
   ──────────────────────────────────────────────────────────────────────────── */

.bd-footer-content__inner.container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

/* Hide the empty footer-item */
.bd-footer-content__inner .footer-item:empty {
  display: none;
}

/* Both the copyright text and the CC license share the same colophon style */
p.copyright,
.extra_footer p {
  font-family: var(--sans-serif-font);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-primary-color);
  opacity: 0.48;
  margin: 0;
}

.extra_footer a {
  font-family: var(--sans-serif-font);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-primary-color) !important;
  opacity: 0.48;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.05em;
  transition: opacity 0.15s ease;
}

.extra_footer a:hover {
  opacity: 0.75;
}

/* Ensure navigation links have proper font size */
nav.bd-links li > a {
  font-size: 0.9rem !important;
}

.bd-sidebar nav.bd-links p.caption {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--sans-serif-font);
  color: var(--text-primary-color) !important;
  opacity: 0.48;
  margin-top: 1.4rem;
  margin-bottom: 0.1rem;
  padding-bottom: 0.35rem;
  position: relative;
}

/* Inset underline below each part title — uses ::before because ::after is
   the chevron. Color is divided by parent opacity (0.12 / 0.48 = 0.25) so
   the rendered result matches the logo separator rgba(1,1,119,0.12). */
.bd-sidebar nav.bd-links p.caption::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0.5rem;
  height: 1px;
  background-color: rgba(1, 1, 119, 0.25);
}

/* Spacing above every part caption except the first */
.bd-sidebar nav.bd-links ul + p.caption {
  padding-top: 0.55rem;
  margin-top: 0.8rem;
}

/* Horizontal separator drawn at the bottom of each part's chapter list.
   Placed on ul::after (no opacity inheritance) so color and width match
   the logo separator exactly. Only between parts — not after the last one. */
.bd-sidebar nav.bd-links p.caption + ul:not(:last-child)::after {
  content: '';
  display: block;
  height: 1px;
  background-color: rgba(1, 1, 119, 0.12);
  margin: 0.8rem 0.5rem 0 0;
}

/* Ensure theorem type pseudo-elements have proper font size */
.lemma.no-number > .admonition-title::before,
.corollary.no-number > .admonition-title::before,
.theorem.no-number > .admonition-title::before,
.example.no-number > .admonition-title::before,
.definition.no-number > .admonition-title::before {
  font-size: 1rem !important;
  font-weight: bold !important;
}

/* Custom styling for DataFrame tables */
.cell-graph table {
  border-collapse: collapse;
  margin: 1em 0;
  font-family: var(--sans-serif-font);
  font-size: 0.8em;
  width: 100%;
  /* border-radius: 5px; */
  overflow: hidden;
  /* box-shadow: 0 0 10px rgba(0,0,0,0.1); */
}

.cell-graph table tr {
  background-color: white !important;
  color: white;
  text-align: left;
}

.cell-graph table th,
.cell-graph table td {
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
  border: 0;
}

.cell-graph table tbody tr:nth-child(even) {
  /* background-color: var(--pst-color-surface); */
  background-color: white !important;
}

.cell-graph table tbody tr:hover {
  background-color: var(--pst-color-on-surface);
}

.cell-graph table tbody tr.row_heading {
  font-weight: bold;
  background-color: var(--pst-color-secondary);
}

/* Styling for the DataFrame table headers */
.cell-graph table th {
  font-weight: bold;
  text-align: center;
}

/* Styling for numeric columns */
.cell-graph table td[class*="col_"] {
  text-align: right;
}

/* Styling for index column */
.cell-graph table .row_heading {
  font-weight: bold;
  background-color: var(--pst-color-surface);
}

/* Code block container with relative positioning for icon */
.highlight {
  position: relative;
}

.ast {
  position: relative; top:0.3em;
}

/* Home page layout styles */
.main-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 50px 0;
}

.left-section {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 20%;
}

.site-logo {
  width: 200px;
  height: auto;
  max-width: 100%;
}

/* Logo in language landing pages (in-content markdown image) */
.bd-content img[alt="SDS logo"] {
  width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
}

.right-section {
  flex: 1;
  text-align: left;
  align-self: flex-start;
}

.right-section h1 {
  font-size: 2.5em;
  margin: 0 0 10px 0;
  color: var(--text-primary-color);
  font-family: var(--sans-serif-font);
}

.author {
  font-size: 1.4em;
  color: #666;
  font-weight: normal;
  margin: 0 0 30px 0;
  font-family: var(--serif-font);
}

.language-prompt {
  margin: 20px 0 30px 0;
  font-size: 1.1em;
  color: #555;
  font-family: var(--serif-font);
}

.language-links { 
  display: flex; 
  gap: 20px; 
  flex-wrap: wrap;
}

.lang-card { 
  background: white; 
  padding: 20px; 
  border-radius: 8px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
  text-decoration: none; 
  color: inherit;
  transition: all 0.3s ease;
  min-width: 120px;
}

.lang-card:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 4px 8px rgba(0,0,0,0.15); 
}

.lang-card h3 {
  margin: 0 0 10px 0;
  color: var(--text-primary-color);
  font-family: var(--sans-serif-font);
}

.lang-card p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
  font-family: var(--serif-font);
}

/* Responsive design for home page */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
    text-align: center;
    gap: 30px;
    margin: 30px 0;
  }
  .right-section {
    text-align: center;
  }
  .site-logo {
    width: 150px;
  }
  .language-links {
    justify-content: center;
  }
}

/* Remove the default vertical border highlighting for current navigation items */
nav.bd-links .current > a {
  box-shadow: none !important;
}

/* Custom current-page class for alternative highlighting */
.current-page {
  background-color: var(--pst-color-primary-bg) !important;
  border-radius: 0.25rem;
  border-left: 3px solid var(--pst-color-primary) !important;
  font-weight: 600;
}

/* Make "Superhero Data Science" title prominent - black and bold */
.bd-sidenav__home-link .toctree-l1 > a {
  color: var(--pst-color-text-base) !important;
  font-weight: bold !important;
}

/* Make part names (captions) less prominent - gray */
nav.bd-links p.caption {
  color: var(--pst-color-text-muted) !important;
}

/* For current/active chapter links: remove bold weight, keep color highlighting */
nav.bd-links .current > a:not(.bd-sidenav__home-link .toctree-l1 > a) {
  font-weight: normal !important;
}

/* Fix alignment of main title with other navigation items */
.bd-sidenav__home-link {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.bd-sidenav__home-link .toctree-l1 {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.bd-sidenav__home-link .toctree-l1 a {
    padding-left: 0 !important; /* Match padding of other navigation items */
}

/* Collapsible TOC elements */
.part-collapsible, .chapter-collapsible {
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding-top: 0.25rem;
}

/* Chapter links: force full-width flex so chevron right-aligns correctly */
.chapter-collapsible {
    cursor: default;
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* Chapter chevrons slightly smaller than part chevrons */
.chapter-collapsible::after {
    font-size: 0.62rem;
}

/* Chevron — flex item pushed to the right edge of the sidebar column */
.part-collapsible::after, .chapter-collapsible::after {
    content: "\f078"; /* FontAwesome chevron-down */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    font-style: normal;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 0.5rem;
    padding-right: 0.4rem;
    align-self: flex-start;
    cursor: pointer;
    color: var(--pst-color-text-muted);
    transition: transform 0.2s ease;
}

/* Exclude nested spans to avoid duplicates */
.part-collapsible span.caption-text::after {
    display: none;
}

/* Rotate chevron when collapsed (matching Sphinx behavior: down=expanded, right=collapsed) */
.part-collapsible.collapsed::after, .chapter-collapsible.collapsed::after {
    transform: rotate(-90deg);
}

/* Section transitions */
.part-chapters, .chapter-sub-items {
    transition: all 0.3s ease;
    overflow: hidden;
}

.part-chapters.collapsed, .chapter-sub-items.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Hide Sphinx default details/summary elements */
details summary {
    display: none;
}


.py-error {
    display: none;
}

.plot-container {
  float: right;
  max-width: 250px;
  margin-left: 15px;
  margin-bottom: 15px;
  margin-top: 0;
  background: white;
  padding: 15px;
  border: 1px solid rgba(1, 1, 119, 0.15);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(1, 1, 119, 0.07);
  clear: right;
}

/* Keep plot-container styling when code is toggled */
.toggle-code-content.expanded ~ .plot-container,
.toggle-code-content ~ .plot-container {
  position: relative;
  float: right;
  max-width: 250px;
  margin-left: 15px;
  margin-bottom: 15px;
  margin-top: 0;
  background: white;
  padding: 15px;
  border: 1px solid rgba(1, 1, 119, 0.15);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(1, 1, 119, 0.07);
  clear: right;
}

/* ── Interactive graph controls (.plot-container widgets) ──────────────────
   Centre the control row and give the action button an on-brand look in place
   of the raw browser default. */
.model-slider-container {
  text-align: center;
  line-height: 2;
}

.model-slider-container input[type="range"] {
  accent-color: var(--text-primary-color);
  vertical-align: middle;
}

.model-slider-container button,
.plot-container button {
  display: block;
  margin: 0.7rem auto 0;
  font-family: var(--sans-serif-font);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: #fff;
  background-color: var(--text-primary-color);
  border: none;
  border-radius: 5px;
  padding: 0.34rem 1.05rem;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease,
              transform 0.06s ease;
}

.model-slider-container button:hover,
.plot-container button:hover {
  background-color: var(--link-color);
  box-shadow: 0 3px 10px rgba(1, 1, 119, 0.22);
}

.model-slider-container button:active,
.plot-container button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(1, 1, 119, 0.22);
}

.model-slider-container button:focus-visible,
.plot-container button:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.mermaid {
  background-color: inherit;
  border: none;
  display: flex;
  justify-content: center;
}
.mermaid > svg {
  width: auto !important;
  max-width: 100%;
}

/* .tag_hide-cell .admonition {
  display: block !important;
} */

/* ==========================================================================
   Exercise + Solution: unified box layout
   ========================================================================== */

/* Esercizio seguito da soluzione: rimuovi bordo inferiore e arrotondamento */
.exercise.admonition:has(+ .solution.admonition) {
  margin-bottom: 0;
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Soluzione che segue un esercizio: rimuovi bordo superiore e margine */
.exercise.admonition + .solution.admonition {
  margin-top: 0;
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding-top: 0;
}

/* Titolo della soluzione: nascondi il testo ma non gli elementi funzionali */
.exercise.admonition + .solution.admonition > .admonition-title {
  color: transparent;
  font-size: 0;
  background: transparent !important;
  padding: 0.5em 1em;
  margin: 0;
  /* border-top: 1px solid rgba(0, 0, 0, 0.15); */
  position: relative;
}

/* Rendi visibile qualsiasi elemento figlio (incluso il toggle button) */
.exercise.admonition + .solution.admonition > .admonition-title > * {
  visibility: visible;
  font-size: 0.9rem;
  color: var(--link-color, #006699);
}

/* Ma nascondi il link "Esercizio X" */
.exercise.admonition + .solution.admonition > .admonition-title > a {
  display: none !important;
}

/* Toggle button ::before - reso visibile in TUTTI gli stati */
.exercise.admonition + .solution.admonition > .admonition-title::before {
  font-size: 0.9rem !important;
  color: var(--link-color, #006699) !important;
  cursor: pointer;
  visibility: visible !important;
  display: inline !important;
}

/* Forza visibilità anche quando toggle-shown è attivo */
.exercise.admonition + .solution.admonition.toggle-shown > .admonition-title::before,
.exercise.admonition + .solution.admonition.toggle-hidden > .admonition-title::before,
.exercise.admonition + .solution.admonition.toggle > .admonition-title::before,
.exercise.admonition + .solution.dropdown.admonition > .admonition-title::before {
  font-size: 0.9rem !important;
  color: var(--link-color, #006699) !important;
  cursor: pointer;
  visibility: visible !important;
  display: inline !important;
}

/* Show toggle hint in both hidden and shown states (library only shows it when
   .toggle-button-hidden is present; this rule covers the visible state too).
   JS in custom.js swaps data-toggle-hint between the show/hide strings. */
@media (min-width: 768px) {
  .exercise.admonition + .solution.admonition button.toggle-button::before {
    content: attr(data-toggle-hint);
    font-size: .8em;
    align-self: center;
  }
}

/* Suppress pydata's :focus-visible purple ring on admonition titles.
   Must cover ::before because pydata colors the pseudo-element's border-bottom
   (rgb(193,50,175)) when the <p> receives focus. */
.exercise.admonition > .admonition-title:focus,
.exercise.admonition > .admonition-title:focus-visible,
.exercise.admonition > .admonition-title *:focus,
.exercise.admonition > .admonition-title *:focus-visible,
.exercise.admonition + .solution.admonition > .admonition-title:focus,
.exercise.admonition + .solution.admonition > .admonition-title:focus-visible,
.exercise.admonition + .solution.admonition > .admonition-title *:focus,
.exercise.admonition + .solution.admonition > .admonition-title *:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}
.exercise.admonition > .admonition-title:focus::before,
.exercise.admonition > .admonition-title:focus-visible::before,
.exercise.admonition + .solution.admonition > .admonition-title:focus::before,
.exercise.admonition + .solution.admonition > .admonition-title:focus-visible::before {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

/* Solution label after toggle button — default: English/French */
.exercise.admonition + .solution.admonition > .admonition-title::after {
  content: "Solution";
  font-size: 1rem;
  color: var(--text-primary-color);
  font-weight: bold;
  font-family: var(--sans-serif-font);
  margin-left: 0.3em;
}

/* ==========================================================================
   Heading type scale
   ========================================================================== */

.bd-article-container h1 {
  font-size: 2.0rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.bd-article-container h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.bd-article-container h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

.bd-article-container h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Section number styling — JS wraps numbers in .sec-num, titles in .sec-title */
.bd-article-container h1 .sec-num,
.bd-article-container h2 .sec-num,
.bd-article-container h3 .sec-num {
  font-size: 0.88em;
  font-weight: 400;
  opacity: 0.55;
  margin-right: 0.3em;
}

.bd-article-container h1 .sec-title,
.bd-article-container h2 .sec-title,
.bd-article-container h3 .sec-title {
  font-weight: 700;
}

/* ==========================================================================
   Mathematical admonition boxes — warm (definitions, examples) vs cool (theorems)
   ========================================================================== */

/* Definitions — warm cream, gold border */
.definition.admonition {
  background-color: var(--accent-gold-tint);
  border-left: 4px solid var(--accent-gold);
}

.definition.admonition > .admonition-title {
  background-color: var(--accent-gold-pale);
}

/* Theorems, lemmas, corollaries — cool navy tint */
.theorem.admonition,
.lemma.admonition,
.corollary.admonition {
  background-color: var(--theorem-bg);
  border-left: 4px solid var(--text-primary-color);
}

.theorem.admonition > .admonition-title,
.lemma.admonition > .admonition-title,
.corollary.admonition > .admonition-title {
  background-color: var(--theorem-tint);
}

/* Theorem + proof compound block
   When a proof immediately follows a theorem/lemma/corollary, fuse the two
   into one compound shape: no gap, dashed internal separator, subordinate
   proof left border, outer-only border-radius. Standalone theorems unchanged. */
.theorem.admonition:has(+ .sds-proof),
.lemma.admonition:has(+ .sds-proof),
.corollary.admonition:has(+ .sds-proof) {
  margin-bottom: 0;
  border-bottom: 1px dashed rgba(1, 1, 119, 0.25);
  border-radius: 3px 3px 0 0;
}

.theorem.admonition + .sds-proof,
.lemma.admonition + .sds-proof,
.corollary.admonition + .sds-proof {
  margin-top: 0;
  border-left: 4px solid var(--text-primary-color);
  background-color: white;
  border-radius: 0 0 3px 3px;
  padding: 0.4rem 0.75em 0.5rem;
}

/* Naming — neutral, subtle */
.naming.admonition {
  background-color: #f5f5f5;
  border-left: 4px solid var(--visited-link-color);
}

@media print {
  .bd-article-container h1,
  .bd-article-container h2,
  .bd-article-container h3,
  .bd-article-container h4,
  .bd-article-container h5,
  .bd-article-container h6,
  .bd-article-container p.caption {
    color: #000 !important;
  }
}
/* Privacy notice in footer — unobtrusive details/summary toggle */
.privacy-notice {
  font-size: 0.78rem;
  color: var(--visited-link-color);
  margin-top: 0.4rem;
}

.privacy-notice summary {
  cursor: pointer;
  display: inline;
  color: var(--visited-link-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  list-style: none;
}

.privacy-notice summary::-webkit-details-marker { display: none; }

.privacy-notice[open] summary {
  color: var(--text-primary-color);
}

.privacy-notice p {
  margin-top: 0.35rem;
  max-width: 52ch;
  line-height: 1.5;
  color: var(--visited-link-color);
}

/* Sidebar layout: grid row 1 (1fr) = scrollable TOC, row 2 (auto) = notice.
   Grid arithmetic guarantees the two rows fill exactly 100vh so scrollTop
   is always clamped to 0, making the notice immune to any JS scrollTop call. */
/* ── True/false (Vero o falso) question cards ───────────────────────────── */

/* Counter: restart at the first item of each consecutive run */
.tf-item:not(.tf-item + .tf-item) {
  counter-reset: tf-question;
  margin-top: 1em;
}

.tf-item {
  counter-increment: tf-question;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

/* Hairline separator between consecutive items */
.tf-item + .tf-item {
  border-top: 1px solid rgba(0, 0, 0, 0.09);
}

/* Question row: flex so the badge sits to the left of the text */
.tf-item > .tf-question {
  display: flex;
  align-items: flex-start;
  gap: 0.75em;
  font-family: var(--serif-font);
  font-weight: normal;
  font-size: 1em;
  line-height: 1.5;
  cursor: pointer;
  padding: 0.65em 0.5em;
  user-select: none;
  color: var(--text-primary-color);
  margin: 0;
  transition: background 0.15s ease;
}

.tf-item > .tf-question:hover {
  background: rgba(0, 0, 0, 0.025);
}

/* Numbered badge */
.tf-item > .tf-question::before {
  content: counter(tf-question);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.22);
  font-family: var(--sans-serif-font);
  font-size: 0.75em;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.3);
  margin-top: 0.07em;        /* optical alignment with cap-height */
  line-height: 1;
  transition: color 0.3s ease, border-color 0.3s ease;
}

/* Badge turns coloured the first time the answer is revealed */
.tf-item.tf-seen.tf-vera  > .tf-question::before {
  color: #1a6b35;
  border-color: #1a6b35;
}
.tf-item.tf-seen.tf-falsa > .tf-question::before {
  color: #8b1c24;
  border-color: #8b1c24;
}

.tf-item > .tf-question p {
  margin: 0;
}

/* Answer slab: hidden by default, slides down on .tf-open */
.tf-verdict {
  display: block;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding-top 0.3s ease, padding-bottom 0.3s ease;
  font-family: var(--serif-font);
  font-size: 1em;
  font-weight: normal;
  line-height: 1.5;
  padding: 0 1rem;
  border-radius: 0;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  color: var(--text-primary-color);
}

.tf-item.tf-open .tf-verdict {
  max-height: 60em;
  padding-top: 0.65em;
  padding-bottom: 0.75em;
}

.tf-item.tf-vera  .tf-verdict { background-color: #cce8d4; }
.tf-item.tf-falsa .tf-verdict { background-color: #f2cdd1; }

/* Verdict word — uppercase sans, colour-coded */
.tf-verdict > p:first-child > strong:first-child {
  font-family: var(--sans-serif-font);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.88em;
}

.tf-item.tf-vera  .tf-verdict > p:first-child > strong:first-child { color: #1a6b35; }
.tf-item.tf-falsa .tf-verdict > p:first-child > strong:first-child { color: #8b1c24; }

/* ── Sidebar primary grid ──────────────────────────────────────────────── */

.bd-sidebar-primary {
  display: grid !important;
  grid-template-rows: 1fr auto;
  height: 100vh !important;
  overflow: hidden !important;
}

.bd-sidebar-scroll-area {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 1rem; /* counteracts .bd-links { margin-right: -1rem } from theme */
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Hide scrollbar (same policy as the original sidebar) */
  scrollbar-width: none;
}

.bd-sidebar-scroll-area::-webkit-scrollbar {
  display: none;
}

/* ── Keyword reveal grid ({sds-wordcloud} directive) ───────────────────────── */

@keyframes sds-cell-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes sds-term-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sds-wordcloud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px;
  margin: 0 0 0.75em;
  background: rgba(1, 1, 119, 0.02);
  border-radius: 6px;
  box-sizing: border-box;
}

.sds-ptable-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px 14px;
  background: #d8eef5;
  border: 1.5px solid #5599b5;
  border-radius: 4px;
  cursor: default;
  opacity: 0;
  animation: sds-cell-in 0.35s ease forwards;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
}

.sds-ptable-cell:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 4px 14px rgba(1, 1, 119, 0.18);
  z-index: 1;
}

/* Term text: invisible initially, revealed per-cell with staggered animation */
.sds-ptable-name {
  font-family: var(--serif-font, Lora, Georgia, serif);
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  color: var(--text-primary-color, #010177);
  opacity: 0;
}

.sds-ptable-cell--revealed .sds-ptable-name {
  animation: sds-term-in 0.38s ease forwards;
}

.sds-ptable-name code {
  font-family: var(--tt-font, "IBM Plex Mono", monospace);
  font-size: 0.88em;
  background: rgba(1, 1, 119, 0.08);
  border-radius: 3px;
  padding: 0.05em 0.35em;
  color: inherit;
}

/* Reveal / hide button — sits above the grid */
.sds-reveal-wrap {
  text-align: center;
  margin: 1em 0 0;
  padding-bottom: 8px;
}

.sds-reveal-btn {
  font-family: var(--sans-serif-font, Oswald, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #fff;
  background: var(--link-color, #006699);
  border: 1.5px solid transparent;
  border-radius: 3px;
  padding: 7px 22px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease,
              border-color 0.15s ease, transform 0.12s ease;
  outline: none;
}

.sds-reveal-btn:hover {
  background: #004d73;
  transform: translateY(-1px);
}

.sds-reveal-btn:active {
  transform: translateY(0);
}

.sds-reveal-btn--reset {
  background: transparent;
  color: var(--link-color, #006699);
  border-color: var(--link-color, #006699);
}

.sds-reveal-btn--reset:hover {
  background: rgba(0, 102, 153, 0.07);
}

/* Privacy notice always visible at the bottom of the sidebar */
.privacy-notice--sidebar {
  flex-shrink: 0;
  background: var(--background-color);
  padding: 0.6rem 1rem 0.8rem;
  border-top: 1px solid rgba(1, 1, 119, 0.1);
}
