/* Think Digitally: site look for TD Forms.
 *
 * TD Forms prints its own stylesheet in the footer (after this file), so every rule here is prefixed
 * `body form.td-form` to win on specificity rather than on order.
 *
 * Three looks, chosen by the form's title class (td-form--<title-slug>, stable across environments):
 *   boxed      default: bordered fields (Contact page, Client Info)
 *   underline  a line under each field, label resting on it and lifting when used
 *              (case-study cards, Download Deck, and the footer form on the blue panel)
 *   flat       borderless white fields on a grey panel (lead popup)
 */

/* 1. Shared ---------------------------------------------------------------- */
body form.td-form {
	--tdf-text: #383838;
	--tdf-label: #333;
	--tdf-muted: #6d6d6d;
	--tdf-line: #e1e1e1;
	--tdf-field-bg: #fff;
	--tdf-focus: #3b46d6;
	--tdf-error: #d0312d;
	max-width: none;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--tdf-text);
	font-family: Poppins, Helvetica, Arial, Lucida, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}
body form.td-form .td-form__grid,
body form.td-form .td-form__page {
	gap: 20px;
}
body form.td-form .td-form__label {
	margin: 0 0 2px;
	padding: 0;
	color: var(--tdf-label);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.7;
}
body form.td-form .td-form__req {
	color: var(--tdf-error);
}
body form.td-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select) {
	min-height: 41px;
	margin: 0;
	padding: 9px;
	border: 1px solid var(--tdf-line);
	border-radius: 2px;
	background-color: var(--tdf-field-bg);
	box-shadow: none;
	color: var(--tdf-text);
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.3;
}
body form.td-form textarea {
	min-height: 140px;
}
body form.td-form :is(input, textarea)::placeholder {
	color: var(--tdf-muted);
	opacity: 1;
}
body form.td-form :is(input, textarea, select):hover {
	border-color: #c9c9c9;
}
body form.td-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select):focus {
	border-color: var(--tdf-focus);
	box-shadow: 0 0 0 2px rgba(59, 70, 214, 0.18);
	outline: 0;
}
body form.td-form .td-form__help {
	margin: 4px 0 0;
	color: var(--tdf-muted);
	font-size: 13px;
}
body form.td-form .td-form__error {
	margin: 4px 0 0;
	color: var(--tdf-error);
	font-size: 13px;
	font-weight: 500;
}
/* Consent and single choices: plain rows, not bordered boxes. */
body form.td-form .td-form__choice {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 14px;
}
body form.td-form .td-form__html {
	color: inherit;
}
body form.td-form .td-form__html p {
	margin: 0 0 8px;
	padding: 0;
}
body form.td-form .td-form__actions {
	margin-top: 20px;
}
/* The site's pill button on the blue artwork. */
body form.td-form .td-form__submit {
	display: block;
	width: 100%;
	min-height: 69px;
	padding: 20px 50px;
	border: 0;
	border-radius: 100px;
	background: #3b46d6 url(/wp-content/uploads/2024/02/TD-Blue-scaled.jpg) center / cover;
	box-shadow: 0 4px 7px 0 rgba(0, 0, 0, 0.2);
	color: #fff;
	font-family: inherit;
	font-size: 20px;
	font-weight: 500;
	line-height: 29px;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease;
}
body form.td-form .td-form__submit:hover {
	filter: brightness(1.08);
}
body form.td-form .td-form__submit:focus-visible {
	outline: 2px solid var(--tdf-focus);
	outline-offset: 3px;
}
body form.td-form .td-form__submit:disabled {
	opacity: 0.7;
	cursor: progress;
}
body form.td-form .td-form__status {
	min-height: 0;
	margin-top: 14px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--tdf-text);
	font-size: 15px;
	font-weight: 500;
}
body form.td-form .td-form__status:empty {
	display: none;
}
body form.td-form.td-form--sent .td-form__status {
	margin-top: 0;
	padding: 14px 16px;
	border-radius: 8px;
	background: #e9f7ee;
	color: #14532d;
}

/* 2. Underline look ---------------------------------------------------------- */
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) {
	--tdf-label: #777771;
	--tdf-line: #777771;
	--tdf-text: #000;
	--tdf-muted: #888;
	--tdf-field-bg: transparent;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:has(> :is(input, textarea)) {
	position: relative;
	padding-top: 16px;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select) {
	padding: 10px 0 9px;
	border: 0;
	border-bottom: 1px solid var(--tdf-line);
	border-radius: 0;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select):focus {
	border-color: transparent;
	border-bottom-color: var(--tdf-focus);
	box-shadow: 0 1px 0 0 var(--tdf-focus);
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select):hover {
	border-bottom-color: var(--tdf-focus);
}
/* The label rests on the line and lifts when the field has focus or a value.
   site.js gives empty placeholders a single space so :placeholder-shown works on every field. */
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:has(> :is(input, textarea)) > .td-form__label {
	position: absolute;
	top: 25px;
	left: 0;
	margin: 0;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.3;
	pointer-events: none;
	transition: top 0.15s ease, font-size 0.15s ease;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:has(> :is(input, textarea)):is(:focus-within, :has(> :is(input, textarea):not(:placeholder-shown))) > .td-form__label {
	top: 0;
	font-size: 12px;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:not(:focus-within) > :is(input, textarea)::placeholder {
	color: transparent;
}
body form.td-form:is([class*="-case-study"], .td-form--download-deck) .td-form__submit {
	box-shadow: none;
}
/* Download Deck: black pill, as on the deck panel. */
body form.td-form.td-form--download-deck .td-form__submit {
	background: #000;
}
body form.td-form.td-form--download-deck .td-form__html p:first-child {
	font-size: 20px;
	font-weight: 500;
}

/* 2a. Footer form on the blue panel. */
body form.td-form.td-form--contact-us {
	--tdf-label: #fff;
	--tdf-line: rgba(255, 255, 255, 0.6);
	--tdf-text: #fff;
	--tdf-muted: rgba(255, 255, 255, 0.75);
	--tdf-focus: #fff;
	--tdf-error: #ffd0cc;
}
body form.td-form.td-form--contact-us .td-form__grid {
	gap: 30px;
}
body form.td-form.td-form--contact-us .td-form__req {
	color: #fff;
}
body form.td-form.td-form--contact-us select option {
	color: #111;
}
body form.td-form.td-form--contact-us .td-form__actions {
	margin-top: 30px;
}
body form.td-form.td-form--contact-us .td-form__submit {
	position: relative;
	background: #fff;
	box-shadow: none;
	color: #000;
}
/* The words swap on hover, as the old footer button did. */
body form.td-form.td-form--contact-us .td-form__submit::after {
	content: 'Let’s make it real.';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: inherit;
	background: #fff;
	opacity: 0;
	transition: opacity 0.15s ease;
}
@media (hover: hover) {
	body form.td-form.td-form--contact-us .td-form__submit:hover::after {
		opacity: 1;
	}
}
body form.td-form.td-form--contact-us .td-form__status,
body form.td-form.td-form--contact-us.td-form--sent .td-form__status {
	padding: 0;
	background: none;
	color: #fff;
	font-size: 18px;
}
body form.td-form.td-form--contact-us .td-form__status a {
	color: #fff;
}

/* 3. Flat look: lead popup ---------------------------------------------------- */
body form.td-form.td-form--book-a-consultation {
	--tdf-label: #000;
	--tdf-text: #4e4e4e;
	--tdf-muted: #757575;
}
body form.td-form.td-form--book-a-consultation .td-form__label {
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 500;
}
body form.td-form.td-form--book-a-consultation :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select) {
	padding: 10px;
	border-color: transparent;
	border-radius: 0;
	font-size: 14px;
}
body form.td-form.td-form--book-a-consultation :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select):not(:focus) {
	border-color: transparent;
}

/* 4. Dark mode ------------------------------------------------------------------
   Same rule the rest of the site follows (see dark-mode.css): a form goes dark only where its
   surroundings do. A card that stays light (.td-dm-card) or a painted panel (.td-dm-paint, e.g. the
   blue footer) keeps the light-mode look. The lead popup follows the mode. */
body.et-dark-mode :is(.td-dm-surface, .td-lead-popup) form.td-form:not(.td-dm-card *):not(.td-dm-paint *) {
	--tdf-text: var(--td-dm-text);
	--tdf-label: var(--td-dm-text);
	--tdf-muted: var(--td-dm-text-muted);
	--tdf-line: var(--td-dm-border);
	--tdf-field-bg: #1a1e22;
	--tdf-focus: #8f97ff;
	--tdf-error: #ff9d96;
}
body.et-dark-mode .td-dm-surface form.td-form:is([class*="-case-study"], .td-form--download-deck):not(.td-dm-card *):not(.td-dm-paint *) {
	--tdf-field-bg: transparent;
	--tdf-line: rgba(255, 255, 255, 0.45);
}
body.et-dark-mode :is(.td-dm-surface, .td-lead-popup) form.td-form:not(.td-dm-card *):not(.td-dm-paint *).td-form--sent .td-form__status {
	background: rgba(46, 160, 90, 0.18);
	color: #b7f0cb;
}
body.et-dark-mode :is(.td-dm-surface, .td-lead-popup) form.td-form:not(.td-dm-card *):not(.td-dm-paint *) select option {
	background: #1a1e22;
	color: var(--td-dm-text);
}
/* The site-wide dark rule recolours every label and paragraph on a dark surface; inside a light card or a
   painted panel the form keeps its own colours. */
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form :is(.td-form__label, .td-form__help, .td-form__html p, .td-form__choice, .td-form__choice span, label, p, span) {
	color: var(--tdf-label) !important;
}
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form .td-form__req {
	color: var(--tdf-error) !important;
}
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form.td-form--contact-us .td-form__req {
	color: #fff !important;
}
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form .td-form__error {
	color: var(--tdf-error) !important;
}
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form .td-form__status,
body.et-dark-mode .td-dm-surface :is(.td-dm-card, .td-dm-paint) form.td-form .td-form__status :is(p, span, a) {
	color: inherit !important;
}

/* 5. Phones ----------------------------------------------------------------------- */
@media (max-width: 767px) {
	/* 16px keeps iOS from zooming the page when a field is tapped. */
	body form.td-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select) {
		min-height: 44px;
		font-size: 16px;
	}
	body form.td-form .td-form__label {
		font-size: 14px;
	}
	body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:has(> :is(input, textarea)) > .td-form__label {
		font-size: 16px;
	}
	body form.td-form:is([class*="-case-study"], .td-form--download-deck, .td-form--contact-us) .td-form__field:has(> :is(input, textarea)):is(:focus-within, :has(> :is(input, textarea):not(:placeholder-shown))) > .td-form__label {
		font-size: 12px;
	}
	body form.td-form .td-form__submit {
		min-height: 54px;
		padding: 16px 24px;
		font-size: 18px;
		line-height: 1.25;
	}
	body form.td-form .td-form__choice input {
		width: 22px;
		height: 22px;
	}
}

/* 6. Touch screens of any width (Duo open): comfortable targets. */
@media (pointer: coarse) {
	body form.td-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select) {
		min-height: 44px;
	}
	body form.td-form .td-form__choice a {
		padding-block: 0.4em;
		margin-block: -0.4em;
	}
}

/* 7. Deck panel (fixed panel on phones): dark text on its light background, in either mode. */
.deckContainer .deckForm form.td-form.td-form--download-deck {
	--tdf-label: #0a0a0a;
	--tdf-text: #0a0a0a;
	--tdf-line: rgba(10, 10, 10, 0.6);
}
