/* The contact form (order 91, 2026-10-27; CLAUDE.md, "The contact form") and the agents form (order 94, 2026-10-28; "The agents form").
 *
 * A plain file in public/, linked by the Worker into the contact pages and the privacy pages while CONTACT_FORM is "test" or "on", into the agents pages while AGENT_FORM is "test" or "on", and by no
 * page at all while both are "off": the built pages do not know it. It is not processed by the build, so it is written final: the site's tokens (they are on the page already), logical properties only, no radius, no shadow, no
 * motion, no colour that is not a token. It follows the payment-plan calculator's fields (src/styles/payment-calculator.css): a 48px box, a 1px border, the accent on hover and focus,
 * a heavier border when a field is wrong, because colour alone must not say so. The text of an error says what is wrong and what to do; the word "Error" is read by a screen reader.
 */

.cf {
  margin-block: var(--space-7) 0;
  max-inline-size: var(--measure-body);
}

.cf__title {
  margin-block: 0 var(--space-4);
}

.cf__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* a track that can shrink below the widest field: at 200% text on a 320px phone the inputs' own width would otherwise push the column out */
  gap: var(--space-5);
}

.cf__cluster {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.cf__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-inline-size: 0;
}

/* A long word (Russian and German have them) must wrap at the window's edge rather than run past it, at 200% text on a 320px phone too. */
.cf__label,
.cf__hint,
.cf__error,
.cf__note,
.cf__summary-list,
.cf__banner,
.cf__lead,
.cf__signpost,
.cf__email,
.cf__caution,
.cf--result p {
  overflow-wrap: anywhere;
}

.cf__label {
  padding: 0;
  color: var(--color-text);
  font-size: var(--font-size-ui);
  font-weight: var(--font-weight-strong);
  line-height: var(--line-height-normal);
}

.cf__hint {
  margin: 0;
  max-inline-size: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  line-height: var(--line-height-caption);
}

.cf__error {
  margin: 0;
  max-inline-size: none;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--color-text);
  color: var(--color-text);
  font-size: var(--font-size-ui);
  font-weight: var(--font-weight-strong);
  line-height: var(--line-height-snug);
}

.cf__input {
  box-sizing: border-box;
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: var(--space-7); /* 48 */
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-text-faint);
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 1.125rem; /* 18: never below 16, so that a phone does not zoom in on focus */
  line-height: 1.5rem;
}

.cf__input:hover {
  border-color: var(--color-accent);
}

.cf__input:focus-visible {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.cf__input[aria-invalid='true'] {
  border-color: var(--color-text);
  border-block-end-width: 3px;
}

.cf__textarea {
  min-block-size: 10rem;
  resize: vertical;
}

/* The preferred channel: three radios in a fieldset, each a row at least 48px high. */
.cf__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.cf__choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-6);
}

.cf__choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: var(--space-7);
  font-size: 1.125rem;
  line-height: 1.5rem;
  cursor: pointer;
}

.cf__radio {
  flex: none;
  inline-size: 1.25rem;
  block-size: 1.25rem;
  margin: 0;
  accent-color: var(--color-text);
}

.cf__radio:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* The solid action (semantic.css, --color-action-*): the button that asks for the next step, as nav.css draws it (.btn-action). */
.cf__submit {
  justify-self: start;
  box-sizing: border-box;
  max-inline-size: 100%;
  min-block-size: var(--space-7);
  margin: 0;
  padding-block: var(--space-3);
  padding-inline: var(--space-6);
  border: 0;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--color-action-bg);
  color: var(--color-action-text);
  font: inherit;
  font-size: var(--font-size-ui);
  font-weight: var(--font-weight-strong);
  line-height: var(--line-height-snug);
  cursor: pointer;
}

.cf__submit:hover,
.cf__submit:focus-visible {
  background-color: var(--color-action-hover);
}

.cf__submit:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.cf__note {
  margin: 0;
  max-inline-size: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  line-height: var(--line-height-caption);
}

/* The honeypot: out of sight, out of the accessibility tree (aria-hidden in the markup, tabindex -1 on the field), and not display:none, which simple programs skip. */
.cf__trap {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

/* What comes back when a field is wrong: the summary above the form, each line a link to its field. */
.cf__summary {
  margin-block-end: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--color-text);
  border-inline-start-width: 6px;
}

.cf__summary-title {
  margin-block: 0 var(--space-2);
  font-size: var(--font-size-h3);
}

.cf__summary-list {
  margin: 0;
  padding-inline-start: var(--space-4);
}

.cf__summary-list li + li {
  margin-block-start: var(--space-1);
}

/* The test version's banner: a dashed rule, so that nobody takes a preview for the site. */
.cf__banner {
  margin-block: 0 var(--space-5);
  max-inline-size: none;
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-text);
  font-size: var(--font-size-small);
  line-height: var(--line-height-caption);
}

/* The thank-you page and the fallback page. */
.cf--result {
  margin-block-start: var(--space-5);
}

.cf__lead {
  max-inline-size: var(--measure-body);
  font-family: var(--font-heading);
  font-optical-sizing: auto;
  font-size: var(--font-size-standfirst);
  line-height: var(--line-height-standfirst);
}

.cf--result > p + p,
.cf--result > p + .cf__field {
  margin-block-start: var(--space-4);
}

.cf--result .cf__field {
  margin-block-start: var(--space-5);
}

/* The office landline's line on the contact form's fallback page (order 102), under the email address: the same line as on the Contact page (src/components/ContactPhone.astro), the icon at the start and
   the words beside it. `overflow-wrap: anywhere`: the number's groups are joined by no-break spaces, so in a very narrow window at a large text size it breaks rather than runs out of the window. */
.cf__phone {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.cf__phone .phone-icon {
  flex: none;
  margin-block-start: calc((1lh - 1.5rem) / 2);
}

.cf__phone > span {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* The version of the privacy notice, under the privacy page's standfirst: its date. */
.cf-version {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

/* The agents form (order 94). It stands in the dark closing band of the agents page, so everything here reads the semantic roles, which that band reassigns: nothing is coloured twice. */

/* The line under a form's heading that points to the other form: quieter than the heading, loud enough to find. */
.cf__signpost {
  margin-block: 0 var(--space-4);
  max-inline-size: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-ui);
  line-height: var(--line-height-snug);
}

/* The address that was the button, still a link beside the form. */
.cf__email {
  margin-block: 0 var(--space-5);
  max-inline-size: none;
}

/* The line that asks the agent not to send the client's name or contact details: not a hint to skim, so it is the text colour, with a mark of the accent beside it. */
.cf__caution {
  margin: 0;
  max-inline-size: none;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--color-accent);
  color: var(--color-text);
  font-size: var(--font-size-ui);
  line-height: var(--line-height-snug);
}
