code {
    border-radius: 0.8rem;
}

:not(pre) > code.hljs {
    background-color: var(--sidebar-spacer);
    border: 1px solid var(--sidebar-non-existant);
}

/* Change icon for collapsing and expanding sections */
.chapter-fold-toggle div {
    font-size: 0; /* Hide default */
}

.chapter-fold-toggle div::after {
    content: "⮜";
    font-size: 1rem;
}

.chapter li.expanded > span > a.chapter-fold-toggle div {
    transform: none !important;
}

.chapter li.expanded > span > .chapter-fold-toggle div::after {
    content: "⮟";
}

footer,
header {
    border-top: 1px solid var(--quote-border);
}

/* Code block backgrounds for Catppuccin themes */
.catppuccin-latte pre {
    background-color: #e6e9ef; /* Latte mantle */
    border: 1px solid #ccd0da; /* Latte surface0 */
    border-radius: 0.8rem;
    padding: 1rem;
}

.catppuccin-latte pre > code {
    background-color: #e6e9ef; /* Latte mantle */
}

.catppuccin-latte {
    --bg: #eff1f5; /* Latte base */
    --fg: #4c4f69; /* Latte text */

    --sidebar-bg: #e6e9ef; /* Latte mantle */
    --sidebar-fg: #4c4f69;
    --sidebar-non-existant: #9ca0b0; /* Latte overlay0 */
    --sidebar-active: #1e66f5; /* Latte blue */
    --sidebar-spacer: #ccd0da; /* Latte surface0 */

    --scrollbar: #7c7f93; /* Latte overlay2 */

    --icons: #8c8fa1; /* Latte overlay1 */
    --icons-hover: #4c4f69;

    --links: #1e66f5; /* Latte blue */

    --inline-code-color: #d20f39; /* Latte red */

    --theme-popup-bg: #e6e9ef;
    --theme-popup-border: #acb0be; /* Latte surface2 */
    --theme-hover: #dce0e8; /* Latte crust */

    --quote-bg: #dce0e8;
    --quote-border: #ccd0da;

    --warning-border: #fe640b; /* Latte peach */

    --table-border-color: #ccd0da;
    --table-header-bg: #bcc0cc; /* Latte surface1 */
    --table-alternate-bg: #e6e9ef;

    --searchbar-border-color: #acb0be;
    --searchbar-bg: #e6e9ef;
    --searchbar-fg: #4c4f69;
    --searchbar-shadow-color: #acb0be;
    --searchresults-header-fg: #5c5f77; /* Latte subtext0 */
    --searchresults-border-color: #9ca0b0;
    --searchresults-li-bg: #dce0e8;
    --search-mark-bg: #df8e1d; /* Latte yellow */

    --color-scheme: light;

    --copy-button-filter: invert(45%);
    --copy-button-filter-hover: invert(14%) sepia(93%) saturate(4250%)
        hue-rotate(243deg) brightness(99%) contrast(130%);

    --footnote-highlight: #7287fd; /* Latte lavender */

    --overlay-bg: rgba(220, 224, 232, 0.4);

    --blockquote-note-color: #1e66f5; /* Latte blue */
    --blockquote-tip-color: #40a02b; /* Latte green */
    --blockquote-important-color: #8839ef; /* Latte mauve */
    --blockquote-warning-color: #df8e1d; /* Latte yellow */
    --blockquote-caution-color: #d20f39; /* Latte red */

    --sidebar-header-border-color: #1e66f5;
}

/* Code block backgrounds for Catppuccin themes */
.catppuccin-frappe pre {
    background-color: #292c3c; /* Frappé mantle */
    border: 1px solid #414559; /* Frappé surface0 */
    border-radius: 0.8rem;
    padding: 1rem;
}

.catppuccin-frappe pre > code {
    background-color: #292c3c; /* Frappé mantle */
}

.catppuccin-frappe {
    --bg: #303446; /* Frappé base */
    --fg: #c6d0f5; /* Frappé text */

    --sidebar-bg: #292c3c; /* Frappé mantle */
    --sidebar-fg: #c6d0f5;
    --sidebar-non-existant: #737994; /* Frappé overlay0 */
    --sidebar-active: #8caaee; /* Frappé blue */
    --sidebar-spacer: #414559; /* Frappé surface0 */

    --scrollbar: #a5adce; /* Frappé overlay2 */

    --icons: #838ba7; /* Frappé overlay1 */
    --icons-hover: #c6d0f5;

    --links: #8caaee; /* Frappé blue */

    --inline-code-color: #e78284; /* Frappé red */

    --theme-popup-bg: #292c3c;
    --theme-popup-border: #626880; /* Frappé surface2 */
    --theme-hover: #232634; /* Frappé crust */

    --quote-bg: #414559;
    --quote-border: #51576d; /* Frappé surface1 */

    --warning-border: #ef9f76; /* Frappé peach */

    --table-border-color: #414559;
    --table-header-bg: #51576d;
    --table-alternate-bg: #292c3c;

    --searchbar-border-color: #838ba7;
    --searchbar-bg: #414559;
    --searchbar-fg: #c6d0f5;
    --searchbar-shadow-color: #838ba7;
    --searchresults-header-fg: #949cbb; /* Frappé subtext0 */
    --searchresults-border-color: #737994;
    --searchresults-li-bg: #414559;
    --search-mark-bg: #e5c890; /* Frappé yellow */

    --color-scheme: dark;

    --copy-button-filter: invert(51%) sepia(10%) saturate(393%)
        hue-rotate(198deg) brightness(86%) contrast(87%);
    --copy-button-filter-hover: invert(46%) sepia(20%) saturate(1537%)
        hue-rotate(156deg) brightness(85%) contrast(90%);

    --footnote-highlight: #babbf1; /* Frappé lavender */

    --overlay-bg: rgba(35, 38, 52, 0.4);

    --blockquote-note-color: #8caaee; /* Frappé blue */
    --blockquote-tip-color: #a6d189; /* Frappé green */
    --blockquote-important-color: #ca9ee6; /* Frappé mauve */
    --blockquote-warning-color: #e5c890; /* Frappé yellow */
    --blockquote-caution-color: #e78284; /* Frappé red */

    --sidebar-header-border-color: #8caaee;
}
