/* Report forms on hand-built posts (posts/*.html), e.g. the Royal Mail
   delivery issues report. Builds on site.css. Written for WCAG 2.2 AA with
   older and partially sighted readers in mind: sentence-case 16px labels
   rather than the site's small caps, 24px choice targets, GOV.UK-style
   error summary and inline errors. */

/* Keep focused fields clear of the sticky header (WCAG 2.4.11). */
html { scroll-padding-top: 120px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.report-form {
  margin-top: 48px;
  background: var(--bg-2);
  gap: 0;
}
/* .form sets display, which beats the [hidden] attribute; the page hides
   the form once a report is sent or if it can't load. */
.report-form[hidden] { display: none; }

/* The brand green fails text contrast on white (about 2.2:1), so this
   page's eyebrow uses the muted purple instead (WCAG 1.4.3). */
.article-page-head .eyebrow { color: var(--js-purple-300); }
.report-form h2 {
  margin: 0 0 12px;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  color: var(--js-purple);
}
.report-intro { margin: 0 0 8px; font-size: 17px; line-height: 1.55; color: var(--js-purple); }
.report-required-note { margin: 0 0 8px; font-size: 15px; color: var(--js-purple-300); }
.report-form a { color: var(--js-purple); text-decoration: underline; text-underline-offset: 3px; }

.report-section { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--js-purple-100); }
.report-section > h3 {
  margin: 0 0 20px;
  font-size: 21px;
  letter-spacing: var(--tracking-tight);
  color: var(--js-purple);
}
.report-section .field + .field { margin-top: 24px; }

/* Readable labels and legends for this form. */
.report-form .field > label,
.report-form .field > legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  color: var(--js-purple);
}
/* site.css tints a focused field's labels green; at 3.3:1 that fails text
   contrast, and here it would recolour every option in a focused group. */
.report-form .field:focus-within > label,
.report-form .field:focus-within .choice { color: var(--js-purple); }
.report-form .field-optional { font-size: 15px; }
.report-form fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-hint { margin: -2px 0 10px; font-size: 15px; line-height: 1.45; color: var(--js-purple-300); }

.report-form .field input:not([type="radio"]):not([type="checkbox"]),
.report-form .field textarea { min-height: 48px; background: #fff; }
.report-form .field input:focus,
.report-form .field textarea:focus {
  border-color: var(--js-purple);
  box-shadow: 0 0 0 3px rgba(20, 200, 120, 0.45);
}
.field-postcode input { max-width: 12em; }
.field-date input { max-width: 14em; }

/* Radio and checkbox lists. Each option is a full-width, 24px-plus target.
   Options are labels and inputs inside .field, so every property site.css
   sets on `.field label` / `.field input` (caps, block display, text-input
   box, appearance: none, outline: none) is overridden here. */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.report-form .choice {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  margin: 0;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--js-grey-300);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  color: var(--js-purple);
  cursor: pointer;
}
.report-form .choice:has(input:checked) { border-color: var(--js-green-700); background: #f0fbf5; }
.report-form .choice input {
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-appearance: auto;
          appearance: auto;
  accent-color: var(--js-green-700);
  cursor: pointer;
}
.report-form .choice input:focus-visible { outline: 3px solid var(--js-purple); outline-offset: 2px; }
.choice-list.is-loading { font-size: 15px; color: var(--js-purple-300); }

/* Consent ticks, which also carry the privacy information. */
.report-form .field-checkbox { grid-template-columns: 24px 1fr; }
.report-form .field-checkbox input[type="checkbox"] { width: 24px; height: 24px; margin: 0; }
.report-form .field-checkbox label { font-size: 16px; color: var(--js-purple); }
.report-form .field-checkbox .field-error { grid-column: 1 / -1; order: -1; margin: 0; }
.report-privacy { margin: 20px 0 0; font-size: 15px; line-height: 1.5; color: var(--js-purple-300); }

/* Errors: summary at the top, message under each problem field. */
.error-summary {
  margin: 24px 0 0;
  padding: 20px 24px;
  background: #fff;
  border: 4px solid #c0392b;
}
.error-summary:focus { outline: 3px solid var(--js-purple); outline-offset: 2px; }
.error-summary h3 { margin: 0 0 12px; font-size: 20px; color: var(--js-purple); }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary li + li { margin-top: 6px; }
/* Block links: the whole row is a 24px-plus target (WCAG 2.5.8), and a
   wrapped link keeps its bullet on the first line. */
.error-summary a { display: block; min-height: 24px; padding: 2px 0; color: #c0392b; font-weight: 600; }
.field-error { margin: 0 0 10px; font-size: 16px; font-weight: 700; line-height: 1.4; color: #c0392b; }
.report-form .field.has-error { padding-left: 16px; border-left: 4px solid #c0392b; }
.report-form .field.has-error .choice { border-color: #c0392b; }

.report-submit { margin-top: 36px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.report-submit .form-status:empty { display: none; }
.report-submit .form-status { min-height: 0; font-size: 16px; }

.report-unavailable,
.report-success {
  margin-top: 48px;
  padding: 32px;
  background: var(--bg-2);
  border-top: 4px solid var(--js-green);
}
.report-success h2 { margin: 0 0 12px; font-size: 28px; color: var(--js-purple); }
.report-success:focus { outline: none; }
.report-success p,
.report-unavailable p { margin: 0; font-size: 17px; line-height: 1.6; color: var(--js-purple); }
.report-success a,
.report-unavailable a { color: var(--js-purple); text-underline-offset: 3px; }

.report-closing { margin: 40px 0 0; font-size: 17px; line-height: 1.6; color: var(--js-purple); }
.report-closing a { color: var(--js-purple); text-underline-offset: 3px; }

@media (max-width: 720px) {
  .report-form { padding: 28px 20px; margin-left: -4px; margin-right: -4px; }
  .report-submit .btn { width: 100%; justify-content: center; }
  .report-success, .report-unavailable { padding: 24px 20px; }
}
