/**
 * HubSpot Form widget styles (Point 2.3). Loaded only on pages that use the widget.
 *
 * Port of panopto blocks/hubspot-form/style.css, with the tokens of elai's /demo/ form
 * (Custom Code snippet 57799: primary #4868FF, hover #31353B, border #D1D5DB, text #1A1A1A,
 * radius 8px, labels 14px / 600, inputs 15px with 12px 16px padding).
 *
 * HubSpot's developer embed injects its own base styles (style[data-hsfc-id="BaseStyle"]) and
 * the form's theme from HubSpot as --hsf-default-* on the Renderer element. Both only READ the
 * --hsf-* variables first, so the variables set on the widget wrapper below win. Rules that need
 * more than a variable are prefixed with the wrapper class AND [data-hsfc-id="Renderer"], one
 * level more specific than HubSpot's own "[data-hsfc-id=Renderer] .hsfc-*".
 *
 * Dark sections: no elai form sits on one today. Add the CSS class "elai-hsf-on-dark" to the
 * widget (Advanced > CSS Classes) or to its section / container: text turns light, inputs stay
 * white. Any token below can also be overridden per page with the same variable names.
 */

.elai-hubspot-form {
	/* elai tokens (from /demo/ and the Elementor kit) */
	--elai-hsf-font: var(--e-global-typography-primary-font-family, "basiercircle"), sans-serif;
	--elai-hsf-primary: #4868ff;
	--elai-hsf-primary-hover: #31353b;
	--elai-hsf-text: #1a1a1a;
	--elai-hsf-body: #333;
	--elai-hsf-label: #1a1a1a;
	--elai-hsf-border: #d1d5db;
	--elai-hsf-control-border: #767676;
	--elai-hsf-placeholder: #6b7280;
	--elai-hsf-input-bg: #fff;
	--elai-hsf-error: #e51b23;
	--elai-hsf-required: #e51b23;
	--elai-hsf-radius: 8px;
	--elai-hsf-input-font-size: 15px;

	/* Global */
	--hsf-global__font-family: var(--elai-hsf-font);
	--hsf-global__font-size: 15px;
	--hsf-global__color: var(--elai-hsf-body);
	--hsf-global__error-color: var(--elai-hsf-error);

	/* Spacing: 16px between rows, 6px between label and input (/demo/) */
	--hsf-row__vertical-spacing: 16px;
	--hsf-row__horizontal-spacing: 16px;
	--hsf-module__vertical-spacing: 6px;

	/* Labels */
	--hsf-field-label__font-family: var(--elai-hsf-font);
	--hsf-field-label__font-size: 14px;
	--hsf-field-label__color: var(--elai-hsf-label);
	--hsf-field-label-requiredindicator__color: var(--elai-hsf-required);
	--hsf-field-description__color: var(--elai-hsf-body);
	--hsf-field-description__font-family: var(--elai-hsf-font);
	--hsf-field-footer__color: var(--elai-hsf-body);
	--hsf-field-footer__font-family: var(--elai-hsf-font);

	/* Inputs: white box, 1px border, 8px radius, 12px 16px padding */
	--hsf-field-input__font-family: var(--elai-hsf-font);
	--hsf-field-input__font-size: var(--elai-hsf-input-font-size);
	--hsf-field-input__color: var(--elai-hsf-text);
	--hsf-field-input__background-color: var(--elai-hsf-input-bg);
	--hsf-field-input__placeholder-color: var(--elai-hsf-placeholder);
	--hsf-field-input__border-color: var(--elai-hsf-border);
	--hsf-field-input__border-width: 1px;
	--hsf-field-input__border-style: solid;
	--hsf-field-input__border-radius: var(--elai-hsf-radius);
	--hsf-field-input__padding: 12px 16px;
	--hsf-field-dropdown-options__border-radius: var(--elai-hsf-radius);

	--hsf-field-textarea__font-family: var(--elai-hsf-font);
	--hsf-field-textarea__font-size: var(--elai-hsf-input-font-size);
	--hsf-field-textarea__color: var(--elai-hsf-text);
	--hsf-field-textarea__background-color: var(--elai-hsf-input-bg);
	--hsf-field-textarea__placeholder-color: var(--elai-hsf-placeholder);
	--hsf-field-textarea__border-color: var(--elai-hsf-border);
	--hsf-field-textarea__border-width: 1px;
	--hsf-field-textarea__border-style: solid;
	--hsf-field-textarea__border-radius: var(--elai-hsf-radius);
	--hsf-field-textarea__padding: 12px 16px;

	/* Checkbox / radio: white box, grey border (3:1 against white), primary when checked */
	--hsf-field-checkbox__background-color: var(--elai-hsf-input-bg);
	--hsf-field-checkbox__border-color: var(--elai-hsf-control-border);
	--hsf-field-checkbox__border-width: 1px;
	--hsf-field-checkbox__border-style: solid;
	--hsf-field-checkbox__color: #fff;
	--hsf-field-checkbox__padding: 0;
	--hsf-field-radio__background-color: var(--elai-hsf-input-bg);
	--hsf-field-radio__border-color: var(--elai-hsf-control-border);
	--hsf-field-radio__border-width: 1px;
	--hsf-field-radio__border-style: solid;
	--hsf-field-radio__color: var(--elai-hsf-primary);
	--hsf-field-radio__padding: 0;

	/* Button: /demo/ "Get a Demo" (primary, 8px radius, dark grey on hover, auto width) */
	--hsf-button__font-family: var(--elai-hsf-font);
	--hsf-button__font-size: 16px;
	--hsf-button__font-weight: 700;
	--hsf-button__color: #fff;
	--hsf-button__background-color: var(--elai-hsf-primary);
	--hsf-button__background-image: none;
	--hsf-button__border-color: transparent;
	--hsf-button__border-width: 0;
	--hsf-button__border-style: none;
	--hsf-button__border-radius: var(--elai-hsf-radius);
	--hsf-button__padding: 14px 28px;
	--hsf-button__box-shadow: none;
	--hsf-button__width: auto;
	--hsf-button--hover__color: #fff;
	--hsf-button--hover__background-color: var(--elai-hsf-primary-hover);
	--hsf-button--hover__border-color: transparent;
	--hsf-button--focus__color: #fff;
	--hsf-button--focus__background-color: var(--elai-hsf-primary-hover);
	--hsf-button--focus__border-color: transparent;
	--hsf-navigationrow-buttons-single__justify-content: flex-start;

	/* Rich text (consent text, thank-you message), headings, alerts */
	--hsf-richtext__font-family: var(--elai-hsf-font);
	--hsf-richtext__font-size: 14px;
	--hsf-richtext__color: var(--elai-hsf-body);
	--hsf-heading__font-family: var(--elai-hsf-font);
	--hsf-heading__color: var(--elai-hsf-text);
	--hsf-erroralert__color: var(--elai-hsf-error);
	--hsf-erroralert__font-family: var(--elai-hsf-font);
	--hsf-erroralert__font-size: 13px;
	--hsf-infoalert__color: var(--elai-hsf-body);
	--hsf-infoalert__font-family: var(--elai-hsf-font);
	--hsf-infoalert__font-size: 13px;

	/* Form container: transparent, no padding, the section shows through */
	--hsf-background__background-color: transparent;
	--hsf-background__background-image: none;
	--hsf-background__border-width: 0;
	--hsf-background__padding: 0;

	width: 100%;
}

/* Dark section fallback (no parity target, see header) */
.elai-hsf-on-dark .elai-hubspot-form {
	--elai-hsf-body: rgba(255, 255, 255, 0.85);
	--elai-hsf-label: #fff;
	--elai-hsf-control-border: #fff;
	--elai-hsf-error: #ff8a8f;
	--elai-hsf-required: #ff8a8f;
	--elai-hsf-primary-hover: #627eff;
	--hsf-heading__color: #fff;
}

/* Rows HubSpot leaves behind for fields hidden by a rule (empty) or for hidden fields only */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Row:empty,
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Row:not(:has(> :not(input[type="hidden"]))) {
	display: none;
}

/* Label: /demo/ weight and line height (no variables for these) */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-FieldLabel {
	font-weight: 600;
	letter-spacing: normal;
	line-height: 1.4;
}

/* Required asterisk: shown in red like /demo/, a little space from the label text */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-FieldLabel__RequiredIndicator {
	margin-inline-start: 2px;
}

/* Inputs: full width, at least 44px high for touch (the /demo/ inputs shrink to about 30px on mobile).
   Porto's global input styles (height, shadow, transitions) are reset here. */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextInput,
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextareaInput {
	box-shadow: none;
	box-sizing: border-box;
	height: auto;
	line-height: 1.25;
	min-block-size: 44px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	width: 100%;
}

/* The search box inside a dropdown list stays compact */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-DropdownOptions__Search .hsfc-TextInput {
	min-block-size: 0;
}

/* Focus: primary border + soft ring, like /demo/ */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextInput:focus,
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextareaInput:focus {
	border-color: var(--elai-hsf-primary);
	box-shadow: 0 0 0 3px rgba(72, 104, 255, 0.15);
	outline: none;
}

/* Phone prefix (flag + country code): input text colour, also inside dark sections */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PhoneInput__FlagAndCaret {
	color: var(--hsf-field-input__color);
}

/* Consent text: HubSpot's rich-text editor writes inline sizes and colours (11px, black on white),
   reset to the form's text here. Links keep the theme link colour. */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Form .hsfc-RichText {
	line-height: 1.7;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Form .hsfc-RichText :is(p, span, strong, em)[style] {
	background-color: transparent !important;
	color: inherit !important;
	font-size: inherit !important;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Form .hsfc-RichText a[style] {
	background-color: transparent !important;
	font-size: inherit !important;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Form .hsfc-RichText p {
	margin: 0;
}

/* Invalid state: red border + inset glow, like /demo/ */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextInput[aria-invalid="true"],
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-TextareaInput[aria-invalid="true"],
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PhoneInput:has(.hsfc-TextInput[aria-invalid="true"]) .hsfc-PhoneInput__FlagAndCaret {
	border-color: var(--elai-hsf-error);
	box-shadow: inset 0 0 4px rgba(229, 27, 35, 0.4);
}

/* Field error text: 13px bold, close under the field (HubSpot's 6px module spacing only) */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-ErrorAlert {
	font-weight: 700;
	line-height: 1.3;
}

/* Dropdown: chevron instead of HubSpot's triangle */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-DropdownInput > .hsfc-TextInput {
	padding-inline-end: 44px;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-DropdownInput__Caret {
	/* stylelint-disable-next-line stylistic/max-line-length */
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6 8 10 12 6' stroke='%231a1a1a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 16px;
	padding: 0;
	right: 16px;
	width: 16px;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-DropdownInput__Caret > span {
	display: none;
}

/* Checkbox (Sales / Marketing opt-in): 20px box, 4px radius, primary with a white check when ticked */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxField label {
	align-items: flex-start;
	justify-content: flex-start;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxInput {
	appearance: none;
	block-size: 20px;
	border-radius: 4px;
	box-shadow: none;
	box-sizing: border-box;
	cursor: pointer;
	flex-shrink: 0;
	inline-size: 20px;
	margin: 2px 0 0;
	position: relative;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxInput:checked {
	background-color: var(--elai-hsf-primary);
	border-color: var(--elai-hsf-primary);
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxInput:checked::after {
	/* stylelint-disable-next-line stylistic/max-line-length */
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='12' viewBox='0 0 14 12' fill='none'%3E%3Cpath d='M1 6 5.16837 10.1684 13 1' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	mask-size: 12px 10px;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxInput:focus-visible {
	box-shadow: 0 0 0 3px rgba(72, 104, 255, 0.25);
	outline: none;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-CheckboxInput[aria-invalid="true"] {
	border-color: var(--elai-hsf-error);
}

/* Button: /demo/ line height, letter spacing and transition (no variables for these).
   HubSpot's 1px lift on hover is kept, /demo/ does the same. */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Button {
	align-items: center;
	display: inline-flex;
	justify-content: center;
	letter-spacing: 0.02em;
	line-height: 1.4;
	min-block-size: 48px;
	text-transform: none;
	transition: background-color 0.2s ease, transform 0.1s ease;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-Button:focus-visible {
	outline: 2px solid var(--elai-hsf-primary);
	outline-offset: 2px;
}

/* Button row: 16px above like every other row (HubSpot doubles it), never full width */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-NavigationRow {
	margin-top: 0;
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-NavigationRow__Buttons > * {
	width: auto;
}

@media (max-width: 430px) {

	.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-NavigationRow__Buttons {
		align-items: flex-start;
	}
}

/* 16px inputs below 1024px, like /demo/ (also keeps iOS Safari from zooming in on focus) */
@media (max-width: 1024px) {

	.elai-hubspot-form {
		--elai-hsf-input-font-size: 16px;
	}
}

/* Thank-you message after submit: form colours instead of HubSpot's inline black */
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PostSubmit,
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PostSubmit span {
	color: var(--elai-hsf-body);
}

.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PostSubmit strong,
.elai-hubspot-form [data-hsfc-id="Renderer"] .hsfc-PostSubmit strong span {
	color: var(--elai-hsf-label);
}
