/* Signup, verification, password reset and provisioning.
 *
 * The palette is not a free choice. A client's path runs signup -> verify -> Cognito
 * Managed Login -> their dashboard, and that middle page is already themed #0d1117 /
 * #161b22 with an #f0552b primary (aws-hosting/cognito/README.md). Pages that do not
 * match it read as a phishing interstitial in the one flow where the client is being
 * asked to type a password. So these tokens are taken from there deliberately.
 *
 * What IS a choice: the type pairing and the nameplate.
 *
 * Monospace carries every structural element — the address, the step list, statuses,
 * codes — and the humanist sans carries everything meant to be read. That split is the
 * shared vernacular of the two worlds this product sits between: a bank statement and a
 * terminal. It also makes the address read as an identifier rather than as marketing.
 *
 * System faces only, no webfonts: a strict CSP, no external hosts, and nothing to block
 * first paint on the page where the client is deciding whether to trust us.
 */

:root {
  --ink: #0d1117;          /* page ground */
  --surface: #161b22;      /* raised panel */
  --sunken: #0b0f14;       /* inset wells: the nameplate, code inputs */
  --edge: #21262d;         /* hairlines */
  --edge-bright: #30363d;  /* hairlines that need to be seen */
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f0552b;       /* spent only on: the address, the primary action, the running step */
  --accent-dim: #7a2a15;
  --link: #58a6ff;
  --ok: #3fb950;
  --bad: #f85149;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;

  --r: 6px;                /* one radius everywhere; this is an instrument, not a card deck */
  --gap: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 64px;
}

/* --- masthead ----------------------------------------------------------- */

.mast {
  width: 100%;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.mark {
  width: 26px; height: 26px;
  border: 1px solid var(--accent);
  border-radius: var(--r);
  display: grid; place-items: center;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px; font-weight: 600;
  flex: none;
}
.mast b { font-weight: 600; letter-spacing: -0.01em; }
.mast span { color: var(--muted); }

/* --- panel -------------------------------------------------------------- */

main {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 28px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.lede {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

/* --- the nameplate: the one thing these pages are remembered by ---------- */

/* The client is not creating an account, they are having an address built for them.
 * It assembles as they type, and it is the same object on every page afterwards —
 * so it is set like an engraved plate rather than like form helper text. */
.plate {
  background: var(--sunken);
  border: 1px solid var(--edge-bright);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 24px;
}
.plate-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.plate-addr {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.4;
  word-break: break-all;
}
.plate-slug { color: var(--accent); }
.plate-slug.is-empty { color: var(--edge-bright); }
.plate-domain { color: var(--muted); }
.plate-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.plate-note.is-warn { color: var(--bad); }

/* --- form --------------------------------------------------------------- */

.row { display: flex; gap: 12px; }
.row > .field { flex: 1; min-width: 0; }
.field { margin-bottom: var(--gap); }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
/* A hint sits under its label rather than beside it. Inline, a sentence-long hint pushes
 * the label into a paragraph and the thing being labelled stops being findable. */
.hint {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  background: var(--sunken);
  border: 1px solid var(--edge-bright);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  padding: 10px 12px;
  transition: border-color .12s ease;
}
input::placeholder { color: #5a636d; }
input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 85, 43, .22);
}
input[aria-invalid="true"] { border-color: var(--bad); }

/* The verification code is machine output being read back; it belongs in mono, spaced
 * so a six-digit code can be checked against the email a character at a time. */
.code {
  font-family: var(--mono) !important;
  font-size: 22px !important;
  letter-spacing: .38em;
  text-align: center;
  padding: 12px !important;
}

/* --- sign-in method choice ---------------------------------------------- */

.choice { display: grid; gap: 8px; margin-bottom: var(--gap); }
.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--edge-bright);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.opt:hover { border-color: #40484f; }
.opt:has(input:checked) { border-color: var(--accent); background: rgba(240, 85, 43, .06); }
.opt:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(240, 85, 43, .22); }
.opt input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.opt-body { min-width: 0; }
/* Blocks, not inline. As spans these ran together into one paragraph — "Passkey Face ID,
 * Touch ID or your security key" reads as a single sentence and the choice stops looking
 * like a choice. The title has to be scannable on its own. */
.opt-title { display: block; font-size: 14px; font-weight: 500; }
.opt-note { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 2px; }

/* --- actions ------------------------------------------------------------ */

button {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 550;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter .12s ease;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
button.quiet {
  background: transparent;
  color: var(--text);
  border-color: var(--edge-bright);
}

.foot {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--edge);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

/* --- messages ----------------------------------------------------------- */

/* Errors state what happened and what to do about it. They do not apologise, and they
 * are never vague — a client who cannot tell whether to retry or to give up will do
 * neither and email support instead. */
.msg {
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: var(--gap);
  border: 1px solid;
}
.msg[hidden] { display: none; }
.msg.bad { border-color: var(--accent-dim); background: rgba(248, 81, 73, .08); color: #ffb4ae; }
.msg.ok  { border-color: #1f5c2e; background: rgba(63, 185, 80, .08); color: #7ee787; }

/* --- provisioning ------------------------------------------------------- */

.bar {
  height: 6px;
  background: var(--sunken);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0 8px;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.bar-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
}

/* An ordered checklist, because the order is real: nothing can go live before its
 * certificate validates. The sequence is information, not decoration. */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--edge);
  font-size: 14px;
  color: var(--muted);
}
.steps li:last-child { border-bottom: 0; }
.steps .tick {
  font-family: var(--mono);
  font-size: 13px;
  width: 14px;
  flex: none;
  text-align: center;
}
.steps li[data-state="DONE"] { color: var(--text); }
.steps li[data-state="DONE"] .tick { color: var(--ok); }
.steps li[data-state="RUNNING"] { color: var(--text); }
.steps li[data-state="RUNNING"] .tick { color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.steps li[data-state="FAILED"] { color: #ffb4ae; }
.steps li[data-state="FAILED"] .tick { color: var(--bad); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.reassure {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--edge);
  font-size: 13px;
  color: var(--muted);
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 480px) {
  body { padding: 24px 14px 40px; }
  main { padding: 20px; }
  .row { flex-direction: column; gap: 0; }
  .plate-addr { font-size: 13px; }
}

/* The pulse is the only motion that repeats, and it is the one signal that the page is
 * still working during a wait that can run twenty minutes. Everything else is a
 * transition, so honouring this costs no information. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
