/* ═══════════════════════════════════════════════════════════════════
   auth_modal.css — sign-up / log-in overlays for the detector surfaces.

   DEFINES NO PALETTE. Every colour is a var() from tokens.css, which is
   loaded on every page that carries this file, so light mode (theme.css
   re-declaring the same names) needs zero work here.

   Class prefix is `am-` on purpose: profile/billing/keys/history/redeem
   already load pages.css, which owns `.modal-*`. Sharing those names
   would silently restyle the password and email dialogs.
   ═══════════════════════════════════════════════════════════════════ */

.am-shade {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 18px;
  overflow-y: auto;
  z-index: 2000;
}
.am-shade.is-open { display: flex; }
html.am-locked { overflow: hidden; }

.am-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px 22px 20px;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.am-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.am-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.am-sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 18px; }

.am-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  color: var(--text-faint);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.am-close:hover { color: var(--gold); border-color: var(--border); }
.am-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.am-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.am-field > label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.am-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .am-row2 { grid-template-columns: 1fr; } }

.am-input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 16px;                 /* 16px stops iOS zooming the page on focus */
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  transition: border-color .15s;
}
.am-input:focus { outline: none; border-color: var(--gold); }
.am-input::placeholder { color: var(--text-faint); }

.am-hint { font-size: 11.5px; color: var(--text-faint); }

/* Stripe mounts its own iframe here; only the frame is ours. */
.am-card-slot {
  padding: 11px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  min-height: 42px;
}

.am-checks { display: flex; flex-direction: column; gap: 9px; margin: 14px 0 4px; }
.am-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  cursor: pointer;
}
.am-check input { margin: 2px 0 0; accent-color: var(--gold); width: 15px; height: 15px; flex: none; }
.am-check a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.am-check .req { color: var(--verdict-ai); }
.am-check.is-locked { opacity: .55; cursor: default; }

.am-cta {
  width: 100%;
  margin-top: 16px;
  padding: 11px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--on-gold);
  background: var(--cta-bg);
  border: 0;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: filter .15s;
}
.am-cta:hover:not(:disabled) { filter: brightness(1.06); }
.am-cta:disabled { opacity: .45; cursor: not-allowed; }
.am-cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.am-msg { font-size: 12.5px; line-height: 1.45; margin: 12px 0 0; display: none; }
.am-msg.is-visible { display: block; }
.am-msg.err { color: var(--verdict-ai); }
.am-msg.ok { color: var(--verdict-real); }

.am-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
}
.am-foot a { color: var(--gold); text-decoration: none; }
.am-foot a:hover { text-decoration: underline; }

/* ── 2FA step, injected by auth.js ────────────────────────────────
   bindAuthForm() builds the code field itself as
   <div id="pd-mfa-wrap" class="field"><label><input class="input"><div class="auth-hint">.
   Those classes come from auth.css, which the dashboard does not load, so
   without these rules the 2FA step would appear unstyled exactly when a
   user is trying to get into their account. Scoped to .am-card so nothing
   here can leak onto the real /login page. */
.am-card #pd-mfa-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.am-card #pd-mfa-wrap > label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.am-card .input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
}
.am-card .input:focus { outline: none; border-color: var(--gold); }
/* ⛔ THE MARGIN RESET IS THE POINT, NOT THE FONT SIZE. auth.css gives
   .auth-hint `margin-top: -8px`, which is correct on the standalone page where
   fields are not gapped. Inside #pd-mfa-wrap (flex column, gap 6px) that -8px
   beats the gap and nets -2px, so the hint climbs INTO the code box. Measured:
   hint.top was 2px above input.bottom until this line existed. Let the flex gap
   own the spacing. */
.am-card .auth-hint { font-size: 11.5px; color: var(--text-faint); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .am-close, .am-input, .am-cta { transition: none !important; }
}
