/*
    Mixin to progressively-enhance :focus-visible, keeping :focus where not supported
    Add an arbitrary list of selectors into the arguments, and the styling in the block.
    I you pass no selectors to the mixin the parent ("ampersand") operator is used instead.

    There are two mixins: 
    - focus-visible: a generic focus-visible, giving you "slots" to decide what to render for :focus, :focus reset, and :focus-visible
    - focus-visible-outline: a focus-visible, which only resets the outline. If you don't need more custom resets, use this one!

    Use focus-visible:
    The key thing here is checking which slot is being rendered.
    For example, you can reset box-shadow here, or anything else.

    @include focus-visible using ($slot) {
        @if $slot == focus {
            outline: 2px solid transparent;
            box-shadow: 0 0 0 4px blue;
        }
        @if $slot == focusReset {
            box-shadow: none;
        }
        @if $slot == focusVisible {
            box-shadow: 0 0 0 4px blue;
        }
    }

    Use focus-visible-outline:
    @include focus-visible-outline("button", "a[href]") {
        outline: 2px solid blue;
    }

    Resulting CSS (compressed):

    button:focus,
    a[href]:focus {
        outline: 2px solid blue;
    }

    button:focus:not(:focus-visible),
    a[href]:focus:not(:focus-visible) {
        outline: none;
    }
    button:focus-visible,
    a[href]:focus-visible {
        outline: 2px solid blue;
    }
*/
.uic-switch {
  /**
      @prop --uic-switch-background: the default background
      @prop --uic-switch-background-active: the background in active state
      @prop --uic-switch-background-checked: the background in checked state 
      @prop --uic-switch-background-disabled: the background in disabled state

      @prop --uic-switch-border: the default border
      @prop --uic-switch-border-checked: the border in checked state 
      @prop --uic-switch-border-disabled: the border in disabled state 
      @prop --uic-switch-border-focus: the border in focus state 

      @prop --uic-switch-thumb-width: the width of the thumb
      @prop --uic-switch-thumb-height: the height of the thumb

      @prop --uic-switch-track-width: the width of the track where the thumb moves
  */
  display: inline-block;
  box-sizing: border-box;
}
.uic-switch__label {
  display: block;
  padding: 12px 8px;
}
.uic-switch__label-slot {
  font-size: var(--uic-font-size-normal);
  line-height: var(--uic-line-height-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--uic-color-black);
}
.uic-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.uic-switch__track {
  position: relative;
  width: var(--uic-switch-track-width);
  cursor: pointer;
}
.uic-switch__track::before {
  position: absolute;
  content: "";
  width: 100%;
  top: 50%;
  height: 2px;
  background: var(--uic-color-grey2);
}
.uic-switch__thumb {
  position: relative;
  height: var(--uic-switch-thumb-height);
  width: var(--uic-switch-thumb-width);
  background: var(--uic-color-white);
  transition: transform 0.3s ease-out;
}
.uic-switch__thumb::before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  content: "";
  border: var(--uic-switch-border);
  background: var(--uic-switch-background);
  box-shadow: 0 2px 4px 0 var(--uic-atom-shadow-color-primary), 0 2px 8px 0 var(--uic-atom-shadow-color-secondary);
}
.uic-switch__thumb:hover::before {
  border: var(--uic-switch-border-hover);
}
.uic-switch--checked .uic-switch__thumb {
  transform: translateX(calc(var(--uic-switch-track-width) - var(--uic-switch-thumb-width)));
}
.uic-switch--checked .uic-switch__thumb::before {
  box-shadow: 0 2px 8px 0 var(--uic-color-blue2a25);
  background: var(--uic-switch-background-checked);
  border: var(--uic-switch-border-checked);
}
.uic-switch--disabled .uic-switch__thumb::before {
  box-shadow: none;
  border: var(--uic-switch-border-disabled);
  background: var(--uic-switch-background-disabled);
}
.uic-switch--has-label .uic-switch__label {
  padding: 2px 8px 8px;
}
.uic-switch--has-label .uic-switch__label-slot {
  padding-bottom: 4px;
}
.uic-switch__input:active + .uic-switch__track .uic-switch__thumb::before, .uic-switch__label:active .uic-switch__thumb::before {
  box-shadow: none;
  background: var(--uic-switch-background-active);
}
.uic-switch__input:focus + .uic-switch__track .uic-switch__thumb::before {
  border: var(--uic-switch-border-focus);
}