/* SES request form — mobile-first, branded, accessible.
   Palette comes from :root custom properties injected by the server. */

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

:root {
  --radius: 10px;
  --gap: 16px;
  --field-h: 48px;            /* comfortable 44px+ touch target */
  --border: #cfd4cd;
  --border-focus: var(--brand-primary);
  --err: #b3261e;
  --muted: #5d6660;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 24px rgba(0,0,0,.06);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;                     /* 16px avoids iOS zoom-on-focus */
  line-height: 1.5;
  color: var(--brand-text);
  background: var(--brand-cream);
}
body.is-embed { background: transparent; }

/* ---------- Card / layout ---------- */
.card {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px;
  background: var(--brand-bg);
}
@media (min-width: 640px) {
  .card {
    margin: 32px auto;
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
}
body.is-embed .card { margin: 0; box-shadow: none; border-radius: 0; }

.card__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--brand-accent);
  margin-bottom: 24px;
}
.card__logo { border-radius: 50%; flex: 0 0 auto; height: auto; }
.card__heading h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  color: var(--brand-primary);
  line-height: 1.2;
}
.lede { margin: 0; color: var(--muted); }

.card__footer {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .875rem; text-align: center;
}

/* ---------- Sections / fields ---------- */
.section {
  border: 0;
  border-top: 1px solid var(--border);
  padding: 20px 0 4px;
  margin: 0;
}
.section:first-of-type { border-top: 0; padding-top: 0; }
.section > legend {
  font-weight: 700;
  color: var(--brand-primary);
  padding: 0;
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.field { margin-bottom: var(--gap); }
.field > label,
.field--radio > legend {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 0;
}
.req { color: var(--err); }
.opt { color: var(--muted); font-weight: 400; }

input[type=text], input[type=email], input[type=tel], textarea {
  width: 100%;
  min-height: var(--field-h);
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 120px; }

input:focus, textarea:focus, button:focus-visible, [tabindex]:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 55%, transparent);
}

.hint { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.err  { margin: 6px 0 0; font-size: .85rem; color: var(--err); min-height: 0; }
.field.has-error input,
.field.has-error textarea { border-color: var(--err); }

/* ---------- Rows (responsive multi-column) ---------- */
.row { display: grid; gap: var(--gap); }
@media (min-width: 640px) {
  .row--2 { grid-template-columns: 1fr 1fr; }
  .row--3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Checkbox / radio ---------- */
.check, .radio {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; cursor: pointer;
}
.field--radio { border: 0; padding: 0; margin-bottom: var(--gap); }
.field--radio .radio { margin-right: 20px; }
.check input, .radio input { width: 20px; height: 20px; accent-color: var(--brand-primary); }

/* ---------- Address lookup ---------- */
.lookup { display: flex; gap: 8px; }
.lookup input { flex: 1 1 auto; }
.results {
  list-style: none; margin: 8px 0 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 260px; overflow-y: auto; background: #fff;
}
.results li {
  padding: 12px; min-height: 44px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.results li:last-child { border-bottom: 0; }
.results li:hover, .results li[aria-selected="true"] {
  background: color-mix(in srgb, var(--brand-accent) 20%, #fff);
}
.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand-primary); text-decoration: underline; font: inherit;
}

/* ---------- Dropzone / files ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px; text-align: center;
  transition: border-color .12s, background .12s;
}
.dropzone.is-drag { border-color: var(--brand-primary); background: color-mix(in srgb, var(--brand-accent) 12%, #fff); }
.dropzone__text { margin: 0 0 12px; color: var(--muted); }
.dropzone__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.filelist { list-style: none; margin: 12px 0 0; padding: 0; }
.filelist li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px;
}
.filelist .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; background: var(--brand-cream); }
.filelist .fmeta { flex: 1 1 auto; min-width: 0; }
.filelist .fname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist .fsize { color: var(--muted); font-size: .8rem; }
.filelist .fremove {
  border: 0; background: none; color: var(--err); cursor: pointer;
  font-size: 1.1rem; min-width: 44px; min-height: 44px;
}
.filelist li.is-invalid { border-color: var(--err); }

/* Show camera buttons only where touch + capture make sense */
.only-touch { display: none; }
@media (pointer: coarse) { .only-touch { display: inline-flex; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--field-h); padding: 10px 18px;
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius); border: 1px solid transparent;
  text-align: center;
}
.btn--primary { background: var(--brand-primary); color: var(--brand-cream); width: 100%; font-size: 1.05rem; }
.btn--primary:hover { background: color-mix(in srgb, var(--brand-primary) 88%, #000); }
.btn--primary:disabled { opacity: .6; cursor: progress; }
.btn--ghost { background: #fff; border-color: var(--brand-primary); color: var(--brand-primary); }
.btn--ghost:hover { background: color-mix(in srgb, var(--brand-accent) 16%, #fff); }

.actions { margin-top: 24px; }
.form-error { color: var(--err); font-weight: 600; margin: 12px 0 0; }

.field--turnstile { margin-top: 20px; }
.field--turnstile .cf-turnstile { display: flex; justify-content: center; }

/* ---------- Honeypot (visually hidden, off-screen; bots fill it) ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Success ---------- */
.success {
  background: color-mix(in srgb, var(--brand-primary) 8%, #fff);
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.success h2 { margin: 0 0 8px; color: var(--brand-primary); }

/* ---------- intl-tel-input tweaks ---------- */
.iti { width: 100%; }
.iti input { width: 100%; }

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