/* Mobile-first. The people filling this in are on phones, often on a weak
   connection, sometimes in a hurry. Large touch targets, high contrast, no webfonts. */

:root {
  /* Official WCK brand colours. Wild Blueberry and Papaya, per the WCK identity:
     blue carries titles and chrome, orange carries actions and emphasis. */
  --wck-blue:      #1565AD;
  --wck-blue-dk:   #114F87;
  --wck-blue-tint: #E7F0F8;
  --wck-orange:    #F68B22;
  --wck-orange-dk: #D9741A;
  --wck-orange-tint: #FEF2E5;

  --ground:   #F4F7FA;
  --surface:  #FFFFFF;
  --ink:      #16191D;
  --ink-soft: #454C56;
  --ink-mute: #6B7480;
  --line:     #D5DDE5;

  /* Errors keep their own red. Orange is the brand accent here, so using it for
     failures would make a warning look like a call to action. */
  --error:    #B3261E;
  --error-bg: #FDECEA;
  --ok:       #1C6E46;
  --ok-bg:    #E8F5EE;
  --focus:    #1565AD;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.55 "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- masthead ---------- */

.masthead {
  background: var(--wck-blue);
  padding: 26px 16px;
  /* A hint of the bubble texture from the WCK globe, drawn rather than downloaded. */
  background-image:
    radial-gradient(circle at 10% 26%, rgba(255,255,255,.10) 18px, transparent 19px),
    radial-gradient(circle at 20% 76%, rgba(255,255,255,.07) 11px, transparent 12px),
    radial-gradient(circle at 31% 18%, rgba(255,255,255,.06) 7px, transparent 8px),
    radial-gradient(circle at 4% 60%, rgba(255,255,255,.06) 6px, transparent 7px),
    radial-gradient(circle at 88% 74%, rgba(255,255,255,.05) 14px, transparent 15px),
    radial-gradient(circle at 78% 20%, rgba(255,255,255,.05) 8px, transparent 9px);
}

/* The lockup is assembled here rather than shipped as one image: the mark is the
   official artwork with its background knocked out, and the wordmark is live text in
   Barlow — WCK's own typeface — so it stays crisp at any size and reads white on the
   blue without needing a knockout version of the full logo. */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
}
.brand-mark {
  height: 92px;
  width: auto;
  display: block;
  flex: none;
}
.brand-name {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-size: 31px;
  line-height: .96;
  letter-spacing: -.015em;
}

/* ---------- page ---------- */

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.01em;
  color: var(--wck-blue);
  margin: 0 0 10px;
}
.lede {
  color: var(--ink-soft);
  margin: 0 0 22px;
}
.req-mark { color: var(--wck-orange); }

/* Programme rules, straight from the top of the form. People need to know whether
   they qualify before they spend ten minutes typing. */
.programme {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--wck-orange);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin: 0 0 16px;
  font-size: 15px;
}
.programme p { margin: 0 0 8px; }
.programme ul { margin: 0; padding-left: 20px; }
.programme li { margin-bottom: 4px; }
.programme li:last-child { margin-bottom: 0; }
/* Who out of the household fills this in. Set off from the rules above it with a
   rule of its own, because it is the one line that stops a household sending four
   forms in good faith — one each — and receiving one parcel between them while the
   call centre rings all four to work out that they are one family. */
.programme .who {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.consent-note {
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 16px;
}

.sub-label {
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-mute);
  margin-top: 12px;
}

/* The way out of the cascade. Findable, but it should not compete with the normal
   path — most people will find their settlement in the list. */
.escape-hatch { margin-top: -4px; }
.escape-hatch .choice {
  border: none;
  background: none;
  padding: 4px 0;
  min-height: 0;
  align-items: center;
}
.escape-hatch .choice input { width: 18px; height: 18px; margin: 0; }
.escape-hatch span { font-size: 14px; color: var(--ink-mute); }
.escape-hatch .choice:has(input:checked) { box-shadow: none; }
.escape-hatch .choice:has(input:checked) span { color: var(--ink); font-weight: 500; }

.field-notice {
  font-size: 14px;
  line-height: 1.45;
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid #f3c4bf;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

/* ---------- stepper ---------- */
/* Two large targets beat a dropdown on a phone. Degrades to a plain number field. */

.stepper { display: flex; align-items: stretch; gap: 8px; max-width: 220px; }
.stepper input[type="number"] {
  width: 100%;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input[type="number"]::-webkit-outer-spin-button,
.stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper-btn {
  flex: none;
  width: 52px;
  min-height: 46px;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.stepper-btn:hover { background: var(--ground); border-color: var(--ink-mute); }
.stepper-btn:active { transform: translateY(1px); }

/* ---------- children ---------- */

.child-slot {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 14px 0;
  margin-bottom: 14px;
  background: var(--ground);
}
.child-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.child-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}
.child-remove {
  font: inherit;
  font-size: 13.5px;
  color: var(--error);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.add-child {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 500;
  font-size: 15.5px;
  color: var(--wck-orange-dk);
  background: var(--surface);
  border: 1px dashed var(--wck-orange);
  border-radius: 6px;
  padding: 13px 16px;
  min-height: 48px;
  margin-bottom: 18px;
  cursor: pointer;
}
.add-child:hover { background: var(--wck-orange-tint); }
.add-child:active { transform: translateY(1px); }

.banner {
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 20px;
  font-weight: 500;
}
.banner-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #f3c4bf;
}

/* ---------- form ---------- */

fieldset {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 16px 16px 6px;
}
legend {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--wck-blue);
  padding: 0 6px;
}

.field { margin-bottom: 18px; }

label, .label-as-text {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type="text"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  min-height: 46px;
}
textarea { min-height: auto; resize: vertical; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

[aria-invalid="true"] { border-color: var(--error); }

.hint {
  font-size: 13.5px;
  color: var(--ink-mute);
  margin: 6px 0 0;
}

/* A long list is this field rather than a select: click it and the browser opens
   the whole list, type and it narrows. Carries the select's caret so it still reads
   as a list to choose from, not a box to write in. */
/* ---------- combobox ---------- */
/* A long list opens under its own field and narrows as letters are typed. The panel
   is ours, so it is positioned against the field and styled like the rest of the
   form — a browser's own dropdown for a datalist is drawn beside the field instead,
   which reads as a separate list rather than the field's own. */

.combo { position: relative; }

/* input.combo-input, not .combo-input: the rule above is input[type="text"], which
   outranks a bare class and whose `background` shorthand would wipe the caret. */
input.combo-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.2 6 6.2l5-5' fill='none' stroke='%23454C56' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  padding-right: 36px;
  cursor: pointer;
}
input.combo-input:focus { cursor: text; }

.combo-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  /* Tall enough to be worth scrolling, short enough to leave the field visible above
     the keyboard on a phone. */
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(19, 65, 105, .16);
}
.combo-panel li {
  padding: 11px 12px;
  border-radius: 6px;
  font-size: 15.5px;
  line-height: 1.3;
  cursor: pointer;
}
.combo-panel li[aria-selected="true"] { font-weight: 600; color: var(--wck-blue-dk); }
.combo-panel li.is-active { background: var(--wck-blue-tint); }
@media (hover: hover) {
  .combo-panel li:hover { background: var(--wck-blue-tint); }
}
.combo-empty { color: var(--ink-mute); cursor: default; }
.field-error {
  font-size: 14px;
  color: var(--error);
  font-weight: 500;
  margin: 6px 0 0;
}

/* ---------- choices ---------- */

.choices { display: flex; gap: 10px; flex-wrap: wrap; }
.choices-stacked { flex-direction: column; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--surface);
  cursor: pointer;
  flex: 1 1 auto;
  min-height: 46px;
}
.choice input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }
.choice:has(input:checked) { border-color: var(--wck-blue); box-shadow: inset 0 0 0 1px var(--wck-blue); }

/* ---------- consent ---------- */

.consent {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.consent .choice { border: none; padding: 0; background: none; min-height: 0; }
.consent span { font-size: 14.5px; color: var(--ink-soft); }
.consent-error { border-color: var(--error); }

/* ---------- submit ---------- */

.submit {
  display: block;
  width: 100%;
  margin-top: 20px;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  color: #fff;
  background: var(--wck-orange);
  border: none;
  border-radius: 6px;
  padding: 15px 20px;
  min-height: 52px;
  cursor: pointer;
}
.submit:hover { background: var(--wck-orange-dk); }
.submit:active { transform: translateY(1px); }

/* ---------- honeypot ---------- */

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

/* ---------- confirmation ---------- */

.done {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
}
.done-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 27px;
  line-height: 52px;
  font-weight: 700;
}
/* The same circle on a page that is not good news. Green behind an exclamation
   mark reads as «done» for the second it takes to read the heading, and the one
   thing this page must not do is look like a confirmation. */
.done-mark.stopped {
  background: var(--error-bg);
  color: var(--error);
}
.done-next {
  text-align: left;
  background: var(--wck-blue-tint);
  border: 1px solid #BFD6EA;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 22px 0 18px;
  font-size: 14.5px;
}
.done-next p { margin: 0 0 8px; }
.done-next p:last-child { margin-bottom: 0; color: var(--ink-soft); }

.reference-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-mute);
  margin: 22px 0 4px;
}
.reference { margin: 0 0 14px; }
.reference code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  display: inline-block;
  word-break: break-all;
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 16px 28px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-mute);
}
/* Logical properties on purpose: `margin: 0 0 6px` here used to clobber the note's
   `margin: 0 auto`, because `.footer p` outranks `.footer-note` on specificity. The
   note kept its max-width but lost its centring and sat against the left edge.
   margin-block and margin-inline cannot collide that way. */
.footer p { margin-block: 0 6px; }
.footer-note { max-width: 460px; margin-inline: auto; }

/* ---------- wider screens ---------- */

@media (min-width: 560px) {
  .masthead { padding: 32px 20px; }
  .brand { gap: 20px; }
  .brand-mark { height: 112px; }
  .brand-name { font-size: 38px; }
  .page { padding: 32px 20px 56px; }
  h1 { font-size: 31px; }
  fieldset { padding: 20px 20px 8px; }
  .submit { width: auto; min-width: 260px; }
}

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