/**
 * Contact Form 7 — Dhyan brand layout + motion.
 * Loads after CF7 plugin CSS on contact (and CF7) pages.
 */

/* ── Shell ── */
.wpcf7.dhyan-cf7-wrap,
.dhyan-cf7-wrap.wpcf7 {
	max-width: var(--dhyan-width-prose);
	margin-left: auto;
	margin-right: auto;
	width: 100%;
}

.dhyan-cf7 {
	--dhyan-cf7-primary: var(--dhyan-color-primary);
	--dhyan-cf7-primary-dark: var(--dhyan-color-primary-dark);
	--dhyan-cf7-ring: rgb(var(--dhyan-color-primary-rgb) / 0.72);
	--dhyan-cf7-border: var(--dhyan-color-border);
	--dhyan-cf7-fg: var(--dhyan-color-foreground);
	--dhyan-cf7-muted: var(--dhyan-color-muted);
	--dhyan-cf7-soft: var(--dhyan-color-primary-soft);
	--dhyan-cf7-danger: var(--dhyan-color-danger);
	position: relative;
	padding: 0;
}

.dhyan-cf7__header {
	margin-bottom: 1.75rem;
	text-align: left;
}

.dhyan-cf7__title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.5rem, 2.5vw, 1.875rem);
	font-weight: 700;
	line-height: 1.25;
	color: var(--dhyan-cf7-fg);
	letter-spacing: var(--dhyan-tracking-tight);
}

.dhyan-cf7__lead {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--dhyan-cf7-muted);
}

/* ── Fields ──
   Progressive enhancement: fields stay visible by default.
   Entrance motion runs only when JS adds .js-animate.is-ready.
   Never gate visibility on JS (no opacity:0 resting state). */
.dhyan-cf7__field,
.dhyan-cf7 .dhyan-cf7__field {
	margin: 0 0 1.15rem;
	padding: 0;
}

.dhyan-cf7.js-animate.is-ready .dhyan-cf7__header,
.dhyan-cf7.js-animate.is-ready .dhyan-cf7__field,
.dhyan-cf7.js-animate.is-ready .dhyan-cf7__submit {
	animation: dhyan-cf7-field-in var(--dhyan-anim-field-in) var(--dhyan-ease-emphasized) both;
}

/* Children: header, name, email, inquiry, subject, message, submit */
.dhyan-cf7.js-animate.is-ready .dhyan-cf7__header { animation-delay: 0.02s; }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__field:nth-child(2) { animation-delay: 0.08s; }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__field:nth-child(3) { animation-delay: 0.14s; }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__field:nth-child(4) { animation-delay: var(--dhyan-duration-normal); }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__field:nth-child(5) { animation-delay: 0.26s; }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__field:nth-child(6) { animation-delay: 0.32s; }
.dhyan-cf7.js-animate.is-ready > .dhyan-cf7__submit { animation-delay: var(--dhyan-anim-shake); }

@keyframes dhyan-cf7-field-in {
	from {
		opacity: 0;
		transform: translateY(0.65rem);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.dhyan-cf7__label,
.dhyan-cf7 label.dhyan-cf7__label {
	display: block;
	margin: 0 0 0.375rem;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--dhyan-cf7-fg);
}

.dhyan-cf7__req {
	color: var(--dhyan-cf7-danger);
	font-weight: 600;
}

.dhyan-cf7__sublabel {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--dhyan-cf7-muted);
}

/* Email row */
.dhyan-cf7__email-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.85rem;
}

@media (min-width: 640px) {
	.dhyan-cf7__email-grid {
		grid-template-columns: 1fr 1fr;
		gap: 1rem;
	}
}

.dhyan-cf7__subfield {
	margin: 0;
	min-width: 0;
}

/* Controls */
.dhyan-cf7 :is(
	input[type='text'],
	input[type='email'],
	input[type='tel'],
	input[type='url'],
	select,
	textarea
).dhyan-cf7__input,
.dhyan-cf7 :is(
	input.wpcf7-text,
	input.wpcf7-email,
	select.wpcf7-select,
	textarea.wpcf7-textarea
) {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
	height: 2.75rem !important;
	min-height: 2.75rem !important;
	margin: 0 !important;
	padding: 0 1rem !important;
	border: var(--dhyan-border-width) solid var(--dhyan-cf7-border) !important;
	border-radius: var(--dhyan-radius-md) !important;
	background: var(--dhyan-color-background) !important;
	color: var(--dhyan-cf7-fg) !important;
	font-size: 1rem !important;
	line-height: 1.5 !important;
	box-shadow: 0 1px 0 rgb(var(--dhyan-color-foreground-rgb) / 0.02) !important;
	transition:
		border-color var(--dhyan-duration-normal) ease,
		box-shadow var(--dhyan-duration-normal) ease,
		transform var(--dhyan-duration-normal) ease,
		background-color var(--dhyan-duration-normal) ease !important;
}

.dhyan-cf7 textarea.dhyan-cf7__input,
.dhyan-cf7 textarea.wpcf7-textarea {
	height: auto !important;
	min-height: 8rem !important;
	padding: 0.75rem 1rem !important;
	resize: vertical;
	line-height: 1.55 !important;
}

.dhyan-cf7 select.dhyan-cf7__input,
.dhyan-cf7 select.wpcf7-select {
	appearance: none !important;
	-webkit-appearance: none !important;
	padding-right: 2.5rem !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 0.85rem center !important;
	background-size: 0.9rem !important;
	cursor: pointer;
}

.dhyan-cf7 :is(input, select, textarea):hover {
	border-color: var(--dhyan-color-border) !important;
}

.dhyan-cf7 :is(input, select, textarea):focus,
.dhyan-cf7 :is(input, select, textarea):focus-visible {
	border-color: var(--dhyan-cf7-primary) !important;
	outline: none !important;
	box-shadow: 0 0 0 2px var(--dhyan-color-background), 0 0 0 5px var(--dhyan-cf7-ring) !important;
	transform: translateY(-1px);
	background-color: var(--dhyan-color-background) !important;
}

.dhyan-cf7 .wpcf7-not-valid {
	border-color: var(--dhyan-cf7-danger) !important;
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
	animation: dhyan-cf7-shake var(--dhyan-anim-shake) ease;
}

@keyframes dhyan-cf7-shake {
	0%,
	100% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(-4px);
	}
	75% {
		transform: translateX(4px);
	}
}

.dhyan-cf7 .wpcf7-not-valid-tip {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--dhyan-cf7-danger);
}

/* ── Submit ── */
.dhyan-cf7__submit,
.dhyan-cf7 .dhyan-cf7__submit {
	margin: 1.35rem 0 0;
	padding: 0;
	text-align: center;
}

.dhyan-cf7 .wpcf7-submit,
.dhyan-cf7 input.wpcf7-submit,
.dhyan-cf7 .dhyan-cf7__btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-width: 11rem;
	width: auto;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.85rem 1.85rem !important;
	border: none !important;
	border-radius: var(--dhyan-radius-md) !important;
	background: var(--dhyan-cf7-primary) !important;
	color: var(--dhyan-color-background) !important;
	font-size: 1rem !important;
	font-weight: 600 !important;
	line-height: 1.25 !important;
	letter-spacing: var(--dhyan-tracking-wide);
	cursor: pointer;
	box-shadow: 0 8px 20px -10px rgb(var(--dhyan-color-primary-rgb) / 0.55) !important;
	transition:
		background-color var(--dhyan-duration-normal) ease,
		transform var(--dhyan-duration-normal) ease,
		box-shadow var(--dhyan-duration-normal) ease !important;
}

.dhyan-cf7 .wpcf7-submit:hover,
.dhyan-cf7 input.wpcf7-submit:hover,
.dhyan-cf7 .dhyan-cf7__btn:hover {
	background: var(--dhyan-cf7-primary-dark) !important;
	transform: translateY(-2px);
	box-shadow: 0 14px 28px -12px rgb(var(--dhyan-color-primary-rgb) / 0.6) !important;
}

.dhyan-cf7 .wpcf7-submit:active,
.dhyan-cf7 input.wpcf7-submit:active,
.dhyan-cf7 .dhyan-cf7__btn:active {
	transform: translateY(0);
	box-shadow: 0 6px 14px -10px rgb(var(--dhyan-color-primary-rgb) / 0.45) !important;
}

.dhyan-cf7 .wpcf7-submit:focus-visible,
.dhyan-cf7 .dhyan-cf7__btn:focus-visible {
	outline: 2px solid var(--dhyan-color-primary) !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 2px var(--dhyan-color-background), var(--dhyan-shadow-focus-primary), 0 8px 20px -10px rgb(var(--dhyan-color-primary-rgb) / 0.55) !important;
}

.dhyan-cf7.submitting .wpcf7-submit,
.dhyan-cf7.submitting .dhyan-cf7__btn {
	opacity: 0.72;
	pointer-events: none;
	transform: none;
}

/* Spinner via CF7 spinner element */
.dhyan-cf7 .wpcf7-spinner {
	margin-left: 0.65rem;
	vertical-align: middle;
}

/* ── Response messages ── */
.dhyan-cf7-wrap .wpcf7-response-output,
.wpcf7.dhyan-cf7-wrap .wpcf7-response-output {
	margin: 1.25rem 0 0 !important;
	padding: 0.9rem 1.1rem !important;
	border-radius: var(--dhyan-radius-lg) !important;
	border-width: var(--dhyan-border-width) !important;
	font-size: 0.9375rem;
	line-height: 1.5;
	animation: dhyan-cf7-msg-in var(--dhyan-anim-msg-in) ease;
}

@keyframes dhyan-cf7-msg-in {
	from {
		opacity: 0;
		transform: translateY(0.4rem) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.dhyan-cf7-wrap .wpcf7-mail-sent-ok,
.wpcf7.dhyan-cf7-wrap form.sent .wpcf7-response-output {
	border-color: rgb(var(--dhyan-color-primary-rgb) / 0.4) !important;
	background: var(--dhyan-cf7-soft) !important;
	color: var(--dhyan-cf7-fg) !important;
}

.dhyan-cf7-wrap .wpcf7-validation-errors,
.dhyan-cf7-wrap .wpcf7-mail-sent-ng,
.wpcf7.dhyan-cf7-wrap form.invalid .wpcf7-response-output,
.wpcf7.dhyan-cf7-wrap form.failed .wpcf7-response-output {
	border-color: rgb(var(--dhyan-color-danger-rgb) / 0.35) !important;
	background: rgb(var(--dhyan-color-danger-rgb) / 0.08) !important;
	color: var(--dhyan-color-danger) !important;
}

.dhyan-cf7-missing {
	max-width: var(--dhyan-width-prose);
	margin: 0 auto;
	padding: 1rem 1.15rem;
	border: var(--dhyan-border-width) dashed var(--dhyan-cf7-border, var(--dhyan-color-border));
	border-radius: var(--dhyan-radius-lg);
	background: var(--dhyan-color-surface);
	font-size: 0.9375rem;
}

/* Screen reader / CF7 wrappers */
.dhyan-cf7 .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.dhyan-cf7.js-animate.is-ready .dhyan-cf7__header,
	.dhyan-cf7.js-animate.is-ready .dhyan-cf7__field,
	.dhyan-cf7.js-animate.is-ready .dhyan-cf7__submit,
	.dhyan-cf7-wrap .wpcf7-response-output {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}

	.dhyan-cf7 :is(input, select, textarea):focus,
	.dhyan-cf7 .wpcf7-submit:hover,
	.dhyan-cf7 .dhyan-cf7__btn:hover {
		transform: none !important;
	}

	.dhyan-cf7 .wpcf7-not-valid {
		animation: none !important;
	}
}
