:root {
    --small-border-radius: 12px;
    --big-border-radius: 18px;
}

/* Indentation. */
div.doc-contents:not(.first) {
    padding-left: 25px;
    border-left: .05rem solid var(--md-typeset-table-color);
}

/* Mark external links as such. */
a.external::after,
a.autorefs-external::after {
    /* https://primer.style/octicons/arrow-up-right-24 */
    mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
    -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
    content: ' ';

    display: inline-block;
    vertical-align: middle;
    position: relative;

    height: 1em;
    width: 1em;
    background-color: currentColor;
}

a.external:hover::after,
a.autorefs-external:hover::after {
    background-color: var(--md-accent-fg-color);
}

/* Tree-like output for backlinks. */
.doc-backlink-list {
    --tree-clr: var(--md-default-fg-color);
    --tree-font-size: 1rem;
    --tree-item-height: 1;
    --tree-offset: 1rem;
    --tree-thickness: 1px;
    --tree-style: solid;
    display: grid;
    list-style: none !important;
}

.doc-backlink-list li > span:first-child {
    text-indent: .3rem;
}

.doc-backlink-list li {
    padding-inline-start: var(--tree-offset);
    border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
    position: relative;
    margin-left: 0 !important;

    &:last-child {
        border-color: transparent;
    }

    &::before {
        content: '';
        position: absolute;
        top: calc(var(--tree-item-height) / 2 * -1 * var(--tree-font-size) + var(--tree-thickness));
        left: calc(var(--tree-thickness) * -1);
        width: calc(var(--tree-offset) + var(--tree-thickness) * 2);
        height: calc(var(--tree-item-height) * var(--tree-font-size));
        border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
        border-bottom: var(--tree-thickness) var(--tree-style) var(--tree-clr);
    }

    &::after {
        content: '';
        position: absolute;
        border-radius: 50%;
        background-color: var(--tree-clr);
        top: calc(var(--tree-item-height) / 2 * 1rem);
        left: var(--tree-offset);
        translate: calc(var(--tree-thickness) * -1) calc(var(--tree-thickness) * -1);
    }
}

/*region Code Blocks*/
.highlight {
    margin: 1rem 0;

    border-radius: var(--big-border-radius);
    border-top: 1px solid var(--code-border-top);
    border-left: 1px solid var(--code-border-left);
    border-right: 1px solid var(--code-border-right);
    border-bottom: 1px solid var(--code-border-bottom);
}

.md-typeset .highlighttable {
    margin: 0;
}
.md-typeset blockquote, .md-typeset dl, .md-typeset figure, .md-typeset ol, .md-typeset pre, .md-typeset ul {
    margin: 0;
}

.highlight .md-code__content {
    border-radius: var(--big-border-radius);
}
.highlight .linenos {
    border-radius: var(--big-border-radius) 0 0 var(--big-border-radius);
}

/* Code Blocks inside Tooltip*/
.md-tooltip2__inner  .highlight {
    border-radius: var(--small-border-radius) !important;
}
.md-typeset code {
    border-radius: var(--small-border-radius);
}
/*endregion*/


/*region Tables*/
.md-typeset table:not([class]) {
    border-radius: var(--small-border-radius) !important;
}
/*endregion*/

/*region Search*/
[data-md-toggle="search"]:checked ~ .md-header .md-search__form {
    border-radius: 20px !important;
    background-color: var(--md-glass-color);
    color: var(--md-typeset-color);
    backdrop-filter: blur(20px);
    z-index: 3;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);

    box-shadow: rgba(0, 0, 0, 0.065) -2px 5px 12px;
}

.md-search__output {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);

    box-shadow: rgba(0, 0, 0, 0.065) -2px 5px 12px;

    border-radius: var(--big-border-radius) !important;
    top: 3rem;
}
.md-search__output::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-color: var(--md-glass-color-light);
    backdrop-filter: blur(20px);
}

.md-search-result__meta {
    background-color: var(--md-glass-primary-color);
}
.md-search-result__list {
    margin: 1rem 1.5rem;
}
.md-search-result__list:not(:has(li)) {
    margin: 0;
}

.md-search__scrollwrap {
    z-index: 2;
    background-color: var(--md-glass-color);
    backdrop-filter: blur(20px);
}

.md-search-result__link, .md-search-result__more {
    border-radius: var(--small-border-radius);
    margin: 0.25rem 0;
}
.md-search-result__link:hover, .md-search-result__more > summary:hover > div {
    background-color: var(--md-glass-primary-color);
    backdrop-filter: blur(20px);
}
/*endregion*/

.md-icon {
    font-size: 0.75em;
}

.md-top.md-icon {
    font-size: initial;
}