@use "./config";
@use "../../../../styles/tokens/base";
@use "../../../../styles/tokens/color";
@use "../../../../styles/tokens/space";
@use "../../../../styles/tools/convert";
@use "../../../../styles/tools/generate";

@mixin slider() {
  @include generate.css-map(config.$base);
}

@mixin slider-width($width, $config: config.$widths) {
  @include generate.css-map($config, $width);
}

@mixin cursor() {
  cursor: inherit !important;
}

@mixin touch-area() {
  position: absolute;
  height: 100%;
  width: 100%;
}

@mixin target() {
  position: relative;
  direction: ltr;

  &,
  * {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: var(--color-background-contrast);
    touch-action: none;
    user-select: none;
    box-sizing: border-box;
  }
}

@mixin base-and-connects() {
  width: 100%;
  position: relative;
  z-index: 1;
}

@mixin connect-and-origin() {
  will-change: transform;
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  transform-origin: 0 0;
}

@mixin tap-transition() {
  transition: transform 0.3s;
}

@mixin base() {
  background: var(--color-surface-moderate);
  height: config.$slider-size;
  margin-bottom: space.get("small");
}

@mixin connects() {
  overflow: hidden;
  z-index: 0;
  height: 100%;
}

@mixin connect() {
  background: var(--color-surface-secondary);
  height: 100%;
  width: 100%;
}

@mixin origin() {
  width: 100%;
  height: 100%;
}

@mixin handle() {
  position: absolute;
  left: auto;
  right: -#{space.get("small")};
  cursor: default;

  @include generate.css-map(config.$handle);

  &:focus {
    @include base.focusring-round;
  }
}

@mixin value() {
  position: absolute;
  padding-top: convert.to-rem(2px);
  white-space: nowrap;
  text-align: center;
  font-weight: bold;
  font-size: convert.to-rem(14px);
  transform: translate(-50%, 50%);
}

@mixin value-sub() {
  color: var(--color-surface-moderate);
}

@mixin pips() {
  height: convert.to-rem(24px);
  margin-bottom: space.get("small");
  top: 100%;
  left: 0;
  width: 100%;
}

@mixin marker() {
  position: absolute;
  background: var(--color-surface-moderate);
  margin-left: -1px;
  width: 2px;
  height: 5px;
}

@mixin marker-sub() {
  height: 10px;
}

@mixin marker-large() {
  height: 10px;
}

@mixin disabled() {
  cursor: not-allowed;
}

@mixin disabled-connect() {
  background: var(--color-surface-moderate);
}
