/* variables */
:root {
  /* colors */
  --sk7-color-primary-hsl: 250, 84%, 54%;
  --sk7-color-bg-hsl: 0, 0%, 100%;
  --sk7-color-contrast-high-hsl: 230, 7%, 23%;
  --sk7-color-contrast-higher-hsl: 230, 13%, 9%;
  --sk7-color-bg-darker-hsl: 240, 4%, 90%;
  --sk7-color-white-hsl: 0, 0%, 100%;
}

/* component */
:root {
  /* style */
  --switch-width: 54px;
  --switch-height: 22px;
  --switch-padding: 3px;
  /* animation */
  --switch-animation-duration: 0.2s;
}

.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  width: var(--switch-width);
  height: var(--switch-height);
  border-radius: 50em;
  padding: var(--switch-padding) 0;
}

.switch__input, .switch__label {
  position: absolute;
  left: 0;
  top: 0;
}

.switch__input {
  margin: 0;
  padding: 0;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}
.switch__input:checked + .switch__label {
  background-color: green;
}
.switch__input:checked + .switch__label + .switch__marker {
  left: calc(100% - var(--switch-height) + var(--switch-padding));
}
.switch__input:focus + .switch__label, .switch__input:active + .switch__label {
  box-shadow: 0 0 0 2px hsla(var(--sk7-color-contrast-higher-hsl), 0.2);
}
.switch__input:checked:focus + .switch__label, .switch__input:checked:active + .switch__label {
  box-shadow: 0 0 0 2px hsla(var(--sk7-color-primary-hsl), 0.2);
}

.switch__label {
  width: 100%;
  height: 100%;
  color: transparent;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  background-color: hsl(var(--sk7-color-bg-darker-hsl));
  border-radius: inherit;
  z-index: 1;
  transition: var(--switch-animation-duration);
  overflow: hidden;
}

.switch__marker {
  position: relative;
  background-color: hsl(var(--sk7-color-white-hsl));
  width: calc(var(--switch-height) - var(--switch-padding) * 2);
  height: calc(var(--switch-height) - var(--switch-padding) * 2);
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0.1px 0.3px rgba(0, 0, 0, 0.06),0 1px 2px rgba(0, 0, 0, 0.12);
  left: var(--switch-padding);
  transition: left var(--switch-animation-duration);
  will-change: left;
}