/*
  Passkeys, on the sign-in screen and on Sign-in and security. assets/passkeys.js shows Sign
  In with Passkey and turns on Add a Passkey only in a browser that can use passkeys, and
  writes its progress and refusals as text into the status line of each block.
*/

/* A control the script hasn't shown keeps `hidden` whatever display its class sets: .btn
   draws as inline-flex, which would otherwise show the hidden passkey button. */
[data-passkey-ui] [hidden] {
  display: none !important;
}

/*
  Sign in: "or", ruled on both sides as in the design's sign-in methods, then Sign In with
  Passkey across the card's width, under the email form. Until the script shows the button,
  or says something, the block takes no room, so the email form stands alone without
  script; "or" leads only to the button, so it hides with it.
*/
.passkey-sign-in {
  display: grid;
  gap: var(--space-4);
}

.passkey-sign-in:has(> [data-passkey-sign-in][hidden]):has(> .passkey-status:empty) {
  display: none;
}

.passkey-sign-in:has(> [data-passkey-sign-in][hidden]) > .divider {
  display: none;
}

.passkey-sign-in > .divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.passkey-sign-in > .divider::before,
.passkey-sign-in > .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/*
  The status line, in the lead's color: under the sign-in button, centered as the card's
  foot is, and beside Add a Passkey. An empty line takes no room but stays drawn, never
  display: none, so screen readers hear each message the script writes into it.
*/
.passkey-status {
  font-size: var(--text-sm);
  color: var(--text-2);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.passkey-sign-in > .passkey-status {
  text-align: center;
}

.passkey-sign-in > .passkey-status:empty {
  margin-top: calc(-1 * var(--space-4));
}

/*
  Beside Add a Passkey: the status line and, once the script shows it, Sign In Again, as one
  group. A long message moves the group under the button whole, so the link stays after the
  sentence it answers. Empty, with the link hidden, the group takes no room.
*/
.passkey-feedback {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  min-width: 0;
}
