/* Custom CSS for mdxplain documentation */

/* Fix for long class/function names that overflow */
.rst-content dl dt {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
}

/* Alternative: Allow horizontal scrolling for signature lines */
.rst-content dl dt .sig {
    overflow-x: auto;
    display: inline-block;
    max-width: 100%;
}

/* Better wrapping for long module paths */
.rst-content code.literal {
    word-wrap: break-word;
    word-break: break-word;
}

/* Ensure class/function signatures don't overflow their containers */
.rst-content .class > dt,
.rst-content .function > dt,
.rst-content .method > dt {
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Better handling of long parameter lists */
.sig-param {
    display: inline-block;
}

/* Hide <no-title> link and separator in breadcrumbs */
.wy-breadcrumbs li a[href$="_root_toctree.html"] {
    display: none !important;
}

/* Hide the separator (») before the hidden breadcrumb */
.wy-breadcrumbs li a[href$="_root_toctree.html"] + .icon-home {
    display: none !important;
}

/* If _root_toctree is in a list item, hide the whole item including separator */
.wy-breadcrumbs li:has(> a[href$="_root_toctree.html"]) {
    display: none !important;
}

/* Hide navigation arrows at the bottom of pages */
.rst-footer-buttons {
    display: none !important;
}

/* Alternative if the above doesn't work */
footer[role="contentinfo"] .rst-footer-buttons,
.footer-relations {
    display: none !important;
}

/* Rubric styled like RTD page title (h1) */
.rubric.rubric-h1 {
    font-family: "Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif;
    font-size: 1.75em;
    margin-top: 0px;
    margin-bottom: 24px !important;
    line-height: 1.2;
    color: #404040;
}

/* Specific styles for a page without singular page title */
.pagetitle-page h1 {
    font-size: 1.5em !important;
    margin-block-start: 0.83em;
    margin-block-end: 0.83em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    unicode-bidi: isolate;
}

/* Specific styles for a page without singular page title */
.pagetitle-page h2 {
    font-size: 1.25em !important;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    unicode-bidi: isolate;
}

/* Benchmarks page: make figure captions behave like table captions (caption-side: top) */
.rst-content figure.benchmark-figure {
    display: table;
    width: 100%;
}

/* Match the RTD table caption look exactly (font + padding + centering) */
.rst-content figure.benchmark-figure figcaption,
.rst-content table.benchmark-table caption {
    color: #000;
    font: italic 85%/1 arial, sans-serif;
    padding: 1em 0;
    text-align: justify;
    text-align-last: left;
    text-justify: inter-word;
}

.rst-content figure.benchmark-figure figcaption {
    display: table-caption;
    caption-side: top;
}

.rst-content figure.benchmark-figure figcaption p {
    margin: 0;
    font: inherit;
    text-align: inherit;
}

/* Ensure both parts of the caption inherit the same style */
.rst-content figure.benchmark-figure figcaption .caption-number,
.rst-content figure.benchmark-figure figcaption .caption-text,
.rst-content table.benchmark-table caption .caption-number,
.rst-content table.benchmark-table caption .caption-text {
    font-style: inherit;
    font-weight: inherit;
}

/* Keep "Figure 1"/"Table 1" together at the start (PDF-like) */
.rst-content figure.benchmark-figure figcaption .caption-number,
.rst-content table.benchmark-table caption .caption-number {
    white-space: nowrap;
}

/* Benchmarks page: wide tables without ugly scroll or crushed columns */
table.benchmark-table {
    table-layout: auto;
    width: 100%;
    font-size: 90%;
}

table.benchmark-table th,
table.benchmark-table td {
    padding: 6px 8px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

/* Keep numeric columns stable */
table.benchmark-table th:nth-child(4),
table.benchmark-table th:nth-child(5),
table.benchmark-table th:nth-child(6),
table.benchmark-table th:nth-child(7),
table.benchmark-table th:nth-child(8),
table.benchmark-table td:nth-child(4),
table.benchmark-table td:nth-child(5),
table.benchmark-table td:nth-child(6),
table.benchmark-table td:nth-child(7),
table.benchmark-table td:nth-child(8) {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Keep the 'Approximation' column readable */
table.benchmark-table td:nth-child(2) {
    white-space: normal;
    text-align: left;
}

/* Give Memmap a bit more breathing room; keep Approximation from hogging space */
table.benchmark-table th:nth-child(2),
table.benchmark-table td:nth-child(2) {
    width: 16%;
}

table.benchmark-table th:nth-child(3),
table.benchmark-table td:nth-child(3) {
    width: 12%;
    text-align: center;
}

/* Global: justify all documentation body text ("Blocksatz") */
.wy-nav-content .rst-content {
    text-align: justify;
    hyphens: auto;
}

/* Layout: make content width responsive (RTD defaults to max-width: 800px) */
.wy-nav-content {
    max-width: clamp(900px, 92vw, 1600px);
}

@media screen and (max-width: 768px) {
    .wy-nav-content {
        max-width: none;
        padding: 1em 1.25em;
    }

    /* RTD wraps tables in .wy-table-responsive via theme.js; use that for mobile scrolling */
    .wy-table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Benchmark tables: don't shrink below a readable minimum; scroll instead */
    .wy-table-responsive > table.benchmark-table {
        min-width: 860px;
    }
}
