/**
 * SJCare Foundation
 *
 * Password field with a show/hide control. The wrapper is inline so it drops
 * into any grid or flex row without changing the layout of the field.
 */

.pw {
  position: relative;
  display: block;
  width: 100%;
}

.pw .input,
.pw input[type='password'],
.pw input[type='text'] {
  width: 100%;
  padding-right: 2.6rem;
}

.pw__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--ix-muted);
  cursor: pointer;
  transition: color 0.15s linear;
}

.pw__toggle:hover {
  color: var(--ix-ink);
}

.pw__toggle:focus-visible {
  outline: 2px solid var(--ix-terracotta);
  outline-offset: 1px;
}

.pw__icon {
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
}

.pw__icon svg {
  width: 100%;
  height: 100%;
}

.pw__icon--hide {
  display: none;
}

.pw__toggle[aria-pressed='true'] .pw__icon--show {
  display: none;
}

.pw__toggle[aria-pressed='true'] .pw__icon--hide {
  display: inline-flex;
}

@media (prefers-reduced-motion: reduce) {
  .pw__toggle {
    transition: none;
  }
}
