/**
 * Contact Form 7 — form controls in the FAVORIT design.
 *
 * Project-wide, not per form: every CF7 form on the site is styled through
 * CF7's own generic classes (.wpcf7-text, .wpcf7-radio, .wpcf7-submit …), so a
 * form placed somewhere new looks right without CSS of its own. The section
 * around a form keeps its own stylesheet — contact-section.css lays out two
 * columns and a card and touches no field.
 *
 * The look comes from the design's one fully drawn form,
 * src-v2/detail-contact.jsx (inputStyle, Label, QLabel, RadioRow, CheckRow),
 * which therefore sets the pattern for all of them.
 *
 * CF7's own stylesheet is dequeued (see includes/cf7.php), so the structural
 * rules it carries have to live here too: hiding the screen reader response and
 * the hidden field container, revealing the response output only in the states
 * that have something to say, and the spinner. They are marked below — that
 * part is behaviour, not taste.
 *
 * Two rules a form has to follow to come out right:
 *   • radio and checkbox groups need `use_label_element`. Without it CF7 emits
 *     no <label>, and neither the chips nor the rows below become clickable.
 *   • every [radio] is implicitly required in CF7 (modules/checkbox.php), so a
 *     group that may stay unanswered has to be a [select].
 *
 * The .fmt-form-* classes at the end are for use inside the CF7 form editor.
 */

/* =========================================================
   Structural — carried over from CF7's own stylesheet
   ========================================================= */

/* The error list for screen readers. Visible text without this. */
.wpcf7 .screen-reader-response {
	position: absolute;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	word-wrap: normal !important;
	word-break: normal !important;
}
.wpcf7 .hidden-fields-container {
	display: none;
}
/* Anchor for the validation tip; block so a field fills its grid cell. */
.wpcf7-form-control-wrap {
	position: relative;
	display: block;
}
.wpcf7 [inert] {
	opacity: .5;
}
.wpcf7 input[type="file"] {
	cursor: pointer;
}
.wpcf7 input[type="file"]:disabled {
	cursor: default;
}
.wpcf7 input[type="url"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"] {
	direction: ltr;
}

/* =========================================================
   Text fields, textareas, selects
   ========================================================= */

.wpcf7-form-control {
	font-family: inherit;
}
.wpcf7-text,
.wpcf7-textarea,
.wpcf7-select,
.wpcf7-number,
.wpcf7-date {
	width: 100%;
	padding: 12px 14px;
	font-size: 14px;
	line-height: 1.45;
	color: var(--ink);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	outline: none;
	transition: border-color .15s ease;
}
.wpcf7-text:focus,
.wpcf7-textarea:focus,
.wpcf7-select:focus,
.wpcf7-number:focus,
.wpcf7-date:focus {
	border-color: var(--ink-2);
}
.wpcf7-text::placeholder,
.wpcf7-textarea::placeholder {
	color: var(--ink-mute);
}
.wpcf7-textarea {
	min-height: 92px;
	resize: vertical;
}

/* The chevron is drawn here because a native select arrow ignores the palette. */
.wpcf7-select {
	appearance: none;
	padding-right: 38px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2374716a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
}

/* =========================================================
   Radio groups — chips (the design's RadioRow)
   ========================================================= */

.wpcf7-radio {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.wpcf7-radio .wpcf7-list-item {
	display: inline-flex;
	margin: 0;
}
.wpcf7-radio .wpcf7-list-item label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--ink);
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all .12s ease;
}
.wpcf7-radio .wpcf7-list-item label:hover {
	border-color: var(--line-2);
}

/* The native control leaves the flow but keeps its place in the tab order and
   its semantics: the chip is what is seen, the dot is drawn on the label. */
.wpcf7-radio .wpcf7-list-item input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.wpcf7-radio .wpcf7-list-item-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.wpcf7-radio .wpcf7-list-item-label::before {
	content: "";
	flex-shrink: 0;
	width: 12px;
	height: 12px;
	border: 1px solid rgba(0, 0, 0, .2);
	border-radius: 50%;
}
.wpcf7-radio .wpcf7-list-item label:has(input:checked) {
	color: #fff;
	background: var(--ink-2);
	border-color: var(--ink-2);
}
.wpcf7-radio .wpcf7-list-item label:has(input:checked) .wpcf7-list-item-label::before {
	background: #fff;
	border-color: #fff;
	box-shadow: inset 0 0 0 3px var(--ink-2);
}
/* The focus ring has to be put back by hand — the input it would belong to is
   the invisible one. */
.wpcf7-radio .wpcf7-list-item label:has(input:focus-visible) {
	outline: 2px solid var(--ink-2);
	outline-offset: 2px;
}

/* =========================================================
   Checkbox groups — full width rows (the design's CheckRow)
   ========================================================= */

.wpcf7-checkbox {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.wpcf7-checkbox .wpcf7-list-item {
	display: block;
	margin: 0;
}
.wpcf7-checkbox .wpcf7-list-item label {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--ink);
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all .12s ease;
}
.wpcf7-checkbox .wpcf7-list-item label:hover {
	border-color: var(--line-2);
}
.wpcf7-checkbox .wpcf7-list-item label:has(input:checked) {
	background: rgba(20, 18, 12, .03);
	border-color: var(--ink-2);
}
.wpcf7-checkbox .wpcf7-list-item label:has(input:focus-visible) {
	outline: 2px solid var(--ink-2);
	outline-offset: 2px;
}
/* Here the box itself is the design's mark, so it stays visible. */
.wpcf7-checkbox input[type="checkbox"] {
	flex-shrink: 0;
	width: 15px;
	height: 15px;
	margin: 0;
	accent-color: var(--red);
}

/* CF7 pads its list labels with spaces; the flex gap does that job here. */
.wpcf7-list-item-label::before,
.wpcf7-list-item-label::after {
	content: none;
}

/* =========================================================
   Submit
   ========================================================= */

/* The same button as .btn--red.btn--lg, which it cannot reuse: [submit] is an
   <input>, so the design's trailing arrow has no element to live in and is
   drawn as a background — which also slides on hover, the way .btn does it
   with .arr. */
.wpcf7-submit {
	display: inline-flex;
	align-items: center;
	padding: 14px 44px 14px 22px;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: -0.005em;
	color: #fff;
	background-color: var(--red);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 20px center;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, background-position .2s ease;
}
.wpcf7-submit:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px -8px rgba(227, 0, 15, .5);
	background-position: right 17px center;
}
.wpcf7 .wpcf7-submit:disabled {
	transform: none;
	box-shadow: none;
	cursor: not-allowed;
}

/* =========================================================
   Validation and response
   ========================================================= */

.wpcf7-not-valid-tip {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--red);
}
.wpcf7-not-valid {
	border-color: var(--red);
}
.wpcf7 form .wpcf7-response-output {
	margin: 22px 0 0;
	padding: 12px 14px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ink-soft);
	background: var(--bg-2);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
}

/* States CF7 sets on the form element. The first three have nothing to say. */
.wpcf7 form.init .wpcf7-response-output,
.wpcf7 form.resetting .wpcf7-response-output,
.wpcf7 form.submitting .wpcf7-response-output {
	display: none;
}
.wpcf7 form.sent .wpcf7-response-output {
	border-color: var(--line-2);
}
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output,
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output {
	color: var(--red-ink);
	background: var(--paper);
	border-color: var(--red);
}

/* Spinner — CF7 only toggles its visibility, the look is ours. */
.wpcf7-spinner {
	visibility: hidden;
	display: inline-block;
	width: 18px;
	height: 18px;
	margin: 0 0 0 14px;
	vertical-align: -4px;
	border: 2px solid var(--line-2);
	border-top-color: var(--ink-2);
	border-radius: 50%;
	animation: fmt-cf7-spin 900ms linear infinite;
}
form.submitting .wpcf7-spinner {
	visibility: visible;
}
@keyframes fmt-cf7-spin {
	to {
		transform: rotate(360deg);
	}
}
@media (prefers-reduced-motion: reduce) {
	.wpcf7-spinner {
		animation: fmt-cf7-blink 1800ms ease-in-out infinite;
	}
	@keyframes fmt-cf7-blink {
		0%, 100% {
			opacity: .25;
		}
		50% {
			opacity: 1;
		}
	}
}

/* =========================================================
   Authoring helpers — for use in the CF7 form editor
   ========================================================= */

/* Also used on <fieldset>, which brings its own frame and spacing. */
.fmt-form-field {
	display: block;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.fmt-form-row {
	margin-bottom: 14px;
}
.fmt-form-row--2,
.fmt-form-row--2-1,
.fmt-form-row--1-2 {
	display: grid;
	gap: 14px;
	margin-bottom: 14px;
}
.fmt-form-row--2 {
	grid-template-columns: 1fr 1fr;
}
.fmt-form-row--2-1 {
	grid-template-columns: 2fr 1fr;
}
.fmt-form-row--1-2 {
	grid-template-columns: 1fr 2fr;
}
/* Before a new group of questions, where the design opens up the rhythm.
   Declared after the row variants so it can be combined with any of them. */
.fmt-form-row--gap {
	margin-bottom: 22px;
}

/* Two questions of unequal length side by side: their labels run one and two
   lines, and the inputs still line up — the cell becomes a column and the
   control is pushed to its bottom (the design does it with marginTop:auto). */
.fmt-form-row--bottom > .fmt-form-field {
	display: flex;
	flex-direction: column;
}
.fmt-form-row--bottom > .fmt-form-field .wpcf7-form-control-wrap {
	margin-top: auto;
}

/* Short labels, uppercase — the design's Label. Also used as <legend>. */
.fmt-form-label {
	display: block;
	margin-bottom: 8px;
	padding: 0;
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .12em;
	color: var(--ink-mute);
}
.fmt-form-label__hint {
	margin-left: 4px;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

/* Whole questions, in sentence case — the design's QLabel. */
.fmt-form-q {
	display: block;
	margin-bottom: 8px;
	padding: 0;
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.45;
	letter-spacing: -0.005em;
	color: var(--ink-soft);
}

.fmt-form-note {
	margin: 0 0 18px;
	padding: 14px 16px;
	font-size: 11.5px;
	line-height: 1.55;
	color: var(--ink-mute);
	background: var(--bg-2);
	border: 1px solid var(--line);
	border-radius: 8px;
}
.fmt-form-note b,
.fmt-form-note strong {
	font-weight: 500;
	color: var(--ink-soft);
}

/* Closing row: consent left, submit right, wrapping when there is no room.
   The consent is a single [checkbox*], which arrives as a one item list — a
   sentence to agree with rather than an option to pick, so it drops the row
   frame the other checkbox groups carry. */
.fmt-form-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	flex-wrap: wrap;
}
.fmt-form-consent {
	max-width: 380px;
}
.fmt-form-consent .wpcf7-checkbox .wpcf7-list-item label,
.fmt-form-consent .wpcf7-checkbox .wpcf7-list-item label:hover,
.fmt-form-consent .wpcf7-checkbox .wpcf7-list-item label:has(input:checked) {
	align-items: flex-start;
	padding: 0;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.5;
	color: var(--ink-soft);
	background: none;
	border-color: transparent;
}
.fmt-form-consent .wpcf7-checkbox input[type="checkbox"] {
	margin-top: 3px;
}
.fmt-form-consent .wpcf7-not-valid-tip {
	margin-top: 4px;
}

/* =========================================================
   Phone — every row collapses to one column
   ========================================================= */

@media (max-width: 680px) {
	.fmt-form-row--2,
	.fmt-form-row--2-1,
	.fmt-form-row--1-2 {
		grid-template-columns: 1fr;
	}
	.fmt-form-actions {
		justify-content: stretch;
	}
	.fmt-form-consent {
		max-width: none;
	}
	.wpcf7-submit {
		justify-content: center;
		width: 100%;
		padding-right: 44px;
	}
}
