/*
 * Forms: Gravity Forms (legacy and 2.5+ markup) and Drip embedded forms, in the Bryghtpath style.
 * Theme CSS only: no Gravity Forms settings are changed. Leadpages popups load their own styles.
 */

:root {
	--bp-field-border: #c9ced6;
	--bp-field-radius: 4px;
	--bp-focus: 0 0 0 3px rgba(0, 140, 207, .22);
}

/* ---------- Fields ---------- */
.gform_wrapper input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=file]),
.gform_wrapper select,
.gform_wrapper textarea,
form[data-drip-embedded-form] input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=hidden]),
form[data-drip-embedded-form] select,
form[data-drip-embedded-form] textarea {
	width: 100% !important;
	max-width: 100%;
	box-sizing: border-box;
	font: inherit;
	font-size: 1rem !important;
	line-height: 1.4;
	color: var(--wp--preset--color--main);
	background: #fff;
	border: 1px solid var(--bp-field-border) !important;
	border-radius: var(--bp-field-radius) !important;
	padding: .75em .9em !important;
	box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
	min-height: 0;
}
.gform_wrapper textarea, form[data-drip-embedded-form] textarea { min-height: 9em; resize: vertical; }
.gform_wrapper :is(input, select, textarea):focus,
form[data-drip-embedded-form] :is(input, select, textarea):focus {
	outline: none;
	border-color: var(--wp--preset--color--primary) !important;
	box-shadow: var(--bp-focus) !important;
}

/* ---------- Labels and help text ---------- */
.gform_wrapper :is(.gfield_label, .gform-field-label--type-sub-group, legend.gfield_label),
form[data-drip-embedded-form] label {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600 !important;
	font-size: .92rem !important;
	color: var(--wp--preset--color--navy);
	margin: 0 0 .4rem !important;
}
.gform_wrapper .gfield_required { color: var(--wp--preset--color--orange); margin-left: .2em; }
.gform_wrapper .gform_required_legend { font-size: .9rem; color: var(--wp--preset--color--secondary); }
.gform_wrapper :is(.gfield_description, .gform-field-label--type-sub, .ginput_complex label) {
	font-size: .85rem !important;
	color: var(--wp--preset--color--secondary);
	padding-top: .3rem !important;
}

/* ---------- Layout ---------- */
.gform_wrapper .gform_fields { row-gap: 1.25rem !important; }
.gform_wrapper.gform_legacy_markup_wrapper ul.gform_fields li.gfield { margin-top: 1.25rem; padding-right: 0; }
.gform_wrapper .ginput_complex { gap: 1rem; }
form[data-drip-embedded-form] > div { margin: 0 0 1.1rem; }
form[data-drip-embedded-form] > div:empty { display: none; }

/* Single-field Drip forms (course sign-ups): email and button on one line. */
form[data-drip-embedded-form]:not(:has(> div)) { display: flex; flex-wrap: wrap; gap: .6rem; max-width: 560px; }
form[data-drip-embedded-form]:not(:has(> div)) input[type=email] { flex: 1 1 260px; width: auto !important; }

/* ---------- Choices ---------- */
.gform_wrapper :is(.gfield_checkbox, .gfield_radio) { display: grid; gap: .45rem; }
.gform_wrapper .gfield--type-checkbox .gfield_checkbox:has(> :nth-child(6)) { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; }
.gform_wrapper :is(.gchoice, .gfield_checkbox li, .gfield_radio li) { display: flex; align-items: flex-start; gap: .55rem; margin: 0 !important; }
.gform_wrapper :is(.gchoice, .gfield_checkbox li, .gfield_radio li) label { font-size: .98rem !important; color: var(--wp--preset--color--main); margin: 0 !important; max-width: none !important; }
.gform_wrapper input:is([type=checkbox], [type=radio]) { width: 1.1rem; height: 1.1rem; margin: .15rem 0 0 !important; accent-color: var(--wp--preset--color--primary); flex: none; }
@media (max-width: 640px) {
	.gform_wrapper .gfield--type-checkbox .gfield_checkbox { grid-template-columns: 1fr !important; }
}

/* ---------- Submit ---------- */
.gform_wrapper :is(.gform_footer, .gform_page_footer) { padding-top: 1.5rem !important; margin: 0 !important; }
.gform_wrapper :is(input[type=submit], button[type=submit], .gform_button, .gform_next_button, .gform_previous_button),
form[data-drip-embedded-form] :is(input[type=submit], button[type=submit]) {
	appearance: none;
	font-family: var(--wp--preset--font-family--display) !important;
	font-weight: 600 !important;
	font-size: 1rem !important;
	line-height: 1.2 !important;
	color: #fff !important;
	background: var(--wp--preset--color--primary) !important;
	border: 0 !important;
	border-radius: var(--bp-field-radius) !important;
	padding: .9em 1.6em !important;
	cursor: pointer;
	width: auto !important;
	transition: background .15s ease;
}
.gform_wrapper :is(input[type=submit], button[type=submit], .gform_button):hover,
form[data-drip-embedded-form] :is(input[type=submit], button[type=submit]):hover { background: var(--wp--preset--color--link-blue) !important; }
.gform_wrapper :is(input[type=submit], .gform_button):focus-visible,
form[data-drip-embedded-form] input[type=submit]:focus-visible { outline: 3px solid rgba(0, 140, 207, .45); outline-offset: 2px; }

/* ---------- Validation and confirmation ---------- */
.gform_wrapper .gform_validation_errors {
	border: 1px solid #f3c1a6 !important; border-left: 4px solid var(--wp--preset--color--orange) !important;
	background: #fff6f1 !important; border-radius: var(--bp-field-radius) !important; box-shadow: none !important; padding: 1rem 1.2rem !important;
}
.gform_wrapper .gform_validation_errors h2 { font-size: 1rem !important; color: var(--wp--preset--color--navy) !important; }
.gform_wrapper .gfield_error :is(input, select, textarea) { border-color: #d9534f !important; }
.gform_wrapper .validation_message { font-size: .88rem; color: #b42318 !important; background: none !important; border: 0 !important; padding: .3rem 0 0 !important; }
.gform_confirmation_message {
	background: var(--wp--preset--color--light-blue); border-left: 4px solid var(--wp--preset--color--primary);
	border-radius: var(--bp-field-radius); padding: 1.1rem 1.3rem; color: var(--wp--preset--color--navy); font-size: 1.05rem;
}

/* ---------- On dark bands ---------- */
.bp-dark :is(.gform_wrapper .gfield_label, form[data-drip-embedded-form] label) { color: #fff; }
.bp-dark .gform_wrapper :is(.gfield_description, .gchoice label) { color: var(--wp--preset--color--blue-3) !important; }
.bp-dark :is(.gform_wrapper, form[data-drip-embedded-form]) :is(input[type=submit], .gform_button) { background: #fff !important; color: var(--wp--preset--color--navy) !important; }

/* Forms sit with the text above them; centred bands centre them. */
form[data-drip-embedded-form], .gform_wrapper { margin-left: 0 !important; }
.bp-center :is(form[data-drip-embedded-form], .gform_wrapper) { margin-left: auto !important; margin-right: auto !important; text-align: left; }

/* ---------- WooCommerce classic cart, checkout, account, and product forms ---------- */
.woocommerce form :is(input.input-text, select, textarea), .woocommerce-page form :is(input.input-text, textarea),
form.cart input.wc-pao-addon-field, form.cart :is(input[type=text], input[type=email], textarea, select) {
	font: inherit; font-size: 1rem; border: 1px solid var(--bp-field-border) !important; border-radius: var(--bp-field-radius) !important;
	padding: .7em .85em !important; background: #fff; box-shadow: none; line-height: 1.4;
}
.woocommerce form :is(input.input-text, select, textarea):focus, form.cart :is(input, select, textarea):focus { outline: none; border-color: var(--wp--preset--color--primary) !important; box-shadow: var(--bp-focus) !important; }
.woocommerce form .form-row label, form.cart .wc-pao-addon-name { font-family: var(--wp--preset--font-family--display); font-weight: 600; font-size: .92rem; color: var(--wp--preset--color--navy); }
.woocommerce form .form-row .required { color: var(--wp--preset--color--orange); text-decoration: none; }
.woocommerce :is(#place_order, .checkout-button, button[name=apply_coupon], button[name=update_cart]), form.cart .single_add_to_cart_button {
	font-family: var(--wp--preset--font-family--display); font-weight: 600; border-radius: var(--bp-field-radius);
}
.wc-pao-addon-description { font-size: .88rem; color: var(--wp--preset--color--secondary); }
