@mixin with-details-base($self) {
  display: inline-block;
  flex-grow: 1;

  --visual-input-size: 18px;

  #{ $self }__inner {
    @apply c-border c-border-outline c-rounded-lg c-text-onSurface c-bg-surfaceBright c-state-interactive c-transition-colors;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;

    padding: spacing(sm);

    cursor: pointer;

    gap: spacing(xs);
  }

  #{ $self }__icon {
    flex-shrink: 0;
    margin: 0;
  }

  #{ $self }__illustration {
    @apply c-rounded-lg;

    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: cover;
  }

  #{ $self }__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
  }

  #{ $self }__title {
    @apply c-text-onSurface;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
  }

  #{ $self }__description {
    @apply c-text-onSurfaceVariant;
    font-family: font-family(base);
    font-size: 14px;
    line-height: 20px;
  }

  #{ $self }__input {
    @apply c-sr-only;

    // https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
    white-space: nowrap;

    & + #{ $self }__inner #{ $self }__visual-input {
      @apply c-border-onPrimaryContainer c-border-2;
      position: relative;
      top: 3px;

      display: flex;

      flex: 0 0 auto;
      align-items: center;
      justify-content: center;
      width: var(--visual-input-size);
      height: var(--visual-input-size);

      box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.08);

      cursor: pointer;
    }

    &:focus-visible + #{ $self }__inner {
      @apply c-outline-onPrimaryContainer;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
      outline-style: dashed;
      outline-width: 1px;
    }

    &:checked + #{ $self }__inner {
      @apply c-border c-border-onPrimaryContainer c-text-onPrimaryContainer c-bg-primaryContainer c-state-interactive c-transition-interactive;
    }

    &:checked + #{ $self }__inner .cobalt-Icon {
      @apply c-fill-onPrimaryContainer;
    }

    &:checked + #{ $self }__inner #{ $self }__visual-input {
      @apply c-border-onPrimaryContainer;
    }

    &:checked + #{ $self }__inner #{ $self }__title,
    &:checked + #{ $self }__inner #{ $self }__description {
      @apply c-text-onPrimaryContainer;
    }

    &[disabled] + #{ $self }__inner {
      @apply c-state-none;
      opacity: 0.7;
      cursor: not-allowed;
    }

    &[disabled] + #{ $self }__inner #{ $self }__visual-input {
      box-shadow: none;
    }

    &[disabled]:not(:checked) + #{ $self }__inner #{ $self }__visual-input {
      @apply c-border-onSurfaceDisabled;
    }

    &[disabled]:checked + #{ $self }__inner #{ $self }__visual-input {
      opacity: 0.7;
    }
  }

  &--noDescription {
    #{ $self }__inner {
      align-items: center !important;

      #{ $self }__visual-input {
        top: 0 !important;
      }
    }
  }
}

@mixin form-input-base($container) {
  --cobalt-form-input-border-radius: 8px;
  @apply c-text-onSurface c-border c-border-outlineVariant c-bg-surfaceBright c-transition-colors;

  @include withContext(#{$container}--success) {
    @apply c-border-success;

    &:not(:disabled):hover,
    &:not(:disabled):focus {
      @apply c-border-success;
    }
  }

  @include withContext(#{$container}--error) {
    @apply c-border-error;

    &:not(:disabled):hover,
    &:not(:disabled):focus {
      @apply c-border-error;
    }
  }

  box-sizing: border-box;

  width: 100%;
  height: 44px;
  padding: 10px 12px;

  font-family: font-family(base);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;

  border-radius: var(--cobalt-form-input-border-radius);

  &:not([readonly]):not([disabled]) {
    @apply c-state-interactive;
  }

  &:not(:disabled):not(:read-only):hover {
    @apply c-text-onSurface;
  }

  &:not(:disabled):not(:read-only):focus {
    @apply c-border-primary;

    outline: none;
    box-shadow: inset 0 0 0 1px theme("colors.primary");
  }

  &:not(select):read-only:focus {
    border-width: 1px;

    outline: none;

    box-shadow: elevation(base);
  }

  &:disabled,
  &:not(select):read-only {
    @apply c-border-outline c-text-onSurfaceDisabled c-bg-disabled;
  }

  &:disabled {
    pointer-events: none;
  }
}
