/* Account pages (sign-in, sign-up, password reset, activation; issue #121). Loaded by
   stylesheet_link_tag :app. Every rule is scoped to .auth or its .auth__* (BEM) classes, so exercises and the
   header are unaffected.
   Colours follow application.css / trainer.css (WCAG AA on white); only the link blue is new. */

.auth {
  box-sizing: border-box;
  width: 100%;
  max-width: 26rem;
  margin: 1rem auto 0;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  overflow-wrap: anywhere; /* long e-mail addresses in messages never widen the page */
}

.auth h2 {
  margin: 0 0 1rem;
  font-size: 1.375rem;
  line-height: 1.25;
}

/* A .flash inside the card (activations/error) keeps its own margin from application.css. */
.auth > p:not(.flash),
.auth__links p {
  margin: 0 0 0.75rem;
}

.auth__form {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.auth__form:last-child {
  margin-bottom: 0;
}

.auth__field {
  display: grid;
  gap: 0.375rem;
  min-width: 0;
  margin: 0;
}

.auth__field label {
  font-weight: 600;
}

.auth__field input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem; /* 44 px touch target */
  padding: 0.5rem 0.75rem;
  border: 1px solid #788590;
  border-radius: 6px;
  background: #fff;
  color: #1f2328;
  font: inherit;
  font-size: 1rem; /* at least 16 px: iOS Safari does not zoom in on focus */
}

.auth__field input:hover {
  border-color: #57606a;
}

.auth__field input:focus-visible,
.auth__submit:focus-visible,
.auth__google-button:focus-visible,
.auth a:focus-visible {
  outline: 3px solid #2860a5;
  outline-offset: 2px;
}

.auth__field input:focus-visible {
  border-color: #2860a5;
}

/* Rails wraps invalid fields in div.field_with_errors. After the hover and focus rules: the error colour stays. */
.auth .field_with_errors input {
  border-color: #82071e;
}

/* Pulled towards its field, but clear of the 5 px focus ring. */
.auth__hint {
  margin: -0.375rem 0 0;
  font-size: 0.875rem;
  color: #57606a;
}

.auth__submit {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 2px solid #263d5a;
  border-radius: 6px;
  background: #263d5a;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: normal; /* long Polish labels wrap instead of overflowing */
}

.auth__submit:hover,
.auth__submit:focus-visible {
  border-color: #36577c;
  background: #36577c;
}

/* "Continue with Google" (shared/_google_login): secondary to the e-mail form, so white with a border. */
.auth__google {
  margin: 0 0 1.25rem;
}

.auth__google-button {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 2px solid #788590;
  border-radius: 6px;
  background: #fff;
  color: #1f2328;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: normal;
}

.auth__google-button:hover,
.auth__google-button:focus-visible {
  border-color: #57606a;
  background: #f6f8fa;
}

.auth__errors {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  color: #82071e;
  background: #ffebe9;
  border: 1px solid #ff8182;
  border-radius: 6px;
}

.auth__errors p {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.auth__errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.auth__links {
  padding-top: 1rem;
  border-top: 1px solid #d0d7de;
  font-size: 0.9375rem;
}

/* Pages without a form: the same space above the divider as below a form. */
.auth > p + .auth__links {
  margin-top: 1.25rem;
}

.auth__links p:last-child,
.auth > p:last-child {
  margin-bottom: 0;
}

.auth a {
  color: #0969da;
}

.auth a:hover {
  text-decoration-thickness: 2px;
}

/* Narrow phones: less padding leaves more room for the controls. */
@media (max-width: 24rem) {
  .auth {
    margin-top: 0;
    padding: 1rem;
    border-radius: 6px;
  }
}

/* Links to the privacy policy and terms under an account form (issue #268). */
.auth__legal {
  margin: 1rem 0 0;
  font-size: 0.875rem;
}

.auth__legal a + a {
  margin-left: 0.75rem;
}
