/* ── Force Mermaid diagrams to use full container width ── */
.mermaid svg {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

/* Rounded corners on ALL mermaid rect elements (nodes, subgraphs, etc.) */
.mermaid rect,
.mermaid .node rect,
.mermaid .actor,
.mermaid .activation,
.mermaid .node polygon {
    rx: 12 !important;
    ry: 12 !important;
}

/* Ensure mermaid text stays dark on light-filled nodes */
.mermaid .nodeLabel,
.mermaid .node .label,
.mermaid .node foreignObject div,
.mermaid .edgeLabel,
.mermaid .actor .actor-label {
    color: #000 !important;
}
/* Mermaid text elements in SVG */
.mermaid text.nodeLabel,
.mermaid .node text,
.mermaid .actor text,
.mermaid .messageText,
.mermaid .labelText,
.mermaid .loopText {
    fill: #000 !important;
}

/* ── Ensure images scale to content area ── */
.md-content img {
    max-width: 100%;
}

/* ── Jupyter notebook output images should fill width ── */
.jp-OutputArea-output img,
.jupyter-wrapper img {
    max-width: 100%;
    height: auto;
}

/* ── Global rounded corners ── */

/* Admonitions */
.md-typeset .admonition,
.md-typeset details {
    border-radius: 12px;
    overflow: hidden;
}
.md-typeset .admonition > .admonition-title,
.md-typeset details > summary {
    border-radius: 12px 12px 0 0;
}

/* Code blocks */
.md-typeset pre > code,
.md-typeset .highlight > pre,
.md-typeset .highlighttable {
    border-radius: 12px;
}
.md-typeset .highlighttable .linenos {
    border-radius: 12px 0 0 12px;
}
.md-typeset .highlighttable .code {
    border-radius: 0 12px 12px 0;
}

/* Tables */
.md-typeset table:not([class]) {
    border-radius: 12px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--md-typeset-table-color);
}
.md-typeset table:not([class]) th:first-child {
    border-top-left-radius: 12px;
}
.md-typeset table:not([class]) th:last-child {
    border-top-right-radius: 12px;
}
.md-typeset table:not([class]) tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}
.md-typeset table:not([class]) tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* Content tabs */
.md-typeset .tabbed-set {
    border-radius: 12px;
    overflow: hidden;
}

/* Cards / grid items */
.md-typeset .grid .card,
.md-typeset .md-typeset .card {
    border-radius: 12px;
}

/* ── Colorful table headers (solid color) ── */
[data-md-color-scheme="default"] .md-typeset table:not([class]) th {
    background-color: #5c6bc0;
    color: #fff;
    font-weight: 600;
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
    background-color: #3f51b5;
    color: #fff;
    font-weight: 600;
}

/* Alternating row tints */
[data-md-color-scheme="default"] .md-typeset table:not([class]) tbody tr:nth-child(even) {
    background-color: rgba(92, 107, 192, 0.06);
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tbody tr:nth-child(even) {
    background-color: rgba(92, 107, 192, 0.10);
}

/* ── Colorful admonition accents ── */

/* Note - blue */
.md-typeset .admonition.note,
.md-typeset details.note {
    border-left: 4px solid #42a5f5;
}

/* Tip - teal */
.md-typeset .admonition.tip,
.md-typeset details.tip {
    border-left: 4px solid #26a69a;
}

/* Warning - amber */
.md-typeset .admonition.warning,
.md-typeset details.warning {
    border-left: 4px solid #ffa726;
}

/* Info - indigo */
.md-typeset .admonition.info,
.md-typeset details.info {
    border-left: 4px solid #5c6bc0;
}

/* Example - purple */
.md-typeset .admonition.example,
.md-typeset details.example {
    border-left: 4px solid #ab47bc;
}

/* Abstract / summary - cyan */
.md-typeset .admonition.abstract,
.md-typeset .admonition.summary,
.md-typeset details.abstract,
.md-typeset details.summary {
    border-left: 4px solid #26c6da;
}

/* Danger - red */
.md-typeset .admonition.danger,
.md-typeset details.danger {
    border-left: 4px solid #ef5350;
}

/* ── Colorful inline code ── */
[data-md-color-scheme="default"] .md-typeset code {
    background-color: rgba(92, 107, 192, 0.10);
    border-radius: 6px;
    color: #5c6bc0;
}
[data-md-color-scheme="slate"] .md-typeset code {
    background-color: rgba(121, 134, 203, 0.15);
    border-radius: 6px;
    color: #9fa8da;
}
/* Don't override code inside code blocks or mermaid */
.md-typeset pre code,
.md-typeset .mermaid code {
    background-color: transparent;
    color: inherit;
    border-radius: 0;
}

/* ── Colorful blockquotes ── */
.md-typeset blockquote {
    border-left: 4px solid #7e57c2;
    border-radius: 0 12px 12px 0;
    background: linear-gradient(135deg, rgba(126, 87, 194, 0.06), transparent);
    padding: 0.8rem 1.2rem;
}

/* ── Smooth hover on table rows ── */
.md-typeset table:not([class]) tbody tr {
    transition: background-color 0.15s ease;
}
.md-typeset table:not([class]) tbody tr:hover {
    background-color: rgba(92, 107, 192, 0.12) !important;
}

/* ── Rounded navigation tabs ── */
.md-tabs__link--active,
.md-tabs__link:hover {
    border-radius: 8px 8px 0 0;
}

/* ── Jupyter cell output rounded ── */
.jupyter-wrapper .jp-OutputArea-output,
.jupyter-wrapper .jp-RenderedHTMLCommon {
    border-radius: 8px;
}

/* ── WebGUI 3D viewer fallback for static docs ── */
/* Show the hidden HTML fallback generated by cavsim3d show() */
.webgui-fallback {
    display: block !important;
}

/* Hide the plain-text widget repr (e.g. "WebGuiWidget(...)") */
.jupyter-wrapper .jp-RenderedText pre {
    /* Only hide if a sibling fallback exists — handled by JS below */
}

/* Hide text output that is just a widget repr */
.cell_output .output_text:has(+ .output_html .webgui-fallback),
.cell_output .jp-RenderedText:has(+ .jp-RenderedHTMLCommon .webgui-fallback) {
    display: none;
}
