:root {
    --bg: #262626;
    --color: #ffffff;
    --color-breadcrumb-delimiter: #d4d4d4;
    --color-breadcrumb-element: #B469F7; /* TBD */
    --code-background: #151515;
    --blockquote-background: #1c1c1c;
    --code-color: #ffffff;
    --radio-select: #3b82f6;
    --radio-border: #737373;
    --settings-button-filter: invert(0.75);
    --sidebar-hover-bg: #424242;
    --link: #06b6d4;
    --desc-toggle-filter: invert(0.55);

    /* item colors */
    --color-function: #4ade80;
    --color-struct: #2dd4bf;
    --color-static: #649df2;
    --color-trait: #a884f5;
    --color-module: #f43f5e;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    background: var(--bg);
    color: var(--color);
    font-family: sans-serif;
    font-weight: 500;
}
body {
    margin: 0;
    display: flex;
}

a {
    text-decoration: none;
    color: var(--link);
}

a:hover {
    text-decoration: underline;
}

.path span, .searchpath span {
    user-select: none;
    color: var(--color-breadcrumb-delimiter);
}

.path a {
    text-decoration: none;
    color: var(--color-breadcrumb-element);
}

.path a:hover, .path a:focus {
    text-decoration: underline;
    color: var(--color-breadcrumb-element);
}

.searchpath {
    text-decoration: none;
    color: var(--color-breadcrumb-element);
}

.search-header {
    display: flex;
    margin-bottom: .5em;
    position: relative;
}

.search-input {
    color: #000;
    padding: .5em;
    border: 1px #fff solid;
    outline: none;
    background: #fff;
    font-weight: 500;
    font-size: 1em;
    flex: 1;
}

.search-input:focus, .search-input:focus-visible {
    border: 1px #3b82f6 solid;
}

.search-results {
    z-index: 500;
    display: flex;
    flex-direction: column;
}

.searchpath {
    padding: 0.2em;
}

.searchpath + .searchpath {
    border-top: 1px var(--sidebar-hover-bg) solid;
}

.searchpath:hover, .searchpath:focus {
    background-color: var(--sidebar-hover-bg);
}

.settings-button {
    margin: 0 .5em;
}

.expand-button {
    margin-right: .25em;
}

.settings-button, .expand-button {
    display: flex;
    align-items: center;
    border: 1px transparent solid;
    padding: .25em;
    padding-right: .5em;
    cursor: pointer;
    user-select: none;
    color: var(--color);
}

.settings-button:hover, .expand-button:hover {
    border: 1px var(--color) solid;
}

.settings-button::before, .expand-button::before {
    filter: var(--settings-button-filter);
    width: 18px;
    height: 18px;
    display: block;
    margin-right: .2em;
    color: var(--color);
}

.settings-button::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-settings"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z" /><path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" /></svg>');
}

.expand-button::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="3 2 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevrons-down"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7l5 5l5 -5" /><path d="M7 13l5 5l5 -5" /></svg>');
}

.settings-popup {
    position: absolute;
    border: 1px solid var(--color);
    background: var(--bg);
    padding: .7em;
    right: .5em;
    top: 120%;
    z-index: 1000;
}

.setting-radio {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.setting-radio + .setting-radio {
    margin-left: 1em;
}

.setting-radio input[type="radio"] {
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    margin: .25em;
    border: 2px var(--radio-border) solid;
    border-radius: 50%;
    margin-right: .3em;
}

.setting-radio input[type="radio"]:checked {
    background: var(--radio-select);
    box-shadow: inset 0 0 0 3px var(--bg);
}

.hidden {
    display: none;
}

.content {
    width: 86%;
    padding: 0 2em;
    padding-top: 1em;
    display: flex;
    flex-direction: column;
}

.sidebar {
    width: 14%;
    min-height: 100vh;
    border-right: 1px solid var(--color);
    padding-top: 2em;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin: 0 4%;
    margin-bottom: .25em;
}

.sidebar a {
    text-decoration: none;
    font-size: 1.1em;
    color: var(--color-breadcrumb-element);
    padding: .25em 5%;
}

.sidebar a:hover, .sidebar a:focus {
    background-color: var(--sidebar-hover-bg);
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0
}

.code {
    padding: .75em;
    border-radius: 7px;
    background: var(--code-background);
    color: var(--code-color);
    margin: 0;
}

.function {
    color: var(--color-function);
}

.struct {
    color: var(--color-struct);
}

.static {
    color: var(--color-static);
}

.trait {
    color: var(--color-trait);
}

.module {
    color: var(--color-module);
}

.anchorable {
    position: relative;
}

.anchorable > .anchor {
    display: none;
    position: absolute;
    color: var(--color);
    left: -15px;
    top: 0;
    padding-right: 8px;
}
.anchorable:hover > .anchor,
.anchorable > .anchor:hover {
    display: initial;
}

.structfield, .member-function, .item-ref {
    font-size: 1.15em;
    margin: .25em 0;
    display: block;
    max-width: max-content;
}

.item-ref {
    margin: .125em 0;
}

.item-list {
    display: grid;
    grid-template-columns: 17% 83%;
    width: 100%;
    align-items: center;
}

.item-list > dt {
    grid-column-start: 1;
    overflow-wrap: anywhere;
}

.item-list > dd {
    margin: 0;
    grid-column-start: 2;
}

.item-list > dd p {
    margin: 0;
}

.header {
    padding-top: .1em;
    padding-bottom: .25em;
    border-bottom: 1px var(--color) solid;
    margin: .25em 0;
}

p {
    margin: 0 0 .75em 0;
}

.footnote_ref:target a {
    background-color: var(--link);
    font-weight: bold;
    color: var(--bg);
}

table {
    border: 1px var(--color) solid;
    padding: 0;
    border-collapse: collapse;
}

table th + th, table td + td {
    border-left: 1px var(--color) solid;
}

table td {
    border-top: 1px var(--color) solid;
}

table th, table td {
    padding: .5em;
}

.description code {
    background-color: var(--code-background);
    color: var(--code-color);
    padding: 0 .25em;
    border-radius: 4px;
}

.description a code {
    color: var(--link);
}

details.description-toggle > * + * {
    margin-left: 1.75em;
}

details.description-toggle summary {
    margin-left: 0;
    cursor: pointer;
}

details.description-toggle[open] summary {
    width: 0;
    height: 0;
}

details.description-toggle summary span {
    filter: var(--desc-toggle-filter);
    color: black;
}

details.description-toggle[open] summary span {
    display: none;
}

details.description-toggle summary::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="-1 -1 20 20" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>');
    filter: var(--desc-toggle-filter);
}

details.description-toggle[open] summary::before {
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="-1 -1 20 20" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>');
}

details.description-toggle summary::marker {
    content: none;
}

blockquote {
    background: var(--blockquote-background);
    color: var(--code-color);
    padding: .25em;
    margin: .25em 0;
    border-left: 4px var(--blockquote-background) solid;
}

blockquote > :last-child {
    margin-bottom: 0;
}

blockquote.markdown-alert-caution {
    border-color: #dc2626;
}

blockquote.markdown-alert-warning {
    border-color: #f59e0b;
}

blockquote.markdown-alert-important {
    border-color: #a855f7;
}

blockquote.markdown-alert-tip {
    border-color: #65a30d;
}

blockquote.markdown-alert-note {
    border-color: #06b6d4;
}

:root[color-scheme="light"] {
    --bg: #f5f5f5;
    --color: #000000;
    --color-breadcrumb-delimiter: #525252;
    --color-breadcrumb-element: #601aa3;
    --code-background: #404040;
    --blockquote-background: #606060;
    --settings-button-filter: none;
    --link: #0891b2;
    --desc-toggle-filter: invert(0.45);
    --sidebar-hover-bg: #b8b8b8;

    /* item colors */
    --color-function: #0b602b;
    --color-struct: #015684;
    --color-static: #4338ca;
    --color-trait: #7e22ce;
    --color-module: #f43f5e;
}

:root[color-scheme="ayu"] {
    --bg: #0d1017;
    --color: #bfbdb6;
    --color-breadcrumb-delimiter: #d4d4d4;
    --color-breadcrumb-element: #e6b450;

    /* item colors */
    --color-function: #ffb454;
    --color-struct: #59c2ff;
    --color-static: #d2a6ff;
    --color-trait: #f07178;
    --color-module: #f43f5e;
}

@media(prefers-color-scheme: light) {
    :root[color-scheme="prefererence"] {
        --bg: #f5f5f5;
        --color: #000000;
        --color-breadcrumb-delimiter: #525252;
        --color-breadcrumb-element: #7e22ce;
        --code-background: #404040;
        --blockquote-background: #606060;
        --settings-button-filter: none;
        --link: #0891b2;
        --desc-toggle-filter: invert(0.45);

        /* item colors */
        --color-function: #16a34a;
        --color-struct: #0284c7;
        --color-static: #4338ca;
        --color-trait: #7e22ce;
        --color-module: #f43f5e;
    }
}
