@use '_variables' as *;
@use '_mixins' as *;

input {
  position: absolute;
  width: 0;
  height: 0;
  left: -100px;

  + label {
    cursor: pointer;
    text-indent: -9999px;
    width: 35px;
    height: 20px;
    background: pvar(--input-bg);
    display: block;
    border-radius: 100px;
    position: relative;
    margin: 0;

    &::after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 14px;
      height: 14px;
      background: pvar(--fg-300);
      border-radius: 50%;
      transition: 0.3s ease-out;
    }

    &:active::after {
      width: 40px;
    }
  }

  &:checked + label {
    background: pvar(--primary);

    &::after {
      left: calc(100% - 3px);
      transform: translateX(-100%);
      background: pvar(--on-primary);
    }
  }

  &:focus-visible + label {
    box-shadow: $focus-box-shadow-form;
  }
}
