/* Flourish's sign-in page, in Greenhouse's look: its tokens, its first
   screen's card on a soft green and cornflower ground, its fields and buttons.
   Nothing here is smaller than 13px. */

@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/dm-sans-latin.woff2") format("woff2"); }

:root {
  --violet: #3d2170;
  --violet-light: #5a3a96;
  --cornflower: #6477eb;
  --cornflower-pale: #e8ebfd;
  --green: #a6ce82;
  --green-deep: #5f8f3e;

  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --border: #e2e5f0;
  --border-strong: #c8cde0;
  --text: #1a1530;
  --text-muted: #4a4966;
  --text-faint: #6b6a8c;

  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-lg: 0 8px 24px rgba(61, 33, 112, 0.14), 0 2px 6px rgba(61, 33, 112, 0.07);

  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 16px;
  font: 400 14px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(166, 206, 130, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(100, 119, 235, 0.18), transparent 60%),
    var(--surface-2);
}

button, input { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 30px 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--violet);
  font-weight: 600;
  font-size: 17px;
}
.brand .mark { width: 30px; height: 29px; }

/* One step at a time, chosen by the card's data-step. */
.card section { display: none; }
.card[data-step="loading"] [data-for="loading"],
.card[data-step="broken"] [data-for="broken"],
.card[data-step="email"] [data-for="email"],
.card[data-step="code"] [data-for="code"],
.card[data-step="consent"] [data-for="consent"],
.card[data-step="sending"] [data-for="sending"],
.card[data-step="done"] [data-for="done"],
.card[data-step="cancelled"] [data-for="cancelled"],
.card[data-step="failed"] [data-for="failed"] {
  display: block;
  animation: stepIn 0.2s ease-out;
}

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

h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead { margin: 0 0 20px; color: var(--text-muted); font-size: 15px; }
.lead b, .purpose b { color: var(--text); font-weight: 600; }

form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--cornflower);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(100, 119, 235, 0.15);
}
.field input.code { font-size: 20px; letter-spacing: 0.2em; text-align: center; font-variant-numeric: tabular-nums; }
.hint { margin: 0; color: var(--text-faint); font-size: 13px; }

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 14px;
}
.form-error[hidden] { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-light); border-color: var(--violet-light); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn:focus-visible, .text-btn:focus-visible { outline: 2px solid var(--cornflower); outline-offset: 2px; }

.text-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.text-btn:hover { text-decoration: underline; }

/* Consent */
.app-tile {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 13px;
  /* The app's own tile: its mark in violet on white, a hairline keeping it a
     tile on the white card. */
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--violet);
}
.app-tile svg { width: 34px; height: 32px; }
.purpose {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--cornflower-pale);
  color: var(--text-muted);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.who .text-btn { margin: 0 0 0 auto; }
.who-text { min-width: 0; overflow-wrap: anywhere; color: var(--text-muted); }
.who-text b { color: var(--text); font-weight: 600; }
.avatar {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cornflower-pale);
  color: var(--violet);
  font-size: 13px;
  font-weight: 600;
}
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.actions .btn { min-width: 110px; }

.tick {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #dcfce7;
  position: relative;
}
.tick::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 13px;
  width: 12px;
  height: 22px;
  border: solid var(--green-deep);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.foot { margin: 0; color: var(--text-faint); font-size: 13px; }

@media (max-width: 480px) {
  body { justify-content: flex-start; padding: 16px; }
  .card { padding: 24px 20px; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .field input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .card section { animation: none !important; }
}
