/**
 * Gravity Forms on dark sections. Mobile-first.
 *
 * Builds on Gravity Forms' own "Orbital" theme. Colours and sizes come from
 * inc/forms.php (gform_default_styles); this file sets the remaining theme
 * variables and the few details the variables can't (uppercase labels,
 * pill button, consent text).
 */

.gform_wrapper.gform-theme--orbital {
	--gf-font-family-base: var(--cxo-font);
	--gf-font-family-primary: var(--cxo-font);
	--gf-font-family-secondary: var(--cxo-font);
	--gf-font-family-tertiary: var(--cxo-font);

	/* Labels: small, bold, spaced capitals; red asterisk. */
	--gf-ctrl-label-font-size-primary: 0.9375rem;
	--gf-ctrl-label-font-weight-primary: 700;
	--gf-ctrl-label-letter-spacing-primary: 0.1em;
	--gf-ctrl-label-line-height-primary: 1.3;
	--gf-ctrl-label-color-req: var(--cxo-red-light);
	--gf-ctrl-label-font-size-req: 0.9375rem;

	/* Inputs. */
	--gf-ctrl-font-size: 1.0625rem;
	--gf-ctrl-padding-x: 1.1rem;
	--gf-ctrl-placeholder-color: rgba(255, 255, 255, 0.45);
	--gf-ctrl-placeholder-opacity: 1;
	--gf-ctrl-border-color-hover: rgba(255, 255, 255, 0.4);
	--gf-ctrl-border-color-error: var(--cxo-red-light);

	/* Help text and errors. */
	--gf-ctrl-desc-color: rgba(255, 255, 255, 0.65);
	--gf-ctrl-desc-color-error: var(--cxo-red-light);
	--gf-ctrl-desc-font-size: 0.875rem;
	--gf-ctrl-desc-font-size-error: 0.9375rem;

	/* Spacing between fields. */
	--gf-field-gap-x: clamp(1rem, 0.5rem + 2vw, 3rem);
	--gf-field-gap-y: clamp(1.5rem, 1.2rem + 1vw, 2.25rem);
	--gf-form-gap-y: 2rem;

	color: var(--cxo-white);

	/* The browser's own parts (dropdown lists, file button, scrollbars)
	 * render dark too, instead of the light grey system look. */
	color-scheme: dark;
}

/* ---------- Labels ---------- */
.gform_wrapper.gform-theme--orbital .gfield_label.gform-field-label {
	text-transform: uppercase;
}

/* Gravity Forms lays labels out as flex, which drops the asterisk onto its
 * own line under long labels on phones. Inline flow keeps it after the
 * last word. */
.gform_wrapper.gform_wrapper.gform-theme--orbital .gfield_label.gform-field-label {
	display: block;
}

.gform_wrapper.gform_wrapper.gform-theme--orbital .gfield_label .gfield_required {
	margin-inline-start: 0.2em;
}

.gform_wrapper.gform-theme--orbital .cxo-optional-note {
	color: rgba(255, 255, 255, 0.7);
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
}

/* ---------- Inputs ---------- */

/* Placeholders clearly dimmer than typed text, so an empty field never
 * looks filled in. Set directly: Gravity Forms' own rule beats the
 * --gf-ctrl-placeholder-color variable above. 0.5 white on the input
 * background still passes WCAG AA for placeholder text. */
.gform_wrapper.gform_wrapper.gform-theme--orbital :is(input, textarea)::placeholder {
	color: rgba(255, 255, 255, 0.5);
	font-weight: 400;
	opacity: 1;
}
.gform_wrapper.gform-theme--orbital textarea.small {
	min-block-size: 7.5rem;
}

/* Dropdown lists: dark options where the browser allows styling them. */
.gform_wrapper.gform-theme--orbital select option {
	background-color: #141414;
	color: var(--cxo-white);
}

/* File fields: a clear dark "Choose file" button inside the input. */
.gform_wrapper.gform_wrapper.gform-theme--orbital input[type="file"] {
	color: rgba(255, 255, 255, 0.7);
	font-size: 1rem;
	cursor: pointer;
}

.gform_wrapper.gform_wrapper.gform-theme--orbital input[type="file"]::file-selector-button {
	margin-inline-end: 1rem;
	padding: 0.55rem 1.1rem;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background: #2a2a2a;
	color: var(--cxo-white);
	font-family: var(--cxo-font);
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s;
}

.gform_wrapper.gform_wrapper.gform-theme--orbital input[type="file"]:hover::file-selector-button {
	border-color: rgba(255, 255, 255, 0.4);
	background: #3a3a3a;
}

/* Error state stays readable on dark: red border, red message. */
.gform_wrapper.gform-theme--orbital .gfield_error :is(input, textarea, select) {
	border-color: var(--cxo-red-light);
}

/* Summary of errors at the top of the form after a failed submit. */
.gform_wrapper.gform-theme--orbital .gform_validation_errors {
	border-color: var(--cxo-red-light);
	background: rgba(240, 52, 60, 0.12);
	color: var(--cxo-white);
}

.gform_wrapper.gform-theme--orbital .gform_validation_errors :is(h2, li, a) {
	color: var(--cxo-white);
}

/* ---------- Consent checkbox ---------- */
.gform_wrapper.gform-theme--orbital .gfield_consent_label {
	color: var(--cxo-white);
	font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
	font-weight: 500;
	line-height: 1.45;
}

/* Links in form text are underlined (base.css removes underlines in sections). */
.cxo-section.cxo-section .gform_wrapper .gfield a,
.gform_wrapper.gform-theme--orbital .gfield a {
	color: var(--cxo-white);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.cxo-section.cxo-section .gform_wrapper .gfield a:hover {
	text-decoration-color: var(--cxo-red-light);
}

/* ---------- Submit button: the red pill from base.css ----------
 * Doubled .gform_wrapper: this file loads before Gravity Forms' own
 * stylesheets, so equal-specificity rules would lose to theirs. */
.gform_wrapper.gform-theme--orbital .gform_footer {
	margin-block-start: 2rem;
	padding: 0;
}

.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	min-block-size: 3.5rem;
	padding: 0 2.2em;
	border: 2px solid transparent;
	border-radius: 999px;
	background: var(--cxo-red);
	color: var(--cxo-white);
	font-family: var(--cxo-font);
	font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.375rem);
	font-weight: 700;
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
}

.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn:hover,
.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn:focus-visible {
	background: var(--cxo-white);
	color: var(--cxo-ink);
}

.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn:focus-visible {
	outline: 2px solid var(--cxo-white);
	outline-offset: 3px;
}

/* Gravity Forms' reset strips SVG strokes; the arrow is a stroked path. */
.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn svg {
	width: 0.6em;
	height: 0.6em;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	transition: transform 0.25s var(--cxo-ease);
}

.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn:hover svg {
	transform: translate(2px, -2px);
}

@media (max-width: 479px) {
	.gform_wrapper.gform_wrapper.gform-theme--orbital .gform_footer .gform_button.cxo-btn {
		inline-size: 100%;
		justify-content: center;
	}
}

/* ---------- Thank-you message (replaces the form after sending) ---------- */
.gform_confirmation_message {
	color: var(--cxo-white);
	font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.3125rem);
	line-height: 1.5;
}

.cxo-section .gform_confirmation_message h2 {
	margin: 0 0 0.75rem;
	color: var(--cxo-white);
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.1;
}

.cxo-section .gform_confirmation_message p {
	margin: 0;
	color: rgba(255, 255, 255, 0.85);
}

/* ---------- "You're applying for: <role>" (job applications) ----------
 * Printed above the form when the page is opened from a job's Apply button
 * (cxo_forms_job_note() in inc/forms.php). */
.cxo-section .cxo-form-job {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
	margin: 0 0 2rem;
	padding: 0.95rem 1.15rem;
	border: 1px solid rgba(240, 52, 60, 0.4);
	border-inline-start: 3px solid var(--cxo-red-light);
	border-radius: 10px;
	background: rgba(240, 52, 60, 0.08);
	color: rgba(255, 255, 255, 0.78);
	font-size: 1rem;
	line-height: 1.4;
}

.cxo-section .cxo-form-job__title {
	color: var(--cxo-white);
	font-weight: 700;
}

.cxo-section.cxo-section .cxo-form-job__link {
	margin-inline-start: auto;
	color: var(--cxo-red-light);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.cxo-section.cxo-section .cxo-form-job__link:hover {
	color: var(--cxo-white);
}
