//
//  Variables
//  --------------------------------------------
@amsearch-text-clamp__font__size: 14;
@amsearch-text-clamp__lines: 2;
@amsearch-text-clamp__height: unit(round(@amsearch-text-clamp__font__size * (@amsearch-text-clamp__font__size / 10) * @amsearch-text-clamp__lines), px);

//
//  Mixins
//  _____________________________________

.am-scrollbar(
    @color: #adadad,
    @second-color: #f0f0f0,
    @direction: y,
    @width: 4px,
    @shadow-color: #fff
) {
    & {
        overflow: hidden;
        /* phpcs:ignore Magento2.Less.BracesFormatting.SpacingBeforeOpen, Magento2.Less.BracesFormatting.SpacingBeforeClose */
        overflow-@{direction}: auto;
        scrollbar-color: @color rgba(255, 255, 255, .2);
        scrollbar-width: thin;
    }

    &::-webkit-scrollbar {
        background: @second-color;
    }

    &::-webkit-scrollbar-thumb {
        background: @color;
        border-radius: @width;
        cursor: pointer;
    }

    ::-webkit-scrollbar-track {
        box-shadow: inset 0 0 5px @shadow-color;
    }

    & when not (@direction = x) {
        &::-webkit-scrollbar {
            width: @width;
        }

        &::-webkit-scrollbar-thumb {
            width: @width;
        }

        ::-webkit-scrollbar-track {
            width: @width;
        }
    }

    & when not (@direction = y) {
        &::-webkit-scrollbar {
            height: @width;
        }

        &::-webkit-scrollbar-thumb {
            height: @width;
        }

        ::-webkit-scrollbar-track {
            height: @width;
        }
    }
}

.am-text-clamp {
    display: block;
    font-size: unit(@amsearch-text-clamp__font__size, px);
    line-height: (@amsearch-text-clamp__font__size / 10);
    max-height: @amsearch-text-clamp__height;
    min-height: @amsearch-text-clamp__height;
    overflow: hidden;
}

.am-word-break {
    & {
        word-break: break-word;
        word-wrap: break-word;
    }

    .ie11 & {
        word-break: break-all;
    }
}

.amsearch-keyframes(@name, @rules) {
    @-webkit-keyframes @name {
        @rules();
    }

    @-moz-keyframes @name {
        @rules();
    }

    @-ms-keyframes @name {
        @rules();
    }

    @-o-keyframes @name {
        @rules();
    }

    @keyframes @name {
        @rules();
    }
}
