/* In-page TOC box - use ID for high specificity */
#contents a,
nav.contents a {
    color: #374151 !important;
    text-decoration: none !important;
}

/* H2, H3 section headings */
a.toc-backref {
    color: black !important;
    text-decoration: none !important;
}

.chapter-flow a,
.chapter-flow a:hover,
.chapter-flow a:focus {
    border-bottom: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.video-credit {
    background: var(--pst-color-surface, #f8fafc);
    border-left: 3px solid var(--pst-color-border, #d0d7de);
    color: var(--pst-color-text-muted, #5a6573);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
}

.video-credit p {
    margin: 0.2rem 0;
}

.video-credit strong {
    color: var(--pst-color-text-base, #1f2937);
    font-weight: 600;
}

.video-rights {
    font-size: 0.85rem;
}

button.thebelab-button.thebelab-run-button {
    padding-left: 0 !important;
}

div.thebelab-cell.thebelab-cell>div.thebelab-input {
    border-left: none !important;
    margin-left: 0 !important;
}

div.thebelab-cell.thebelab-cell>div.thebelab-output,
div.thebelab-cell>div.thebelab-output,
div.thebelab-output {
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

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

div.thebelab-cell.thebelab-cell>div.thebelab-input {
    padding: 0 !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
}

.thebelab-input {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.thebelab-input,
.thebelab-cell .thebelab-input,
.thebelab-cell.thebelab-cell .thebelab-input {
    margin: 0 !important;
}

.thebelab-cell .jp-OutputArea {
    margin-top: 6px !important;
    margin-left: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
}

.tag_thebe-interactive .thebelab-cell .jp-OutputArea {
    margin-top: 3px !important;
    padding-top: 3px !important;
}

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

div.output {
    margin: 0 !important;
}

.thebelab-button {
    margin: 0 !important;
}

body {
    font-size: 0.85rem;
    line-height: 1.28;
    counter-reset: exercise-counter;
}

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

h1 {
    font-size: 2.2em !important;
}

h2 {
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.5rem !important;
}

h3 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem !important;
}

h4 {
    margin-top: 0.75rem;
    font-size: 1.05rem !important;
}

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;
}

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

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

/* Empty quiz feedback placeholders should not add bottom space. */
.bd-article-container div[class$="-preview-feedback"]:empty {
    display: none !important;
    margin: 0 !important;
}

.bd-article-container [class$="-preview-question"] {
    padding-bottom: 0.45rem !important;
}

.bd-article-container [class$="-preview-question"] label:last-of-type {
    margin-bottom: 0 !important;
}

body.bd-exercise-card-page .bd-article-container div.cell:has(.tf-options),
body.bd-exercise-card-page .bd-article-container div.cell.bd-exercise-question-card,
body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card,
body.bd-assignment-card-page .bd-article-container div.cell.bd-assignment-question-card,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card,
.bd-article-container .assignment-question-card {
    border: 1px solid #d8dee4 !important;
    border-radius: 6px !important;
    padding: 1rem !important;
    margin: 1rem 0 !important;
    background: #fff !important;
}

body.bd-exercise-card-page .bd-article-container div.cell:has(.tf-options) label:last-of-type,
body.bd-exercise-card-page .bd-article-container div.cell.bd-exercise-question-card label:last-of-type,
body.bd-assignment-card-page .bd-article-container div.cell.bd-assignment-question-card label:last-of-type,
.bd-article-container .assignment-question-card label:last-of-type {
    margin-bottom: 0 !important;
}

.bd-article-container .tf-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin: 0.4rem 0 0.15rem;
}

.bd-article-container .tf-options label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font: inherit;
    font-weight: 400 !important;
    line-height: normal;
    margin-bottom: 0 !important;
}

.bd-article-container .tf-options input {
    margin: 0;
}

body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card > div.cell,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card > div.cell {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card .assignment-question-card,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card .assignment-question-card {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card .cell_input,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card .cell_input {
    margin: 0 !important;
}

body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card details,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card details {
    margin-top: 0.6rem !important;
}

body.bd-exercise-card-page .bd-article-container .bd-exercise-question-card > div.cell.tag_hide-input,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card > div.cell.tag_hide-input {
    border-top: 1px solid #eaeef2 !important;
    margin-top: 0.75rem !important;
    padding-top: 0.75rem !important;
}

body.bd-exercise-card-page .bd-article-container .exercise-question-title,
body.bd-assignment-card-page .bd-article-container .exercise-question-title {
    color: var(--pst-color-text-base) !important;
    font-size: inherit !important;
    font-weight: 700 !important;
}

body.bd-exercise-card-page .bd-article-container .exercise-count,
body.bd-assignment-card-page .bd-article-container .exercise-count {
    color: #771212 !important;
    font-size: inherit !important;
    font-weight: 400 !important;
}

body.bd-exercise-card-page .bd-article-container .exercise-label,
body.bd-assignment-card-page .bd-article-container .exercise-label {
    color: #771212 !important;
    font-size: inherit !important;
    line-height: 1.35 !important;
}

.bd-article-container [class$="-actions"] button:disabled:not(.secondary),
.bd-article-container [class$="-actions"].is-locked button:not(.secondary) {
    background: #8c959f !important;
    border-color: #8c959f !important;
    color: #fff !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: green left border, light background
   - 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 */
html[data-theme=light] 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;
}

/* Wrap terminal transcript blocks so long command/output lines fit the page. */
.highlight-bash pre,
.highlight-console pre,
.highlight-powershell pre,
.highlight-text pre {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

/* Green left border ONLY on input code blocks */
div.cell_input pre,
div.cell_input .highlight pre {
    border-left: 1px solid #1b5e20 !important;
    border-bottom-left-radius: 0 !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Output pre: no green border, slightly different bg to distinguish */
html[data-theme=light] 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;
}

/* 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;
}

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;
}

.tag_thebe-interactive .thebelab-cell.thebelab-cell,
.bd-exercise-question-card .thebelab-cell.thebelab-cell {
    padding: 0 8px 8px 8px !important;
    margin: 0 0 8px 0 !important;
    margin-left: 0 !important;
    transition: border-color 0.3s ease, box-shadow 0.3s !important;
    border: 1px solid #ddd !important;
    border-left: 1px solid #1b5e20 !important;
    border-radius: 6px !important;
    background-color: #f7f7f7 !important;
    font-size: 0.8rem !important;
}

.tag_thebe-interactive .thebelab-cell.thebelab-cell .thebelab-input,
.bd-exercise-question-card .thebelab-cell.thebelab-cell .thebelab-input {
    background-color: inherit !important;
    border: none !important;
    border-left: none !important;
    border-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    padding: 8px !important;
    display: block !important;
    overflow: visible !important;
}

.tag_thebe-interactive .thebelab-cell .jp-OutputArea pre,
.tag_thebe-interactive .thebelab-cell .thebelab-output pre,
.bd-exercise-question-card .thebelab-cell .jp-OutputArea pre,
.bd-exercise-question-card .thebelab-cell .thebelab-output pre {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Exercise interactive output should match exercise static style */
.tag_thebe-interactive .thebelab-cell .jp-OutputArea,
.tag_thebe-interactive .thebelab-cell .thebelab-output,
.bd-exercise-question-card .thebelab-cell .jp-OutputArea,
.bd-exercise-question-card .thebelab-cell .thebelab-output {
    border-left: none !important;
}

/* Final exercise interactive cell shape: green input edge + single divider + output */
.tag_thebe-interactive .thebelab-cell > .thebelab-input,
.bd-exercise-question-card .thebelab-cell > .thebelab-input {
    border-left: none !important;
}

.tag_thebe-interactive .thebelab-cell > .thebelab-output,
.bd-exercise-question-card .thebelab-cell > .thebelab-output {
    border-top: 1px solid #ededed !important;
}

.tag_thebe-interactive .thebelab-cell.thebelab-cell .highlight-python,
.bd-exercise-question-card .thebelab-cell.thebelab-cell .highlight-python {
    margin: 8px 0 !important;
    padding: 8px !important;
    border: none !important;
    background: transparent !important;
}

.tag_thebe-interactive .thebelab-cell .thebelab-input>*,
.bd-exercise-question-card .thebelab-cell .thebelab-input>* {
    margin: 0 !important;
}

.tag_thebe-interactive .thebelab-cell .thebelab-input pre,
.bd-exercise-question-card .thebelab-cell .thebelab-input pre {
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    color: inherit !important;
}

body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card > div.cell.tag_thebe-interactive .cell_input pre,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card > div.cell.tag_thebe-interactive .cell_input .highlight,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card > div.cell.tag_thebe-interactive .cell_input .highlight pre,
body.bd-assignment-card-page .bd-article-container .bd-assignment-question-card .thebelab-cell .thebelab-input pre {
    font-size: inherit !important;
    line-height: 1.45 !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
}

.tag_thebe-interactive .thebelab-cell:hover,
.bd-exercise-question-card .thebelab-cell:hover {
    border: 1px solid #790303;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thebelab-button {
    font-size: 0.8rem;
    padding: 4px;
    background-color: #f7f7f7 !important;
    color: #999 !important;
    transition: all 0.2s ease;
    display: inline-block;
    margin-top: 0px !important;
}

.thebelab-button:hover {
    color: #333 !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.thebelab-buttons {
    text-align: left !important;
    margin-top: 0px !important;
    border: none !important;
}

.cell_output,
.thebelab-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,
.tag_thebe-interactive .admonition,
.tag_thebe-interactive 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;
}

.thebe-launch-button::after {
    content: "...";
    font-size: 0.85em;
    color: #c3c2c2;
    font-style: italic;
}

.thebe-launch-button.thebelab-active::after {
    content: "";
}

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: 0.5rem !important;
}

div.cell.tag_thebe-interactive {
    /* counter-increment: exercise-counter; */
    margin-bottom: 0.75rem !important;
    /* padding: 8px !important; */
    /* border-left: 1px solid #AD2327; */
    /* counter-increment */
    padding: 0 !important;
}

/* Tighter spacing for exercise cells */
.tag_thebe-interactive .cell_input,
.tag_thebe-interactive div.cell_input {
    margin-bottom: 0.25rem !important;
}

.tag_thebe-interactive .cell_output,
.tag_thebe-interactive div.cell_output {
    margin-top: 3px !important;
    padding-top: 3px !important;
}

/* div.cell.tag_thebe-interactive::before {
    content: "✏️ Interactive Exercise " counter(exercise-counter);
    display: block;
    font-size: 0.85em;
    color: #66010b;
    font-weight: bold;
    margin-bottom: 8px;
} */

div.cell.tag_thebe-interactive {
    padding: 8px;
}

.tag_thebe-interactive .thebelab-cell>.thebelab-input,
.bd-exercise-question-card .thebelab-cell>.thebelab-input {
    padding: 0 !important;
}

/* NOTE: do NOT put border:none here — it overrides the green border-left
   set in .thebelab-cell.thebelab-cell .thebelab-input above */

/* Ensure exercise cell output (moved outside <details> by JS) is always visible */
div.thebelab-output,
.thebelab-cell .thebelab-output {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
}

/* Style the jp-OutputArea wrapper that JS moved outside <details> for exercise cells */
.tag_hide-input>div[data-moved-out="1"] {
    border-top: 1px solid #e8e8e8 !important;
    margin-top: 4px !important;
    padding-top: 4px !important;
    padding-bottom: 2px !important;
    padding-left: 12px !important;
    background-color: #fafafa !important;
    border-radius: 0 0 6px 6px !important;
}

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

.tag_hide-input.lab-answer-locked {
    display: block !important;
    opacity: 1 !important;
}

.tag_hide-input.lab-answer-locked .cell_input {
    display: none !important;
}

.tag_hide-input.lab-answer-locked details {
    pointer-events: none !important;
    user-select: none !important;
}

/* Hide the answer but keep the summary row visible (greyed out below), so
   students can see an answer exists. The details element also has the
   admonition class, so the summary must be excluded explicitly. */
.tag_hide-input.lab-answer-locked details > :not(summary),
.tag_hide-input.lab-answer-locked .admonition > :not(.admonition-title):not(summary) {
    display: none !important;
}

.tag_hide-input.lab-answer-locked summary,
.tag_hide-input.lab-answer-locked .admonition-title {
    background: #f6f8fa !important;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    color: #8c959f !important;
    cursor: not-allowed !important;
    padding: 0.5rem 0.75rem !important;
}

.lab-answer-lock-notice {
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    color: #57606a;
    font-weight: 600;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
}

/* =============================================================
   DEMO CELL OUTPUT VISIBILITY
   'thebe-is-active' is added to body by our own JS (custom.js)
   when Thebe activates (Thebe 0.8.2 never sets thebelab-active).

   _config.yml predefinedOutput: true (default) (made false 02-21-2026), so static outputs
   are visible. When Thebe activates, demo cell outputs are hidden
   until student clicks run. Exercise cells (tag_hide-input) are
   exempt — their static output stays visible always.
   ============================================================= */

/* Hide demo cell output when Thebe is active */
body.thebe-is-active .cell:not(.tag_hide-input):not(.cell-has-run) .jp-OutputArea {
    display: none !important;
}

/* Show output after student clicks run */
body.thebe-is-active .cell.cell-has-run .jp-OutputArea {
    display: block !important;
    visibility: visible !important;
}

/* Exercise cells: jp-OutputArea always visible */
body.thebe-is-active .tag_hide-input .jp-OutputArea {
    display: block !important;
    visibility: visible !important;
}

/* Bibliography and Index aftermatter links (injected by custom.js) */
nav.bd-links a.bd-aftermatter-link {
    display: block;
    font-size: var(--pst-sidebar-font-size, 0.85rem);
    font-weight: 400;
    color: var(--pst-color-text-muted) !important;
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding: 0.075rem 0;
    text-decoration: none;
    box-shadow: none !important;
}

nav.bd-links a.bd-aftermatter-link + a.bd-aftermatter-link {
    margin-top: 0.1rem !important;
}

nav.bd-links a.bd-aftermatter-link:hover {
    color: var(--pst-color-link-hover) !important;
    text-decoration: underline;
    text-decoration-skip-ink: none;
}

/* Student account panel injected at the bottom of the left sidebar */
nav.bd-links .bd-student-links {
    border-top: 1px solid var(--pst-color-border);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    background: var(--pst-color-background);
    z-index: 2;
}

nav.bd-links .bd-student-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.1rem;
    width: auto;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

nav.bd-links .bd-student-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--pst-color-primary);
    color: white;
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    position: relative;
}

nav.bd-links .bd-student-avatar::before {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 999px;
    background: white;
    position: absolute;
    top: 0.42rem;
}

nav.bd-links .bd-student-avatar::after {
    content: "";
    width: 0.92rem;
    height: 0.46rem;
    border-radius: 999px 999px 0.45rem 0.45rem;
    background: white;
    position: absolute;
    bottom: 0.36rem;
}

nav.bd-links .bd-student-avatar.has-initials::before,
nav.bd-links .bd-student-avatar.has-initials::after {
    display: none;
}

nav.bd-links .bd-student-actions {
    display: none;
    border: 0.5px solid var(--pst-color-primary);
    border-radius: 6px;
    overflow: hidden;
}

nav.bd-links .bd-student-links.is-open .bd-student-actions {
    display: grid;
    align-items: start;
}

nav.bd-links .bd-student-button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 1.8rem;
    border: 0;
    border-radius: 0;
    color: var(--pst-color-primary) !important;
    font-size: var(--pst-sidebar-font-size, 0.85rem);
    font-weight: 400;
    line-height: 1.25;
    padding: 0.25rem 0.45rem;
    text-align: left;
    text-decoration: none;
    box-shadow: none !important;
    white-space: nowrap;
}

nav.bd-links .bd-student-button + .bd-student-button {
    border-top: 0.5px solid var(--pst-color-primary);
}

nav.bd-links .bd-student-button:hover {
    background: var(--pst-color-primary);
    color: white !important;
    text-decoration: none;
}

.bd-auth-modal[hidden] {
    display: none !important;
}

.bd-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: block;
    --bd-auth-left: 5rem;
    --bd-auth-bottom: 5.25rem;
}

.bd-auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
}

.bd-auth-modal-dialog {
    position: absolute;
    left: min(var(--bd-auth-left), calc(100vw - min(82vw, 18rem) - 0.75rem));
    bottom: min(var(--bd-auth-bottom), calc(100vh - min(72vh, 20rem) - 0.75rem));
    width: min(82vw, 18rem);
    max-height: min(72vh, 20rem);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--pst-color-border);
    border-radius: 8px;
    background: var(--pst-color-background);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
}

.bd-auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--pst-color-border);
}

.bd-auth-modal-header h2 {
    margin: 0;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.2;
}

.bd-auth-modal-close {
    width: 1.45rem;
    height: 1.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pst-color-border);
    border-radius: 6px;
    background: var(--pst-color-surface);
    color: var(--pst-color-text-base);
    font-size: 13px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.bd-auth-modal-frame {
    width: 100%;
    height: min(62vh, 16.75rem);
    border: 0;
    background: #f6f8fa;
}

body.bd-auth-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .bd-auth-modal-dialog {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 4.5rem;
        width: auto;
    }
}

/* BEGIN shared reading continuity css */
/* Jupyter Book reading continuity button. */
.book-continue-reading {
  border: 1px solid var(--pst-color-border, #d0d7de);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(25, 42, 70, 0.16);
  max-width: min(260px, calc(100vw - 32px));
  padding: 0.75rem 2rem 0.75rem 0.85rem;
  position: fixed;
  right: 1.15rem;
  top: 25vh;
  transition: opacity 180ms ease, transform 180ms ease;
  width: 240px;
  z-index: 1030;
}

.book-continue-reading-hiding {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.35rem);
}

.book-continue-reading-link {
  color: var(--pst-color-link, #176de8);
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  text-decoration: none;
}

.book-continue-reading p {
  color: #5a6573;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin: 0;
  text-transform: uppercase;
}

.book-continue-reading-link span {
  font-size: var(--pst-font-size-base, 1rem);
  font-weight: 400;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-continue-reading-link svg {
  color: #5f4de0;
  fill: currentColor;
  height: 0.92rem;
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-10%);
  width: 0.92rem;
}

.book-continue-reading-link:hover,
.book-continue-reading-link:focus {
  color: var(--pst-color-link-hover, #0b5ed7);
  text-decoration: none;
}

.book-continue-reading-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #5a6573;
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  height: 1.35rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 0.4rem;
  top: 0.4rem;
  width: 1.35rem;
}

.book-continue-reading-close:hover,
.book-continue-reading-close:focus {
  background: var(--pst-color-on-background, #f6f8fa);
  color: var(--pst-color-text-base, #1f2937);
  outline: 2px solid rgba(47, 111, 222, 0.18);
  outline-offset: 1px;
}

.book-continue-reading:hover,
.book-continue-reading:focus-within {
  background: var(--pst-color-on-background, #f6f8fa);
  outline: 2px solid rgba(47, 111, 222, 0.18);
  outline-offset: 3px;
}

@media (max-width: 960px) {
  .book-continue-reading {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    top: auto;
    width: auto;
  }
}
/* END shared reading continuity css */

/* Title page catalog card (Press docs/UI.md, Title Page Catalog Card). The card is
   its own object on the page, so it keeps its cream stock and dark ink in dark mode;
   only the punched hole follows the page background. */
.tp-catalog-card {
    --card-line: 1.75rem;
    background-color: #fbf6e6;
    background-image:
        linear-gradient(to bottom, transparent calc(2.6rem - 1px), #d9534f calc(2.6rem - 1px), #d9534f 2.6rem, transparent 2.6rem),
        repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--card-line) - 1px), #c9d8ea calc(var(--card-line) - 1px), #c9d8ea var(--card-line));
    background-position: 0 0, 0 2.6rem;
    border: 1px solid #e4dcc2;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(40, 32, 12, 0.14), 0 1px 2px rgba(40, 32, 12, 0.12);
    color: #2b2a26;
    display: grid;
    font-family: "Courier New", Courier, "Liberation Mono", monospace;
    font-size: 0.85rem; /* body text size (Press docs/UI.md) */
    gap: 0 1.25rem;
    grid-template-columns: 5.5rem 1fr;
    line-height: var(--card-line);
    margin: 2rem auto 2.5rem;
    max-width: 38rem;
    padding: 2.65rem 1.5rem 3rem 1.25rem;
    position: relative;
}

.tp-catalog-card p {
    margin: 0;
    font-size: inherit !important;
    line-height: var(--card-line);
}

.tp-catalog-card a {
    color: #1d4f9a;
}

.tp-catalog-card__call {
    line-height: var(--card-line);
    white-space: nowrap;
}

.tp-catalog-card__author {
    font-weight: 700;
}

.tp-catalog-card__line {
    text-indent: 0;
}

.tp-catalog-card__tracings {
    margin-top: var(--card-line) !important;
}

.tp-catalog-card__hole {
    background: var(--pst-color-background, #ffffff);
    border: 1px solid #d8cfb3;
    border-radius: 50%;
    bottom: 0.9rem;
    box-shadow: inset 0 1px 2px rgba(40, 32, 12, 0.25);
    height: 1.1rem;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    width: 1.1rem;
}

@media (max-width: 560px) {
    .tp-catalog-card {
        grid-template-columns: 1fr;
        padding: 2.65rem 1rem 3rem;
    }

    .tp-catalog-card__call br {
        display: none;
    }

    .tp-catalog-card__call {
        white-space: normal;
        word-spacing: 0.4rem;
    }
}
