@import (reference) "../exports/constants-helpers.less";
@import (reference) "../base/configuration-static.less";
@import (reference) "../base/internal.less";

.truncation(@count) {
    // Despite these all being webkit-specific properties, this works across
    // Safari, Chrome, Edge, and Firefox.
    display: -webkit-box;
    -webkit-line-clamp: @count;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis !important;
    white-space: nowrap;
}

.v-truncate1 {
    .truncation(1);
}

.v-truncate2 {
    .truncation(2);
}

.v-truncate3 {
    .truncation(3);
}

.v-truncate4 {
    .truncation(4);
}

.v-truncate5 {
    .truncation(5);
}

.v-truncate-fade {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 9em), transparent);
    mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 9em), transparent);
    max-height: calc(var(--lh-md) * 12em);

    &.v-truncate-fade__sm {
        -webkit-mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 3em), transparent);
        mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 3em), transparent);
        max-height: calc(var(--lh-md) * 6em);
    }

    &.v-truncate-fade__lg {
        -webkit-mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 21em), transparent);
        mask-image: linear-gradient(180deg, #000 calc(var(--lh-md) * 21em), transparent);
        max-height: calc(var(--lh-md) * 24em);
    }
}
