@use "variable";
@use "mixin_icons";

@media print {
    button.copy {
        display: none;
    }
}

div[class^='highlight-'] {
    position: relative;
}

div.highlight {
    @include mixin_icons.icons(("copy"));

    button.copy {
        border-radius: variable.$border-radius;
        transition: .25s ease opacity;
        background: var(--bg-color3);
        position: absolute;
        cursor: pointer;
        padding: .25em;
        right: .25em;
        top: .5em;
        opacity: .5;

        &::before {
            display: block;
            content: '';
            width: 1.25rem;
            height: 1.25rem;
            background-color: var(--text-color3);
            mask-image: var(--icon-copy);
            mask-repeat: no-repeat;
        }
    }

    &:hover button.copy {
        opacity: 1;
        background: var(--bg-color2);
    }
}

.code-shell div.highlight {

    button.copy {
        right: -0.25rem;
        top: -.125rem;
        opacity: 0.25;

        &::before {
            width: 1.125rem;
            height: 1.125rem;
            mask-size:cover;
        }
    }

    &:hover button.copy {
        opacity: 1;
    }
}

/* Collections */
.tocwrapper .collections {
    .sub-header {
        user-select: none;
        cursor: pointer;

        &:before {
            font-size: 1.5em;
            padding-right: .5em;
            font-family: monospace;
            content: "+";
        }

        &:hover:before {
            color: var(--accent-color);
        }
    }

    .group {
        margin-bottom: .5em;
    }

    ul {
        overflow: hidden;
        margin: 0;
    }

    .span-ul {
        display: grid;
        grid-template-rows: 0fr;
        transition: opacity .25s ease, grid-template-rows .25s ease;
        opacity: 0;
    }
}

.tocwrapper .collection-collapse {
    display: none;
}

.tocwrapper .collection-collapse:checked ~ .span-ul {
    grid-template-rows: 1fr;
    opacity: 1;
}

.tocwrapper .collection-collapse:checked ~ .sub-header:before {
    content: "-";
}
