/**
 * Contact Form 7, dressed to match the theme.
 *
 * Loaded only when Contact Form 7 is active, after the plugin's own stylesheet.
 * Every selector here is also one step more specific than the plugin's, so the
 * theme still wins if a caching or optimisation plugin reorders the files.
 *
 * Covers every standard form tag: text, email, tel, url, number, date,
 * textarea, select, checkbox, radio, acceptance, file, quiz and submit, plus
 * the validation messages, the response message and the sending spinner.
 *
 * Optional: in the form editor, wrap two fields in <div class="pp-form-row">
 * to set them side by side on wider screens.
 */

.wpcf7 {
	--pp-field-line: rgba(244, 241, 234, 0.22);
	--pp-field-line-hover: rgba(244, 241, 234, 0.42);
	--pp-error: #e8836e;
	--pp-success: #9fc7a4;
}

/* Kept hidden even if the plugin's own stylesheet has been switched off. */
.wpcf7 .hidden-fields-container {
	display: none;
}

.wpcf7 .screen-reader-response {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* ------------------------------------------------------------------ Layout */

.wpcf7 .wpcf7-form > p,
.wpcf7 .wpcf7-form > .pp-form-row {
	margin: 0 0 clamp(26px, 3.4vw, 38px);
}

.wpcf7 .pp-form-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(26px, 3.4vw, 38px) clamp(20px, 3vw, 36px);
}

.wpcf7 .pp-form-row > p {
	margin: 0;
}

@media (max-width: 640px) {
	.wpcf7 .pp-form-row {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ------------------------------------------------------------------ Labels */

/* The small tracked capitals used for labels across the site. */
.wpcf7 .wpcf7-form label,
.wpcf7 .wpcf7-form p:has(.wpcf7-checkbox, .wpcf7-radio) {
	display: block;
	font-family: var(--pp-sans);
	font-size: 10px;
	font-weight: 400;
	line-height: 1.6;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--pp-muted);
	transition: color 0.3s ease;
}

.wpcf7 .wpcf7-form label:focus-within {
	color: var(--pp-ink);
}

/* The form editor puts a line break between a label and its field; spacing
   is handled here instead. */
.wpcf7 .wpcf7-form label > br,
.wpcf7 .wpcf7-form p:has(.wpcf7-checkbox, .wpcf7-radio) > br {
	display: none;
}

/* ------------------------------------------------------------------ Fields */

.wpcf7 .wpcf7-form input[type="text"],
.wpcf7 .wpcf7-form input[type="email"],
.wpcf7 .wpcf7-form input[type="tel"],
.wpcf7 .wpcf7-form input[type="url"],
.wpcf7 .wpcf7-form input[type="number"],
.wpcf7 .wpcf7-form input[type="date"],
.wpcf7 .wpcf7-form textarea,
.wpcf7 .wpcf7-form select {
	display: block;
	width: 100%;
	margin: 12px 0 0;
	padding: 10px 0 12px;
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--pp-field-line);
	border-radius: 0;
	box-shadow: none;
	color: var(--pp-ink);
	font-family: var(--pp-sans);
	/* 17px. Anything under 16px makes iOS zoom the page on focus. */
	font-size: 1.0625rem;
	font-weight: 300;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wpcf7 .wpcf7-form input::placeholder,
.wpcf7 .wpcf7-form textarea::placeholder {
	color: var(--pp-faint);
	opacity: 1;
}

.wpcf7 .wpcf7-form input:hover,
.wpcf7 .wpcf7-form textarea:hover,
.wpcf7 .wpcf7-form select:hover {
	border-bottom-color: var(--pp-field-line-hover);
}

/* The underline turns gold and thickens: a clear focus mark that does not
   shift the layout. */
.wpcf7 .wpcf7-form input:focus,
.wpcf7 .wpcf7-form textarea:focus,
.wpcf7 .wpcf7-form select:focus {
	outline: none;
	border-bottom-color: var(--pp-accent);
	box-shadow: 0 1px 0 0 var(--pp-accent);
}

.wpcf7 .wpcf7-form textarea {
	height: 10rem;
	min-height: 6rem;
	resize: vertical;
}

.wpcf7 .wpcf7-form select {
	padding-right: 28px;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23f4f1ea' stroke-opacity='0.7' stroke-width='1.2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 2px center;
	background-size: 12px 8px;
}

/* Some systems draw the open list light; keep the options legible on it. */
.wpcf7 .wpcf7-form select option {
	background-color: var(--pp-bg-soft);
	color: var(--pp-ink);
}

/* Browser autofill otherwise paints a pale box over the dark page. */
.wpcf7 .wpcf7-form input:-webkit-autofill,
.wpcf7 .wpcf7-form input:-webkit-autofill:hover,
.wpcf7 .wpcf7-form textarea:-webkit-autofill,
.wpcf7 .wpcf7-form select:-webkit-autofill {
	-webkit-text-fill-color: var(--pp-ink);
	caret-color: var(--pp-ink);
	box-shadow: 0 0 0 1000px var(--pp-bg) inset;
	transition: background-color 99999s ease-out 0s;
}

.wpcf7 .wpcf7-form input:-webkit-autofill:focus {
	-webkit-text-fill-color: var(--pp-ink);
	box-shadow: 0 0 0 1000px var(--pp-bg) inset, 0 1px 0 0 var(--pp-accent);
}

/* -------------------------------------------------- Checkboxes and radios */

.wpcf7 .wpcf7-form .wpcf7-checkbox,
.wpcf7 .wpcf7-form .wpcf7-radio,
.wpcf7 .wpcf7-form .wpcf7-acceptance {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 28px;
	margin-top: 14px;
}

.wpcf7 .wpcf7-form .wpcf7-acceptance {
	margin-top: 0;
}

.wpcf7 .wpcf7-form .wpcf7-list-item {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

/* Option text reads as ordinary text, not as another label. Only the label
   is a flex box, to space the tick box from its text; the text itself stays
   inline, or a link inside it (a privacy policy, say) is pulled apart from
   the words and punctuation around it. */
.wpcf7 .wpcf7-form .wpcf7-list-item label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.wpcf7 .wpcf7-form .wpcf7-list-item label,
.wpcf7 .wpcf7-form .wpcf7-list-item-label {
	font-family: var(--pp-sans);
	font-size: 0.9375rem;
	font-weight: 300;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	color: rgba(244, 241, 234, 0.82);
	cursor: pointer;
}

/* The plugin pads option text with spaces, which doubles up with the gap. */
.wpcf7 .wpcf7-form .wpcf7-list-item-label::before,
.wpcf7 .wpcf7-form .wpcf7-list-item-label::after {
	content: none;
}

.wpcf7 .wpcf7-form input[type="checkbox"],
.wpcf7 .wpcf7-form input[type="radio"] {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--pp-accent);
	cursor: pointer;
}

/* ------------------------------------------------------------------- Files */

.wpcf7 .wpcf7-form input[type="file"] {
	display: block;
	margin-top: 14px;
	font-family: var(--pp-sans);
	font-size: 0.875rem;
	font-weight: 300;
	letter-spacing: normal;
	text-transform: none;
	color: var(--pp-muted);
}

.wpcf7 .wpcf7-form input[type="file"]::file-selector-button {
	margin-right: 16px;
	padding: 10px 20px;
	background: transparent;
	border: 1px solid rgba(244, 241, 234, 0.4);
	border-radius: 999px;
	color: var(--pp-ink);
	font-family: var(--pp-sans);
	font-size: 10px;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.wpcf7 .wpcf7-form input[type="file"]::file-selector-button:hover {
	background: var(--pp-ink);
	border-color: var(--pp-ink);
	color: #0a0a0b;
}

/* ------------------------------------------------------------------ Submit */

.wpcf7 .wpcf7-form p:has(> .wpcf7-submit) {
	display: flex;
	align-items: center;
	margin-top: clamp(34px, 4.4vw, 48px);
}

/* The same pill as the Explore button on the home page. */
.wpcf7 .wpcf7-form .wpcf7-submit {
	display: inline-block;
	margin: 0;
	padding: 16px 38px;
	background: transparent;
	border: 1px solid rgba(244, 241, 234, 0.4);
	border-radius: 999px;
	color: var(--pp-ink);
	font-family: var(--pp-sans);
	font-size: 10px;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.wpcf7 .wpcf7-form .wpcf7-submit:hover,
.wpcf7 .wpcf7-form .wpcf7-submit:focus-visible {
	background: var(--pp-ink);
	border-color: var(--pp-ink);
	color: #0a0a0b;
}

.wpcf7 .wpcf7-form .wpcf7-submit:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.wpcf7 .wpcf7-form .wpcf7-submit:disabled:hover {
	background: transparent;
	border-color: rgba(244, 241, 234, 0.4);
	color: var(--pp-ink);
}

/* A thin ring in place of the plugin's grey disc. */
.wpcf7 .wpcf7-spinner {
	width: 18px;
	height: 18px;
	margin: 0 0 0 20px;
	background: transparent;
	border: 1px solid rgba(244, 241, 234, 0.2);
	border-top-color: var(--pp-ink);
	border-radius: 50%;
	opacity: 1;
}

.wpcf7 .wpcf7-spinner::before {
	display: none;
}

.wpcf7 .wpcf7-form.submitting .wpcf7-spinner {
	animation: pp-form-spin 0.8s linear infinite;
}

@keyframes pp-form-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpcf7 .wpcf7-form.submitting .wpcf7-spinner {
		animation: none;
		border-color: rgba(244, 241, 234, 0.6);
	}
}

/* -------------------------------------------------------------- Validation */

/* Two classes deep on purpose: the field rules above use a type selector
   plus an attribute, which would otherwise outrank a single class and keep
   an invalid field's underline grey, and let hover override it. */
.wpcf7 .wpcf7-form .wpcf7-form-control.wpcf7-not-valid {
	border-bottom-color: var(--pp-error);
}

.wpcf7 .wpcf7-form .wpcf7-form-control.wpcf7-not-valid:focus {
	border-bottom-color: var(--pp-error);
	box-shadow: 0 1px 0 0 var(--pp-error);
}

/* The tip sits inside the label, so undo the label's capitals. */
.wpcf7 .wpcf7-not-valid-tip {
	display: block;
	margin-top: 8px;
	font-family: var(--pp-sans);
	font-size: 12px;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 0.02em;
	text-transform: none;
	color: var(--pp-error);
}

.wpcf7 .use-floating-validation-tip .wpcf7-not-valid-tip {
	position: static;
	width: auto;
	padding: 0;
	background: none;
	border: 0;
}

/* ------------------------------------------------------- Response message */

.wpcf7 .wpcf7-form .wpcf7-response-output {
	margin: clamp(22px, 3vw, 32px) 0 0;
	padding: 14px 18px 14px 20px;
	background: rgba(244, 241, 234, 0.03);
	border: 1px solid var(--pp-line);
	border-left: 2px solid var(--pp-line);
	border-radius: calc(var(--pp-radius) * 0.4);
	color: var(--pp-ink);
	font-family: var(--pp-sans);
	font-size: 0.9375rem;
	font-weight: 300;
	line-height: 1.55;
}

/* Hidden until there is something to say, as the plugin does. */
.wpcf7 .wpcf7-form.init .wpcf7-response-output,
.wpcf7 .wpcf7-form.resetting .wpcf7-response-output,
.wpcf7 .wpcf7-form.submitting .wpcf7-response-output,
.wpcf7 .wpcf7-form .wpcf7-response-output:empty {
	display: none;
}

.wpcf7 .wpcf7-form.sent .wpcf7-response-output {
	border-color: rgba(159, 199, 164, 0.35);
	border-left-color: var(--pp-success);
}

.wpcf7 .wpcf7-form.invalid .wpcf7-response-output,
.wpcf7 .wpcf7-form.unaccepted .wpcf7-response-output,
.wpcf7 .wpcf7-form.payment-required .wpcf7-response-output {
	border-color: rgba(201, 162, 39, 0.35);
	border-left-color: var(--pp-accent);
}

.wpcf7 .wpcf7-form.failed .wpcf7-response-output,
.wpcf7 .wpcf7-form.aborted .wpcf7-response-output,
.wpcf7 .wpcf7-form.spam .wpcf7-response-output {
	border-color: rgba(232, 131, 110, 0.35);
	border-left-color: var(--pp-error);
}
