/*
 * trying to improve the rendering of jupyter notebooks
 * particularly wrt spacing around lists and paragraphs
 * as well as other miscellanous tweaks
 *
 * .bd-container targets jupyter-book output
 * .myst targets jupyter-lab rendering
 */

/* use more horizontal space when available
 * this is otherwise arbitrarily set to 88rem
 */

@media (min-width: 960px) {
    .bd-page-width {
        max-width: initial !important;
    }

    /* but keep the upper-left logo to grow too much */
    .navbar-brand.logo>img {
        max-width: 250px;
        max-height: 170px;
    }
}

/* make the right-hand-side index background transparent */
#bd-toc-nav {
    background-color: rgb(0 0 0 / 0);
}


/* not too much space between paragraphs */
:is(.bd-container, .myst) :is(p, ul) {
    margin-bottom: 0.5em !important;
    margin-top: 0.5em !important;
}

.myst :where(:is(p, ul)):not(:where([class~=not-prose], [class~=not-prose] *)) {
    margin-bottom: 0.5em !important;
    margin-top: 0.5em !important;
}


/* not too much space around lists */
:is(.bd-container, .myst) *+ :is(ol, ul),
/* a paragraph that is just above a list should not have a bottom margin
 * thanks SO
 * https://stackoverflow.com/questions/1817792/is-there-a-previous-sibling-selector
 */
:is(.bd-container, .myst) p:has(+ :is(ol, ul)) {
    margin-bottom: initial !important;
}

:is(.bd-container, .myst) li>ul {
    margin-top: 0.1em !important;
}


/* execution output cells */
div.cell div.cell_output .output pre {
    background-color: #f8fff8 !important;
    border: 0.3px solid blue !important;
}

html[data-theme='dark'] div.cell div.cell_output .output pre {
    background-color: #064b06 !important;
}

div.prompt.input_prompt, div.prompt.output_prompt {
    opacity: 0.6;
}

/* jupyterlab-myst and tables */
:is(.bd-container, .myst) table td {
    padding: initial !important;
}

:is(.bd-container, .myst) table tbody tr:nth-child(odd) {
    background-color: #fdfdfd;
}

:is(.bd-container, .myst) table tbody tr:nth-child(even) {
    background-color: #fbfbfb;
}

:is(.bd-container, .myst) table :is(thead, tfoot) tr {
    background-color: #f8f8f8;
}

html[data-theme='dark'] {
    & :is(.bd-container, .myst) table tbody tr:nth-child(odd) {
        background-color: #020202;
    }

    & :is(.bd-container, .myst) table tbody tr:nth-child(even) {
        background-color: #040404;
    }

    & :is(.bd-container, .myst) table :is(thead, tfoot) tr {
        background-color: #080808;
    }
}

/* space before admonitions */
:is(.bd-container, .myst) div.admonition>.admonition-title+* {
    margin-top: 0px !important;
}

/* standard admonition classes */
.admonition-smaller {
    font-size: smaller;
    line-height: 1.2;
}

.admonition-small {
    font-size: small;
    line-height: 1.2;
}

.admonition-x-small {
    font-size: x-small;
    line-height: 1.2;
}

/* slight gradient for corriges */
.corrige {
    background-image: radial-gradient(circle at top left, #d1effa, #e2f9cd);
}

html[data-theme='dark'] .corrige {
    background-image: radial-gradient(circle at top left, #0e3852, #0c5517);
}
