sup,
a.footnote-reference {
    font-size: 0.6em;
    vertical-align: super;
    line-height: 0;
}

div.cell_output.docutils.container {
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.output.text_plain.highlight-myst-ansi.notranslate {
    margin: 0 !important;
}

div.output {
    margin: 0 !important;
}

body {
    line-height: 1.28;
}

h1,
h2,
h3,
h4 {
    line-height: 1.25;
    margin-bottom: 0.3em;
    font-weight: 600;
}

h2 {
    margin: 1.5rem 0 0.75rem 0;
}

h3 {
    margin: 1rem 0 0.5rem 0;
}

h4 {
    margin-top: 0.75rem;
}

p {
    font-size: inherit !important;
    margin-bottom: 0.5rem;
}

li {
    font-size: inherit !important;
    line-height: 1.25 !important;
}

.bd-article-container .bd-content ul,
.bd-article-container .bd-content ol {
    margin-top: 0.3rem;
    margin-bottom: 0.75rem !important;
}

.bd-article-container .bd-content li {
    margin-bottom: 0.125rem !important;
}

nav.bd-links p.caption {
    margin-top: 0.45rem !important;
    margin-bottom: 0.15rem !important;
}

/* Sphinx's local contents directive wraps headings in a toc-backref link.
   Keep those headings visually consistent with ordinary headings. */
.bd-content h1 a.toc-backref,
.bd-content h2 a.toc-backref,
.bd-content h3 a.toc-backref,
.bd-content h4 a.toc-backref,
.bd-content h5 a.toc-backref,
.bd-content h6 a.toc-backref {
    color: inherit !important;
    text-decoration: none !important;
}

.bd-content h1 a.toc-backref:hover,
.bd-content h2 a.toc-backref:hover,
.bd-content h3 a.toc-backref:hover,
.bd-content h4 a.toc-backref:hover,
.bd-content h5 a.toc-backref:hover,
.bd-content h6 a.toc-backref:hover {
    color: inherit !important;
    text-decoration: none !important;
}

/* Local contents/mini-TOC boxes are navigation, not prose links. */
.bd-content .contents a,
.bd-content .topic.contents a,
.bd-content nav.contents a {
    text-decoration: none !important;
}

.bd-content .contents a:hover,
.bd-content .topic.contents a:hover,
.bd-content nav.contents a:hover {
    text-decoration: none !important;
}

/* PyData can render the book root as a separate home-link above the first part;
   the logo already links to the root (the cover), so hide the duplicate. */
.bd-sidebar-primary nav.bd-links .bd-sidenav__home-link {
    display: none !important;
}

html[data-theme=light] {
    --sbt-color-announcement: #616161;
    --pst-color-primary: #176de8;
}

.bd-sidebar-primary {
    line-height: 1.25 !important;
}

/* Fix oversized font when sidebar is toggled open (drawer/navbar mode) */
div.bd-toc-item.navbar-nav,
div.bd-toc-item.navbar-nav a,
div.bd-toc-item.navbar-nav p.caption,
div.bd-toc-item.navbar-nav li {
    font-size: 0.85rem !important;
}

/* Keep right "Contents" drawer font size consistent with compact sidebar text */
#pst-secondary-sidebar,
#pst-secondary-sidebar .sidebar-secondary-item,
#pst-secondary-sidebar .sidebar-secondary-item a,
#pst-secondary-sidebar .toc-entry a,
#pst-secondary-sidebar .nav-link {
    font-size: 0.85rem !important;
    line-height: 1.25 !important;
}

#pst-secondary-sidebar .sidebar-secondary-items,
#pst-secondary-sidebar nav.bd-toc-nav,
#pst-secondary-sidebar nav.bd-toc-nav ul,
#pst-secondary-sidebar nav.bd-toc-nav li,
#pst-secondary-sidebar nav.bd-toc-nav a,
.sidebar-secondary-item,
.sidebar-secondary-item a,
nav.bd-toc-nav,
nav.bd-toc-nav li,
nav.bd-toc-nav a {
    font-size: 0.85rem !important;
    line-height: 1.25 !important;
}

nav.bd-links li>a {
    padding: .1rem .25rem !important;
}

/* Tighter left sidebar line spacing */
.bd-sidebar-primary nav.bd-links li,
.bd-sidebar-primary nav.bd-links li>a {
    line-height: 1.2 !important;
}

.bd-content .sd-tab-set>input:checked+label {
    background-color: var(--pst-color-on-background);
    border-color: var(--pst-color-primary) var(--pst-color-primary) transparent;
    border-radius: .125rem .125rem 0 0;
    border-style: solid solid none;
    border-width: .125rem .125rem 0;
    color: var(--pst-color-primary);
    transform: translateY(.125rem);
}

/* =============================================================
   STATIC PAGE: code cell input/output styling
   
   - Cell input: inset from prose, light background without a left border
   - Cell output: no left border, separated from input by top border
   - pre inside output: no green left border (that's only for input)
   ============================================================= */

/* Base pre styling - no green by default */
pre {
    background-color: #f7f7f7 !important;
    color: #222 !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem !important;
    border-left: 1px solid #ddd;
}

/* A shared inset keeps the input and its controls on the same left edge. */
div.cell {
    --cscs-code-inset: 1rem;
    --cscs-code-text-offset: 8px;
}

div.cell:has(.cell_input .linenos) {
    --cscs-code-text-offset: 2.8rem;
}

div.cell > .cell_input,
div.cell > details > .cell_input {
    margin-left: var(--cscs-code-inset) !important;
}

div.cell_input pre,
div.cell_input .highlight pre {
    border-left: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Jupyter Book renders source line numbers as spans inside the same <pre>.
   Treat them as a quiet gutter so they guide reading without becoming code. */
div.cell_input .highlight pre:has(span.linenos) {
    border: none !important;
    background-color: transparent !important;
    background-image: linear-gradient(to right, transparent 2.1rem, #f7f7f7 2.1rem);
    padding-left: 0.35rem !important;
}

div.cell_input .highlight:has(span.linenos) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

div.cell_input:has(span.linenos) {
    background: transparent !important;
}

div.cell_input .highlight span.linenos {
    background: transparent !important;
    border-top: none !important;
    border-left: none !important;
    border-bottom: none !important;
    box-sizing: border-box;
    display: inline-block;
    font-variant-numeric: tabular-nums;
    margin-right: 0.7rem;
    min-width: 1.75rem;
    padding-left: 0 !important;
    padding-right: 0.45rem !important;
    text-align: right;
    user-select: none;
    border-right: 1px solid #d6dde5;
}

html[data-theme="dark"] div.cell_input .highlight span.linenos {
    border-right-color: #3a4654;
}

/* Output pre: no green border, slightly different bg to distinguish */
div.cell_output pre {
    border-left: 1px solid #c3c3c3 !important;
    background-color: #fafafa !important;
    border-top-left-radius: 0 !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Static code/output cells: gentle hover feedback like interactive cells */
div.cell:hover div.cell_input pre,
div.cell:hover div.cell_input .highlight pre,
div.cell:hover div.cell_output pre {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Every runnable cell is edited in place (execution.js); the frame marks the cell
   being typed in. */
div.cell_input pre.cscs-inline-editing {
    cursor: text;
}

div.cell_input pre.cscs-inline-editing:focus-within {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18), 0 6px 18px rgba(37, 99, 235, 0.08) !important;
    outline: none;
}

div.cell_input pre .cscs-code-line {
    display: block;
    min-height: 1.45em;
}

div.cell_input pre .cscs-code-line .linenos {
    pointer-events: none;
}

div.cell_input pre .cscs-code-line-content {
    display: inline-block;
    min-width: calc(100% - 3rem);
    outline: none;
    white-space: pre;
}

div.cell_input pre.cscs-inline-editing .cscs-code-line-content:focus {
    outline: none;
}

/* Gap and separator between cell_input and cell_output */
div.cell_input {
    border: none !important;
    margin-bottom: 0 !important;
}

div.cell_output {
    border-top: 1px solid #e8e8e8 !important;
    margin-top: 6px !important;
    padding-top: 6px !important;
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Output text starts beneath the source text, past any line-number gutter. */
div.cell > div.cell_output,
div.cell > div.cell_output.docutils.container {
    margin-left: var(--cscs-code-inset) !important;
}

div.cell_output pre,
pre.cscs-execution-output {
    border-left: none !important;
    padding-left: var(--cscs-code-text-offset, 8px) !important;
}

table.dataframe,
table {
    border-collapse: collapse !important;
    width: auto !important;
    margin: 0 auto 1em auto !important;
}

.dataframe td,
.dataframe th,
table td,
table th {
    padding: 2px 6px !important;
    line-height: 1.2 !important;
}

table td p,
table th p,
table.dataframe th,
table.dataframe td {
    font-size: 0.85rem !important;
    color: #333 !important;
}

/* Inline code inside tables */
table td code,
table th code {
    font-size: 0.8rem !important;
}

/* Match output table text to code-cell size */
div.cell_output table td,
div.cell_output table th,
div.cell_output table td p,
div.cell_output table th p,
div.cell_output table.dataframe td,
div.cell_output table.dataframe th,
.jp-OutputArea table td,
.jp-OutputArea table th,
.jp-OutputArea table td p,
.jp-OutputArea table th p,
.jp-OutputArea table.dataframe td,
.jp-OutputArea table.dataframe th {
    font-size: 0.8rem !important;
}

table thead tr,
table.dataframe thead tr {
    color: #555 !important;
    font-weight: 500 !important;
    background-color: #f9f9f9 !important;
    border-bottom: 2px solid #eee !important;
}

table.dataframe thead th,
table thead th {
    color: #222 !important;
    font-weight: 500 !important;
    background-color: #f9f9f9 !important;
}

table.dataframe tbody th,
table tbody th {
    color: #222 !important;
    font-weight: 500 !important;
    border-bottom: 1px solid #eee !important;
}

table.dataframe tbody tr,
table tbody tr {
    font-weight: 400 !important;
}

table.dataframe tbody tr:hover,
table.dataframe tbody tr th:hover,
table tbody tr:hover {
    background-color: #ebf7ee !important;
}

.simple.glossary>dt {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}

:root {
    --pst-sidebar-font-size: 0.85rem;
    --pst-sidebar-secondary-font-size: 0.85rem;
}

.highlight {
    font-size: 0.9rem !important;
}

/* C# syntax highlighting tuned for teaching code.
   Scope to Pygments' C# blocks so other languages keep their own palettes. */
html[data-theme="light"] .highlight-csharp .highlight {
    color: #1f2937;
}

html[data-theme="light"] .highlight-csharp .k,
html[data-theme="light"] .highlight-csharp .kc,
html[data-theme="light"] .highlight-csharp .kd,
html[data-theme="light"] .highlight-csharp .kn,
html[data-theme="light"] .highlight-csharp .kp,
html[data-theme="light"] .highlight-csharp .kr,
html[data-theme="light"] .highlight-csharp .ow {
    color: #7c3aed !important;
}

html[data-theme="light"] .highlight-csharp .kt,
html[data-theme="light"] .highlight-csharp .nc {
    color: #b45309 !important;
}

html[data-theme="light"] .highlight-csharp .nf,
html[data-theme="light"] .highlight-csharp .fm {
    color: #0369a1 !important;
}

html[data-theme="light"] .highlight-csharp .s,
html[data-theme="light"] .highlight-csharp .s1,
html[data-theme="light"] .highlight-csharp .s2,
html[data-theme="light"] .highlight-csharp .sa,
html[data-theme="light"] .highlight-csharp .sb,
html[data-theme="light"] .highlight-csharp .sc,
html[data-theme="light"] .highlight-csharp .sd,
html[data-theme="light"] .highlight-csharp .se,
html[data-theme="light"] .highlight-csharp .sh,
html[data-theme="light"] .highlight-csharp .si,
html[data-theme="light"] .highlight-csharp .sx {
    color: #047857 !important;
}

html[data-theme="light"] .highlight-csharp .m,
html[data-theme="light"] .highlight-csharp .mi,
html[data-theme="light"] .highlight-csharp .mf,
html[data-theme="light"] .highlight-csharp .mh,
html[data-theme="light"] .highlight-csharp .mo,
html[data-theme="light"] .highlight-csharp .il {
    color: #c2410c !important;
}

html[data-theme="light"] .highlight-csharp .c,
html[data-theme="light"] .highlight-csharp .c1,
html[data-theme="light"] .highlight-csharp .cm,
html[data-theme="light"] .highlight-csharp .cs {
    color: #6b7280 !important;
    font-style: italic;
}

html[data-theme="light"] .highlight-csharp .o,
html[data-theme="light"] .highlight-csharp .p {
    color: #0891b2 !important;
}

html[data-theme="dark"] .highlight-csharp .highlight {
    color: #d4d4d4;
}

html[data-theme="dark"] .highlight-csharp .k,
html[data-theme="dark"] .highlight-csharp .kc,
html[data-theme="dark"] .highlight-csharp .kd,
html[data-theme="dark"] .highlight-csharp .kn,
html[data-theme="dark"] .highlight-csharp .kp,
html[data-theme="dark"] .highlight-csharp .kr,
html[data-theme="dark"] .highlight-csharp .ow {
    color: #c586c0 !important;
}

html[data-theme="dark"] .highlight-csharp .kt,
html[data-theme="dark"] .highlight-csharp .nc {
    color: #d7ba7d !important;
}

html[data-theme="dark"] .highlight-csharp .nf,
html[data-theme="dark"] .highlight-csharp .fm {
    color: #4fc1ff !important;
}

html[data-theme="dark"] .highlight-csharp .s,
html[data-theme="dark"] .highlight-csharp .s1,
html[data-theme="dark"] .highlight-csharp .s2,
html[data-theme="dark"] .highlight-csharp .sa,
html[data-theme="dark"] .highlight-csharp .sb,
html[data-theme="dark"] .highlight-csharp .sc,
html[data-theme="dark"] .highlight-csharp .sd,
html[data-theme="dark"] .highlight-csharp .se,
html[data-theme="dark"] .highlight-csharp .sh,
html[data-theme="dark"] .highlight-csharp .si,
html[data-theme="dark"] .highlight-csharp .sx {
    color: #ce9178 !important;
}

html[data-theme="dark"] .highlight-csharp .m,
html[data-theme="dark"] .highlight-csharp .mi,
html[data-theme="dark"] .highlight-csharp .mf,
html[data-theme="dark"] .highlight-csharp .mh,
html[data-theme="dark"] .highlight-csharp .mo,
html[data-theme="dark"] .highlight-csharp .il {
    color: #b5cea8 !important;
}

html[data-theme="dark"] .highlight-csharp .c,
html[data-theme="dark"] .highlight-csharp .c1,
html[data-theme="dark"] .highlight-csharp .cm,
html[data-theme="dark"] .highlight-csharp .cs {
    color: #858585 !important;
    font-style: italic;
}

html[data-theme="dark"] .highlight-csharp .o,
html[data-theme="dark"] .highlight-csharp .p {
    color: #4ec9b0 !important;
}

.cell_output {
    font-size: 0.8rem !important;
    margin-bottom: 1em !important;
}

.tag_hide-input .admonition-title,
.tag_hide-input summary {
    font-weight: normal;
    margin-bottom: 0.25rem !important;
}

p.admonition-title {
    margin: 0px 10px 5px 0px;
    font-weight: normal !important;
}

.tag_hide-input details {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

.tag_hide-input .admonition,
.tag_hide-input details.admonition {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
    border-top-left-radius: 0 !important;
    box-shadow: none !important;
}

.admonition,
.sd-admonition {
    border-left: 1px solid !important;
}

div.output_stream,
div.cell_output {
    font-size: 0.75rem !important;
}

div.output_stream pre,
div.cell_output pre {
    font-size: 0.75rem !important;
}

div.output_stream pre span,
div.cell_output pre span {
    font-size: 0.75rem !important;
}

div.cell.docutils.container,
div.container.cell,
div.cell {
    margin-bottom: 1rem !important;   /* the theme's own spacing after a code cell */
}

/* Cell states from Press's shared code-cells.css: thinkpress-cell-ran tints the
   line-number gutter, thinkpress-cell-edited the code area, each as a translucent
   background-image overlay. With line numbers this book paints the code box on the <pre>
   (a gradient: transparent 2.1rem gutter, then #f7f7f7) over a transparent .highlight,
   so the shared .highlight wash would show only in the gutter and the per-line linenos
   wash would leave gaps between lines. Those two are switched off here and the overlays
   are layered onto the <pre>'s own gradient instead, so nothing stacks. */
div.cell.thinkpress-cell-edited div.cell_input .highlight:has(span.linenos),
div.cell.thinkpress-cell-ran div.cell_input .highlight span.linenos {
    background-image: none !important;
}

div.cell.thinkpress-cell-ran div.cell_input .highlight pre:has(span.linenos) {
    background-image:
        linear-gradient(to right, var(--thinkpress-ran-gutter) 2.1rem, transparent 2.1rem),
        linear-gradient(to right, transparent 2.1rem, #f7f7f7 2.1rem);
}

div.cell.thinkpress-cell-edited div.cell_input .highlight pre:has(span.linenos) {
    background-image:
        linear-gradient(to right, transparent 2.1rem, var(--thinkpress-edited-code) 2.1rem),
        linear-gradient(to right, transparent 2.1rem, #f7f7f7 2.1rem);
}

div.cell.thinkpress-cell-ran.thinkpress-cell-edited div.cell_input .highlight pre:has(span.linenos) {
    background-image:
        linear-gradient(to right, var(--thinkpress-ran-gutter) 2.1rem, var(--thinkpress-edited-code) 2.1rem),
        linear-gradient(to right, transparent 2.1rem, #f7f7f7 2.1rem);
}

/* Without line numbers the <pre>'s opaque background hides the shared .highlight wash,
   so the <pre> carries it (the .highlight one stays underneath, unseen). */
div.cell.thinkpress-cell-edited div.cell_input .highlight pre:not(:has(span.linenos)) {
    background-image: linear-gradient(var(--thinkpress-edited-code), var(--thinkpress-edited-code));
}

/* The shared row style drops this book's inset and centers the stdin panel. */
.cscs-execution-controls.thinkpress-cell-controls {
    align-items: flex-start;
    margin-left: var(--cscs-code-inset, 1rem);
}

.cscs-execution-controls {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    margin: 4px 0 6px var(--cscs-code-inset, 1rem);   /* room below when the output is collapsed */
}

.cscs-execution-controls button {
    appearance: none;
    background: var(--pst-color-surface, #f7f7f7);
    border: 0;
    border-radius: 2px;
    color: var(--pst-color-text-muted, #666666);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    flex: 0 0 auto;
    line-height: 1;
    padding: 2px 8px;
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    width: auto;
}

.cscs-execution-controls button:hover:not(:disabled) {
    background: var(--pst-color-border, #e4e7eb);
    color: var(--pst-color-text-base, #27313a);
}

.cscs-execution-controls button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.cscs-execution-controls button:focus-visible {
    box-shadow: 0 0 0 2px rgba(39, 125, 161, 0.2);
    outline: none;
}

.cscs-stdin-panel {
    display: grid;
    gap: 6px;
    grid-column: 1 / -1;
    max-width: 32rem;
}

.cscs-stdin-heading {
    color: #52616b;
    font-size: 0.8rem;
    line-height: 1.2;
}

.cscs-stdin-hint {
    color: #6b7780;
    font-size: 0.72rem;
    margin-left: 8px;
}

.cscs-stdin-label {
    color: #52616b;
    display: grid;
    font-size: 0.8rem;
    gap: 2px;
    line-height: 1.2;
}

.cscs-stdin-fields {
    display: grid;
    gap: 6px;
}

.cscs-stdin-input {
    box-sizing: border-box;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.85rem;
    line-height: 1.35;
    min-height: 2rem;
    padding: 4px 8px;
    width: 100%;
}

.cscs-execution-output {
    display: block;
    box-sizing: border-box;
    margin: 4px 0 0 var(--cscs-code-inset, 1rem);
    max-width: calc(100% - var(--cscs-code-inset, 1rem));
    overflow: auto;
    white-space: pre-wrap;
    width: calc(100% - var(--cscs-code-inset, 1rem));
}

.cscs-code-editor {
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 6px;
    box-sizing: border-box;
    color: #222;
    display: block;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.8rem;
    line-height: 1.45;
    min-height: 0;
    padding: 8px;
    resize: none;
    width: 100%;
}

.cscs-student-copy .cscs-code-editor:not([hidden]),
div.cell.cscs-is-editing[data-cscs-edit-mode="edit"] .cscs-code-editor:not([hidden]) {
    border-color: #5b9be8;
    border-left-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14), 0 6px 18px rgba(37, 99, 235, 0.08);
}

.cscs-code-editor:focus {
    border-color: #4f8edc;
    border-left-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 8px 22px rgba(37, 99, 235, 0.10);
    outline: none;
}

.cscs-code-editor.is-inline {
    margin: 0;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
    resize: vertical;
}

.cscs-code-editor[hidden],
.cscs-execution-controls [hidden],
.cscs-execution-controls button[hidden] {
    display: none !important;
}

.cscs-student-copy {
    --cscs-code-text-offset: 8px;
    border-left: 2px solid #7d8b96;
    margin: 10px 0 16px 12px;
    padding-left: 10px;
}

.cscs-student-copy .cscs-execution-controls {
    margin-left: 0;
}

.cscs-student-copy .cscs-execution-output {
    margin-left: 0;
    max-width: 100%;
    width: 100%;
}

.cscs-student-copy-label {
    color: #52616b;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

/* The reader's book: saved outputs start collapsed, and the page gets Run all and
   Show all saved outputs. */
div.cell > div.cell_output[hidden] {
    display: none !important;
}

/* The saved-output toggle sits in the controls row and takes the shared button style. */
.cscs-expected-toggle[aria-expanded="true"] {
    font-weight: 600;
}

.cscs-expected-toggle[hidden] {
    display: none !important;
}

.cscs-execution-output.is-skipped {
    color: #6b5b12;
    font-style: italic;
}

.cscs-page-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0.5rem 0 1.25rem;
}

.cscs-page-controls button {
    appearance: none;
    background: var(--pst-color-surface, #f7f7f7);
    border: 1px solid var(--pst-color-border, #e4e7eb);
    border-radius: 4px;
    color: var(--pst-color-text-base, #27313a);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.2;
    padding: 5px 12px;
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.cscs-page-controls button:hover:not(:disabled) {
    background: var(--pst-color-border, #e4e7eb);
}

.cscs-page-controls button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.cscs-page-controls button:focus-visible {
    box-shadow: 0 0 0 2px rgba(39, 125, 161, 0.3);
    outline: none;
}

.cscs-page-controls .cscs-run-all-button[aria-pressed="true"] {
    background: #e8f1f8;
    border-color: #9fc3dc;
}

.cscs-page-controls button[hidden] {
    display: none !important;
}

.cscs-page-controls-status {
    color: var(--pst-color-text-muted, #6b7780);
    font-size: 0.8rem;
}

@media print {
    div.cell > div.cell_output[hidden] {
        display: block !important;
    }

    .cscs-page-controls,
    .cscs-expected-toggle,
    .cscs-execution-controls {
        display: none !important;
    }
}

.cscs-author-save {
    background: #2f6fde;
    border: 1px solid #245bb9;
    border-radius: 6px;
    bottom: 18px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 8px 12px;
    position: fixed;
    right: 22px;
    z-index: 1001;
}

.cscs-author-save:hover { background: #245fca; }

.cscs-author-sync {
    background: #fff;
    border: 1px solid #245bb9;
    border-radius: 6px;
    bottom: 18px;
    color: #245bb9;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 8px 12px;
    position: fixed;
    right: 150px;
    z-index: 1001;
}

.cscs-author-sync:hover {
    background: #eef4ff;
}

/* Saved edits the server checkout still holds: Sync has not committed and pushed them. */
.cscs-author-sync--dirty {
    background: #fff3cd;
    border-color: #b7791f;
    box-shadow: 0 0 0 2px rgba(183, 121, 31, 0.25);
    color: #7a4b00;
    font-weight: 600;
}

.cscs-author-sync--dirty:hover {
    background: #ffe8a8;
}

.cscs-author-copy-save {
    background: #2f6fde;
    border: 1px solid #245bb9;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 6px;
    padding: 5px 9px;
}

.cscs-author-cell-controls {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
}

.cscs-author-cell-controls button,
.cscs-author-insert-controls button,
.cscs-new-cell-actions button {
    background: #fff;
    border: 1px solid #b7c0c8;
    border-radius: 4px;
    color: #27313a;
    cursor: pointer;
    font-size: 0.8rem;
    height: 24px;
    padding: 2px 8px;
}

.cscs-author-cell-controls button:hover,
.cscs-author-insert-controls button:hover,
.cscs-new-cell-actions button:hover {
    background: #f1f5f7;
    border-color: #7d8b96;
}

.cscs-author-insert-controls {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
}

.cscs-new-cell {
    margin-top: 0.65rem;
}

.cscs-new-cell.is-done {
    border-left-color: #cbd5df;
}

.cscs-new-cell.is-done .cscs-student-copy-label {
    color: #6b7780;
    font-size: 0.78rem;
}

.cscs-new-cell-preview {
    border: 0;
    border-radius: 0;
    margin: 0.25rem 0 0.35rem;
    padding: 0;
}

.cscs-new-cell-preview > :last-child {
    margin-bottom: 0;
}

.cscs-new-cell-actions {
    display: inline-flex;
    gap: 4px;
    margin-top: 0.4rem;
}

.cscs-author-sync-warning {
    color: #6b5b12;
    display: inline-block;
    font-size: 0.8rem;
    margin: 0.35rem 0 0.6rem;
}

.cscs-execution-controls .cscs-author-sync-warning {
    margin-left: 0.5rem;
}

.cscs-markdown-editor {
    background: #fff;
    border: 1px solid #cbd5df;
    border-left: 2px solid #2563eb;
    border-radius: 6px 6px 6px 0;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
    box-sizing: border-box;
    display: block;
    font: inherit;
    line-height: 1.45;
    margin: 8px 0;
    min-height: 8rem;
    padding: 10px;
    resize: vertical;
    width: 100%;
}

.cscs-markdown-copy {
    max-width: 100%;
}

.cscs-markdown-copy .cscs-markdown-editor {
    font-family: var(--pst-font-family-monospace);
    margin: 0;
}

.cscs-markdown-editor.is-inline {
    font-size: 0.92rem;
    margin: 4px 0 8px;
    min-height: 4.5rem;
    padding: 8px;
}

.cscs-markdown-editor:focus {
    border-color: #4f8edc;
    border-left-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
    outline: none;
}

.cscs-markdown-inline-editing {
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
    cursor: text;
    outline: 2px solid transparent;
    outline-offset: 3px;
}

.cscs-markdown-inline-editing:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
    outline: none;
}

.cscs-markdown-controls {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    margin: 0.35rem 0 0.6rem;
}

.cscs-markdown-controls button {
    background: #fff;
    border: 1px solid #b7c0c8;
    border-radius: 4px;
    color: #27313a;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 8px;
}

.cscs-markdown-controls button:hover {
    background: #f1f5f7;
    border-color: #7d8b96;
}

.cscs-markdown-controls button:disabled,
.cscs-markdown-controls button.is-disabled {
    background: #f6f8fa;
    border-color: #d5dce3;
    color: #8a96a3;
    cursor: not-allowed;
}

.cscs-markdown-preview {
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    margin: 8px 0;
    padding: 8px 12px;
}

.cscs-markdown-preview pre {
    overflow-x: auto;
    white-space: pre-wrap;
}

.cscs-student-copy .cscs-code-editor {
    max-height: 70vh;
    min-height: 0;
    resize: vertical;
}

.cscs-author-active .cscs-code-editor {
    max-height: 70vh;
    min-height: 0;
    resize: vertical;
}

button.sidebar-toggle.primary-toggle {
    pointer-events: auto !important;
    cursor: pointer !important;
}

@media (max-width: 768px) {
    button.sidebar-toggle.primary-toggle {
        pointer-events: auto !important;
        cursor: pointer !important;
        display: block !important;
        visibility: visible !important;
    }
}

@media (max-width: 480px) {
    button.sidebar-toggle.primary-toggle {
        pointer-events: auto !important;
        cursor: pointer !important;
        display: block !important;
        visibility: visible !important;
    }
}

.tag_hide-input .cell_output {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

/* Press links remain un-underlined; keyboard focus uses an outline. */
.bd-container a {
    text-decoration: none;
}

.bd-container a:hover,
.bd-container a:focus-visible {
    text-decoration: none;
}

/* Part titles are the overview links, retaining the sidebar heading's typography. */
nav.bd-links .caption-text a.part-overview-link {
    color: inherit;
    font: inherit;
    text-decoration: none;
}
nav.bd-links .caption-text a.part-overview-link:hover,
nav.bd-links .caption-text a.part-overview-link:focus-visible {
    text-decoration: none;
}

/* Short primary-navigation labels stay on one line at every nesting level. */
.bd-sidebar-primary nav.bd-links li > a.reference.internal {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    text-decoration: none;
}
.bd-sidebar-primary nav.bd-links li > a.reference.internal:hover,
.bd-sidebar-primary nav.bd-links li > a.reference.internal:focus-visible {
    text-decoration: none;
}
.bd-sidebar-primary nav.bd-links li > a.reference.internal:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

/* Apply the Press link rule to all link content, including theme-generated titles. */
.bd-container a,
.bd-container a:hover,
.bd-container a:focus-visible,
.bd-container a:hover *,
.bd-container a:focus-visible * {
    text-decoration: none !important;
}
.bd-container a:focus-visible {
    border-radius: 2px;
}
.bd-content a.reference:not(.image-reference):hover {
    background-color: color-mix(in srgb, var(--pst-color-link, #176de8) 12%, transparent);
}

/* Chapter landing pages: Chapter Flow links inside the {div} chapter-flow container (book-authoring skill). */
.chapter-flow a,
.chapter-flow a:hover,
.chapter-flow a:focus-visible {
    text-decoration: none;
}

/* Trace viewer (_static/trace_viewer.js): the stepper rendered under an output whose
   program printed @@trace lines. Theme colors come from the pydata variables, so the
   same rules serve light and dark; the accent is the book's inline-code color. */
.cscs-trace-host[hidden] {
    display: none !important;
}

.cscs-trace-host {
    margin: 6px 0 4px var(--cscs-code-inset, 1rem);
    max-width: calc(100% - var(--cscs-code-inset, 1rem));
}

.cscs-student-copy .cscs-trace-host,
div.cell_output .cscs-trace-host {
    margin-left: 0;
    max-width: 100%;
}

pre.cscs-trace-empty,
div.cell_output pre.cscs-trace-empty {
    display: none !important;
}

.cscs-trace {
    --cscs-trace-accent: var(--pst-color-inline-code, #912583);
    background: var(--pst-color-surface, #f3f4f5);
    border: 1px solid var(--pst-color-border, #e4e7eb);
    border-radius: 6px;
    box-sizing: border-box;
    color: var(--pst-color-text-base, #27313a);
    font-size: 0.85rem;
    padding: 10px 12px 12px;
}

.cscs-trace:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--cscs-trace-accent) 35%, transparent);
    outline: none;
}

.cscs-trace-header {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cscs-trace-title {
    font-weight: 600;
}

.cscs-trace-counter {
    color: var(--pst-color-text-muted, #666666);
    font-variant-numeric: tabular-nums;
}

.cscs-trace-array-wrapper {
    overflow-x: auto;
    padding: 2px 0 4px;
}

.cscs-trace-array {
    display: grid;
    gap: 3px 4px;
    grid-auto-flow: row dense;
    grid-auto-rows: min-content;
    grid-template-columns: repeat(var(--cscs-trace-columns, 1), minmax(2.6rem, max-content));
    width: max-content;
}

.cscs-trace-slot {
    align-items: center;
    background: var(--pst-color-on-background, #ffffff);
    border: 1.5px solid var(--pst-color-border, #c9ced3);
    border-radius: 4px;
    box-sizing: border-box;
    display: flex;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.95rem;
    grid-row: 1;
    justify-content: center;
    min-height: 2.4rem;
    padding: 4px 6px;
    transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.cscs-trace-slot.is-highlight {
    background: color-mix(in srgb, var(--cscs-trace-accent) 16%, var(--pst-color-on-background, #ffffff));
    border-color: var(--cscs-trace-accent);
    box-shadow: 0 0 0 1px var(--cscs-trace-accent);
    font-weight: 700;
}

.cscs-trace-slot.is-out {
    opacity: 0.35;
}

.cscs-trace-slot.is-end {
    background: transparent;
    border-style: dashed;
    color: var(--pst-color-text-muted, #666666);
    font-size: 0.75rem;
}

.cscs-trace-index {
    color: var(--pst-color-text-muted, #666666);
    font-family: var(--pst-font-family-monospace);
    font-size: 0.72rem;
    grid-row: 2;
    text-align: center;
}

.cscs-trace-mark {
    border-top: 2px solid var(--cscs-trace-accent);
    color: var(--cscs-trace-accent);
    font-size: 0.72rem;
    line-height: 1.2;
    padding-top: 2px;
    text-align: center;
    white-space: nowrap;
}

.cscs-trace-mark.is-span {
    border-top-color: var(--pst-color-success, #00843f);
    color: var(--pst-color-success, #00843f);
}

/* The theme's paragraph and definition-list margins are set with !important. */
.cscs-trace p.cscs-trace-message {
    margin: 8px 0 0 !important;
    min-height: 1.3em;
}

.cscs-trace dl.cscs-trace-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 4px 0 0 !important;
}

.cscs-trace-vars[hidden] {
    display: none !important;
}

.cscs-trace-var {
    display: flex;
    gap: 6px;
}

.cscs-trace-var dt {
    color: var(--pst-color-text-muted, #666666);
    float: none;
    font-weight: 400;
    margin: 0 !important;
    width: auto;
}

.cscs-trace-var dt::after {
    content: " =";
}

.cscs-trace-var dd {
    font-family: var(--pst-font-family-monospace);
    margin: 0 !important;
}

.cscs-trace-controls {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.cscs-trace-controls button {
    appearance: none;
    background: var(--pst-color-on-background, #ffffff);
    border: 1px solid var(--pst-color-border, #e4e7eb);
    border-radius: 4px;
    color: var(--pst-color-text-base, #27313a);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.2;
    padding: 4px 10px;
}

.cscs-trace-controls button:hover:not(:disabled) {
    border-color: var(--cscs-trace-accent);
    color: var(--cscs-trace-accent);
}

.cscs-trace-controls button:disabled {
    cursor: default;
    opacity: 0.45;
}

.cscs-trace-controls button:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--cscs-trace-accent) 35%, transparent);
    outline: none;
}

.cscs-trace-slider {
    accent-color: var(--cscs-trace-accent);
    flex: 1 1 auto;
    margin: 0;
    min-width: 6rem;
}

@media print {
    .cscs-trace-controls {
        display: none;
    }
}

/* Diagram toolkit (authoring/DIAGRAMS.md): center Graphviz output, and let
   figure videos fill the text width. */
div.graphviz { text-align: center; }
figure video.figure-video { width: 100%; height: auto; border-radius: 6px; cursor: pointer; }

/* Mermaid figures (authoring/DIAGRAMS.md): natural size, no code-block frame.
   sphinxcontrib-mermaid forces every diagram to height 500px and full width,
   which leaves empty space and scales the text away from its 13px size. */
pre.mermaid,
.mermaid-container > pre.mermaid {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
  text-align: center;
}
pre.mermaid > svg,
.mermaid-container > pre > svg {
  height: auto !important;
  width: auto !important;
  max-width: 100% !important;
}
