.AutoExpand {
  --_grid-area: 1 / 1 / 2 / 2;

  @apply grid w-full grid-cols-[100%];

  &::before {
    @apply TextInput invisible my-0 whitespace-pre-wrap break-words content-[attr(data-value)_'_'];
  }

  &::before,
  > :where(.AutoExpand-shim, textarea, btu-textarea-input) {
    grid-area: var(--_grid-area);
  }

  > :where(textarea, btu-textarea-input > textarea) {
    @apply overflow-hidden;
  }

  /* Prevent the textarea from collapsing below one row when empty.
     The min-block-size replicates the single-row height of .TextInput:
     1lh (line height) + 1rem (py-2 top+bottom padding) + 2px (1px border top+bottom). */
  > textarea,
  > btu-textarea-input > textarea {
    @apply my-0 h-full [field-sizing:content] [min-block-size:calc(1lh_+_1rem_+_2px)];
  }

  &.is-noShim {
    &::before,
    > .AutoExpand-shim {
      @apply hidden;
    }
  }
}
