/*
 * WM Contact Form in the Popa Toiture style: square fields with a black border, choices
 * as cards, a square slider, a yellow progress bar and the step navigation.
 */

.wmcf-form {
	font-size: 16px;
}

.wmcf-fields {
	gap: 18px;
}

/* Labels */
.wmcf-label,
.wmcf-choices legend.wmcf-label {
	display: block;
	margin-bottom: 8px;
	font: 700 18px / 1.1 var(--wm-font-head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.wmcf-required {
	margin-left: 4px;
}

/* Character counter ("120 / 5000") at the right of the label, on the same line. */
.wmcf-field:has(> .wmcf-info > .wmcf-counter:only-child) {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 16px;
}

.wmcf-field:has(> .wmcf-info > .wmcf-counter:only-child) > .wmcf-label {
	flex: 1 1 auto;
}

.wmcf-field:has(> .wmcf-info > .wmcf-counter:only-child) > .wmcf-input {
	flex-basis: 100%;
}

.wmcf-field > .wmcf-info > .wmcf-counter:only-child {
	font: 500 15px / 1.1 var(--wm-font-head);
	letter-spacing: 0.04em;
	opacity: 0.7;
	font-variant-numeric: tabular-nums;
}

.wm-legend-hidden legend.wmcf-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Inputs */
.wmcf-input:not(.wmcf-range, .wmcf-file) {
	box-sizing: border-box;
	width: 100%;
	padding: 16px;
	background: var(--wm-white);
	color: var(--wm-ink);
	border: var(--wm-border);
	border-radius: 0;
	font: 400 16px / 1.4 var(--wm-font-body);
}

.wmcf-input:not(.wmcf-range, .wmcf-file):focus {
	outline: 3px solid var(--wm-yellow);
	outline-offset: 0;
}

.wmcf-input::placeholder {
	color: #6b6b6b;
}

textarea.wmcf-input {
	resize: vertical;
}

select.wmcf-input {
	appearance: none;
	padding-right: 48px;
	background: var(--wm-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10'%3E%3Cpolyline points='1,1 7,7 13,1' fill='none' stroke='%230e0e0e' stroke-width='2.5'/%3E%3C/svg%3E") right 18px center / 14px 10px no-repeat;
	cursor: pointer;
}

.wm-field-narrow {
	max-width: 420px;
}

.wmcf-field.is-invalid .wmcf-input:not(.wmcf-range, .wmcf-file) {
	box-shadow: inset 6px 0 0 var(--wm-yellow);
}

.wmcf-error {
	display: inline-block;
	margin-top: 8px;
	padding: 4px 8px;
	background: var(--wm-yellow);
	color: var(--wm-ink);
	font-size: 14px;
	font-weight: 700;
}

.wmcf-error[hidden] {
	display: none;
}

/* Single checkbox (consent) */
.wmcf-checkbox,
.wmcf-radio {
	width: 22px;
	height: 22px;
	accent-color: var(--wm-ink);
	cursor: pointer;
}

/* ------------------------------------------------------------------ Choice cards */

.wm-choice-cards .wmcf-choices {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
	gap: 10px;
}

.wm-choice-cards--check .wmcf-choices {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
	gap: 12px;
}

.wm-choice-cards--small .wmcf-choices {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
}

.wm-choice-cards .wmcf-choices legend {
	grid-column: 1 / -1;
}

.wm-choice-cards .wmcf-check + .wmcf-check {
	margin-top: 0;
}

.wm-choice-cards .wmcf-check {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 18px;
	background: var(--wm-white);
	border: var(--wm-border);
	transition: background-color 0.2s, transform 0.2s;
}

.wm-choice-cards .wmcf-check:hover {
	transform: translateY(-3px);
}

.wm-choice-cards .wmcf-check:has(input:checked) {
	background: var(--wm-yellow);
}

.wm-choice-cards .wmcf-check:has(input:focus-visible) {
	outline: 3px solid var(--wm-ink);
	outline-offset: 2px;
}

.wm-choice-cards .wmcf-check-label {
	font: 700 20px / 1.05 var(--wm-font-head);
	text-transform: uppercase;
	cursor: pointer;
}

/* The whole card is clickable. */
.wm-choice-cards .wmcf-check-label::after {
	content: "";
	position: absolute;
	inset: 0;
}

.wm-choice-cards .wmcf-check-description {
	margin-top: 6px;
	font: 400 14px / 1.4 var(--wm-font-body);
	text-transform: none;
	opacity: 1;
}

/* Radio cards: no visible button, the yellow fill shows the choice. */
.wm-choice-cards .wmcf-radio {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
}

/* Checkbox cards: a square box with a check. */
.wm-choice-cards--check .wmcf-check {
	padding: 20px;
}

.wm-choice-cards--check .wmcf-check-label {
	font-size: 21px;
}

.wm-choice-cards--check .wmcf-checkbox {
	appearance: none;
	flex: none;
	display: grid;
	place-content: center;
	width: 24px;
	height: 24px;
	margin: 0;
	background: var(--wm-white);
	border: var(--wm-border);
	border-radius: 0;
}

.wm-choice-cards--check .wmcf-checkbox:checked::before {
	content: "";
	width: 11px;
	height: 6px;
	margin-top: -3px;
	border-left: 3px solid var(--wm-ink);
	border-bottom: 3px solid var(--wm-ink);
	transform: rotate(-45deg);
}

.wm-choice-cards--check .wmcf-checkbox:focus-visible {
	outline: 0;
}

/* ------------------------------------------------------------------ Slider */

.wmcf-field--range .wmcf-label {
	margin: 0;
	font-size: 22px;
}

.wmcf-range-value {
	padding: 4px 10px;
	background: var(--wm-yellow);
	font: 800 36px / 1 var(--wm-font-head);
}

.wmcf-range {
	appearance: none;
	width: 100%;
	height: 28px;
	margin-top: 14px;
	background: transparent;
}

.wmcf-range::-webkit-slider-runnable-track {
	height: 10px;
	background: var(--wm-white);
	border: var(--wm-border);
}

.wmcf-range::-moz-range-track {
	height: 6px;
	background: var(--wm-white);
	border: var(--wm-border);
}

.wmcf-range::-webkit-slider-thumb {
	appearance: none;
	width: 28px;
	height: 28px;
	margin-top: -11px;
	background: var(--wm-yellow);
	border: var(--wm-border);
	border-radius: 0;
	cursor: grab;
}

.wmcf-range::-moz-range-thumb {
	width: 24px;
	height: 24px;
	background: var(--wm-yellow);
	border: var(--wm-border);
	border-radius: 0;
	cursor: grab;
}

.wmcf-range:focus-visible {
	outline: 3px solid var(--wm-yellow);
	outline-offset: 4px;
}

.wmcf-range-ends {
	font-size: 14px;
}

/* ------------------------------------------------------------------ Photos */

.wm-dropzone {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	gap: 4px 16px;
	align-items: center;
	padding: 20px;
	border: 2px dashed var(--wm-ink);
	transition: background-color 0.2s;
}

.wm-dropzone:hover {
	background: var(--wm-cream);
}

.wm-dropzone::before {
	content: "+";
	grid-row: span 3;
	align-self: start;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: var(--wm-yellow);
	font: 800 28px / 1 var(--wm-font-head);
}

.wm-dropzone .wmcf-label {
	margin: 0;
	font-size: 20px;
}

.wm-dropzone .wmcf-hint {
	grid-column: 2;
	margin: 0;
	font-size: 14px;
	opacity: 1;
}

.wm-dropzone .wmcf-error {
	grid-column: 2;
}

.wmcf-file {
	grid-column: 2;
	max-width: 100%;
	font-size: 15px;
}

.wmcf-file::file-selector-button {
	margin-right: 12px;
	padding: 10px 14px;
	background: var(--wm-ink);
	color: var(--wm-white);
	border: 0;
	font: 700 16px / 1 var(--wm-font-head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.wmcf-file:hover::file-selector-button {
	background: var(--wm-yellow);
	color: var(--wm-ink);
}

/* ------------------------------------------------------------------ Buttons */

.wmcf-submit.wp-element-button,
.wmcf-next.wp-element-button {
	padding: 20px 30px;
	background: var(--wm-ink);
	color: var(--wm-white);
	border: var(--wm-border);
	font: 700 21px / 1 var(--wm-font-head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.wmcf-submit.wp-element-button:hover,
.wmcf-next.wp-element-button:hover,
.wmcf-submit.wp-element-button:focus-visible,
.wmcf-next.wp-element-button:focus-visible {
	background: var(--wm-yellow);
	color: var(--wm-ink);
}

.wmcf-actions {
	margin-top: 28px;
}

/* ------------------------------------------------------------------ Multi-step */

.wmcf-progress {
	appearance: none;
	box-sizing: border-box;
	height: 10px;
	margin-bottom: 48px;
	background: var(--wm-white);
	border: var(--wm-border);
	color: var(--wm-yellow);
}

.wmcf-progress::-webkit-progress-bar {
	background: var(--wm-white);
}

.wmcf-progress::-webkit-progress-value {
	background: var(--wm-yellow);
	transition: width 0.5s var(--wm-ease);
}

.wmcf-progress::-moz-progress-bar {
	background: var(--wm-yellow);
}

.wmcf-form--steps .wmcf-step {
	animation: wm-step-in 0.5s var(--wm-ease);
}

@keyframes wm-step-in {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wmcf-form--steps .wmcf-step {
		animation: none;
	}
}

.wmcf-step-title {
	font: 800 clamp(36px, 4vw, 56px) / 0.95 var(--wm-font-head);
	text-transform: uppercase;
	scroll-margin-top: calc(var(--wm-sticky-top) + 24px);
}

.wmcf-step-title:focus {
	outline: 0;
}

.wmcf-step-description {
	margin-top: 10px;
	font-size: 17px;
}

.wmcf-step > .wmcf-fields {
	margin-top: 28px;
	gap: 40px 18px;
}

.wmcf-form--steps .wmcf-actions {
	margin-top: 48px;
	padding-top: 28px;
	border-top: var(--wm-border);
}

.wmcf-back {
	padding: 12px 0;
	background: none;
	border: 0;
	border-bottom: 3px solid var(--wm-ink);
	color: var(--wm-ink);
	font: 700 20px / 1 var(--wm-font-head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.wmcf-back:hover {
	border-bottom-color: var(--wm-yellow);
}

.wmcf-step-count {
	margin-inline: auto 4px;
	font: 600 18px / 1 var(--wm-font-head);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* ------------------------------------------------------------------ Messages */

.wmcf-message--error {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	background: var(--wm-ink);
	color: var(--wm-white);
	font-size: 15px;
}

.wmcf-message--error::before {
	content: "";
	flex: none;
	width: 10px;
	height: 10px;
	background: var(--wm-yellow);
}

.wmcf-message--error p {
	margin: 0;
}

.wmcf-message--success {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 24px;
}

.wmcf-message--success > * {
	margin: 0;
}

.wmcf-message--success h2 {
	font: 800 44px / 0.95 var(--wm-font-head);
	text-transform: uppercase;
}

.wmcf-message--success p {
	font-size: 17px;
	line-height: 1.6;
	max-width: 560px;
}

.wmcf-message--success:focus {
	outline: 0;
}

.wmcf-form--steps .wmcf-message--success h2,
#wmcf-devis .wmcf-message--success h2 {
	font-size: clamp(40px, 5vw, 72px);
}

.wm-summary {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 12px 32px;
	width: 100%;
	max-width: 640px;
	margin: 0;
	padding-top: 20px;
	border-top: var(--wm-border);
}

.wm-summary dt {
	font: 700 18px / 1.3 var(--wm-font-head);
	text-transform: uppercase;
}

.wm-summary dd {
	margin: 0;
}

.wmcf-message--success .wm-done-icon {
	width: 72px;
	height: 72px;
}
