/* PetPals waitlist styles. The colour tokens below are the PetPals app's own (lib/web/theme/app_colors.dart). */
:root {
  --bg: #f5f2fc;            /* surfaceMuted */
  --bg-glow: #ede7fe;       /* violetSoft */
  --surface: #ffffff;       /* surface */
  --text: #1b1329;          /* ink */
  --muted: #6e6580;         /* inkMuted */
  --border: #e7e1f7;        /* line */
  --primary: #5b2fe0;       /* violet */
  --primary-hover: #3a1f8c; /* violetMid */
  --primary-ink: #ffffff;   /* white */
  --primary-soft: #ede7fe;  /* violetSoft */
  --accent-soft: #fdf0dc;   /* warmSoft */
  --accent-ink: #8a5300;    /* warmDark */
  --danger: #c24545;        /* danger */
  --shadow: 0 1px 2px rgb(31 17 71 / 6%), 0 12px 32px -8px rgb(31 17 71 / 14%);
  --radius: 20px;
  --radius-sm: 14px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

/* Dark mode: the app's dark palette (section 10 of flutter_ui_style_guide.md). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1147;            /* violetDark */
    --bg-glow: #2a1a5e;
    --surface: #2a1a5e;
    --text: #ede9fb;
    --muted: #b9afd6;
    --border: #3d2b7a;
    --primary: #8b6bf0;       /* violetLight */
    --primary-hover: #5b2fe0; /* violet */
    --primary-ink: #ffffff;
    --primary-soft: #3a1f8c;  /* violetMid */
    --accent-soft: #3d2c12;
    --accent-ink: #ffb648;    /* warm */
    --danger: #f08a8a;
    --shadow: 0 12px 32px -8px rgb(10 5 30 / 50%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(120% 50% at 50% -10%, var(--bg-glow), transparent 70%) no-repeat, var(--bg);
}

[hidden] { display: none !important; }

.page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

@media (min-width: 600px) {
  .page { padding-top: 56px; }
}

/* ---------- Header ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-mark {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 7px;
  border-radius: 12px;
  background: var(--primary);
  fill: var(--primary-ink);
}

.hero { margin-bottom: 24px; }

.pill {
  display: inline-block;
  margin: 20px 0 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0;
  font-size: clamp(1.875rem, 7vw, 2.5rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* ---------- Card & form groups ---------- */

.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (min-width: 480px) {
  .card { padding: 28px; }
}

.card:focus { outline: none; }

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.group + .group { margin-top: 32px; }

legend,
.label {
  float: left;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.3;
}

legend + *,
.label + * { clear: both; }

.step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.875rem;
  vertical-align: 1px;
}

.hint {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Selectable cards (radios) and chips (checkboxes) ---------- */

.options { display: grid; gap: 10px; }

@media (min-width: 480px) {
  .options-role { grid-template-columns: 1fr 1fr; }
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 480px) {
  .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.option,
.chip {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.option input,
.chip input {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.option-body,
.chip-body {
  display: flex;
  align-items: center;
  height: 100%;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.option-body {
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.chip-body {
  gap: 8px;
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
}

.option-emoji,
.chip-emoji {
  flex: none;
  line-height: 1;
  text-align: center;
}

.option-emoji { width: 32px; font-size: 1.5rem; }
.chip-emoji { font-size: 1.25rem; }

.option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 700;
  line-height: 1.3;
}

.option-text small {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Radio indicator */
.option-body::after {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  margin-left: auto;
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: inherit;
}

/* Checkbox tick */
.chip-body::after {
  content: '✓';
  margin-left: auto;
  color: var(--primary);
  font-weight: 800;
  opacity: 0;
}

@media (hover: hover) {
  .option:hover .option-body,
  .chip:hover .chip-body { border-color: var(--primary); }
}

.option-body:active,
.chip-body:active { transform: scale(0.985); }

input:checked + .option-body,
input:checked + .chip-body {
  border-color: var(--primary);
  background: var(--primary-soft);
}

input:checked + .option-body::after {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 4px var(--primary-soft);
}

input:checked + .chip-body::after { opacity: 1; }

input:focus-visible + .option-body,
input:focus-visible + .chip-body {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.placeholder {
  margin: 0;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

/* ---------- Text inputs ---------- */

input[type='text'],
input[type='email'],
input[type='url'] {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem; /* 16px+ stops iOS zooming in on focus */
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

input[type='text']:focus,
input[type='email']:focus,
input[type='url']:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

input[aria-invalid='true'] { border-color: var(--danger); }

.other-field { margin-top: 12px; }

.other-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9375rem;
  font-weight: 700;
}

/* ---------- Errors ---------- */

.error,
.form-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 700;
}

.form-error {
  margin-top: 24px;
  padding: 12px 14px;
  border: 2px solid var(--danger);
  border-radius: var(--radius-sm);
}

/* Consent checkbox */
.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
  cursor: pointer;
}

.consent input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* "Did you mean …?" email hint */
.suggest {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.suggest-btn {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.985); }

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.btn:disabled { cursor: progress; opacity: 0.85; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { border-color: var(--primary); }

.btn-link {
  min-height: 44px;
  padding: 10px;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

#submit-btn { margin-top: 28px; }

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn[aria-busy='true'] .spinner { display: inline-block; }

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

.fineprint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Spam trap, kept off-screen */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Success ---------- */

.success {
  padding-top: 36px;
  padding-bottom: 28px;
  text-align: center;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--primary-soft);
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.success-icon svg {
  width: 38px;
  height: 38px;
  fill: var(--primary);
}

.success h2 {
  margin: 0 0 8px;
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.2;
}

.success p {
  margin: 0 0 24px;
  color: var(--muted);
}

.success strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.success-actions {
  display: grid;
  gap: 6px;
}

@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Banner & footer ---------- */

.demo-banner {
  padding: 10px 16px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.875rem;
  text-align: center;
}

.footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }

  .spinner { animation-duration: 1.6s !important; }
}
