:root {
  color-scheme: light;
  --bg: #f3f1ec;
  --surface: #ffffff;
  --ink: #16202e;
  --muted: #475467;
  --line: #c9cdd4;
  --line-strong: #7a8494;
  --primary: #0b4f9c;
  --primary-ink: #ffffff;
  --primary-soft: #e8f0fb;
  --focus: #ffbf47;
  --error: #b42318;
  --error-soft: #fdecea;
  --success: #12733a;
  --success-soft: #e6f4ea;
  --legal-bg: #f7f6f2;
  --radius: 14px;
  --gap: clamp(16px, 3vw, 28px);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html {
  font-size: 112.5%; /* 18px */
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 720px) { html { font-size: 125%; } } /* 20px */
html.large { font-size: 137.5%; }
@media (min-width: 720px) { html.large { font-size: 150%; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
}

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 16px;
}

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.top {
  background: var(--primary);
  color: var(--primary-ink);
  padding: 20px 0;
  margin-bottom: var(--gap);
}
.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top__eyebrow {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
  letter-spacing: 0.02em;
}
.top__title {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.8rem);
  line-height: 1.2;
}

.textsize {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 14px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.textsize:hover { background: rgba(255, 255, 255, 0.12); }
.textsize[aria-pressed="true"] { background: #fff; color: var(--primary); }
.textsize__icon { font-size: 0.9rem; line-height: 1; }
.textsize__off, .textsize[aria-pressed="true"] .textsize__on { display: none; }
.textsize[aria-pressed="true"] .textsize__off { display: inline; }
.textsize__icon span { font-size: 1.35em; }
@media (max-width: 480px) {
  .textsize {
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 14px;
    width: 92px;
    text-align: center;
    line-height: 1.1;
  }
  .textsize__icon { font-size: 16px; }
  .textsize__label { font-size: 13px; }
  .top__title { font-size: clamp(1.25rem, 6vw, 1.6rem); }
}

/* ---------- Intro ---------- */
.intro {
  margin-bottom: var(--gap);
}
.intro p { margin: 0 0 12px; }
.intro__tips {
  margin: 0;
  padding: 16px 20px 16px 40px;
  background: var(--primary-soft);
  border-radius: var(--radius);
}
.intro__tips li + li { margin-top: 4px; }

/* ---------- Cards / sections ---------- */
.card {
  margin: 0 0 var(--gap);
  padding: clamp(20px, 4vw, 36px);
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.card__title {
  display: flex;
  align-items: center;
  gap: 12px;
  float: left; /* lets the legend sit inside the padded card */
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
}
.card__title + * { clear: both; }
.step {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 1rem;
}

.legal {
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--legal-bg);
  border-left: 4px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
}
.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.question, .label {
  margin: 0 0 12px;
  font-weight: 700;
}
.confirm {
  margin: 8px 0 20px;
  font-weight: 700;
}
.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  background: #fff4e5;
  color: #7a3e00;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: 0.15em;
  white-space: nowrap;
}
.tag--muted { background: #eef0f3; color: var(--muted); }
.divider {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---------- Fields ---------- */
.field { margin-bottom: 22px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}
.field > label + input,
.field > label + textarea { margin-top: 4px; }

input[type="text"],
input[type="date"],
textarea {
  display: block;
  width: 100%;
  min-height: 3.1rem;
  padding: 12px 14px;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
}
input[type="date"] { min-width: 0; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; min-height: 6rem; }
input:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible {
  border-color: var(--ink);
  outline: 4px solid var(--focus);
  outline-offset: 0;
}
.upper { text-transform: uppercase; }
.mono { letter-spacing: 0.06em; }

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 20px;
}
/* Fields in a row share 4 row tracks (label, hint, input, error) via subgrid,
   so inputs stay aligned even when a label, hint or error wraps differently.
   Without subgrid support they simply stack, which is still fine. */
.row > .field {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
  align-content: start;
  margin-bottom: 22px;
}
.row > .field > label { grid-row: 1; align-self: end; }
.row > .field > .hint { grid-row: 2; }
.row > .field > input { grid-row: 3; margin-top: 4px; }
.row > .field > .error { grid-row: 4; align-self: start; }
@media (min-width: 640px) {
  .row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .row--3 { grid-template-columns: 1fr 1fr 1fr; }
}

.field.has-error input,
.field.has-error textarea { border-color: var(--error); background: var(--error-soft); }
.error {
  display: flex;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--error);
  font-weight: 700;
  font-size: 0.95rem;
}
.error::before { content: "⚠"; }

/* ---------- Big choice cards (radio / checkbox) ---------- */
.choices {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) {
  .choices { grid-template-columns: 1fr 1fr; }
  .choices--4 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .choices--4 { grid-template-columns: repeat(4, 1fr); }
}
.choices--stack { grid-template-columns: 1fr !important; }
.choices.has-error .choice { border-color: var(--error); }

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 3.4rem;
  padding: 14px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice input {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  margin: 0.05rem 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.choice input:focus-visible { outline: none; }
.choice:has(input:focus-visible) { outline: 4px solid var(--focus); outline-offset: 2px; }
.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice__body { display: flex; flex-direction: column; gap: 2px; }
.choice__title { font-weight: 700; line-height: 1.3; }
.choice__desc { color: var(--muted); font-size: 0.92rem; line-height: 1.4; }

.nested {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.nested > legend { padding: 0; }

.subsection {
  margin-top: 20px;
  padding: clamp(14px, 3vw, 24px);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfbfa;
}
.subsection__title {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

/* ---------- Signature ---------- */
.sig {
  position: relative;
  height: 11rem;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}
.sig canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 1;
}
.sig__placeholder {
  position: absolute;
  left: 20px;
  bottom: 2.4rem;
  color: #9aa1ad;
  font-size: 1.1rem;
  font-style: italic;
  pointer-events: none;
}
.sig__line {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 2rem;
  border-bottom: 2px solid #c3c7cf;
  pointer-events: none;
}
.sig.signed .sig__placeholder { display: none; }
.field.has-error .sig { border-color: var(--error); }
.sig + .btn { margin-top: 10px; }

/* ---------- Captcha ---------- */
.captcha { min-height: 65px; }

/* ---------- Honeypot ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 3rem;
  padding: 10px 22px;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn--primary {
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 1.15rem;
  min-height: 3.6rem;
}
.btn--primary:hover { background: #083d79; }
.btn--primary:disabled { opacity: 0.7; cursor: progress; }
.btn--ghost {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}
.btn--ghost:hover { background: var(--primary-soft); }
.btn--block { width: 100%; margin-top: 8px; }

.status {
  margin: 14px 0 0;
  font-weight: 700;
  text-align: center;
}
.status.is-error { color: var(--error); }

/* ---------- Error summary ---------- */
.summary {
  margin-bottom: var(--gap);
  padding: 20px 24px;
  border: 3px solid var(--error);
  border-radius: var(--radius);
  background: var(--surface);
}
.summary:focus { outline: 4px solid var(--focus); outline-offset: 2px; }
.summary__title { margin: 0 0 4px; color: var(--error); font-size: 1.2rem; }
.summary p { margin: 0 0 8px; }
.summary ul { margin: 0; padding-left: 22px; }
.summary a { color: var(--error); font-weight: 700; }
.summary li + li { margin-top: 6px; }

/* ---------- Done ---------- */
.done { text-align: center; }
.done:focus { outline: none; }
.done__icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}
.done__title { margin: 0 0 12px; color: var(--success); font-size: 1.4rem; }
.done p { margin: 0 0 10px; }
.done__folio {
  display: inline-block;
  margin: 4px 0 16px !important;
  padding: 10px 22px;
  border: 2px dashed var(--success);
  border-radius: 10px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.done .btn { margin-top: 12px; }

/* ---------- Footer ---------- */
.foot {
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

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

/* Very narrow phones: Turnstile needs >= 300px, so trim the side padding. */
@media (max-width: 400px) {
  .wrap { padding: 0 12px; }
  .card { padding: 20px 14px; }
  .subsection { padding: 14px 12px; }
}
