/* 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;
}

/**
 * TextField — boxed floating-label input.
 *
 * Class naming: single-class, no BEM `__`; elements nested under `.text-field`
 * (scoped as `.text-field .input`). State modifiers bared to `&.error` /
 * `&.disabled` (compound on the root; disjoint from the `.error` message el).
 *
 * Floating label pattern:
 *   The <input> always has placeholder=" " (a single space).
 *   :placeholder-shown = true  → input is empty  → label at vertical center
 *   :placeholder-shown = false → input has value  → label floats to top
 *
 * Figma spec (node 1861:2614 "Input / Boxed / Text"):
 *   bg:            #f1f3f2  (Neutral/Lighter)
 *   border-radius: 16px
 *   height:        64px
 *   placeholder:   #52605a  (Neutral/Dark)
 *   value text:    #292929  (Neutral/color-100)
 *   error:         #e53935
 */

:host,
.text-field {
  display: block;
}

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

.text-field {
  .wrapper {
    position: relative;
    width: 100%;
  }

  .input {
    display: block;
    width: 100%;
    height: 64px;
    /* Top padding leaves room for the floated label */
    padding: 24px 20px 8px;
    background-color: #f1f3f2;
    border: 1.5px solid transparent;
    border-radius: 16px;
    color: #292929;
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.3px;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;

    /* Hide the space placeholder visually */
    &::placeholder {
      color: transparent;
    }

    &:focus {
      border-color: #292929;
      background-color: #ffffff;
    }

    /* Float up when the input has a value (:placeholder-shown = false) */
    &:not(:placeholder-shown) ~ .label {
      top: 12px;
      transform: translateY(0);
      font-size: 11px;
      line-height: 14px;
    }

    /* Float up + change color when focused */
    &:focus ~ .label {
      top: 12px;
      transform: translateY(0);
      font-size: 11px;
      line-height: 14px;
      color: #292929;
    }
  }

  .label {
    position: absolute;
    left: 20px;
    /* Default: vertically centered (empty state) */
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Helvetica Now Display', 'Helveticanowdisplay', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.3px;
    color: #52605a;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: top 0.15s ease, transform 0.15s ease, font-size 0.15s ease,
      color 0.15s ease;
  }

  .required {
    color: #e53935;
  }

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

  /* Error state (root modifier — disjoint from the `.error` message element). */
  &.error .input {
    border-color: #e53935;
    background-color: #fff8f8;
  }

  /* Disabled state. */
  &.disabled .input {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

