/* Brand tokens — overridden per firm from config.json (see app.js applyBranding) */
:root {
  --brand: #1f3a5f;
  --on-brand: #ffffff;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1b1b1b;
  --muted: #5f6368;
  --border: #d6d3cc;
  --error: #b3261e;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* Header */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 0 16px;
}
.brand-logo { max-height: 48px; max-width: 160px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.05rem; }

/* Progress */
.progress {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  border-radius: 999px;
  transition: width 250ms ease;
}
.progress-label { margin: 8px 0 0; font-size: 0.875rem; color: var(--muted); }

main { flex: 1; display: flex; flex-direction: column; }

form { flex: 1; display: flex; flex-direction: column; }
#step { flex: 1; padding-top: 24px; }

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 8px;
}
h1:focus { outline: none; }
.step-help { color: var(--muted); margin: 0 0 20px; }

/* Fields */
.field { margin: 0 0 20px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 0;
}
.optional { font-weight: 400; color: var(--muted); }
.hint { font-size: 0.875rem; color: var(--muted); margin: -2px 0 8px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem; /* >=16px stops iOS zoom on focus */
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
}
textarea { min-height: 140px; resize: vertical; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
[aria-invalid="true"] { border-color: var(--error) !important; }

.field-error { color: var(--error); font-size: 0.875rem; margin: 6px 0 0; }

/* Choice cards (radio) */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
}
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: none; }
.choice:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}
.choice:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }

/* Checkbox */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 500; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

/* Nav */
.nav {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  padding: 12px 0 4px;
  background: var(--bg);
}
.btn {
  min-height: 52px;
  padding: 0 20px;
  font: inherit;
  font-weight: 700;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
}
.btn-primary { flex: 1; background: var(--brand); color: var(--on-brand); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }

.form-error {
  background: color-mix(in srgb, var(--error) 8%, var(--surface));
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 8px;
}

/* Honeypot — off-screen rather than display:none so naive bots still fill it */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Confirmation */
.thanks { text-align: center; padding-top: 48px; }
.thanks:focus { outline: none; }
.thanks-check {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 32px;
  line-height: 64px;
}
.thanks .disclaimer { margin-top: 32px; }

.status { padding-top: 48px; text-align: center; color: var(--muted); }

.disclaimer { font-size: 0.8125rem; color: var(--muted); }
.footer { padding-top: 12px; text-align: center; }

@media (min-width: 600px) {
  .shell { padding-top: 40px; }
  h1 { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
}
