/* Sign-in forms: link-or-code choice, and the code page. Colors come from
   the theme's tokens where it has them. */

.magic-login-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.25rem 0 0;
}

.magic-login-methods .button,
.magic-login-methods input[type="submit"] {
  margin: 0;
}

.magic-login-methods__help {
  flex-basis: 100%;
  margin: 0.4rem 0 0;
  color: color-mix(in sRGB, currentColor 70%, transparent);
  font-size: 0.875rem;
  line-height: 1.5;
}

.magic-login-code-form__lead {
  font-size: 1.05rem;
}

.magic-login-code-form__hint {
  color: color-mix(in sRGB, currentColor 70%, transparent);
  font-size: 0.9rem;
}

/* The code: six boxes (js/magic_login_code.js) over one see-through input,
   so taps, typing, paste and the phone's autofill all reach the real field.
   Structure only; themes skin .magic-login-otp__cell. */
.magic-login-otp {
  --magic-login-otp-cell: 3rem;
  --magic-login-otp-gap: 0.5rem;

  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0.25rem 0 0.75rem;
}

.magic-login-otp__cells {
  display: flex;
  gap: var(--magic-login-otp-gap);
  pointer-events: none;
}

.magic-login-otp__cell {
  display: grid;
  place-items: center;
  width: var(--magic-login-otp-cell);
  height: calc(var(--magic-login-otp-cell) * 1.25);
  border: 1px solid color-mix(in sRGB, currentColor 30%, transparent);
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.magic-login-otp__cell--split {
  margin-inline-start: calc(var(--magic-login-otp-gap) * 1.5);
}

/* The real field, stretched over the boxes. Transparent text and caret; 16px
   or more so iOS does not zoom in on focus. The doubled class outranks theme
   input rules that load later. */
.magic-login-otp input.magic-login-otp__input.magic-login-otp__input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
  opacity: 1;
  color: transparent;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  inset: 0;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Autofill paints its own background; keep it off the boxes. */
.magic-login-otp input.magic-login-otp__input:-webkit-autofill {
  transition: background-color 600000s 0s;
  -webkit-box-shadow: 0 0 0 100px transparent inset;
}

.magic-login-otp input.magic-login-otp__input::selection {
  background: transparent;
}

@media (max-width: 400px) {
  .magic-login-otp {
    --magic-login-otp-cell: 2.6rem;
    --magic-login-otp-gap: 0.35rem;
  }
}

.magic-login-code-form__other {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in sRGB, currentColor 15%, transparent);
  font-size: 0.9rem;
}

.magic-login-code-form__other p {
  margin: 0 0 0.6rem;
  color: color-mix(in sRGB, currentColor 70%, transparent);
}

.magic-login-code-form__other input[type="submit"] {
  margin: 0 0.4rem 0.5rem 0;
}

.magic-login-code-form__change {
  display: inline-block;
  margin-top: 0.4rem;
}
