:host {
  /**
   * @prop --bar-background: Background of the range bar
   * @prop --bar-background-active: Background of the active range bar
   * @prop --bar-height: Height of the range bar
   * @prop --bar-border-radius: Border radius of the range bar
   * @prop --height: Height of the range
   * @prop --knob-background: Background of the range knob
   * @prop --knob-border-radius: Border radius of the range knob
   * @prop --knob-box-shadow: Box shadow of the range knob
   * @prop --knob-size: Size of the range knob
   * @prop --pin-background: Background of the range pin (only available in MD mode)
   * @prop --pin-color: Color of the range pin (only available in MD mode)
   */
  --knob-handle-size: calc(var(--knob-size) * 2);
  display: flex;
  position: relative;
  flex: 3;
  align-items: center;
  font-family: var(--gasco-font-family, inherit);
  user-select: none;
  z-index: 2;
}

:host(.range-disabled) {
  pointer-events: none;
}

::slotted(gasco-label) {
  flex: initial;
}

::slotted(gasco-icon[slot]) {
  font-size: 24px;
}

.range-slider {
  position: relative;
  flex: 1;
  width: 100%;
  height: var(--height);
  contain: size layout style;
  cursor: grab;
  touch-action: pan-y;
}
.range-slider:hover .range-knob::before {
  opacity: 1;
  visibility: visible;
}

:host(.range-pressed) .range-slider {
  cursor: grabbing;
}

.range-pin {
  position: absolute;
  background: var(--gasco-color-base);
  color: var(--gasco-color-contrast);
  text-align: center;
  box-sizing: border-box;
}

.range-knob-handle {
  left: 0;
  top: calc((var(--height) - var(--knob-handle-size)) / 2);
  margin-left: calc(0px - var(--knob-handle-size) / 2);
  position: absolute;
  width: var(--knob-handle-size);
  height: var(--knob-handle-size);
  text-align: center;
}
[dir=rtl] .range-knob-handle, :host-context([dir=rtl]) .range-knob-handle {
  left: unset;
  right: unset;
  right: 0;
}

@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  .range-knob-handle {
    margin-left: unset;
    -webkit-margin-start: calc(0px - var(--knob-handle-size) / 2);
    margin-inline-start: calc(0px - var(--knob-handle-size) / 2);
  }
}
[dir=rtl] .range-knob-handle, :host-context([dir=rtl]) .range-knob-handle {
  /* stylelint-disable-next-line property-disallowed-list */
  left: unset;
}

.range-knob-handle:active, .range-knob-handle:focus {
  outline: none;
}

.range-bar {
  border-radius: var(--bar-border-radius);
  left: 0;
  top: calc((var(--height) - var(--bar-height)) / 2);
  position: absolute;
  width: 100%;
  height: var(--bar-height);
  background: var(--bar-background);
  pointer-events: none;
}
[dir=rtl] .range-bar, :host-context([dir=rtl]) .range-bar {
  left: unset;
  right: unset;
  right: 0;
}

[dir=rtl] .range-bar, :host-context([dir=rtl]) .range-bar {
  /* stylelint-disable-next-line property-disallowed-list */
  left: unset;
}

.range-knob {
  border-radius: var(--knob-border-radius);
  left: calc(50% - var(--knob-size) / 2);
  top: calc(50% - var(--knob-size) / 2);
  position: absolute;
  width: var(--knob-size);
  height: var(--knob-size);
  background: var(--knob-background);
  box-shadow: var(--knob-box-shadow);
  z-index: 2;
  pointer-events: none;
}
[dir=rtl] .range-knob, :host-context([dir=rtl]) .range-knob {
  left: unset;
  right: unset;
  right: calc(50% - var(--knob-size) / 2);
}

[dir=rtl] .range-knob, :host-context([dir=rtl]) .range-knob {
  /* stylelint-disable-next-line property-disallowed-list */
  left: unset;
}

.range-knob::before {
  content: "";
  border-radius: 50%;
  left: calc(50% - 18px);
  top: calc(50% - 18px);
  position: absolute;
  width: 36px;
  height: 36px;
  z-index: -1;
  transition: 300ms;
  visibility: hidden;
  opacity: 0;
  background: rgba(var(--gasco-color-primary-rgb, 0, 163, 224), 0.26);
}
[dir=rtl] .range-knob::before, :host-context([dir=rtl]) .range-knob::before {
  left: unset;
  right: unset;
  right: calc(50% - 18px);
}

:host(.range-pressed) .range-bar-active {
  will-change: left, right;
}

:host(.in-item) {
  width: 100%;
}

:host(.in-item) ::slotted(gasco-label) {
  align-self: center;
}

:host {
  --knob-border-radius: 50%;
  --knob-background: var(--bar-background-active);
  --knob-box-shadow: none;
  --knob-size: 18px;
  --bar-height: 4px;
  --bar-background: rgba(var(--gasco-color-primary-rgb, 0, 163, 224), 0.26);
  --bar-background-active: var(--gasco-color-primary, #00A3E0);
  --bar-border-radius: 20px;
  --height: 42px;
  --pin-background: var(--gasco-color-primary, #00A3E0);
  --pin-color: var(--gasco-color-primary-contrast, #fff);
  padding-left: 14px;
  padding-right: 14px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  :host {
    padding-left: unset;
    padding-right: unset;
    -webkit-padding-start: 14px;
    padding-inline-start: 14px;
    -webkit-padding-end: 14px;
    padding-inline-end: 14px;
  }
}

:host(.gasco-color) .range-bar {
  background: rgba(var(--gasco-color-base-rgb), 0.26);
}

:host(.gasco-color) .range-bar-active,
:host(.gasco-color) .range-knob,
:host(.gasco-color) .range-pin,
:host(.gasco-color) .range-pin::before,
:host(.gasco-color) .range-tick {
  background: var(--gasco-color-base);
  color: var(--gasco-color-contrast);
}

::slotted([slot=start]) {
  margin-left: 0;
  margin-right: 14px;
  margin-top: 0;
  margin-bottom: 0;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  ::slotted([slot=start]) {
    margin-left: unset;
    margin-right: unset;
    -webkit-margin-start: 0;
    margin-inline-start: 0;
    -webkit-margin-end: 14px;
    margin-inline-end: 14px;
  }
}

::slotted([slot=end]) {
  margin-left: 14px;
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  ::slotted([slot=end]) {
    margin-left: unset;
    margin-right: unset;
    -webkit-margin-start: 14px;
    margin-inline-start: 14px;
    -webkit-margin-end: 0;
    margin-inline-end: 0;
  }
}

.range-bar-active {
  bottom: 0;
  width: auto;
  background: var(--bar-background-active);
}

.range-knob {
  transform: scale(0.67);
  transition-duration: 120ms;
  transition-property: transform, background-color, border;
  transition-timing-function: ease;
  z-index: 2;
}

.range-tick {
  position: absolute;
  top: calc((var(--height) - var(--bar-height)) / 2);
  width: var(--bar-height);
  height: var(--bar-height);
  background: var(--bar-background-active);
  z-index: 1;
  pointer-events: none;
}

.range-tick-active {
  background: transparent;
}

.range-pin {
  padding-left: 0;
  padding-right: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: 50%;
  transform: translate3d(0,  0,  0) scale(0.01);
  display: inline-block;
  position: relative;
  min-width: 28px;
  height: 28px;
  transition: transform 120ms ease, background 120ms ease;
  background: var(--pin-background);
  color: var(--pin-color);
  text-align: center;
}
.range-pin::before {
  left: 50%;
  top: 3px;
  margin-left: -13px;
  /* stylelint-disable-next-line property-disallowed-list */
  border-radius: 50% 50% 50% 0;
  position: absolute;
  width: 26px;
  height: 26px;
  transform: rotate(-45deg);
  transition: background 120ms ease;
  background: var(--pin-background);
  content: "";
  z-index: -1;
}
[dir=rtl] .range-pin::before, :host-context([dir=rtl]) .range-pin::before {
  left: unset;
  right: unset;
  right: 50%;
}

@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
  .range-pin::before {
    margin-left: unset;
    -webkit-margin-start: -13px;
    margin-inline-start: -13px;
  }
}
[dir=rtl] .range-pin::before, :host-context([dir=rtl]) .range-pin::before {
  /* stylelint-disable-next-line property-disallowed-list */
  left: unset;
}

.range-knob-pressed .range-pin {
  transform: translate3d(0,  -24px,  0) scale(1);
}

:host(:not(.range-has-pin)) .range-knob-pressed .range-knob {
  transform: scale(1);
}

:host(.range-disabled) .range-bar,
:host(.range-disabled) .range-tick {
  background-color: #EBEBEB;
}

:host(.range-disabled) .range-bar.range-bar-active {
  background-color: var(--gasco-color-light-contrast, #CCCCCC);
}

:host(.range-disabled) .range-knob {
  background-color: var(--gasco-color-light-contrast, #CCCCCC);
}