.toggle {
  border-radius: 100px;
  width: 26px;
  height: 16px;
  position: relative;
}

/* Increase hit area of toggle. */
.toggle::after {
  content: "";
  inset: -10px;
  position: absolute;
}

.toggle:focus-within {
  box-shadow: 0 0 0 2px var(--global-background), 0 0 0 4px var(--global-focus-border-color);
}

.toggle__track {
  background: var(--toggle-track-normal-background);
  border: 1px solid var(--toggle-track-normal-border-color);
  border-radius: 100px;
  width: 100%;
  height: 100%;
  transition: all 100ms ease;
  position: absolute;
  z-index: 1;
}

.toggle__input:checked ~ .toggle__track {
  background: var(--toggle-track-checked-background);
  border: 1px solid var(--toggle-track-checked-border-color);
}

.toggle__input {
  inset: 0;
  opacity: 0;
  position: absolute;
  z-index: 3;
}

.toggle__knob {
  width: 17px;
  height: 100%;
  top: 0;
  transform: translateX(-1px);
  transition: transform 150ms ease;
  position: absolute;
  z-index: 2;
}

.toggle__input:checked ~ .toggle__knob {
  transform: translateX(10px);
}

.toggle__knob::after {
  content: "";
  background: var(--toggle-knob-normal-background);
  border-radius: 100px;
  position: absolute;
  width: 8px;
  height: 8px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 150ms ease;
}

.toggle__input:checked ~ .toggle__knob::after {
  background: var(--toggle-knob-checked-background);
  width: 12px;
  height: 12px;
}

.toggle__input:checked:hover ~ .toggle__knob::after {
  background: var(--toggle-knob-hover-background);
}
