/* Keep article typography out of Mermaid's label measurements and SVG. */
.gh-content .mermaid {
    display: block;
    max-width: 100%;
    min-width: 0;
    margin: 2.5rem 0;
    padding: 28px 20px;
    overflow-x: auto;
    border: 1px solid #dbe3ed;
    border-radius: 12px;
    background: #f8fafc;
    color: #243247;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
}

.dark-mode .gh-content .mermaid {
    border-color: #495061;
    background: #21252c;
    color: #edf2f7;
}

.gh-content pre.mermaid {
    white-space: pre-wrap;
}

.gh-content .mermaid svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}

.gh-content .mermaid .label,
.gh-content .mermaid .nodeLabel,
.gh-content .mermaid .edgeLabel,
.gh-content .mermaid .label p {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.4;
    letter-spacing: normal;
    word-break: normal;
    overflow-wrap: normal;
}

.gh-content .mermaid .nodeLabel {
    /* Explicit <br/> still works; don't split hostnames or IP:port labels. */
    white-space: nowrap;
}

.gh-content .mermaid .node rect {
    rx: 10px;
    ry: 10px;
    filter: none;
    stroke-width: 1.25px;
}

@media (max-width: 600px) {
    .gh-content .mermaid {
        padding: 20px 12px;
    }

    /* Keep complex diagrams readable, allowing the panel to scroll. */
    .gh-content .mermaid svg {
        min-width: 480px;
    }
}
