/* Base styles and content styles */

:root {
    color-scheme: var(--color-scheme);
}

html {
    /* Base font size: 1rem = 10px for easier calculations */
    font-size: 10px !important;
    font-family: "Noto Sans", sans-serif;
    color: var(--fg);
    background-color: var(--bg);
    text-size-adjust: none;
    -webkit-text-size-adjust: none;
}

body {
    margin: 0;
    font-size: 1.6rem; /* 16px on mobile - minimum for readability */
    overflow-x: hidden;
}

code {
    font-family: var(--mono-font) !important;
    font-size: var(--code-font-size);
    direction: ltr !important;
    /* calt is on by default per the CSS Fonts spec, so JetBrains Mono's
       programming ligatures (->, !=, <=...) would otherwise render as
       glyphs the reader can't type. */
    font-feature-settings: "calt" 0, "liga" 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--mono-font);
    letter-spacing: -0.02em;
}

/* make long words/inline code not x overflow */
main {
    overflow-wrap: break-word;
}

/* make wide tables scroll if they overflow */
.table-wrapper {
    overflow-x: auto;
}

/* Don't change font size in headers. */
h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
    font-size: unset;
}

.left {
    float: left;
}

.right {
    float: right;
}

.boring {
    opacity: 0.6;
}

.hide-boring .boring {
    display: none;
}

.hidden {
    display: none !important;
}

h2,
h3 {
    margin-block-start: 2.5em;
}

h4,
h5 {
    margin-block-start: 2em;
}

.header+.header h3,
.header+.header h4,
.header+.header h5 {
    margin-block-start: 1em;
}

h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before {
    display: inline-block;
    content: "»";
    margin-inline-start: -30px;
    width: 30px;
}

/* This is broken on Safari as of version 14, but is fixed
   in Safari Technology Preview 117 which I think will be Safari 14.2.
   https://bugs.webkit.org/show_bug.cgi?id=218076
*/
:target {
    /* Safari does not support logical properties */
    scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}

.page {
    outline: 0;
    padding: 0 var(--page-padding);
    margin-block-start: calc(0px - var(--menu-bar-height));
    /* Compensate for the #mdbook-menu-bar-hover-placeholder */
}

.page-wrapper {
    box-sizing: border-box;
    background-color: var(--bg);
}

.no-js .page-wrapper,
.js:not(.sidebar-resizing) .page-wrapper {
    transition: margin-left 0.3s ease, transform 0.3s ease;
    /* Animation: slide away */
}

[dir=rtl] .js:not(.sidebar-resizing) .page-wrapper {
    transition: margin-right 0.3s ease, transform 0.3s ease;
    /* Animation: slide away */
}

.content {
    overflow-y: auto;
    padding: 0 5px 50px 5px;
}

.content main {
    margin-inline-start: auto;
    margin-inline-end: auto;
    max-width: var(--content-max-width);
}

.content p {
    line-height: 1.45em;
}

.content ol {
    line-height: 1.45em;
}

.content ul {
    line-height: 1.45em;
}

.content a {
    text-decoration: none;
}

.content a:hover {
    text-decoration: underline;
}

.content img,
.content video {
    max-width: 100%;
}

/* Center standalone content images/diagrams (matches EPUB and PDF output) */
.content img {
    display: block;
    margin-inline: auto;
}

/* Figure captions: the emphasized "Fig. N.M: ..." line right after an image */
.content p:has(> img) + p:has(> em:only-child) {
    text-align: center;
    font-size: 0.85em;
    opacity: 0.75;
    margin-top: -0.5em;
}

.content .header:link,
.content .header:visited {
    color: var(--fg);
}

.content .header:link,
.content .header:visited:hover {
    text-decoration: none;
}

.sidebar-header {
    flex-shrink: 0;
    padding: 10px;
    border-bottom: 1px solid var(--sidebar-spacer);
    background-color: var(--sidebar-bg);
}

.cover {
    height: auto;
    max-height: 90%;
    width: 85%;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

/* Collapsible Sidebar Styles */
.chapter-toggle {
    background: none;
    border: none;
    color: var(--sidebar-fg);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
}

.chapter-toggle:hover {
    background-color: var(--theme-hover);
    transform: scale(1.1);
}

.chapter-toggle:focus {
    outline: 2px solid var(--links);
    outline-offset: 2px;
}

.chapter-toggle i {
    font-size: 5px;
    transition: transform 0.2s ease;
}

.chapter-toggle:hover i {
    transform: scale(1.2);
}

/* Smooth animations for collapsing sections */
.sidebar .section {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Active chapter styling */
.chapter-item.expanded>a {
    font-weight: 600;
}

/* Improved spacing for subsections */
.sidebar .section .chapter-item {
    margin-left: 8px;
}


/* CSS Callout System for Tips, Warnings, and Notes */
.callout {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid;
    border-radius: 0 var(--radius) var(--radius) 0;
    position: relative;
    background-color: var(--quote-bg);
}

.callout::before {
    content: '';
    font-family: 'FontAwesome';
    font-size: 7px;
    position: absolute;
    left: 8px;
    top: 12px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.callout-content {
    margin-left: 32px;
}

.callout-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}

/* Tip Callout */
.callout.tip {
    border-left-color: var(--blockquote-tip-color);
    background-color: color-mix(in srgb, var(--blockquote-tip-color) 10%, transparent);
}

.callout.tip::before {
    content: '\f0eb';
    /* lightbulb icon */
    color: var(--blockquote-tip-color);
}

.callout.tip .callout-title {
    color: var(--blockquote-tip-color);
}

/* Warning Callout */
.callout.warning {
    border-left-color: var(--blockquote-warning-color);
    background-color: color-mix(in srgb, var(--blockquote-warning-color) 10%, transparent);
}

.callout.warning::before {
    content: '\f071';
    /* warning triangle icon */
    color: var(--blockquote-warning-color);
}

.callout.warning .callout-title {
    color: var(--blockquote-warning-color);
}

/* Error/Danger Callout */
.callout.error {
    border-left-color: var(--blockquote-caution-color);
    background-color: color-mix(in srgb, var(--blockquote-caution-color) 10%, transparent);
}

.callout.error::before {
    content: '\f06a';
    /* exclamation circle icon */
    color: var(--blockquote-caution-color);
}

.callout.error .callout-title {
    color: var(--blockquote-caution-color);
}

/* Info/Note Callout */
.callout.info {
    border-left-color: var(--blockquote-note-color);
    background-color: color-mix(in srgb, var(--blockquote-note-color) 10%, transparent);
}

.callout.info::before {
    content: '\f05a';
    /* info circle icon */
    color: var(--blockquote-note-color);
}

.callout.info .callout-title {
    color: var(--blockquote-note-color);
}

/* Success Callout */
.callout.success {
    border-left-color: var(--blockquote-tip-color);
    background-color: color-mix(in srgb, var(--blockquote-tip-color) 10%, transparent);
}

.callout.success::before {
    content: '\f00c';
    /* check icon */
    color: var(--blockquote-tip-color);
}

.callout.success .callout-title {
    color: var(--blockquote-tip-color);
}

/* Code Block Callout */
.callout.code {
    border-left-color: var(--inline-code-color);
    background-color: color-mix(in srgb, var(--inline-code-color) 10%, transparent);
}

.callout.code::before {
    content: '\f121';
    /* code icon */
    color: var(--inline-code-color);
}

.callout.code .callout-title {
    color: var(--inline-code-color);
}

/* Mobile responsive callouts */
@media (max-width: 768px) {
    .callout {
        margin: 12px 0;
        padding: 10px 12px;
    }

    .callout-content {
        margin-left: 28px;
    }

    .callout::before {
        font-size: 10px;
        left: 6px;
        top: 10px;
    }
}

/* Enhanced Mobile Drawer Navigation */
@media (max-width: 1080px) {

    /* Mobile overlay backdrop */
    .mobile-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(2px);
    }

    /* Show overlay when sidebar is open */
    #mdbook-sidebar-toggle-anchor:checked~.mobile-drawer-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* Enhanced sidebar for mobile */
    .sidebar {
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        z-index: 101;
        border-right: 1px solid var(--sidebar-resize-indicator-color);
    }

    /* Improve sidebar scrolling on mobile */
    .sidebar .sidebar-scrollbox {
        padding: 12px 8px;
        overscroll-behavior: contain;
    }

    /* Better mobile menu bar */
    #mdbook-menu-bar {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(8px);
        background-color: var(--bg);
    }

    /* Enhanced sidebar toggle button for mobile */
    #mdbook-sidebar-toggle {
        position: relative;
        transition: transform 0.2s ease, background-color 0.2s ease;
        border-radius: var(--radius);
        margin: 4px;
        padding: 8px;
    }

    #mdbook-sidebar-toggle:hover,
    #mdbook-sidebar-toggle:focus {
        background-color: var(--theme-hover);
        transform: scale(1.05);
    }

    #mdbook-sidebar-toggle:active {
        transform: scale(0.95);
    }

    /* Animated hamburger icon */
    #mdbook-sidebar-toggle i {
        transition: transform 0.3s ease;
    }

    #mdbook-sidebar-toggle-anchor:checked~* #mdbook-sidebar-toggle i {
        transform: rotate(90deg);
    }

    /* Better spacing for mobile chapter items */
    .sidebar .chapter-item {
        margin: 2px 0;
    }

    .sidebar .chapter-item>a {
        padding: 12px 8px;
        border-radius: var(--radius);
        transition: background-color 0.2s ease, transform 0.1s ease;
        display: block;
        min-height: 44px;
        /* Better touch target */
        display: flex;
        align-items: center;
    }

    .sidebar .chapter-item>a:hover {
        background-color: var(--theme-hover);
        transform: translateX(4px);
    }

    .sidebar .chapter-item>a:active {
        transform: translateX(4px) scale(0.98);
    }

    /* Enhanced cover image for mobile */
    .cover {
        width: 70%;
        margin: 8px auto 16px auto;
        border-radius: var(--radius);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Improved chapter toggle buttons for mobile */
    .chapter-toggle {
        min-width: 32px;
        height: 32px;
        margin-left: 8px;
        border-radius: var(--radius);
        background-color: var(--theme-popup-bg);
        border: 1px solid var(--theme-popup-border);
    }

    .chapter-toggle:hover {
        background-color: var(--theme-hover);
        border-color: var(--links);
    }

    .chapter-toggle:active {
        transform: scale(0.9);
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {

    /* Adjust sidebar width for very small screens */
    :root {
        --sidebar-width: 280px;
    }

    .sidebar .sidebar-scrollbox {
        padding: 8px 6px;
    }

    .sidebar .chapter-item>a {
        padding: 10px 6px;
        font-size: 0.9em;
    }

    .cover {
        width: 60%;
        margin: 6px auto 12px auto;
    }

    /* Smaller menu bar for tiny screens */
    #mdbook-menu-bar {
        padding: 0 8px;
    }

    .menu-title {
        font-size: 0.9em;
        line-height: 1.2;
    }

}

/* Diagram Zoom Modal System (HTML-only) */
.diagram-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.diagram-zoom-modal.active {
    opacity: 1;
    visibility: visible;
}

.diagram-zoom-container {
    position: relative;
    width: fit-content;
    height: fit-content;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    cursor: grab;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.diagram-zoom-container:active {
    cursor: grabbing;
}

.diagram-zoom-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 95vh;
    transition: transform 0.2s ease;
    transform-origin: center center;
    display: block;
}

.diagram-zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 1001;
}

.diagram-zoom-button {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: var(--radius);
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg);
    font-size: 9px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.diagram-zoom-button:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.diagram-zoom-button:active {
    transform: scale(0.95);
}

.diagram-zoom-close {
    background-color: rgba(255, 0, 0, 0.9);
    color: white;
}

.diagram-zoom-close:hover {
    background-color: rgba(255, 0, 0, 1);
}

.diagram-zoom-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9em;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.diagram-zoom-info.hidden {
    opacity: 0;
}

/* Diagram hover effects for clickable diagrams */
.content img[src*="diagrams/"] {
    cursor: zoom-in;
    transition: all 0.2s ease;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.content img[src*="diagrams/"]:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ============================================
 * Python Code Enhancement Styles
 * ============================================ */

.python-code-container {
    margin: 1em 0;
    border: 1px solid var(--table-border-color);
    border-radius: var(--radius);
    background-color: var(--bg);
    overflow: hidden;
}

.run-python-btn {
    background: var(--code-block-bg);
    color: var(--inline-code-color);
    border: 1px solid var(--table-border-color);
    padding: 8px 16px;
    font-family: var(--mono-font);
    font-size: 0.9em;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    margin: 8px;
    transition: border-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.run-python-btn:hover {
    border-color: var(--links);
    color: var(--links);
}

.run-python-btn:active {
    border-color: var(--sidebar-active);
}

.run-python-btn:before {
    content: "▶";
    font-size: 0.8em;
}

.python-output {
    background-color: var(--code-block-bg);
    border-top: 1px solid var(--table-border-color);
    padding: 12px;
    font-family: var(--mono-font);
    font-size: 0.85em;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 40px;
    max-height: 300px;
    overflow-y: auto;
}

.python-output.loading {
    background-color: color-mix(in srgb, var(--blockquote-warning-color) 12%, var(--bg));
    color: var(--blockquote-warning-color);
}

.python-output.success {
    background-color: color-mix(in srgb, var(--blockquote-tip-color) 12%, var(--bg));
    color: var(--blockquote-tip-color);
}

.python-output.error {
    background-color: color-mix(in srgb, var(--blockquote-caution-color) 12%, var(--bg));
    color: var(--blockquote-caution-color);
}

.python-translate {
    border-top: 1px dashed var(--table-border-color);
}

.translate-toggle-btn:before {
    content: "🌐";
}

.python-output.translate-explanation {
    border-top: none;
}

/* ============================================
 * Accessibility Enhancement Styles
 * ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius);
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode */
.high-contrast {
    filter: contrast(150%) brightness(110%);
}

.high-contrast * {
    text-shadow: none !important;
    box-shadow: 0 0 0 1px currentColor !important;
}

/* ARIA live region */
#aria-live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Dark theme adjustments */
.navy .diagram-zoom-button {
    background-color: rgba(42, 45, 54, 0.9);
    color: var(--fg);
}

.navy .diagram-zoom-button:hover {
    background-color: rgba(42, 45, 54, 1);
}

/* Mobile adjustments for diagram zoom */
@media (max-width: 768px) {
    .diagram-zoom-controls {
        top: 15px;
        right: 15px;
        gap: 8px;
    }

    .diagram-zoom-button {
        width: 44px;
        height: 44px;
        font-size: 7px;
    }

    .diagram-zoom-info {
        bottom: 15px;
        font-size: 0.8em;
        padding: 6px 12px;
    }

    .diagram-zoom-container {
        max-width: 98vw;
        max-height: 98vh;
    }
}

table {
    margin: 0 auto;
    border-collapse: collapse;
}

table td {
    padding: 3px 20px;
    border: 1px var(--table-border-color) solid;
}

table thead {
    background: var(--table-header-bg);
}

table thead td {
    font-weight: 700;
    border: none;
}

table thead th {
    padding: 3px 20px;
}

table thead tr {
    border: 1px var(--table-header-bg) solid;
}

/* Alternate background colors for rows */
table tbody tr:nth-child(2n) {
    background: var(--table-alternate-bg);
}


blockquote {
    margin: 20px 0;
    padding: 0 20px;
    color: var(--fg);
    background-color: var(--quote-bg);
    border-block-start: .1em solid var(--quote-border);
    border-block-end: .1em solid var(--quote-border);
}

.warning {
    margin: 20px;
    padding: 0 20px;
    border-inline-start: 2px solid var(--warning-border);
}

.warning:before {
    position: absolute;
    width: 3rem;
    height: 3rem;
    margin-inline-start: calc(-1.5rem - 21px);
    content: "ⓘ";
    text-align: center;
    background-color: var(--bg);
    color: var(--warning-border);
    font-weight: bold;
    font-size: 1.4rem;
}

blockquote .warning:before {
    background-color: var(--quote-bg);
}

kbd {
    background-color: var(--table-border-color);
    border-radius: var(--radius);
    border: solid 1px var(--theme-popup-border);
    box-shadow: inset 0 -1px 0 var(--theme-hover);
    display: inline-block;
    font-size: var(--code-font-size);
    font-family: var(--mono-font);
    line-height: 10px;
    padding: 4px 5px;
    vertical-align: middle;
}

sup {
    /* Set the line-height for superscript and footnote references so that there
       isn't an awkward space appearing above lines that contain the footnote.

       See https://github.com/rust-lang/mdBook/pull/2443#discussion_r1813773583
       for an explanation.
    */
    line-height: 0;
}

.footnote-definition {
    font-size: 0.9em;
}

/* The default spacing for a list is a little too large. */
.footnote-definition ul,
.footnote-definition ol {
    padding-left: 20px;
}

.footnote-definition>li {
    /* Required to position the ::before target */
    position: relative;
}

.footnote-definition>li:target {
    scroll-margin-top: 50vh;
}

.footnote-reference:target {
    scroll-margin-top: 50vh;
}

/* Draws a border around the footnote (including the marker) when it is selected.
   TODO: If there are multiple linkbacks, highlight which one you just came
   from so you know which one to click.
*/
.footnote-definition>li:target::before {
    border: 2px solid var(--footnote-highlight);
    border-radius: var(--radius);
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -32px;
    pointer-events: none;
    content: "";
}

/* Pulses the footnote reference so you can quickly see where you left off reading.
   This could use some improvement.
*/
@media not (prefers-reduced-motion) {
    .footnote-reference:target {
        animation: fn-highlight 0.8s;
        border-radius: var(--radius);
    }

    @keyframes fn-highlight {
        from {
            background-color: var(--footnote-highlight);
        }
    }
}

.tooltiptext {
    position: absolute;
    visibility: hidden;
    color: #fff;
    background-color: #333;
    transform: translateX(-50%);
    /* Center by moving tooltip 50% of its width left */
    left: -8px;
    /* Half of the width of the icon */
    top: -35px;
    font-size: 0.8em;
    text-align: center;
    border-radius: var(--radius);
    padding: 5px 8px;
    margin: 5px;
    z-index: 1000;
}

.tooltipped .tooltiptext {
    visibility: visible;
}

.chapter li.part-title {
    color: var(--sidebar-fg);
    margin: 5px 0px;
    font-weight: bold;
}

.result-no-output {
    font-style: italic;
}

/* Responsive Typography - Mobile First Approach */

/* Tablet and small desktop (768px+) */
@media (min-width: 768px) {
    body {
        font-size: 1.7rem; /* 17px */
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    body {
        font-size: 1.8rem; /* 18px for better readability */
    }
}

/* Large desktop (1440px+) */
@media (min-width: 1440px) {
    body {
        font-size: 1.9rem; /* 19px for large screens */
    }
}

/* Responsive Heading Sizes */
h1 { font-size: 3.2rem; }  /* 32px */
h2 { font-size: 2.4rem; }  /* 24px */
h3 { font-size: 1.9rem; }  /* 19px */
h4 { font-size: 1.6rem; }  /* 16px */
h5 { font-size: 1.4rem; }  /* 14px */
h6 { font-size: 1.2rem; }  /* 12px */

/* Mobile heading adjustments */
@media (max-width: 768px) {
    h1 { font-size: 2.8rem; }  /* 28px */
    h2 { font-size: 2.2rem; }  /* 22px */
    h3 { font-size: 1.8rem; }  /* 18px */
}

/* Enhanced Mobile Optimizations */
@media (max-width: 768px) {
    /* Larger tap targets for links */
    .content a {
        padding: 2px 4px;
        margin: -2px -4px;
        border-radius: var(--radius);
    }
    
    /* Better spacing for mobile reading */
    .content p,
    .content li {
        line-height: 1.6em; /* Slightly more line height on mobile */
    }
    
    /* Ensure code blocks are readable */
    code {
        font-size: 0.9em; /* Slightly larger code on mobile */
    }
    
    /* Improve button touch targets */
    button,
    .btn {
        min-height: 44px; /* Apple's recommended minimum touch target */
        padding: 8px 12px;
    }
}

/* === Appended from stock mdBook 0.5.3 general.css (new in 0.5) === */

.fa-svg svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    margin-bottom: -0.1em;
}

dt {
    font-weight: bold;
    margin-top: 0.5em;
    margin-bottom: 0.1em;
}

/* This uses a CSS counter to add numbers to definitions, but only if there is
 more than one definition. */
dl, dt {
    counter-reset: dd-counter;
}

/* When there is more than one definition, increment the counter. The first
selector selects the first definition, and the second one selects definitions
2 and beyond.*/
dd:has(+ dd), dd + dd {
    counter-increment: dd-counter;
    /* Use flex display to help with positioning the numbers when there is a p
    tag inside the definition. */
    display: flex;
    align-items: flex-start;
}

/* Shows the counter for definitions. The first selector selects the first
definition, and the second one selections definitions 2 and beyond.*/
dd:has(+ dd)::before, dd + dd::before  {
    content: counter(dd-counter) ". ";
    font-weight: 600;
    display: inline-block;
    margin-right: 0.5em;
}

dd > p {
    /* For loose definitions that have a p tag inside, don't add a bunch of
    space before the definition. */
    margin-top: 0;
}

.blockquote-tag p:last-child {
    margin-bottom: 2px;
}

.blockquote-tag {
    /* Add some padding to make the vertical bar a little taller than the text.*/
    padding: 2px 0px 2px 20px;
    /* Add a solid color bar on the left side. */
    border-inline-start-style: solid;
    border-inline-start-width: 4px;
    /* Disable the background color from normal blockquotes . */
    background-color: inherit;
    /* Disable border blocks from blockquotes. */
    border-block-start: none;
    border-block-end: none;
}

.blockquote-tag-title svg {
    fill: currentColor;
    /* Add space between the icon and the title. */
    margin-right: 8px;
}

.blockquote-tag-note {
    border-inline-start-color: var(--blockquote-note-color);
}

.blockquote-tag-tip {
    border-inline-start-color: var(--blockquote-tip-color);
}

.blockquote-tag-important {
    border-inline-start-color: var(--blockquote-important-color);
}

.blockquote-tag-warning {
    border-inline-start-color: var(--blockquote-warning-color);
}

.blockquote-tag-caution {
    border-inline-start-color: var(--blockquote-caution-color);
}

.blockquote-tag-note > .blockquote-tag-title {
    color: var(--blockquote-note-color);
}

.blockquote-tag-tip > .blockquote-tag-title {
    color: var(--blockquote-tip-color);
}

.blockquote-tag-important > .blockquote-tag-title {
    color: var(--blockquote-important-color);
}

.blockquote-tag-warning > .blockquote-tag-title {
    color: var(--blockquote-warning-color);
}

.blockquote-tag-caution > .blockquote-tag-title {
    color: var(--blockquote-caution-color);
}

.blockquote-tag-title {
    /* Slightly increase the weight for more emphasis. */
    font-weight: 600;
    /* Vertically center the icon with the text. */
    display: flex;
    align-items: center;
    /* Remove default large margins for a more compact display. */
    margin: 2px 0 8px 0;
}

.blockquote-tag-title .fa-svg {
    fill: currentColor;
    /* Add some space between the icon and the text. */
    margin-right: 8px;
}

/* ============================================
 * Terminal (navy) dark-theme extras
 * ============================================ */

/* 20px engineering grid on the sidebar only; the content column stays flat
   so the texture never sits under prose or figures. */
.navy .sidebar {
    background-image:
        linear-gradient(rgba(224, 224, 224, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(224, 224, 224, 0.04) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* The 47 e-ink figures are pure-white-ground line art (VISUAL_STYLE.md);
   present them as lit schematic sheets instead of glare rectangles. */
.navy .content img {
    background: #fff;
    padding: 8px 12px;
    border: 1px solid var(--table-border-color);
    border-radius: var(--radius);
    box-sizing: border-box;
}

