/*
 * Sign in with Apple / Google buttons and the email code step (auth-extras.js), in the
 * sign-in and create account dialogs of the landing page, app-welcome.html and the learning page.
 * Uses the page's brand tokens (--primary, --white, --gray, --space-*, --spring, --ease-out).
 */
.oauth { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.oauth[hidden], .is-reset .oauth { display: none; }
.join-dialog .oauth { margin-top: 0; }

/* Apple: solid black (main style); Google: outline. Logos as the providers ask for them. */
.oauth-btn {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 50px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: transform 260ms var(--spring);
}
.oauth-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.oauth-apple { background: var(--primary); color: var(--white); }
.oauth-apple::after { background: rgba(124, 249, 122, .2); }
.oauth-google { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.oauth-google::after { background: rgba(0, 0, 0, .06); }
.oauth-btn:hover::after, .oauth-btn.is-busy::after { opacity: 1; }
.oauth-btn:active { transform: scale(.98); }
.oauth-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.oauth[aria-busy="true"] .oauth-btn { cursor: progress; }
.oauth-logo { flex: none; display: block; }

.oauth-msg { margin: 0; font-size: .8rem; line-height: 1.6; color: #B71C1C; }
.oauth-msg:empty { display: none; }
.oauth-note { margin: 0; font-size: .72rem; line-height: 1.6; color: var(--gray); text-align: center; }

/* "or with email" divider above the email form */
.oauth-or {
  margin: var(--space-1) 0 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: .78rem;
  color: var(--gray);
}
.oauth-or::before,
.oauth-or::after { content: ""; flex: 1; height: 1px; background: var(--light-gray); opacity: .6; }

/* ---------- Code step ---------- */
.otp-form { width: 100%; max-width: 340px; display: grid; gap: var(--space-3); }
.otp-label { font-size: .8rem; font-weight: 600; color: var(--dark-gray); }
.otp-field {
  width: 100%;
  height: 64px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 16px;
  background: #FFFFFF;
  color: var(--primary);
  font: inherit;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: .4em;
  text-indent: .4em; /* keeps the digits centred despite the spacing after the last one */
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
.otp-field::placeholder { color: var(--light-gray); }
.otp-field:hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4); }
.otp-field:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.otp-field[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--primary); }
.otp-field.is-shaking { animation: otp-shake 360ms var(--ease-out); }
@keyframes otp-shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
.otp-form .reg-submit { display: flex; align-items: center; justify-content: center; }
.otp-form .spinner {
  width: 16px;
  height: 16px;
  margin-right: var(--space-2);
  border-radius: 50%;
  border: 2px solid rgba(249, 249, 249, .3);
  border-top-color: var(--brand-green);
  animation: otp-spin 700ms linear infinite;
}
@keyframes otp-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .otp-field.is-shaking, .otp-form .spinner { animation: none; }
  .oauth-btn { transition: none; }
}

/* Wide create account dialog: the buttons sit in the left column, the form in the right one */
@media (min-width: 860px) {
  #reg-step-form .oauth-or { display: none; }
}
