.ds-form-checkbox__box {
  background: var(--ds-color-london-100);
  border: 0.0625rem solid var(--ds-color-london-35);
  border-radius: 0.25rem;
  cursor: pointer;
  height: 1.25rem;

  /* prevents collapsing from multiple lines */
  min-width: 1.25rem;
  pointer-events: none;

  /* so we can pass the pointer events through to the input */
  position: relative;
  width: 1.25rem;
  &::after {
    background: transparent;
    border: 0.125rem solid var(--ds-color-london-100);
    border-right: none;
    border-top: none;
    content: '';
    height: 0.25rem;
    left: 0.25rem;
    opacity: 0;
    position: absolute;
    top: 0.375rem;
    transform: rotate(-45deg);
    width: 0.5625rem;
  }
}

.ds-form-checkbox {
  align-items: flex-start;
  display: flex;
  flex-direction: row;
  .ds-form-check-label {
    margin-left: 0.5rem;
  }
  input {
    -webkit-appearance: none;
    appearance: none;
    border: 0.0625rem solid transparent;
    border-radius: 0.25rem;

    /* need to match the size of the box */
    box-sizing: content-box;
    cursor: pointer;
    height: 1.25rem;
    margin: 0;
    min-width: 1.25rem;
    opacity: 0;
    position: absolute;
    width: 1.25rem;
    &:checked + .ds-form-checkbox__box {
      background: var(--ds-color-london-20);
      border-color: var(--ds-color-london-5);
    }
    &:checked + .ds-form-checkbox__box::after {
      opacity: 1;
    }
    &:focus + .ds-form-checkbox__box {
      box-shadow: 0 0 0 0.125rem var(--ds-color-hong-kong-55);
      outline: solid transparent;
    }
    &:disabled {
      &,
      & ~ .ds-form-check-label {
        cursor: not-allowed;
      }
      & + .ds-form-checkbox__box {
        background-color: var(--ds-color-london-100);
        border-color: var(--ds-color-london-70);
      }
      & + .ds-form-checkbox__box::after {
        border-color: var(--ds-color-london-70);
      }
    }
  }
  &.ds-form-checkbox--indeterminate {
    input {
      + .ds-form-checkbox__box {
        background-color: var(--ds-color-london-20);
        border-color: var(--ds-color-london-5);
        &::after {
          background-color: var(--ds-color-london-100);
          border: none;
          height: 0.125rem;
          left: 0.25rem;
          opacity: 1;
          top: 0.5625rem;
          transform: rotate(0deg);
          width: 0.75rem;
        }
      }
      &:disabled + .ds-form-checkbox__box {
        background-color: var(--ds-color-london-100);
        border-color: var(--ds-color-london-70);
      }
      &:disabled + .ds-form-checkbox__box::after {
        background-color: var(--ds-color-london-70);
      }
    }
  }
}
