@use "sass:meta";
@use "sass:math";

$ds-btn__min-clickable-area: 48px;

@function ds-px-to-rem($value) {
  @return math.div(ds-strip-unit($value), 16) * 1rem;
}

@function ds-strip-unit($number) {
  @if meta.type-of($number) == "number" and not math.is-unitless($number) {
    @return math.div($number, ($number * 0 + 1));
  }

  @return $number;
}

@mixin ds-hide-scrollbars() {
  scrollbar-width: none; // hide scrollbar in Firefox
  -ms-overflow-style: none; // hide scrollbar in IE

  &::-webkit-scrollbar {
    display: none; // hide scrhollbar in chrome, edge & safari
  }
}

@mixin min-click-surface() {
  &::after {
    content: "";
    position: absolute;
    min-height: $ds-btn__min-clickable-area;
    min-width: $ds-btn__min-clickable-area;
    width: 100%;

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}
