@mixin clipped() {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

@mixin unclipped() {
    clip: auto;
    height: auto;
    overflow: visible;
    white-space: normal;
    width: auto;
}

@mixin truncate() {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@mixin image-treatment($border-radius: 8px, $display: flex) {
    align-items: center;
    border-radius: $border-radius;
    display: $display;
    justify-content: center;
    overflow: hidden;
    position: relative;

    &::after {
        background: rgba(0, 0, 0, 0.05);
        bottom: 0;
        content: "";
        display: block;
        left: 0;
        pointer-events: none;
        position: absolute;
        right: 0;
        top: 0;
    }

    > img {
        display: inline-block;
        max-height: 100%;
        max-width: 100%;
        object-fit: contain;
    }
}

@mixin flex-items-centered($display: flex) {
    align-items: center;
    display: $display;
    justify-content: center;
}

@mixin inline-flex-items-centered() {
    @include flex-items-centered(inline-flex);
}

@mixin scrollbars-permanent($target) {
    #{$target} {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        /* stylelint-disable declaration-block-no-duplicate-properties */
        -webkit-scroll-snap-type: mandatory;
        -webkit-scroll-snap-type: x mandatory;
        -ms-scroll-snap-type: mandatory;
        -ms-scroll-snap-type: x mandatory;
        scroll-snap-type: proximity;
        scroll-snap-type: x proximity;
        /* stylelint-enable declaration-block-no-duplicate-properties */
    }

    #{$target}::-webkit-scrollbar {
        background-color: var(--color-background-faint);
        border-radius: 12px;
    }

    #{$target}::-webkit-scrollbar:vertical {
        width: 6px;
    }

    #{$target}::-webkit-scrollbar:horizontal {
        height: 6px;
    }

    #{$target}::-webkit-scrollbar-thumb {
        background-color: var(--color-foreground-secondary);
        border-color: transparent;
        border-radius: 12px;
        border-right-style: inset;
        box-shadow: none;
    }
}
