/* Light documentation polish without custom widgets or branding. */

.bd-main .bd-content .bd-article-container {
    max-width: 980px;
}

.bd-article h1 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.bd-article h2 {
    margin-top: 2.25rem;
}

.bd-article a {
    text-underline-offset: 0.16em;
}

.bd-article table {
    font-size: 0.95rem;
}

.bd-article pre {
    border-radius: 0.45rem;
}

.bd-sidebar-primary {
    font-size: 0.95rem;
}

.bd-toc {
    font-size: 0.9rem;
}

.admonition {
    border-radius: 0.45rem;
}

code {
    font-size: 0.92em;
}

.bd-article > p:first-of-type {
    font-size: 1.08rem;
    line-height: 1.65;
}

/*
 * Display math needs vertical breathing room.
 *
 * PyData/Jupyter Book makes long equations horizontally scrollable. On some
 * browser/font combinations that scroll container can crop tall MathJax
 * glyphs (superscripts, sums, fractions) at the top or bottom. Padding the
 * math block keeps those glyphs inside the scroll box without changing the
 * equation itself.
 */
.bd-article .math {
    padding-block: 0.45rem;
}

.bd-article mjx-container[display="true"] {
    margin-block: 0.45rem !important;
    padding-block: 0.18rem;
}

/* Mermaid diagrams remain transparent and grayscale. sphinxcontrib-mermaid
   handles light/dark rendering, D3 zoom/pan, and fullscreen viewing. */
.mermaid {
    background: transparent !important;
    overflow: hidden;
    min-height: 360px;
}

.mermaid svg {
    background: transparent !important;
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    margin: 1rem auto 1.5rem auto;
    filter: grayscale(1);
}

/* The standard-model diagram is denser than the software architecture.
   Give it more initial viewing area before the reader zooms or goes full
   screen. */
#standard-cge-theory {
    min-height: 560px;
}
