/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
@forward "./style/themecolors";

$uicore-scrollbar-width: 12px;
$uicore-scrollbar-padding: 2px;

@mixin uicore-scrollbar(
  $color: hsl(var(--iui-color-foreground-hsl) / var(--iui-opacity-4)),
  $width: $uicore-scrollbar-width,
  $padding: $uicore-scrollbar-padding
) {
  &::-webkit-scrollbar {
    width: $width;
    height: $width;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: $width;
    background-color: $color;
    background-clip: content-box;
    border-style: solid;
    border-color: transparent;
    border-width: $padding;

    &:hover {
      background-color: hsl(
        var(--iui-color-foreground-hsl) / var(--iui-opacity-3)
      );
    }
  }

  &::-webkit-scrollbar-corner {
    background-color: transparent;
  }

  &::-webkit-scrollbar-track-piece:corner-present {
    margin-bottom: -2 * $padding;
    margin-right: -2 * $padding;
  }
}

@mixin uicore-hidden-scrollbar {
  &::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

@mixin uicore-touch-scrolling {
  @supports (-webkit-overflow-scrolling: touch) {
    overflow-y: scroll; /* overflow-y has to be scroll, not auto */
    -webkit-overflow-scrolling: touch;
  }
}
