/* ============================================================
   WeVote Auth — modal / bottom-sheet shell + form language.
   Ported from the design-system kit (ui_kits/auth/auth.css). Desktop:
   centered dialog (~460px), ✕ top-right. Mobile (<640px): bottom sheet —
   rounded top, drag handle, swipe-to-dismiss, no ✕. Tokens only → free
   light/dark. Shown by toggling `.is-shown` on `.au-overlay` (same mechanism
   as the wv-oa action overlays, so the shared modal base drives it). */

/* ---- overlay + backdrop ---- */
.au-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .24s ease;
}
.au-overlay.is-shown { opacity: 1; pointer-events: auto; }
.au-backdrop {
  position: absolute; inset: 0; border: 0; padding: 0; margin: 0; cursor: default;
  background: rgba(8, 10, 12, .52);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}

/* ---- the sheet ---- */
.au-sheet {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  width: min(460px, 100%); max-height: min(760px, 92vh);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 26px; overflow: hidden;
  box-shadow: var(--shadow-pop);
  transform: translateY(16px) scale(.985);
  transition: transform .32s cubic-bezier(.22, .61, .36, 1);
}
.au-overlay.is-shown .au-sheet { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .au-overlay { transition: none; }
  .au-sheet { transition: none; transform: none; }
}

/* ---- top chrome: drag handle (mobile) · ✕ (desktop) ---- */
.au-top { position: relative; flex: none; height: 14px; }
@media (min-width: 640px) { .au-top { height: 16px; } }
.au-handle { display: none; }
.au-x {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  color: var(--faint); transition: background .15s ease, color .15s ease; z-index: 5;
}
.au-x:hover { background: var(--sunken); color: var(--ink); }

/* ---- scroll region ---- */
.au-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 30px 32px; }
@media (min-width: 640px) { .au-scroll { padding: 8px 38px 36px; } }

/* ---- masthead (logo · title · subtitle) — centered ---- */
.au-head { text-align: center; }
.au-logo {
  width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: 18px; display: grid; place-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.au-logo img { width: 40px; height: 40px; display: block; object-fit: contain; }
.au-title {
  font-family: "Poppins", sans-serif; font-weight: 700;
  font-size: 24px; line-height: 1.2; letter-spacing: -.02em; color: var(--ink); text-wrap: balance;
}
.au-sub { margin-top: 7px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---- OAuth round buttons ---- */
.au-oauth { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 22px; }
.au-oauth__btn {
  width: 56px; height: 56px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline-strong); background: var(--sunken);
  display: grid; place-items: center; color: var(--ink);
  transition: border-color .15s ease, background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.au-oauth__btn:hover { border-color: var(--faint); background: var(--surface); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.au-oauth__btn:active { transform: translateY(0); }
.au-oauth__btn img { width: 24px; height: 24px; display: block; }

/* ---- divider with centered label ---- */
.au-or { display: flex; align-items: center; gap: 14px; margin: 24px 0 4px; }
.au-or::before, .au-or::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.au-or span {
  font-family: "Open Sans", sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap;
}

/* ---- form (left-aligned stack) ---- */
.au-form { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.au-group { display: flex; flex-direction: column; gap: 7px; }
.au-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.au-label { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }

/* ---- text inputs ---- */
.au-fieldwrap { position: relative; }
.au-field {
  width: 100%; height: 54px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--hairline-strong); background: var(--sunken);
  font-size: 15px; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.au-field::placeholder { color: var(--faint); }
.au-field:hover { border-color: var(--faint); }
.au-field:focus { outline: 0; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.au-field.has-trail { padding-right: 50px; }
.au-field.is-invalid { border-color: var(--st-unres-dot); background: color-mix(in srgb, var(--st-unres-bg) 60%, var(--surface)); }
.au-field.is-invalid:focus { box-shadow: 0 0 0 3px var(--st-unres-bg); }

/* show/hide password eye */
.au-eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--faint); border-radius: 10px;
  transition: color .15s ease, background .15s ease;
}
.au-eye:hover { color: var(--ink); background: var(--surface); }

/* ---- checkbox (remember-me / terms) ---- */
.au-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.au-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.au-check__box {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid var(--hairline-strong); display: grid; place-items: center;
  color: #fff; background: var(--surface); transition: background .14s ease, border-color .14s ease;
}
.au-check__box svg { opacity: 0; transition: opacity .14s ease; }
.au-check input:checked + .au-check__box { background: var(--accent); border-color: var(--accent); }
.au-check input:checked + .au-check__box svg { opacity: 1; }
.au-check input:focus-visible + .au-check__box { box-shadow: 0 0 0 3px var(--accent-soft); }
.au-check__label { font-size: 14px; color: var(--muted); }

/* ---- primary CTA (gradient emerald) ---- */
.au-cta {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 54px; border: 0; cursor: pointer; margin-top: 2px;
  border-radius: 15px;
  background: var(--accent);
  color: #fff; font-family: "Poppins", sans-serif; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em;
  box-shadow: var(--shadow-soft);
  transition: background-color .15s ease, transform .12s ease, box-shadow .15s ease, opacity .15s ease;
}
.au-cta:hover { background: var(--accent-hover); box-shadow: var(--shadow-card); }
.au-cta:active { transform: translateY(1px); }
.au-cta:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.au-cta__spin { width: 20px; height: 20px; animation: au-spin 0.8s linear infinite; }
@keyframes au-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .au-cta__spin { animation: none; } }

/* ---- text links ---- */
.au-link {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: 0; border: 0; cursor: pointer; padding: 0; flex: none; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
  border-radius: 6px; transition: color .15s ease;
}
.au-link:hover { color: var(--accent-hover); }
.au-link--inline { display: inline; white-space: normal; }

/* ---- password-strength meter ---- */
.au-strength { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.au-strength__track { display: flex; gap: 5px; flex: 1; min-width: 0; }
.au-strength__seg { flex: 1; height: 5px; border-radius: 999px; background: var(--sunken); transition: background .25s ease; }
.au-strength__seg.is-weak { background: #dc2626; }
.au-strength__seg.is-fair { background: #d97706; }
.au-strength__seg.is-good { background: var(--accent); }
.au-strength__label { font-size: 11.5px; font-weight: 700; color: var(--faint); white-space: nowrap; min-width: 48px; text-align: right; letter-spacing: .01em; }
.au-strength__label.is-weak { color: #dc2626; }
.au-strength__label.is-fair { color: #d97706; }
.au-strength__label.is-good { color: var(--accent-ink); }

/* ---- email medallion (success / confirm screens) ---- */
.au-medallion {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 999px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(158deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 36%, transparent), inset 0 1px 0 rgba(255, 255, 255, .24);
}
@media (prefers-reduced-motion: no-preference) { .au-medallion { animation: au-pop .5s cubic-bezier(.34, 1.56, .64, 1) both; } }
@keyframes au-pop { 0% { transform: scale(.7); } 100% { transform: scale(1); } }

/* ---- honeypot (visually hidden) ---- */
.au-hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- footer + divider ---- */
.au-foot { margin-top: 22px; text-align: center; font-size: 14px; color: var(--muted); }
.au-foot .au-link { font-size: 14px; }
.au-divline { height: 1px; background: var(--hairline); margin: 22px 0 0; }

/* ---- inline message (error / info) ---- */
.au-msg {
  display: flex; align-items: flex-start; gap: 9px; text-align: left;
  padding: 12px 14px; border-radius: 13px; font-size: 13px; line-height: 1.45;
}
.au-msg svg { flex: none; margin-top: 1px; }
.au-msg--error { background: var(--st-unres-bg); color: var(--st-unres-fg); border: 1px solid color-mix(in srgb, var(--st-unres-dot) 28%, transparent); }
.au-msg--info { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
.au-msg__act { margin-top: 4px; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; background: 0; border: 0; padding: 0; font-size: 13px; }

/* ============================================================
   FULL-PAGE auth (cold email-link flows: reset, unlock).
   A centered card on a real page — same form language, no overlay.
   ============================================================ */
.au-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1100px 520px at 50% -8%, color-mix(in srgb, var(--accent) 7%, var(--paper)) 0%, var(--paper) 58%);
}
.au-page__inner { width: min(440px, 100%); }
.au-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.au-brand img { width: 34px; height: 34px; object-fit: contain; }
.au-brand b { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.au-card { background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: 24px; box-shadow: var(--shadow-card); padding: 30px 30px 34px; }
.au-card .au-form { margin-top: 22px; }
.au-page__foot { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--faint); }
@media (max-width: 480px) {
  .au-page { padding: 16px; }
  .au-card { padding: 24px 20px 28px; border-radius: 20px; }
}

/* ============================================================
   MOBILE — bottom sheet
   ============================================================ */
@media (max-width: 639px) {
  .au-overlay { padding: 0; align-items: flex-end; }
  .au-sheet {
    width: 100%; max-height: 92vh;
    border: 0; border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
  .au-overlay.is-shown .au-sheet { transform: none; }
  @media (prefers-reduced-motion: reduce) { .au-sheet { transform: none; } }
  .au-top { height: 26px; cursor: grab; touch-action: none; }
  .au-handle {
    display: block; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 999px; background: var(--hairline-strong);
  }
  .au-x { display: none; }
  .au-scroll { padding: 10px 22px 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .au-logo { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 14px; }
  .au-logo img { width: 36px; height: 36px; }
  .au-title { font-size: 21px; }
  .au-oauth__btn { width: 52px; height: 52px; }
  .au-oauth { gap: 14px; }
  .au-field { height: 50px; font-size: 14.5px; border-radius: 13px; }
  .au-cta { height: 50px; font-size: 15px; border-radius: 14px; }
}
