/*===========================================================================*/
/* markdown-parsed specific elements */


.src-md a:before {
    content: "";
    background: url("../icons/link-vertical.svg") no-repeat bottom;
    background-size: contain;
    width: 0.8rem;
    height: 0.7rem;
    display: inline-block;
}
.src-md a.footnote-ref:before,
.src-md a.footnote-backref:before,
.src-md a:has(img):before,
.src-md h1 a:before,
.src-md h2 a:before,
.src-md h3 a:before,
.src-md h4 a:before,
.src-md h5 a:before,
.src-md h6 a:before {
    content: unset;
    background: unset;
}

/* tables */
.src-md .table-wrapper {
    margin: 1rem 0;
    overflow: auto;
    display: block;
}
.src-md table.inline p {
    margin: unset;
}
.src-md table.inline {
    margin: 0 auto;
    max-width: 100%;
    min-width: 70%;
    width: max-content;
    border-spacing: 0 0;
    border-collapse: separate;
    border-radius: 15px;

}
.src-md table.inline th,
.src-md table.inline td {
    vertical-align: middle;
    padding: 0.8em;
}
.src-md table.inline th {
    background-color: var(--bg-color-MM);
    border-bottom: 2px solid var(--color-WW);
}
.src-md table.inline tr {
    background-color: var(--bg-color-M);
}
.src-md table.inline tr:hover {
    background-color: var(--bg-color-MM);
}
.src-md table.inline td {
    border: 1px solid transparent;
    border-left: 2px solid var(--bg-color-MM)
}
.src-md table.inline ul {
    padding-inline-start: 15px;
}

/* code blocks */
/* XXX: we assume linenums_style=pymdownx-inline */
.src-md div.highlight {
    margin: 1rem 0;
}
.src-md div.highlight > pre {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background-color: var(--bg-color-M);
    border: 1px solid var(--bg-color-MM);
    border-radius: var(--radius-S);
    padding: 1rem;
    margin: unset;
    overflow: auto;
}
.src-md div.highlight .linenos {
    color: var(--color-WW);
}
.src-md div.highlight span.filename {
    position: relative;
    display: block;
    padding: 0.5rem;
    width: 100%;
    /* cover the top rounded corner of the <pre> below */
    top: 5px;
    background-color: var(--bg-color-MM);
    text-align: left;
    color: var(--color-WW);
    font-weight: bold;
}
.src-md div.highlight [data-linenos]:before {
    /* make the line number visible */
    content: attr(data-linenos);
}

/* inline code */
.src-md code.inline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background-color: var(--bg-color-MM);
    color: var(--color-W);
    border-radius: 5px;
    padding: 2px 5px;
    text-wrap: nowrap;
}
.src-md a > code.inline {
    color: inherit;
    border-left: 1px solid var(--color-primary-WW);
}

/* admonitions */
.src-md div.admonition {
    position: relative;
    border-radius: var(--radius-S);
    background-color: var(--bg-color-M);
    border: 1px solid var(--color-WW);
    /* top slightly bigger to account for title exceeding block height */
    padding: 1.3rem 1rem 1rem;
    margin: 1.4rem 0 1rem;

    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    .admonition-title {
        position: absolute;
        font-weight: bold;
        top: -10px;
        background: linear-gradient(0deg, var(--bg-color-M) 60%, transparent 100%);
        padding: 0 4px;
        border-radius: var(--radius-S);
        /*text-shadow: 0 0 5px var(--bg-color-M);;*/
        margin: 0;
    }

    > * {
        margin: 0;
    }
}
.src-md div.admonition.highlight-block {
    /* doesn't have title so no need for extra margin/padding */
    margin-top: 1rem;
    padding: 1rem;

    > *:first-child {
        margin-top: 0;
    }
}
.src-md div.admonition.danger,
.src-md div.admonition.error {
    border-color: var(--color-negative);

    .admonition-title {
        color: var(--color-negative);
    }
}
.src-md div.admonition.attention,
.src-md div.admonition.important {
    border-color: var(--color-attention);

    .admonition-title {
        color: var(--color-attention);
    }
}
.src-md div.admonition.caution {
    border-color: var(--color-caution);

    .admonition-title {
        color: var(--color-caution);
    }
}
.src-md div.admonition.hint {
    border-color: var(--color-hint);

    .admonition-title {
        color: var(--color-hint);
    }
}
.src-md div.admonition.note {
    border-color: var(--color-info);

    .admonition-title {
        color: var(--color-info);
    }
}
.src-md div.admonition.tip {
    border-color: var(--color-positive);

    .admonition-title {
        color: var(--color-positive);
    }
}
.src-md div.admonition.warning {
    border-color: var(--color-warning);

    .admonition-title {
        color: var(--color-warning);
    }
}

/* fix code background for some elements */
.src-md div.admonition .highlight > pre,
.src-md div.admonition code.inline,
.src-md td .highlight > pre,
.src-md td code.inline {
    background-color: var(--bg-color);
}

/* images */
.src-md img {
    display: block;
}
.src-md img.align-left,
.src-md figure.align-left {
    margin: unset;
    align-items: start;
}
.src-md img.align-right,
.src-md figure.align-right {
    margin-left: auto;
    align-items: end;
}
.src-md img.align-center,
.src-md figure.align-center {
    margin: auto;
    align-items: center;
}
.src-md img.align-right,
.src-md figure.align-right {
    margin-left: auto;
    align-items: end;
}
.src-md figure.align-center img {
    margin: auto;
}
.src-md figure.align-right img {
    margin-left: auto;
}

/* table of contents */
.src-md nav.toc {
    position: relative;
    padding: 1rem;
    margin: 3rem 0 2rem;
    background-color: var(--bg-color-M);
    border-radius: var(--radius-S);
    border: 1px solid var(--color-primary);

    a:before {
        content: none;
    }

    .topic-title {

        position: absolute;
        margin: 0;
        background: linear-gradient(0deg, var(--bg-color-M) 60%, transparent 100%);
        padding: 0 0.5rem;
        top: -15px;

        font-weight: bold;
        font-size: 1.5rem;

        a {
            color: inherit;
        }
    }

    ul {
        margin: 0.5rem 0 0;
        padding-inline-start: 20px;
        list-style-position: outside;
        list-style-type: "▫ ";
        color: var(--color-W);
    }

    li {
        margin: 0.1rem 0;

        > * {
            margin: 0;
        }

        > p {
            display: inline;
        }
    }

    > div > ul > li > p {
        font-weight: 600;
    }

    > div > ul > li > ul > li > ul > li > p,
    > div > ul > li > ul > li > ul > li > ul > li > p {
        font-size: 0.9rem;
    }

}
@media screen and (min-width: 1600px) {
    aside.toc-wrapper {
        position: fixed;
        top: 15%;
        left: 2%;
    }

    .src-md aside.toc-wrapper nav.toc {
        position: sticky;
        padding: 0 0 0 1rem;
        margin: 10px 0 0;
        background-color: unset;
        border-width: 0 0 0 1px;
        border-style: solid;
        border-color: var(--color-WW);
        border-radius: 0;

        .topic-title {
            position: unset;
            padding: unset;
            background: unset;
            margin-bottom: 1rem;

            font-weight: 300;
            font-family: var(--font-B);
            letter-spacing: 2px;
        }
    }

    .src-md aside.toc-wrapper nav.toc > .toc-list {
        padding-left: 1rem;

        max-height: 60vh;
        overflow-y: auto;
        /* trick to have scrollbar on left*/
        direction: rtl;

        opacity: 0.5;
        line-height: 25px;
        font-size: 0.9rem;

        scrollbar-width: thin;

        a {
            color: var(--color);
        }

        * {
            /* reset scrollbar trick */
            direction: ltr;
        }

    }

}


.src-md .footnote {
    font-size: 0.75rem;

    > * {
        margin: 0.5rem;
    }

    p {
        margin: 0;
    }
}

/* custom url-preview directive */
.url-preview-box {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    transition: 0.25s;

    > a {
        /*trick from https://stackoverflow.com/a/67156294/13806195 */
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }

    p {
        margin: unset;
    }
}
.url-preview-box:hover {
    transform: scale(1.05);
}
.url-preview-details {
    width: 100%;
    background-color: var(--bg-color-MM);
    border-radius: var(--radius-S);
    padding: 1rem;
}
.url-preview-image {
    display: flex;
    align-items: center;
    border-radius: 0.5rem;
    color: var(--color-WW);
    max-width: 160px;
}
@media screen and (max-width: 500px) {
    .url-preview-image {
        max-width: 90px;
    }
}
.url-preview-image img {
    border-radius: var(--radius-S);
    object-fit: cover;
    min-height: 100%;
    width: 100%;
}
.url-preview-title {
    font-weight: 800;
    margin: 0;
}
.url-preview-subtitle {
    display: flex;
    margin-bottom: 0.5rem;
}
.url-preview-subtitle a {
    font-size: 0.8rem;
    color: var(--color-WW);
}
.url-preview-subtitle a::before {
    all: initial;
}
.url-preview-description {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-W);

    *:first-child {
        margin-top: 0;
    }

    *:last-child {
        margin-bottom: 0;
    }

}

/* custom image-grid directive */
.image-grid {
    display: flex;
    flex-direction: column;

    .image-grid-row {
        white-space: nowrap;
        /* this a hack to remove the whitespace between inline-block items*/
        font-size: 0;
    }

    figure {
        display: inline-block;
        position: relative;
        margin: 0;
    }

    img {
        width: 100%;
        height: 100%;
    }

    figcaption {
        margin: 0;
        opacity: 0;
        text-wrap: wrap;
        font-size: 0.75rem;
        width: 100%;
        position: absolute;
        bottom: 0;
        left: 0;
        padding: 0.5rem;
        /*background: linear-gradient(0deg, rgba(0,0,0,0.8) 10%, transparent 100%);*/
        background-color: rgba(0, 0, 0, 0.5);
    }

    figure:hover figcaption {
        opacity: 1;
    }

    figcaption > * {
        margin: 0;
    }
}
@media screen and (max-width: 600px) {
    .image-grid figure {
        display: block;
        margin: auto;
        width: unset !important;
    }
}

:root {
    --image-gallery-spacing: 2rem;
}

/* custom image-gallery directive */
/* this is a 2 colum layout with ul sticking on left or right */
.image-gallery {
    display: flex;
    flex-direction: row;
    gap: var(--image-gallery-spacing);

    font-weight: 300;

    img, ul, div.line-block {
        margin-top: var(--image-gallery-spacing);
        margin-bottom: var(--image-gallery-spacing);
        width: 100%;
    }

    p {
        margin: 0.6rem 0;
    }

    p:first-child {
        margin-top: var(--image-gallery-spacing);
    }

    p:last-child {
        margin-bottom: var(--image-gallery-spacing);
    }

    .img-fullscreen {
        display: flex;
        position: fixed;
        transform: translate(-50%, -50%);
        top: 50%;
        left: 50%;
        height: 100vh;
        width: 100vw;
        max-width: unset;
        z-index: 10;
        background-color: rgba(0, 0, 0, 0.85);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s;
    }

    .img-fullscreen img {
        object-fit: contain;
        margin: 2rem;
        padding: 0;
    }

    .img-fullscreen:target {
        visibility: visible;
        opacity: 1;
    }

    .responsive {
        display: none;
    }

    .left {
        display: initial;
    }

    .right {
        display: initial;
    }

    .image-wrapper {

        position: relative;

        ul {
            margin-top: auto;
            margin-bottom: auto;
            position: absolute;
            top: 50%;
            /* "translate": trick to take in account own height */
            /* "perspective": trick to avoid blury font rendering with transform */
            transform: perspective(1px) translateY(-50%);

            padding-inline-start: 0;
            list-style: none;

            opacity: 0;
            letter-spacing: -6px;
            transition: letter-spacing 0.3s, opacity 0.2s;

            p {
                margin: 0;
            }

        }
    }

    .left ul {
        text-align: right;
        margin-left: calc(-1 * var(--image-gallery-spacing));
        left: -100%;
    }

    .right ul {
        text-align: left;
        margin-right: 0;
        left: calc(100% + var(--image-gallery-spacing));
    }

    .responsive ul {
        letter-spacing: unset;
        text-align: center;
        font-size: 0.9rem;
        font-weight: 400;
        color: var(--color-WW);
    }

    .left .image-wrapper:hover ul,
    .right .image-wrapper:hover ul {
        opacity: 0.65;
        letter-spacing: unset;
    }
}
@media screen and (max-width: 1000px) {
    .image-gallery {
        .responsive {
            display: flex;
            flex-direction: column;

            ul, ul:hover {
                position: relative;
                top: unset;
                left: unset;
                transform: unset;
                opacity: 1;
            }
        }

        .left {
            display: none;
        }

        .right {
            display: none;
        }
    }
}

/* custom :emoji: role */
.emoji-role.inline {
    display: inline;
    vertical-align: middle;
    height: 1.3em;
}
.emoji-role.inline:hover {
    transform: scale(2);
    background-color: var(--bg-color);
    padding: 2px;
    border-radius: 2px;
}

