:root {
  --blue: #1b5eab;
  --blue-deep: #144a89;
  --blue-soft: #e8f0fa;
  --ground: #f3f5f8;
  --card: #ffffff;
  --ink: #1c2330;
  --muted: #5d6778;
  --line: #d9e0ea;
  --chip: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #1b5eab55;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #5b9be6;
    --blue-deep: #3f84d8;
    --blue-soft: #1c2b40;
    --ground: #10151d;
    --card: #182029;
    --ink: #e8edf4;
    --muted: #9aa6b8;
    --line: #2c3746;
    --chip: #1d2631;
    --danger: #f97066;
    --danger-soft: #3a1c1a;
    --focus: #5b9be666;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 "Open Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding-inline: 16px;
}

.band {
  background: var(--blue);
  background: linear-gradient(135deg, #1b5eab 0%, #154f93 100%);
  color: #fff;
  padding-block: 28px 64px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .85;
}

h1 {
  margin: 0;
  font: 700 clamp(28px, 6vw, 38px)/1.15 "Source Serif 4", Georgia, "Times New Roman", serif;
}

main.wrap { margin-top: -40px; padding-bottom: 48px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .04);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.field { margin-bottom: 18px; min-width: 0; }
.card > .field:last-child, .row:last-child .field { margin-bottom: 0; }

label, legend {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

.req { color: var(--blue); }

input[type=text], input[type=date], input[type=tel], input[type=email], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}

input[type=date] { appearance: none; -webkit-appearance: none; }

textarea { resize: vertical; min-height: 110px; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--focus);
}

.invalid input, .invalid textarea { border-color: var(--danger); }

.err {
  color: var(--danger);
  font-size: 14px;
  margin: 6px 0 0;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
/* Floating the legend stops it from being drawn into the fieldset's top border */
legend { float: left; width: 100%; padding: 0; }
legend + * { clear: both; }

.lead { margin: 0 0 20px; color: var(--muted); }

.scale + .scale {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.chips {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.chips label, .pills label {
  position: relative;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}

.chips input, .pills input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chips span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--chip);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  user-select: none;
}

.chips label:hover span { border-color: var(--blue); }
.chips input:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.chips label:active span { transform: scale(.94); }
.chips input:focus-visible + span, .pills input:focus-visible + span {
  box-shadow: 0 0 0 4px var(--focus);
  border-color: var(--blue);
}

.ends {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.ends span:last-child { text-align: right; }

.invalid .chips span { border-color: var(--danger); }

.pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pills span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
  transition: background .12s, border-color .12s, color .12s;
}
.pills label:hover span { border-color: var(--blue); }
.pills input:checked + span {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue-deep);
}

.referral {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.referral .yesno { margin-bottom: 20px; }

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button[type=submit] {
  display: block;
  width: 100%;
  min-height: 54px;
  font: 700 17px "Open Sans", "Segoe UI", system-ui, sans-serif;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, transform .08s;
}
button[type=submit]:hover { background: var(--blue-deep); }
button[type=submit]:active { transform: translateY(1px); }
button[type=submit]:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
button[type=submit][disabled] { opacity: .7; cursor: progress; }

.banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 12px;
  font-weight: 600;
}

.done { text-align: center; padding: 40px 24px; outline: none; }
.done h2 {
  font: 700 28px/1.2 "Source Serif 4", Georgia, serif;
  margin: 14px 0 6px;
}
.done p { margin: 0; color: var(--muted); }
.tick {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}

.foot {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 24px;
}
.foot a { color: inherit; }

@media (max-width: 560px) {
  .band { padding-block: 22px 56px; }
  .card { padding: 20px 16px; }
  .row { grid-template-columns: 1fr; }
  .row .field, .row:last-child .field:not(:last-child) { margin-bottom: 18px; }
  .chips { gap: 4px; }
  .chips span { height: 44px; font-size: 15px; border-radius: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
