/**
 * Course signup form.
 *
 * Styles Contact Form 7's own markup rather than replacing it. That means
 * living with CF7's wrappers (.wpcf7-form-control-wrap, .wpcf7-list-item,
 * .wpcf7-list-item-label) and overriding a handful of rules from CF7's
 * stylesheet, in exchange for keeping CF7's validation, its error messages, its
 * ARIA wiring and real form controls.
 *
 * Checkboxes are styled with appearance:none directly on the input, so the
 * control the browser exposes and the box you can see are the same element.
 * The radios are the exception: their visible shape is the label, so there the
 * input is clipped and the ring is drawn on the label instead.
 */

.snof-su {
	--snof-su-cream: #faf7f2;
	--snof-su-cream-2: #efede6;
	--snof-su-ink: #20211f;
	--snof-su-ink-60: #575a56;
	--snof-su-brand: #5c8a92;
	--snof-su-brand-dk: #47727a;
	--snof-su-brand-deep: #2c4a50;
	--snof-su-brand-tint: #e3edee;
	--snof-su-line: #e0dbd1;
	--snof-su-error: #a3341c;
	--snof-su-error-bg: #fbeeea;
	--snof-su-radius: 14px;
	--snof-su-font: inherit;
	--snof-su-head: Merriweather, Georgia, serif;

	box-sizing: border-box;
	max-width: 664px;
	margin: 0 auto;
	font-family: var(--snof-su-font);
	color: var(--snof-su-ink);
}

.snof-su *,
.snof-su *::before,
.snof-su *::after {
	box-sizing: inherit;
}

/*
 * Themes love to add margins to headings, paragraphs and lists inside content.
 *
 * :where() is what makes this safe. Written as `.snof-su p { margin: 0 }` the
 * reset scores (0,1,1) and quietly beats every (0,1,0) class rule below it,
 * flattening the spacing of the whole form. Inside :where() it contributes
 * nothing, so the component rules win as intended.
 */
.snof-su :where(h2, h3, p, ol, ul, li, fieldset, legend) {
	margin: 0;
	padding: 0;
}

.snof-su :where(fieldset) {
	border: 0;
	min-width: 0; /* Firefox refuses to let flex children of a fieldset shrink otherwise. */
}

.snof-su :where(ul, ol) {
	list-style: none;
}

/* ---------------------------------------------------- CF7 chrome overrides */

/* CF7 ships `margin: 0 0 0 1em` on every list item. */
.snof-su .wpcf7-list-item {
	display: block;
	margin: 0;
}

/*
 * CF7 puts `content: " "` on both pseudo-elements of every list item label, to
 * space the text away from the input. Harmless in normal flow, but the labels
 * here are grid containers, and a pseudo-element on a grid container is a grid
 * item: the two spaces take the first and last cells and shunt the real content
 * sideways. Removing them is what keeps the programme rows readable.
 */
.snof-su .wpcf7-list-item-label::before,
.snof-su .wpcf7-list-item-label::after {
	content: none;
}

.snof-su .wpcf7-form-control-wrap {
	display: block;
}

/*
 * Puts CF7's error summary above the form instead of below it. CF7 renders it
 * last in the markup, which on a form this long means the message announcing
 * that something is wrong can appear a full screen below the field that is
 * wrong.
 */
.snof-su .wpcf7-form {
	display: flex;
	flex-direction: column;
}

.snof-su .wpcf7-form > .wpcf7-response-output {
	order: -1;
}

.snof-su .wpcf7 form .wpcf7-response-output,
.snof-su .wpcf7-response-output {
	margin: 0 0 26px;
	padding: 16px 20px;
	border: 1.5px solid var(--snof-su-error);
	border-radius: var(--snof-su-radius);
	background: var(--snof-su-error-bg);
	font-size: 15px;
	line-height: 1.5;
	color: var(--snof-su-error);
}

/*
 * CF7's own off-screen response, a sibling of the form rather than a child of
 * it. Deliberately left alone: when the confirmation panel takes over, the form
 * is hidden but this is not, so the result is still announced.
 */
.snof-su .screen-reader-response {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.snof-su .wpcf7-not-valid-tip {
	display: block;
	margin-top: 6px;
	font-size: 14px;
	font-weight: 500;
	color: var(--snof-su-error);
}

.snof-su .wpcf7-spinner {
	margin: 0 0 0 12px;
	vertical-align: middle;
}

/* ------------------------------------------------------------------ layout */

.snof-su__set {
	margin: 0 0 38px;
}

.snof-su__set:last-of-type {
	margin-bottom: 0;
}

.snof-su__legend {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
	font-family: var(--snof-su-head);
	font-weight: 600;
	font-size: 24px;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--snof-su-ink);
}

.snof-su__legend i {
	flex: none;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--snof-su-brand-tint);
	font-style: normal;
	font-size: 15px;
	font-weight: 700;
	color: var(--snof-su-brand-deep);
}

.snof-su__grid2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 16px;
}

@media (max-width: 560px) {
	.snof-su__grid2 {
		grid-template-columns: 1fr;
	}
}

/* ------------------------------------------------------------------ fields */

.snof-su__field {
	margin: 0 0 16px;
}

.snof-su__field--spaced {
	margin-top: 18px;
}

.snof-su__field > label,
.snof-su__sub > legend {
	display: block;
	margin-bottom: 7px;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.4;
}

.snof-su__hint {
	font-weight: 400;
	color: var(--snof-su-ink-60);
}

.snof-su input[type="text"],
.snof-su input[type="email"],
.snof-su input[type="date"],
.snof-su input[type="tel"],
.snof-su textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 14px 18px;
	border: 1.5px solid var(--snof-su-line);
	border-radius: var(--snof-su-radius);
	background: #fff;
	font: inherit;
	font-size: 16px; /* Below 16px, iOS Safari zooms the page on focus. */
	line-height: 1.5;
	color: var(--snof-su-ink);
	-webkit-appearance: none;
	appearance: none;
}

.snof-su textarea {
	min-height: 104px;
	resize: vertical;
}

.snof-su input::placeholder,
.snof-su textarea::placeholder {
	color: #8b8578; /* 4.5:1 on white. Lighter placeholders fail AA. */
	opacity: 1;
}

/* One ring, not two: outline-offset 0 lets the outline sit on the border. */
.snof-su input[type="text"]:focus,
.snof-su input[type="email"]:focus,
.snof-su input[type="date"]:focus,
.snof-su textarea:focus,
.snof-su input[type="text"]:focus-visible,
.snof-su input[type="email"]:focus-visible,
.snof-su input[type="date"]:focus-visible,
.snof-su textarea:focus-visible {
	outline: 2px solid var(--snof-su-brand-dk);
	outline-offset: 0;
	border-color: var(--snof-su-brand-dk);
}

.snof-su .wpcf7-not-valid {
	border-color: var(--snof-su-error);
}

/* ------------------------------------------------------- checkboxes proper */

.snof-su input[type="checkbox"] {
	flex: none;
	width: 22px;
	height: 22px;
	margin: 0;
	border: 2px solid var(--snof-su-line);
	border-radius: 7px;
	background: #fff no-repeat center;
	background-size: 13px 13px;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.snof-su input[type="checkbox"]:checked {
	border-color: var(--snof-su-brand-dk);
	background-color: var(--snof-su-brand-dk);
	/* The tick, inlined so it needs no HTTP request and no markup of its own. */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.snof-su input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--snof-su-brand-deep);
	outline-offset: 2px;
}

/*
 * Windows High Contrast Mode throws away background colours, which would leave
 * every box looking identical whether ticked or not. Handing the control back
 * to the browser is the only reliable fix.
 */
@media (forced-colors: active) {
	.snof-su input[type="checkbox"] {
		-webkit-appearance: auto;
		appearance: auto;
	}
}

/* -------------------------------------------------------------- pill radios */

.snof-su__pills .wpcf7-radio {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
}

.snof-su__pills .wpcf7-list-item label {
	display: inline-block;
	cursor: pointer;
}

.snof-su__pills input[type="radio"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.snof-su__pills .wpcf7-list-item-label {
	display: inline-block;
	padding: 11px 20px;
	border: 1.5px solid var(--snof-su-line);
	border-radius: 100px;
	background: #fff;
	font-size: 15.5px;
	font-weight: 500;
	line-height: 1.3;
}

.snof-su__pills input:checked + .wpcf7-list-item-label {
	background: var(--snof-su-brand-dk);
	border-color: var(--snof-su-brand-dk);
	color: #fff;
	font-weight: 600;
}

.snof-su__pills input:focus-visible + .wpcf7-list-item-label {
	outline: 2px solid var(--snof-su-brand-deep);
	outline-offset: 2px;
}

@supports not selector(:focus-visible) {
	.snof-su__pills input:focus + .wpcf7-list-item-label {
		outline: 2px solid var(--snof-su-brand-deep);
		outline-offset: 2px;
	}
}

/* --------------------------------------------------------- programme rows */

.snof-su__progs .wpcf7-checkbox,
.snof-su__progs .wpcf7-radio {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.snof-su__progs .wpcf7-list-item label {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 14px;
	align-items: center;
	padding: 16px 20px;
	border: 1.5px solid var(--snof-su-line);
	border-radius: 16px;
	background: #fff;
	cursor: pointer;
}

.snof-su__progs .wpcf7-list-item:has(input:checked) label {
	border-color: var(--snof-su-brand-dk);
	box-shadow: inset 0 0 0 1px var(--snof-su-brand-dk);
}

/*
 * Radios used as card rows, on the enrolment form. Same shape as the checkbox
 * above but round, so the difference between "pick several" and "pick one" is
 * visible before you click rather than after.
 */
.snof-su__progs input[type="radio"] {
	flex: none;
	width: 22px;
	height: 22px;
	margin: 0;
	border: 2px solid var(--snof-su-line);
	border-radius: 50%;
	background: #fff;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.snof-su__progs input[type="radio"]:checked {
	border-color: var(--snof-su-brand-dk);
	border-width: 7px;
}

.snof-su__progs input[type="radio"]:focus-visible {
	outline: 2px solid var(--snof-su-brand-deep);
	outline-offset: 2px;
}

@media (forced-colors: active) {
	.snof-su__progs input[type="radio"] {
		-webkit-appearance: auto;
		appearance: auto;
	}
}

/* Fallback for browsers without :has(), applied by the script. */
.snof-su__progs .wpcf7-list-item.is-on label {
	border-color: var(--snof-su-brand-dk);
	box-shadow: inset 0 0 0 1px var(--snof-su-brand-dk);
}

.snof-su__progs .wpcf7-list-item-label {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4px 14px;
	align-items: center;
	font-size: 16px;
	line-height: 1.4;
}

.snof-su__prog-body b {
	display: block;
	font-size: 16.5px;
	font-weight: 600;
	line-height: 1.3;
}

.snof-su__prog-body span {
	display: block;
	font-size: 14.5px;
	line-height: 1.4;
	color: var(--snof-su-ink-60);
}

.snof-su__progs em {
	font-style: normal;
	font-family: var(--snof-su-head);
	font-size: 17px;
	font-weight: 600;
	color: var(--snof-su-ink-60);
	white-space: nowrap;
}

.snof-su__progs .wpcf7-not-valid-tip {
	margin-top: 10px;
}

@media (max-width: 480px) {
	.snof-su__progs .wpcf7-list-item-label {
		grid-template-columns: 1fr;
	}

	.snof-su__progs em {
		justify-self: start;
	}
}

/* ---------------------------------------------------------------- age hint */

.snof-su__match {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-top: 10px;
	padding: 14px 18px;
	border-radius: var(--snof-su-radius);
	background: var(--snof-su-brand-tint);
	font-size: 15px;
	line-height: 1.5;
	color: var(--snof-su-brand-deep);
}

.snof-su__match[hidden] {
	display: none;
}

.snof-su__match::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	background: no-repeat center / contain
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C4A50' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}

.snof-su__match b {
	font-weight: 700;
}

/* ------------------------------------------------------------ account card */

.snof-su__acct {
	margin-bottom: 22px;
	border: 2px solid var(--snof-su-brand-dk);
	border-radius: 20px;
	background: #fff;
	overflow: hidden;
}

.snof-su__acct-top {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 24px;
	background: var(--snof-su-brand-tint);
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--snof-su-brand-deep);
}

.snof-su__acct-top::before {
	content: "";
	flex: none;
	width: 15px;
	height: 15px;
	background: no-repeat center / contain
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C4A50' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 3l2.6 5.6 6.1.8-4.5 4.2 1.2 6-5.4-3-5.4 3 1.2-6L3.3 9.4l6.1-.8z'/%3E%3C/svg%3E");
}

.snof-su__acct-in {
	padding: 24px;
}

.snof-su__acct-in .wpcf7-list-item label {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 14px;
	align-items: center;
	cursor: pointer;
}

.snof-su__acct-in input[type="checkbox"] {
	border-color: var(--snof-su-brand-dk);
}

.snof-su__acct-in .wpcf7-list-item-label {
	font-family: var(--snof-su-head);
	font-size: 21px;
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

/* Aligns the body under the title rather than under the tick box. */
.snof-su__acct-body {
	padding-left: 36px;
}

.snof-su__acct-sub {
	margin: 6px 0 16px;
	font-size: 15.5px;
	line-height: 1.5;
	color: var(--snof-su-ink-60);
}

.snof-su__acct-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 20px;
}

@media (max-width: 560px) {
	.snof-su__acct-list {
		grid-template-columns: 1fr;
	}

	.snof-su__acct-body {
		padding-left: 0;
	}
}

.snof-su__acct-list li {
	display: grid;
	grid-template-columns: 15px 1fr;
	gap: 9px;
	align-items: start;
	font-size: 15px;
	line-height: 1.45;
}

.snof-su__acct-list li::before {
	content: "";
	width: 15px;
	height: 15px;
	margin-top: 4px;
	background: no-repeat center / contain
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2347727A' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.snof-su__nopass {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--snof-su-line);
	font-size: 14px;
	line-height: 1.5;
	color: var(--snof-su-ink-60);
}

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

/*
 * The grid is on the label rather than on this wrapper, and nothing here uses
 * display:contents. Flattening a <label> that way has a long history of dropping
 * it out of the accessibility tree, and it would also make the layout depend on
 * exactly how CF7 nests the acceptance tag, which differs between the enclosing
 * and self-closing forms.
 *
 * Putting the grid on the label means the checkbox is the first cell and
 * whatever CF7 renders after it, a span or a bare text node, lands in the
 * second. Both work.
 */
.snof-su__consent {
	margin-bottom: 24px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--snof-su-ink-60);
}

.snof-su__consent .wpcf7-list-item label {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 14px;
	align-items: start;
	cursor: pointer;
}

.snof-su__consent input[type="checkbox"] {
	margin-top: 2px;
}

.snof-su__consent .wpcf7-not-valid-tip {
	margin-left: 36px;
}

/* ----------------------------------------------------------------- button */

.snof-su input[type="submit"],
.snof-su .snof-su__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 16px 30px;
	border: 0;
	border-radius: 100px;
	background: var(--snof-su-brand-dk);
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
	text-align: center;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.snof-su input[type="submit"]:hover,
.snof-su input[type="submit"]:focus,
.snof-su .snof-su__btn:hover,
.snof-su .snof-su__btn:focus {
	background: var(--snof-su-brand-deep);
	color: #fff;
}

.snof-su input[type="submit"]:focus-visible,
.snof-su .snof-su__btn:focus-visible {
	outline: 2px solid var(--snof-su-brand-deep);
	outline-offset: 3px;
}

.snof-su input[type="submit"]:disabled,
.snof-su .snof-su__btn[aria-disabled="true"] {
	opacity: 0.65;
	cursor: default;
}

.snof-su__btn--light {
	background: #fff;
	color: var(--snof-su-brand-deep);
}

.snof-su__btn--light:hover,
.snof-su__btn--light:focus {
	background: var(--snof-su-cream-2);
	color: var(--snof-su-brand-deep);
}

.snof-su__note {
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--snof-su-ink-60);
	text-align: center;
}

/* ---------------------------------------------------------------- success */

.snof-su__done {
	text-align: center;
}

.snof-su__done[hidden] {
	display: none;
}

.snof-su__tickwrap {
	display: grid;
	place-items: center;
	width: 74px;
	height: 74px;
	margin: 0 auto 26px;
	border-radius: 50%;
	background: var(--snof-su-brand-tint);
}

.snof-su__tickwrap::before {
	content: "";
	width: 34px;
	height: 34px;
	background: no-repeat center / contain
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C4A50' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.snof-su__done-title {
	margin: 0 0 16px;
	font-family: var(--snof-su-head);
	font-size: 38px;
	font-weight: 600;
	line-height: 1.08;
	letter-spacing: -0.02em;
}

.snof-su__done-msg {
	max-width: 540px;
	margin: 0 auto 30px;
	font-size: 19px;
	line-height: 1.55;
	color: var(--snof-su-ink-60);
}

.snof-su__next {
	margin-bottom: 18px;
	padding: 26px 28px;
	border: 1px solid var(--snof-su-line);
	border-radius: 20px;
	background: #fff;
	text-align: left;
}

.snof-su__next h3 {
	margin-bottom: 14px;
	font-family: var(--snof-su-head);
	font-size: 19px;
	font-weight: 600;
	line-height: 1.2;
}

.snof-su__next ol {
	counter-reset: snofstep;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.snof-su__next li {
	counter-increment: snofstep;
	display: grid;
	grid-template-columns: 28px 1fr;
	gap: 13px;
	align-items: start;
	font-size: 15.5px;
	line-height: 1.5;
	color: var(--snof-su-ink-60);
}

.snof-su__next li::before {
	content: counter(snofstep);
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--snof-su-cream-2);
	font-family: var(--snof-su-head);
	font-size: 14px;
	font-weight: 700;
	color: var(--snof-su-brand-deep);
}

.snof-su__next li b {
	color: var(--snof-su-ink);
}

.snof-su__second {
	padding: 28px 30px;
	border-radius: 20px;
	background: var(--snof-su-brand-deep);
	color: #fff;
	text-align: left;
}

.snof-su__second[hidden] {
	display: none;
}

.snof-su__second h3 {
	margin-bottom: 8px;
	font-family: var(--snof-su-head);
	font-size: 21px;
	font-weight: 600;
	line-height: 1.15;
}

.snof-su__second p {
	margin-bottom: 18px;
	font-size: 15.5px;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.82);
}

.snof-su__second b {
	color: #fff;
}

.snof-su__second .snof-su__btn:focus-visible {
	outline-color: #fff;
}

.snof-su__second-msg {
	margin: 0;
	font-size: 15.5px;
	line-height: 1.55;
	color: #fff;
}

/*
 * Hides the form once the confirmation takes over. Only the <form>, not the
 * whole .wpcf7 block: CF7's .screen-reader-response sits outside the form and
 * is what announces the result.
 */
.snof-su--sent .wpcf7-form {
	display: none;
}

@media (max-width: 480px) {
	.snof-su__done-title {
		font-size: 30px;
	}

	.snof-su__done-msg {
		font-size: 17px;
	}

	.snof-su__next,
	.snof-su__second {
		padding: 22px 20px;
	}
}

/* --------------------------------------------------- invitation and gate */

.snof-su__group {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	margin-bottom: 32px;
	padding: 18px 22px;
	border-radius: var(--snof-su-radius);
	background: var(--snof-su-brand-tint);
	color: var(--snof-su-brand-deep);
}

.snof-su__group-label {
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.snof-su__group strong {
	font-family: var(--snof-su-head);
	font-size: 19px;
	font-weight: 600;
	line-height: 1.2;
}

.snof-su__gate {
	padding: 32px 30px;
	border: 1px solid var(--snof-su-line);
	border-radius: 20px;
	background: #fff;
}

.snof-su__gate h2 {
	margin-bottom: 12px;
	font-family: var(--snof-su-head);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.snof-su__gate p {
	margin-bottom: 10px;
	font-size: 16px;
	line-height: 1.55;
	color: var(--snof-su-ink-60);
}

.snof-su__gate p:last-child {
	margin-bottom: 0;
}
