/* ==========================================================================
   Public sign-up form — modern, mobile-first, light/dark aware.
   ========================================================================== */

:root {
  --bg-1: #eef1fb;
  --bg-2: #e3e7f7;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --field: #f8fafc;
  --field-ink: #0f172a;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --ring: rgba(99, 102, 241, 0.28);
  --error: #dc2626;
  --ok: #16a34a;
  --shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.35);
  --radius: 18px;
  --radius-in: 13px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #0b1020;
    --bg-2: #0f172a;
    --card: #141b2d;
    --ink: #e8ecf5;
    --muted: #94a3b8;
    --field: #0f1626;
    --field-ink: #e8ecf5;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.18);
    --brand: #6366f1;
    --brand-2: #818cf8;
    --ring: rgba(129, 140, 248, 0.32);
    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-2), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(20px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(20px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Header ---- */
.head { text-align: center; margin-bottom: 22px; }

.badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 10px 24px -8px var(--brand);
}

h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ---- Fields ---- */
.row { margin-bottom: 14px; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

input[type="text"], input[type="tel"] {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  font-size: 16px;                 /* 16px keeps iOS from zooming on focus */
  color: var(--field-ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-in);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder { color: var(--muted); opacity: 0.7; }

input:hover { border-color: var(--line-strong); }

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
  background: var(--card);
}

input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
}

/* Keep browser autofill on-theme instead of the default yellow highlight.
   The inset box-shadow paints over the UA background; 9999s transition
   defeats the delayed autofill repaint. */
input:-webkit-autofill,
input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--field-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--field) inset;
  caret-color: var(--field-ink);
  transition: background-color 9999s ease-out 0s;
}
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--card) inset, 0 0 0 4px var(--ring);
}

/* Honeypot — visually and functionally hidden from real users. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cf-turnstile { margin: 8px 0 16px; min-height: 65px; }

/* ---- Button ---- */
button {
  position: relative;
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border: none;
  border-radius: var(--radius-in);
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.15s, transform 0.03s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: 0.7; }

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

button.loading .btn-label { visibility: hidden; }
button.loading .spinner {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Messages ---- */
.message {
  margin: 12px 2px 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--error);
}
.message.ok { color: var(--ok); }

/* ---- Success ---- */
.done { text-align: center; padding: 8px 0 6px; animation: rise 0.35s ease both; }
.done .check { width: 72px; height: 72px; margin: 0 auto 14px; color: var(--ok); }
.done h2 { margin: 0 0 6px; font-size: 1.3rem; }
.done p { margin: 0; color: var(--muted); line-height: 1.45; }

.check-ring {
  stroke: var(--ok);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw 0.5s ease-out forwards;
}
.check-mark {
  stroke: var(--ok);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.35s 0.4s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Small phones ---- */
@media (max-width: 380px) {
  .card { padding: 22px 18px 18px; border-radius: 16px; }
  h1 { font-size: 1.35rem; }
}

/* ---- Respect reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  .spinner { animation-duration: 0.7s !important; }  /* keep the loading spinner meaningful */
}
