.navds-textarea__input {
  /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
  height: var(--__axc-textarea-height);
  appearance: none;
  padding: var(--ax-spacing-2);
  background-color: var(--ax-bg-input);
  border-radius: var(--ax-border-radius-medium);
  border: 1px solid var(--ax-border-default);
  resize: none;
  width: 100%;
  display: block;
  color: var(--ax-text-default);

  &::placeholder {
    color: var(--ax-text-subtle);
  }

  &:hover {
    border-color: var(--ax-border-accent-strong);
  }

  &:focus-visible {
    outline: 2px solid var(--ax-border-focus);
    outline-offset: 2px;
    border-color: var(--ax-border-accent-strong);
  }

  &:disabled {
    background-color: var(--ax-bg-input);
    border-color: var(--ax-border-default);
    cursor: not-allowed;
  }

  .navds-form-field--small & {
    padding: var(--ax-spacing-1-alt);
  }

  .navds-textarea--readonly & {
    background-color: var(--ax-bg-neutral-moderate);
    border-color: var(--ax-border-neutral-subtleA);
    cursor: default;
  }
}

.navds-textarea__counter {
  margin-top: -0.25rem;
  color: var(--ax-text-subtle);
}

.navds-textarea__counter--error {
  color: var(--ax-text-danger);
}

.navds-textarea__sr-counter {
  display: none;
}

.navds-textarea__input:focus ~ .navds-textarea__sr-counter {
  display: initial;
}

.navds-textarea--resize-both .navds-textarea__input {
  resize: both;
  border-end-end-radius: 0;
}

.navds-textarea--resize-horizontal .navds-textarea__input {
  resize: horizontal;
  border-end-end-radius: 0;
}

.navds-textarea--resize-vertical .navds-textarea__input {
  resize: vertical;
  border-end-end-radius: 0;
}

.navds-textarea--autoscrollbar,
.navds-textarea--autoscrollbar .navds-textarea__wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Makes the box-shadow visible even though overflow is hidden: */
  padding: 3px;
  margin: -3px;
}

.navds-textarea--autoscrollbar .navds-textarea__input {
  scrollbar-gutter: stable; /* Needed to prevent scrollbar from appearing too early */
}

.navds-textarea--error .navds-textarea__input:not(:disabled) {
  box-shadow: 0 0 0 1px var(--ax-border-danger);
  border-color: var(--ax-border-danger);
}

@media (forced-colors: active) {
  .navds-textarea__input {
    background-color: field;
    color: fieldtext;
  }
}
