.slider {
  height: 100%;

  &#{&}--marks-label-alignment-inside#{&}--horizontal :global(.wsr-slider-mark-text):first-child &__mark-value {
    transform: translateX(45%);
  }

  &#{&}--marks-label-alignment-inside#{&}--horizontal :global(.wsr-slider-mark-text):last-child &__mark-value {
    transform: translateX(-45%);
  }

  &#{&}--marks-label-alignment-inside :global(.wsr-slider-mark-text):first-child &__mark-value {
    transform: translateY(-25%);
  }

  &#{&}--marks-label-alignment-inside :global(.wsr-slider-mark-text):last-child &__mark-value {
    transform: translateY(25%);
  }

  &#{&}--horizontal {
    width: 100%;
  }

  & :global(.wsr-slider) {
    position: relative;
    height: calc(var(--wds-slider-track-size, 4px) + 2 * 4px);
    width: 100%;
    touch-action: none;
    box-sizing: border-box;
    margin: 9px 0 6px 0;
  }

  &#{&}--has-gradient :global(.wsr-slider) {
    height: calc(var(--wds-slider-track-size-transparent, 8px) + 2 * 4px);
    width: 100%;
    margin: 6px 0 6px 0;
  }

  & :global(.wsr-slider.wsr-slider-vertical) {
    width: calc(var(--wds-slider-track-size, 4px) + 2 * 4px);
    height: 100%;
    margin: 0 9px 0 6px;
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical) {
    width: calc(var(--wds-slider-track-size-transparent, 8px) + 2 * 4px);
    height: 100%;
    margin: 0 6px 0 6px;
  }

  & :global(.wsr-slider:not(.wsr-slider-disabled)) {
    cursor: pointer;
  }

  & :global(.wsr-slider)::before {
    content: '';
    position: absolute;
    top: -12px;
    bottom: -12px;
    left: 0;
    right: 0;
  }

  &#{&}--has-gradient :global(.wsr-slider)::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 0;
    right: 0;
  }

  & :global(.wsr-slider.wsr-slider-vertical)::before {
    content: '';
    position: absolute;
    left: -12px;
    right: -12px;
    top: 0;
    bottom: 0;
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical)::before {
    content: '';
    position: absolute;
    left: -10px;
    right: -10px;
    top: 0;
    bottom: 0;
  }

  & :global(.wsr-slider-with-marks) {
    height: calc(var(--wds-slider-track-size, 4px) + 2 * 4px + 6px + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 12px + 18px);
    margin-bottom: 0;
  }

  &#{&}--has-gradient :global(.wsr-slider-with-marks) {
    height: calc(var(--wds-slider-track-size-transparent, 8px) + 2 * 4px + 6px + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 12px + 18px);
    margin-bottom: 0;
  }

  & :global(.wsr-slider-rail) {
    position: absolute;
    width: 100%;
    background-color: var(--wds-slider-track-color, var(--wds-color-fill-standard-secondary, #d6e6fe));
    height: var(--wds-slider-track-size, 4px);
    border-radius: var(--wds-slider-track-border-border-radius, var(--wds-border-radius-full, 10px));
    margin: 4px 0;
  }

  & :global(.wsr-slider-with-marks)::before {
    content: '';
    position: absolute;
    top: -12px;
    bottom: 0;
    left: 0;
    right: 0;
  }

  &#{&}--has-gradient :global(.wsr-slider-rail) {
    width: 100%;
    height: var(--wds-slider-track-size-transparent, 8px);
    margin: 4px 0;
  }

  & :global(.wsr-slider.wsr-slider-vertical .wsr-slider-rail) {
    position: absolute;
    height: 100%;
    width: var(--wds-slider-track-size, 4px);
    margin: 0 4px;
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical .wsr-slider-rail) {
    width: var(--wds-slider-track-size-transparent, 8px);
    height: 100%;
    box-shadow: inset 0 0 0 1px var(--wds-color-border-transparent-primary, rgba(0, 6, 36, 0.2));
    margin: 0 4px;
  }

  & :global(.wsr-slider-track) {
    position: absolute;
    left: 0;
    background-color: var(--wds-color-fill-standard-primary, #116dff);
    height: var(--wds-slider-track-size, 4px);
    border-radius: var(--wds-slider-track-border-border-radius, var(--wds-border-radius-full, 10px));
    margin: 4px 0;
  }

  & :global(.wsr-slider-disabled .wsr-slider-track) {
    background-color: var(--wds-slider-track-color-disabled, var(--wds-color-black-500, rgba(0, 6, 36, 0.1)));
  }

  &#{&}--has-gradient :global(.wsr-slider-track) {
    display: none;
  }

  & :global(.wsr-slider.wsr-slider-vertical .wsr-slider-track) {
    position: absolute;
    top: 0;
    background-color: var(--wds-color-fill-standard-primary, #116dff);
    width: var(--wds-slider-track-size, 4px);
    border-radius: var(--wds-slider-track-border-border-radius, var(--wds-border-radius-full, 10px));
    height: 100%;
    margin: 0 4px;
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical .wsr-slider-track) {
    display: none;
  }

  & :global(.wsr-slider-mark) {
    position: absolute;
    top: calc(var(--wds-slider-track-size, 4px) + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 4px + 6px);
    left: 0;
    width: 100%;
  }

  &#{&}--has-gradient :global(.wsr-slider-mark) {
    top: calc(var(--wds-slider-track-size-transparent, 8px) + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 4px + 6px);
    width: 100%;
  }

  & :global(.wsr-slider.wsr-slider-vertical .wsr-slider-mark) {
    position: absolute;
    top: 0;
    left: calc(var(--wds-slider-track-size, 4px) + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 4px + 6px);
    height: 100%;
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical .wsr-slider-mark) {
    left: calc(var(--wds-slider-track-size-transparent, 8px) + var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px)) + 4px + 6px);
    height: 100%;
  }

  & :global(.wsr-slider-mark-text) {
    position: absolute;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    color: var(--wds-color-text-standard-primary, #000624);
  }

  & :global(.wsr-slider-mark-text-active) {
    color: var(--wds-color-text-standard-primary, #000624);
  }

  & :global(.wsr-slider-step) {
    position: absolute;
    width: 100%;
    height: var(--wds-slider-track-size, 4px);
    background: transparent;
    margin: 4px 0;
  }

  &#{&}--has-gradient :global(.wsr-slider-step) {
    width: 100%;
    height: var(--wds-slider-track-size-transparent, 8px);
    margin: 4px 0;
  }

  & :global(.wsr-slider.wsr-slider-vertical .wsr-slider-step) {
    height: 100%;
    width: var(--wds-slider-track-size, 4px);
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical .wsr-slider-step) {
    height: 100%;
    width: var(--wds-slider-track-size-transparent, 8px);
  }

  & :global(.wsr-slider-disabled .wsr-slider-rail) {
    background-color: var(--wds-color-black-700, rgba(0, 6, 36, 0.1));
  }

  & :global(.wsr-slider-disabled .wsr-slider-track) {
    background-color: var(--wds-slider-track-color-disabled, var(--wds-color-black-500, #acafc4));
  }

  & :global(.wsr-slider.wsr-slider-vertical.wsr-slider-disabled .wsr-slider-track) {
    background-color: var(--wds-color-black-500, #acafc4);
  }

  &#{&}--has-gradient :global(.wsr-slider.wsr-slider-vertical.wsr-slider-disabled .wsr-slider-track) {
    background-color: var(--wds-color-black-500, #acafc4);
  }

  &#{&}--horizontal .slider-handle {
    align-items: center;
    width: 100%;
    height: calc(var(--wds-slider-track-size, 4px) + 2 * 4px);
  }

  &#{&}--horizontal#{&}--has-gradient .slider-handle {
    height: calc(var(--wds-slider-track-size-transparent, 8px) + 2 * 4px);
  }

  &:not(&--horizontal) .slider-handle {
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: calc(var(--wds-slider-track-size, 4px) + 2 * 4px);
  }

  &:not(&--horizontal)#{&}--has-gradient .slider-handle {
    width: calc(var(--wds-slider-track-size-transparent, 8px) + 2 * 4px);
  }

  & &__mark-line {
    position: relative;
    margin: auto;
    width: 1px;
    height: var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px));
    background-color: var(--wds-color-black-500, #acafc4);
  }

  :global(.wsr-slider.wsr-slider-vertical) &__mark-line {
    position: relative;
    margin: auto;
    height: 1px;
    width: var(--wds-slider-slider-mark-size, var(--wds-space-100, 6px));
    background-color: var(--wds-color-black-500, #acafc4);
  }

  & &__mark-value {
    position: relative;
    margin-top: 12px;
  }

  :global(.wsr-slider.wsr-slider-vertical) &__mark-value {
    position: relative;
    margin-top: 0;
    margin-left: 12px;
  }

  &:not(&--horizontal) &__mark {
    display: flex;
    flex-direction: row;
    align-items: center;
  }
}

.slider-handle {
  position: absolute;
  display: flex;
  pointer-events: none;

  & &__handle {
    position: absolute;
    box-sizing: border-box;
    touch-action: pan-x;
    /* stylelint-disable-next-line plugin/use-baseline */
    outline: none;
    pointer-events: auto;
  }

  &#{&}--disabled &__thumb {
    border-color: var(--wds-color-black-500, #acafc4);
    background-color: var(--wds-slider-slider-knob-color-disabled, var(--wds-color-black-500, #acafc4));
  }

  &#{&}--hovered:not(&--disabled) &__thumb {
    border-color: var(--wds-color-fill-standard-primary-hover, #116dff);
    background-color: var(--wds-slider-slider-knob-color-hover, var(--wds-color-fill-standard-primary-hover, #116dff));
    transform: scale(1.5);
  }

  &#{&}--has-gradient#{&}--hovered:not(&--disabled) &__thumb {
    transform: scale(1.375);
  }

  & &__thumb {
    margin: auto;
    width: var(--wds-slider-slider-knob-size, 12px);
    height: var(--wds-slider-slider-knob-size, 12px);
    border-radius: 50%;
    border: var(--wds-slider-slider-knob-border-width, 0) solid var(--wds-color-fill-standard-primary, #116dff);
    background-color: var(--wds-slider-slider-knob-color, var(--wds-color-fill-standard-primary, #116dff));
    box-shadow: var(--wds-slider-slider-knob-shadow);
  }

  :global(.wsr-slider.wsr-slider-disabled) &:not(&--has-gradient) &__thumb {
    box-shadow: 0 0 0 0;
  }

  &#{&}--has-gradient &__thumb {
    border: none;
    box-shadow: inset 0 0 0 2px var(--wds-color-fill-standard-tertiary, #ffffff);
    width: var(--wds-slider-slider-knob-size-transparent, 16px);
    height: var(--wds-slider-slider-knob-size-transparent, 16px);
  }

  /* local focus ring on the thumb, driven by the rc-slider handle's focus */
  &:not(&--hovered):not(&--disabled) &__handle:focus-visible &__thumb {
    position: relative;
    /* stylelint-disable-next-line plugin/use-baseline */
    outline: var(--wds-outline-focus-outer, 3px solid #116dff);
    outline-offset: 1px;
    z-index: 2;
  }

  /* the gap band, anchored to the thumb's border-box (the knob border is
     themeable, so the overlay's padding-box anchor is pulled outward) */
  &:not(&--hovered):not(&--disabled) &__handle:focus-visible &__thumb::before {
    content: '';
    position: absolute;
    inset: calc(var(--wds-slider-slider-knob-border-width, 0) * -1);
    pointer-events: none;
    border-radius: inherit;
    /* stylelint-disable-next-line plugin/use-baseline */
    outline: var(--wds-outline-focus-inner, 1px solid #ffffff);
  }

  &#{&}--has-gradient:not(&--hovered):not(&--disabled) &__handle:focus-visible &__thumb {
    box-shadow: inset 0 0 0 2px var(--wds-color-white, #ffffff);
  }

  &:not(&--disabled) &__handle:focus &__thumb {
    box-shadow: 0 0 0 3px transparent;
    /* rc-slider focus overwrite */
    z-index: 2;
  }

  &#{&}--has-gradient:not(&--disabled) &__handle:focus &__thumb {
    box-shadow: inset 0 0 0 2px var(--wds-color-white, #ffffff);
  }
}
