/*
 * GHI redesign: Gravity Forms.
 * Covers the contact form (homepage + Contact Us) and the multi-step
 * Scholarship / Training Material applications. Loaded after ghi-pages.css.
 * Tokens (--ghi-*) come from ghi-home.css.
 *
 * Multi-step forms are detected with :has(.gform_page), so no form settings are needed.
 */

/* ---------- Base: labels, help text, inputs ---------- */
body.ghi-site .gform_wrapper {
	--ghi-field-gap: 26px;
	font-family: var(--ghi-body);
	color: var(--ghi-fg);
}
body.ghi-site .gform_wrapper .gform_fields { row-gap: var(--ghi-field-gap) !important; }

body.ghi-site .gform_wrapper :is(.gfield_label, legend.gfield_label) {
	font-family: var(--ghi-body);
	font-weight: 600;
	font-size: .98rem;
	line-height: 1.4;
	color: var(--ghi-fg);
	margin-bottom: 10px;
}
body.ghi-site .gform_wrapper .gfield_required_text {
	font-family: var(--ghi-mono);
	font-size: .68rem;
	font-weight: 500;
	font-style: normal;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ghi-muted);
	margin-left: 8px;
	vertical-align: 1px;
}
body.ghi-site .gform_wrapper .gfield_required_asterisk { color: var(--ghi-orange); }

/* Sub-labels (First / Last, Enter Email / Confirm Email) */
body.ghi-site .gform_wrapper .ginput_complex label,
body.ghi-site .gform_wrapper .gform-field-label--type-sub {
	font-size: .82rem;
	font-weight: 600;
	color: var(--ghi-muted);
	margin-bottom: 6px;
}

body.ghi-site .gform_wrapper .gfield_description,
body.ghi-site .gform_wrapper .gform_fileupload_rules {
	margin-top: 0;
	font-size: .88rem;
	line-height: 1.5;
	color: var(--ghi-muted);
	padding-top: 8px;
}
body.ghi-site .gform_wrapper .charleft {
	font-family: var(--ghi-mono);
	font-size: .72rem;
	letter-spacing: .04em;
	color: var(--ghi-muted);
	text-align: right;
	margin-top: 6px;
}
body.ghi-site .gform_wrapper .charleft.ginput_counter_error { color: #b42318; }

body.ghi-site .gform_wrapper input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=file]),
body.ghi-site .gform_wrapper select,
body.ghi-site .gform_wrapper textarea {
	font-family: var(--ghi-body);
	font-size: 1rem;
	line-height: 1.4;
	color: var(--ghi-fg);
	background: #fff;
	border: 1.5px solid var(--ghi-line-strong);
	border-radius: 8px;
	padding: 12px 14px;
	min-height: 48px;
	box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
}
body.ghi-site .gform_wrapper textarea { min-height: 120px; resize: vertical; }
body.ghi-site .gform_wrapper textarea.small { min-height: 96px; height: 96px; }
body.ghi-site .gform_wrapper :is(input, select, textarea)::placeholder { color: #6b7780; opacity: 1; }
body.ghi-site .gform_wrapper :is(input, select, textarea):hover { border-color: #aab6c3; }
body.ghi-site .gform_wrapper :is(input, select, textarea):focus {
	outline: none;
	border-color: var(--ghi-navy);
	box-shadow: 0 0 0 3px rgba(0, 64, 123, .15);
}
body.ghi-site .gform_wrapper select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2300407b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	cursor: pointer;
}

/* ---------- Radio and checkbox choices as tappable tiles ---------- */
body.ghi-site .gform_wrapper .gfield_radio,
body.ghi-site .gform_wrapper .gfield_checkbox {
	display: grid;
	gap: 8px;
}
body.ghi-site .gform_wrapper .gfield--type-choice .gchoice {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 12px 14px;
	background: #fff;
	border: 1.5px solid var(--ghi-line);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}
body.ghi-site .gform_wrapper .gfield--type-choice .gchoice:hover { border-color: #aab6c3; }
body.ghi-site .gform_wrapper .gfield--type-choice .gchoice:has(input:checked) {
	border-color: var(--ghi-navy);
	background: #f1f6fb;
}
body.ghi-site .gform_wrapper .gfield--type-choice .gchoice:has(input:focus-visible) {
	box-shadow: 0 0 0 3px rgba(0, 64, 123, .2);
}
body.ghi-site .gform_wrapper .gchoice input[type=radio],
body.ghi-site .gform_wrapper .gchoice input[type=checkbox] {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--ghi-navy);
	cursor: pointer;
}
body.ghi-site .gform_wrapper .gchoice label {
	flex: 1;
	margin: 0;
	max-width: none;
	font-size: .96rem;
	font-weight: 400;
	line-height: 1.35;
	color: var(--ghi-fg);
	cursor: pointer;
}
/* Make the whole tile clickable */
body.ghi-site .gform_wrapper .gchoice label::after { content: ""; position: absolute; inset: 0; }

/* Two columns for long choice lists on wider screens */
@media (min-width: 720px) {
	body.ghi-site .gform_wrapper .gfield_radio:has(> .gchoice:nth-child(6)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Single "I Agree" checkboxes: compact tile, not full width */
body.ghi-site .gform_wrapper .gfield--type-checkbox .gfield_checkbox:has(> .gchoice:only-child) { justify-content: start; }
body.ghi-site .gform_wrapper .gfield--type-checkbox .gchoice:only-child { padding: 9px 16px 9px 12px; }
body.ghi-site .gform_wrapper .gfield--type-checkbox .gchoice:only-child label { font-weight: 600; }

/* Consent checkbox on the contact form (no tile) */
body.ghi-site .gform_wrapper .gfield--type-consent .ginput_container_consent { display: flex; align-items: flex-start; gap: 10px; }
body.ghi-site .gform_wrapper .gfield--type-consent input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ghi-navy); flex: none; }
body.ghi-site .gform_wrapper .gfield--type-consent label { font-size: .92rem; font-weight: 400; color: var(--ghi-fg); }

/* ---------- Section headings ---------- */
body.ghi-site .gform_wrapper .gsection {
	border: 0;
	padding: 0;
	margin-top: 8px;
}
body.ghi-site .gform_wrapper .gsection_title {
	font-family: var(--ghi-display);
	font-size: clamp(1.4rem, 2.4vw, 1.75rem);
	font-weight: 700;
	letter-spacing: -.015em;
	line-height: 1.15;
	color: var(--ghi-fg);
	margin: 0;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--ghi-line);
}

/* ---------- File upload ---------- */
body.ghi-site .gform_wrapper .gform_drop_area {
	background: var(--ghi-bg);
	border: 1.5px dashed var(--ghi-line-strong);
	border-radius: var(--ghi-radius);
	padding: 28px 20px;
	color: var(--ghi-muted);
	font-size: .95rem;
	transition: border-color .15s, background-color .15s;
}
body.ghi-site .gform_wrapper .gform_drop_area:hover,
body.ghi-site .gform_wrapper .gform_drop_area.hover { border-color: var(--ghi-navy); background: #f1f6fb; }
body.ghi-site .gform_wrapper .gform_drop_instructions { display: block; margin-bottom: 12px; }
body.ghi-site .gform_wrapper .ginput_preview { font-size: .9rem; padding: 6px 0; }

/* ---------- Buttons ---------- */
body.ghi-site .gform_wrapper :is(.gform_footer, .gform_page_footer) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 14px;
	margin-top: 32px !important;
	padding: 0 !important;
}
body.ghi-site .gform_wrapper :is(.gform_footer, .gform_page_footer) :is(input[type=submit], input[type=button], button),
body.ghi-site .gform_wrapper .gform_button_select_files {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	margin: 0 !important;
	padding: 12px 24px;
	font-family: var(--ghi-body);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	border: 2px solid transparent;
	border-radius: 8px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
/* Primary: Next / Submit (orange, dark text, like the site's main buttons) */
body.ghi-site .gform_wrapper :is(.gform_next_button, .gform_button, input[type=submit]) {
	background: var(--ghi-orange);
	border-color: var(--ghi-orange);
	color: var(--ghi-board);
}
body.ghi-site .gform_wrapper :is(.gform_next_button, .gform_button, input[type=submit]):hover {
	background: var(--ghi-orange-hover);
	border-color: var(--ghi-orange-hover);
	color: var(--ghi-board);
	transform: translateY(-1px);
}
/* Secondary: Previous, Select files */
/* !important: Gravity Forms' .gform-theme-button--secondary rule is more specific */
body.ghi-site .gform_wrapper :is(.gform_previous_button, .gform_button_select_files) {
	background: #fff !important;
	border-color: var(--ghi-navy) !important;
	color: var(--ghi-navy) !important;
}
body.ghi-site .gform_wrapper :is(.gform_previous_button, .gform_button_select_files):hover {
	background: var(--ghi-navy) !important;
	color: #fff !important;
}
body.ghi-site .gform_wrapper .gform_previous_button { order: -1; }
/* Save and Continue Later: a quiet text link */
body.ghi-site .gform_wrapper .gform_save_link {
	background: transparent !important;
	border-color: transparent !important;
	color: var(--ghi-link) !important;
	padding-inline: 8px;
	font-weight: 600;
}
body.ghi-site .gform_wrapper .gform_save_link:hover { text-decoration: underline; transform: none; }
body.ghi-site .gform_wrapper .gform_save_link svg { width: 15px; height: 15px; }
body.ghi-site .gform_wrapper .gform_save_link svg path { fill: currentColor; }
body.ghi-site .gform_wrapper .gform_ajax_spinner { margin-left: 4px; }

/* ---------- Validation ---------- */
body.ghi-site .gform_wrapper .gform_validation_errors {
	background: #fef3f2;
	border: 1.5px solid #f3b8b2;
	border-radius: 10px;
	box-shadow: none;
	padding: 14px 18px;
	margin-bottom: 28px;
}
body.ghi-site .gform_wrapper .gform_validation_errors .gform_submission_error {
	font-family: var(--ghi-body);
	font-size: .98rem;
	font-weight: 600;
	color: #912018;
}
body.ghi-site .gform_wrapper .gfield_error :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { border-color: #d92d20 !important; }
body.ghi-site .gform_wrapper .gform_validation_errors:focus { outline: 2px solid #d92d20; outline-offset: 2px; }
body.ghi-site .gform_wrapper .gfield_error .gchoice { border-color: #f3b8b2; }
body.ghi-site .gform_wrapper .gfield_error :is(.gfield_label, legend) { color: var(--ghi-fg); }
body.ghi-site .gform_wrapper .gfield_validation_message,
body.ghi-site .gform_wrapper .validation_message {
	background: none;
	border: 0;
	padding: 8px 0 0;
	font-size: .88rem;
	font-weight: 600;
	color: #b42318;
}

/* ---------- Confirmation and "progress saved" messages ---------- */
body.ghi-site .gform_confirmation_message,
body.ghi-site .form_saved_message,
body.ghi-site .form_saved_message_sent {
	background: #f1f6fb;
	border: 1.5px solid var(--ghi-tint);
	border-left: 4px solid var(--ghi-navy);
	border-radius: 10px;
	padding: 20px 24px;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--ghi-fg);
}
body.ghi-site .form_saved_message :is(input[type=text], .resume_form_link_wrapper) { width: 100%; }
body.ghi-site .form_saved_message .resume_form_link_wrapper {
	display: block;
	margin: 12px 0;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--ghi-line);
	border-radius: 8px;
	font-family: var(--ghi-mono);
	font-size: .85rem;
	word-break: break-all;
}

/* ================================================================
 * Multi-step applications (Scholarship / Training Material)
 * ================================================================ */

/* Light page background behind the form card */
body.ghi-site .vc_section:has(.gform_wrapper .gform_page) {
	background: var(--ghi-bg);
	/* Bleed the background to the screen edges without changing layout */
	box-shadow: 0 0 0 100vmax var(--ghi-bg);
	clip-path: inset(0 -100vmax);
}

body.ghi-site .gform_wrapper:has(.gform_page) {
	max-width: 820px;
	margin: 0 auto;
	background: var(--ghi-card);
	border: 1px solid var(--ghi-line);
	border-radius: 16px;
	box-shadow: var(--ghi-shadow);
	padding: clamp(24px, 5vw, 48px);
}
/* The confirmation replaces the form: keep the same card width */
body.ghi-site .gform_confirmation_wrapper,
body.ghi-site .form_saved_message,
body.ghi-site .form_saved_message_sent { max-width: 820px; margin-inline: auto; }

/* Progress: "STEP 1 OF 3 · YOUR INFO" over a slim bar */
body.ghi-site .gform_wrapper .gf_progressbar_wrapper { margin: 0 0 36px; padding: 0; border: 0; }
body.ghi-site .gform_wrapper .gf_progressbar_title {
	font-family: var(--ghi-mono);
	font-size: .76rem;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--ghi-navy);
	margin: 0 0 12px;
	line-height: 1.4;
}
body.ghi-site .gform_wrapper .gf_progressbar_title .gf_step_page_name { color: var(--ghi-muted); }
body.ghi-site .gform_wrapper .gf_progressbar {
	background: var(--ghi-chip);
	border-radius: 999px;
	height: 8px;
	padding: 0;
	box-shadow: none;
	overflow: hidden;
}
body.ghi-site .gform_wrapper .gf_progressbar_percentage {
	height: 8px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--ghi-navy), #1468a2) !important;
	transition: width .3s ease;
}
body.ghi-site .gform_wrapper .gf_progressbar_percentage span { display: none; }

/* Footer row sits on a divider */
body.ghi-site .gform_wrapper:has(.gform_page) .gform_page_footer {
	border-top: 1px solid var(--ghi-line);
	padding-top: 24px !important;
}

/* Agreement page: each commitment is a quiet card with its "I Agree" tile */
body.ghi-site .gform_wrapper:has(.gform_page) .gfield--type-checkbox:has(.gchoice:only-child) {
	padding: 16px 18px;
	background: var(--ghi-bg);
	border: 1px solid var(--ghi-line);
	border-radius: 10px;
}
body.ghi-site .gform_wrapper:has(.gform_page) .gfield--type-checkbox:has(.gchoice:only-child) legend.gfield_label {
	font-weight: 400;
	font-size: .98rem;
	line-height: 1.55;
	float: left;
	width: 100%;
	margin-bottom: 12px;
}
body.ghi-site .gform_wrapper:has(.gform_page) .gfield--type-checkbox:has(.gchoice:only-child) .ginput_container { clear: both; }

/* Single checkboxes on one-page forms (contact newsletter opt-in): plain, no tile */
body.ghi-site .gform_wrapper:not(:has(.gform_page)) .gfield--type-checkbox .gchoice:only-child {
	padding: 0;
	border: 0;
	background: none;
}
body.ghi-site .gform_wrapper:not(:has(.gform_page)) .gfield--type-checkbox .gchoice:only-child label { font-weight: 400; font-size: .94rem; }
body.ghi-site .gform_wrapper:has(.gform_page) .gfield--type-checkbox:has(.gchoice:only-child) + .gfield--type-checkbox:has(.gchoice:only-child) { margin-top: -12px; }

/* Contact form cards: the Contact Us card is .contact-form in ghi-pages.css; the homepage card is in ghi-home-wpb.css. */

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
	body.ghi-site .gform_wrapper:has(.gform_page) { border-radius: 12px; padding: 22px 18px; }
	body.ghi-site .gform_wrapper :is(.gform_footer, .gform_page_footer) :is(.gform_next_button, .gform_button, input[type=submit], .gform_previous_button) { flex: 1 1 140px; }
	body.ghi-site .gform_wrapper .gform_save_link { flex-basis: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	body.ghi-site .gform_wrapper * { transition: none !important; }
	body.ghi-site .gform_wrapper :is(.gform_next_button, .gform_button, input[type=submit]):hover { transform: none; }
}
