/* Legacy-parity text rendering: the old Creditas site sets
 * -webkit-font-smoothing: antialiased globally, which renders type
 * lighter/thinner on macOS. Webflow Code Components live in isolated
 * shadow roots, so this must be declared per-component on :host to
 * inherit into the shadow tree (the property does not cross the
 * shadow boundary). Without it, Blink defaults to subpixel smoothing
 * and identical 400-weight text looks heavier than the old site. */
:host {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/**
 * RadioField — radio group matching the design system (same tokens as
 * CheckboxField). Class naming: no BEM `__`; elements nested under
 * `.radio-field`.
 *
 * Tokens:
 *   Primary/color-40   = #8EDB00 (selected state)
 *   Neutral/Lighter    = #f1f3f2
 *   Neutral/color-100  = #292929
 *   Error              = #e53935
 */
:host,
.radio-field {
  display: block;
}

.radio-field,
.radio-field *,
.radio-field *::before,
.radio-field *::after {
  box-sizing: border-box;
}

.radio-field {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;

  .legend {
    padding: 0;
    margin-bottom: 12px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.3px;
    color: #292929;
  }

  .required {
    color: #e53935;
  }

  .options {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
  }

  /* Hide native radio */
  .input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;

    &:checked ~ .circle {
      background-color: #8edb00;
      border-color: #8edb00;
    }

    &:checked ~ .circle::after {
      display: block;
    }

    &:focus-visible ~ .circle {
      outline: 2px solid #292929;
      outline-offset: 2px;
    }
  }

  /* Custom circle */
  .circle {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid #d6dcd9;
    background-color: #f1f3f2;
    position: relative;
    transition: border-color 0.15s ease, background-color 0.15s ease;

    &::after {
      content: '';
      position: absolute;
      display: none;
      left: 50%;
      top: 50%;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background-color: #292929;
      transform: translate(-50%, -50%);
    }
  }

  .text {
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.3px;
    color: #292929;
  }

  .error {
    display: block;
    margin-top: 8px;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 12px;
    line-height: 16px;
    color: #e53935;
  }

  &.error .circle {
    border-color: #e53935;
  }

  &.disabled .option {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

