/* AF theme: visitor-facing form presentation. Loaded only on form pages, after af.css
   (equal specificity wins here). Uses the af theme's tokens with fallbacks (the --afm-* block),
   so it also works under another theme. Rules: 48 px rows (44 px small buttons), visible focus everywhere (border +
   ring, transparent outline for forced colours), max(16px, 1em) inputs (no iOS zoom), 4.5:1
   text, 3:1 control borders, motion only under prefers-reduced-motion: no-preference. */

.af-form {
	--afm-primary: var(--af-primary, #65001f);
	--afm-button: var(--af-theme, #970055);
	--afm-text: var(--af-text, #1e1e1e);
	--afm-link: var(--af-link, #91003a);
	--afm-muted: #4b4f58;
	--afm-border: var(--af-field-line, #766a5e); /* 5.3:1 on white */
	--afm-border-hover: #4a4038;
	--afm-line: var(--af-line, #ebe2d6);
	--afm-soft: var(--af-tan-pale, #f6eee3);
	--afm-tint: rgba(151, 0, 85, .05);
	--afm-ring: rgba(151, 0, 85, .2);
	--afm-error: #b3261e;
	--afm-error-bg: #fdf4f3;
	--afm-ok: #2f6b45;
	--afm-r: var(--af-radius-control, 3px); /* the theme's buttons and fields */
	--afm-r-card: var(--af-radius, 6px); /* the theme's tiles */
	--afm-font: var(--af-font, Roboto, sans-serif);
	--afm-display: var(--af-font-slab, Georgia, serif);
	color: var(--afm-text);
	font-family: var(--afm-font);
}
.af-form [hidden] { display: none !important; }
.af-form .af-sr, .af-form .af-form__default, .af-form .af-form__hp {
	position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.af-form h2.af-form__title { margin: 0 0 20px; color: var(--afm-primary); font: 600 clamp(24px, 2.4vw, 30px)/1.25 var(--afm-display); }
.af-form p.af-form__required-note, .af-form p.af-progress__saved { margin: 0 0 1.5em; color: var(--afm-muted); font-size: .95em; }

/* Notices, error summary, confirmation: cards with an icon badge (text carries the meaning) */
.af-form .af-form__notice, .af-form .af-errors, .af-form .af-form__confirmation {
	position: relative; margin: 0 0 1.75em; padding: 18px 20px 18px 60px;
	border: 1px solid rgba(179, 38, 30, .35); border-radius: var(--afm-r-card); background: var(--afm-error-bg);
	box-shadow: 0 1px 2px rgba(60, 20, 10, .06);
}
.af-form .af-form__notice::before, .af-form .af-errors::before, .af-form .af-form__confirmation::before {
	content: "!"; content: "!" / ""; position: absolute; top: 17px; left: 18px; width: 26px; height: 26px; border-radius: 50%;
	background: var(--afm-error); color: #fff; font: 700 16px/26px var(--afm-font); text-align: center;
}
.af-form .af-form__notice p { margin: 0; }
.af-form .af-errors__title { margin: 0 0 .4em; color: var(--afm-error); font: 600 1.1em/1.5 var(--afm-font); }
.af-form ul.af-errors__list { margin: 0 0 0 1.1em; padding: 0; list-style: disc; }
.af-form .af-errors__list li { margin: .2em 0; }
.af-form .af-errors__list a { color: var(--afm-error); text-decoration: underline; text-underline-offset: 3px; }
.af-form .af-form__confirmation { border-color: var(--afm-line); background: var(--afm-soft); font-size: 1.05em; }
.af-form .af-form__confirmation::before { content: "\2713"; content: "\2713" / ""; background: var(--afm-ok); }
.af-form .af-form__confirmation p:last-child { margin-bottom: 0; }
.af-form-warning { padding: 10px 14px; border-left: 4px solid #d63638; background: #fcf0f1; }

/* Progress (multi-page) */
.af-form .af-progress { margin: 0 0 1.75em; }
.af-form p.af-progress__label { margin: 0 0 .5em; color: var(--afm-primary); font-size: .85em; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.af-form .af-progress__bar {
	display: block; width: 100%; height: 8px; margin: 0 0 .9em; border: 0; border-radius: 99px;
	background: var(--afm-soft); box-shadow: inset 0 1px 2px rgba(60, 20, 10, .12); accent-color: var(--afm-button); appearance: none;
}
.af-form .af-progress__bar::-webkit-progress-bar { border-radius: 99px; background: transparent; }
.af-form .af-progress__bar::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, var(--afm-primary), var(--afm-button)); }
.af-form .af-progress__bar::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, var(--afm-primary), var(--afm-button)); }

/* Sections and HTML blocks */
.af-form .af-section {
	margin: 2.25em 0 .75em; padding-top: 1em; border-top: 1px solid var(--afm-line);
	color: var(--afm-primary); font: 600 1.25em/1.35 var(--afm-display);
}
.af-form .af-section__desc, .af-form .af-html { margin: 0 0 1.25em; }
.af-form hr.af-section-rule { margin: 1.75em 0; border: 0; border-top: 1px solid var(--afm-line); }
.af-form .af-html h3, .af-form .af-html h4, .af-form .af-html h5 { margin: 1.2em 0 .5em; color: var(--afm-text); font-weight: 600; }
.af-form .af-center { text-align: center; }

/* Fields */
.af-form .af-field { min-width: 0; margin: 0 0 1.6em; padding: 0; border: 0; }
.af-form .af-field.has-error { padding-left: 16px; border-left: 3px solid var(--afm-error); }
.af-form .af-label { display: block; margin: 0 0 .45em; padding: 0; color: var(--afm-text); font-weight: 600; line-height: 1.45; }
.af-form legend.af-label { float: left; width: 100%; }
.af-form legend.af-label + * { clear: left; }
.af-form .af-req { color: var(--afm-error); }
.af-form .af-desc, .af-form p.af-if { margin: 0 0 .6em; color: var(--afm-muted); font-size: .95em; }
.af-form .af-desc p { margin: 0 0 .5em; }
.af-form p.af-if { font-style: italic; }
.af-form.af-js p.af-if { display: none; }
.af-form p.af-error { margin: 0 0 .5em; color: var(--afm-error); font-weight: 600; }
.af-form .af-sublabel { display: block; margin: 0 0 .3em; color: var(--afm-muted); font-size: .95em; }

.af-form input[type="text"], .af-form input[type="email"], .af-form input[type="tel"],
.af-form input[type="date"], .af-form textarea, .af-form select {
	box-sizing: border-box; width: 100%; max-width: 100%; min-height: 48px; margin: 0; padding: 11px 14px;
	border: 1px solid var(--afm-border); border-radius: var(--afm-r); background: #fff; color: var(--afm-text);
	box-shadow: inset 0 1px 2px rgba(60, 20, 10, .07); outline: 2px solid transparent; outline-offset: 2px;
	font: 400 max(16px, 1em)/1.5 var(--afm-font);
}
.af-form input[type="date"] { max-width: 16em; }
.af-form input[type="date"]::-webkit-calendar-picker-indicator { opacity: .65; cursor: pointer; }
.af-form textarea { min-height: 8em; resize: vertical; }
.af-form select {
	padding-right: 42px; appearance: none; cursor: pointer;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%234b4f58' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 16px;
}
.af-form ::placeholder { color: #6b6b6b; opacity: 1; }
.af-form [aria-invalid="true"]:not([type="radio"]):not([type="checkbox"]) { border-color: var(--afm-error); background-color: #fffbfa; }
.af-form :is(input:not([type="radio"]):not([type="checkbox"]), textarea, select):focus-visible {
	border-color: var(--afm-button); box-shadow: 0 0 0 1px var(--afm-button), 0 0 0 5px var(--afm-ring);
}
.af-form :not(.af-choice) > :is(input, textarea, select)[aria-invalid="true"]:focus-visible { border-color: var(--afm-error); box-shadow: 0 0 0 1px var(--afm-error), 0 0 0 5px rgba(179, 38, 30, .18); }

/* Choices: each row is a card; the label's ::after covers the card, so all of it is the target */
.af-form .af-choices { display: grid; gap: 8px 12px; }
.af-form .af-choice {
	position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px;
	border: 1px solid var(--afm-line); border-radius: var(--afm-r-card); background: #fff;
}
.af-form .af-choice label { flex: 1; padding: 11px 0; cursor: pointer; line-height: 1.4; }
.af-form .af-choice label::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.af-form .af-choice :is(input[type="radio"], input[type="checkbox"]) {
	position: relative; z-index: 1; flex: none; width: 20px; height: 20px; margin: 0;
	border: 2px solid var(--afm-border); border-radius: 50%; background: #fff; appearance: none; cursor: pointer;
}
.af-form .af-choice input[type="checkbox"] { border-radius: var(--afm-r); }
.af-form .af-choice input:checked { border-color: var(--afm-button); background: var(--afm-button); }
.af-form .af-choice input[type="radio"]:checked { box-shadow: inset 0 0 0 3px #fff; }
.af-form .af-choice input[type="checkbox"]:checked {
	background: var(--afm-button) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.af-form .af-choice input:focus-visible { outline: 2px solid var(--afm-button); outline-offset: 2px; }
.af-form .af-choice:has(:checked) { border-color: var(--afm-button); background: var(--afm-tint); box-shadow: inset 0 0 0 1px var(--afm-button); }
.af-form .af-choice:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--afm-ring); }
.af-form .af-choice:has(:checked:focus-visible) { box-shadow: inset 0 0 0 1px var(--afm-button), 0 0 0 4px var(--afm-ring); }
.af-form .af-choice:has([aria-invalid="true"]):not(:has(:checked)) { border-color: rgba(179, 38, 30, .45); }
.af-form .af-choice--other { flex-wrap: wrap; padding-block: 4px; }
.af-form .af-choice--other input.af-other { position: relative; z-index: 1; flex: 1 1 14em; width: auto; margin: 0 0 6px; }
@media (min-width: 640px) {
	.af-form .af-choices--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.af-form .af-choices--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.af-form .af-choices--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 340px) and (max-width: 639px) {
	.af-form :is(.af-choices--cols-3, .af-choices--cols-4) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Name and confirmed e-mail: two boxes side by side from 540 px */
.af-form .af-name { display: grid; gap: .9em 1.25em; }
@media (min-width: 540px) { .af-form .af-name { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Signature: a paper pad with a baseline */
.af-form .af-sig__pad {
	display: block; box-sizing: border-box; width: 100%; max-width: 600px; height: auto; aspect-ratio: 3 / 1;
	border: 2px dashed var(--afm-border); border-radius: var(--afm-r-card); cursor: crosshair; touch-action: none;
	background: #fffdfa linear-gradient(to top, transparent 24%, #b9ada0 24%, #b9ada0 calc(24% + 1px), transparent calc(24% + 1px)) no-repeat center / calc(100% - 48px) 100%;
}
.af-form .af-sig__pad:focus-visible { border-style: solid; border-color: var(--afm-button); outline: 2px solid transparent; box-shadow: 0 0 0 5px var(--afm-ring); }
.af-form p.af-sig__help { margin: 0 0 .5em; color: var(--afm-muted); font-size: .95em; }
.af-form .af-sig__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5em 1.25em; margin: .75em 0 0; }
.af-form p.af-sig__msg { margin: .5em 0 0; color: var(--afm-error); font-weight: 600; }
.af-form p.af-sig__msg:empty { display: none; }
.af-form .af-sig__typed input[type="text"] { max-width: 28em; }

/* Buttons */
.af-form .af-btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 48px; margin: 0;
	padding: 12px 30px; border: 1px solid var(--afm-button); border-radius: var(--afm-r);
	background: var(--afm-button); color: #fff; font: 500 16px/1.2 var(--afm-font); letter-spacing: .01em; cursor: pointer;
}
.af-form .af-btn:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25); }
.af-form .af-btn[disabled], .af-form .af-btn[disabled]:hover {
	border-color: #c9c4be; background: #eeebe7; box-shadow: none; color: #5f5a54; cursor: not-allowed; transform: none;
}
.af-form :is(.af-btn, .af-link-button):focus-visible { outline: 2px solid var(--afm-button); outline-offset: 3px; }
.af-form .af-btn--secondary { background: #fff; color: var(--afm-button); }
.af-form .af-btn--small { min-height: 44px; padding: 9px 18px; font-size: 15px; }
.af-form .af-link-button {
	display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 2px; border: 0; background: none;
	color: var(--afm-link); font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.af-form .af-form__nav {
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
	margin: 2.25em 0 0; padding-top: 1.5em; border-top: 1px solid var(--afm-line);
}
.af-form .af-form__turnstile { margin: 1.5em 0 0; }

@media (hover: hover) {
	.af-form :is(input[type="text"], input[type="email"], input[type="tel"], input[type="date"], textarea, select):hover:not(:focus) { border-color: var(--afm-border-hover); }
	.af-form .af-choice:hover { border-color: var(--afm-border); background: var(--afm-tint); }
	.af-form .af-choice:hover input:not(:checked) { border-color: var(--afm-button); }
	.af-form .af-sig__pad:hover { border-color: var(--afm-border-hover); }
	.af-form .af-btn:hover { border-color: var(--afm-primary); background-color: var(--afm-primary); }
	.af-form .af-btn--secondary:hover { background: var(--afm-tint); color: var(--afm-primary); }
	.af-form .af-link-button:hover { color: var(--af-link-hover, #a3005c); text-decoration-thickness: 2px; }
}

/* Micro-motion, only for visitors who have not asked for less */
@media (prefers-reduced-motion: no-preference) {
	.af-form :is(input, textarea, select, .af-choice, .af-sig__pad, .af-btn, .af-link-button) {
		transition: border-color .18s ease, background-color .18s ease, box-shadow .2s ease, color .18s ease, transform .18s ease;
	}
	.af-form .af-choice input:checked { animation: afm-pop .22s ease-out; }
	@media (hover: hover) { .af-form .af-btn:not([disabled]):hover { transform: translateY(-1px); } }
	.af-form .af-btn:not([disabled]):active { transform: translateY(1px); }
}
@keyframes afm-pop { 50% { transform: scale(1.18); } }

@media (max-width: 480px) {
	.af-form .af-form__nav .af-btn { flex: 1 1 auto; }
	.af-form .af-field.has-error { padding-left: 12px; }
	.af-form :is(.af-form__notice, .af-errors, .af-form__confirmation) { padding: 16px 16px 16px 52px; }
	.af-form :is(.af-form__notice, .af-errors, .af-form__confirmation)::before { left: 14px; top: 15px; }
}

/* Windows high contrast: native controls back, system colours for focus and checked */
@media (forced-colors: active) {
	.af-form .af-choice :is(input[type="radio"], input[type="checkbox"]), .af-form select { appearance: auto; background-image: none; }
	.af-form select { padding-right: 14px; }
	.af-form :is(input, textarea, select, .af-sig__pad, .af-btn, .af-link-button):focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
	.af-form .af-choice:has(:checked) { border: 2px solid Highlight; }
	.af-form .af-choice:has(input:focus-visible) { outline: 2px solid Highlight; }
	.af-form .af-progress__bar { forced-color-adjust: none; border: 1px solid CanvasText; background: Canvas; }
	.af-form .af-progress__bar::-webkit-progress-value { background: Highlight; }
	.af-form .af-progress__bar::-moz-progress-bar { background: Highlight; }
	.af-form :is(.af-form__notice, .af-errors, .af-form__confirmation)::before { forced-color-adjust: none; background: CanvasText; color: Canvas; }
}

@media print {
	.af-form * { box-shadow: none !important; transition: none !important; animation: none !important; }
	.af-form :is(.af-choice, .af-name__part, .af-sig) { break-inside: avoid; }
	/* Backgrounds do not print by default: native controls print their checked state */
	.af-form .af-choice :is(input[type="radio"], input[type="checkbox"]) { appearance: auto; accent-color: var(--afm-button); background: none !important; }
}
