/*
 * femorph-solver doc theme overrides.
 *
 * Layered on top of pydata_sphinx_theme.  Every rule here addresses
 * an engineering-grade-typography concern that the default theme
 * leaves loose: tabular numerals in result tables, prose width caps
 * for readability on wide screens, equation block separation from
 * surrounding prose, and verification accuracy badges.
 *
 * Keep this file small.  Resist the urge to skin the whole theme —
 * pydata is what NumPy / SciPy / PyAnsys use, and divergence from
 * the family resemblance is a feature not a bug.
 */

/* Tabular numerals + monospace digit alignment in every table.
 * Result tables in the verification corpus and per-element
 * accuracy badges rely on this for column alignment.  Without it
 * proportional digit widths break tabular comparisons.
 */
table.docutils,
table.docutils td,
table.docutils th {
    font-feature-settings: "tnum" 1, "lnum" 1;
    font-variant-numeric: tabular-nums lining-nums;
}

/* Cap prose width on very wide displays.
 *
 * The default pydata theme grows the article column to fit the
 * available space.  Past ~80ch line lengths, scanning the eye back
 * to the start of the next line becomes effortful (Bringhurst's
 * "Elements of Typographic Style" §2.1).  Cap at 80ch on screens
 * wider than 1280 px.  Tables, grids, and code blocks override.
 */
@media (min-width: 1280px) {
    .bd-article {
        max-width: 80ch;
        margin-left: auto;
        margin-right: auto;
    }

    /* Allow tables, code, and sphinx-design grids to use the full
     * width — capping them along with prose makes them feel cramped.
     */
    .bd-article > section > table,
    .bd-article > section > div.highlight,
    .bd-article > section > div.sd-container-fluid,
    .bd-article > section > div.sd-row,
    .bd-article > section > div.math {
        max-width: none;
    }
}

/* Subtle background tint on math blocks so equations are visually
 * separated from surrounding prose without competing for attention.
 * The colour token tracks pydata's theme (light + dark) automatically.
 */
.math {
    background-color: var(--pst-color-surface);
    border-radius: 4px;
    padding: 0.5em 0.75em;
    margin: 0.75em 0;
}

/* Accuracy-badge component for the verification gallery and
 * per-element technical sheets.  Use as:
 *
 *   .. raw:: html
 *
 *       <span class="accuracy-badge accuracy-pass">verified vs MAPDL VM-1: 0.02%</span>
 *
 * Three states: pass (green), warn (amber), fail (red).
 */
.accuracy-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: var(--pst-font-family-monospace);
    font-weight: 600;
}

.accuracy-pass {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.accuracy-warn {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.accuracy-fail {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Dark-mode adjustments for the accuracy badges — keep contrast
 * high without relying on white-on-pastel which fails WCAG AA.
 */
html[data-theme="dark"] .accuracy-pass {
    background-color: #1c4a2c;
    color: #d4edda;
    border-color: #2d6e3f;
}

html[data-theme="dark"] .accuracy-warn {
    background-color: #5a4a1a;
    color: #fff3cd;
    border-color: #7a651e;
}

html[data-theme="dark"] .accuracy-fail {
    background-color: #5a1f25;
    color: #f8d7da;
    border-color: #7a2932;
}

/* Tighter spacing on the gallery thumbnail captions.  Default
 * pydata leaves the example title flush with the next thumb,
 * which makes the gallery wall feel cramped.
 */
.sphx-glr-thumbcontainer {
    margin: 0.5em;
    padding: 0.25em;
}

.sphx-glr-thumbcontainer p.caption {
    margin-top: 0.5em;
    line-height: 1.3;
}
