/* Fluent Forms: theme button and field colors. */
.frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style) {
	border: 0;
	border-radius: 999px;
	background-color: var(--wp--preset--color--royal-purple);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
}

.frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style):hover,
.frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style):focus {
	background-color: var(--wp--preset--color--night-purple);
	color: var(--wp--preset--color--white);
	opacity: 1;
}

.frm-fluent-form .ff-el-form-control {
	border-color: var(--wp--preset--color--gold-line);
	font-family: var(--wp--preset--font-family--body);
}

.frm-fluent-form .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--royal-purple);
}

/* Inside the green newsletter band: keep the band's own look. */
.ylb-newsletter__form .frm-fluent-form .ff-btn-submit:not(.ff_btn_no_style) {
	border: 0;
	background: linear-gradient(180deg, #301537, #4a1f63);
}

.ylb-newsletter__form .frm-fluent-form .ff-el-form-control {
	border: 0;
}

/* ==========================================================================
 * "Inherit Theme Style" forms: the full Yassah Lee Books look.
 * Applies when the Fluent Forms block's Form Style is "Inherit Theme Style",
 * the form's Styler is set to it, or the shortcode has theme="ffs_inherit_theme".
 * Fluent's admin preview marks that state differently (it removes .ff-default
 * from the form and strips the submit button's classes), so the selectors
 * also match a preview form without .ff-default and its plain submit button.
 * ========================================================================== */

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) {
	--ylb-ff-radius: clamp(8px, 0.8vw, 12px);
	--ylb-ff-height: clamp(44px, 3.3vw, 52px);
	font-family: var(--wp--preset--font-family--body);
	color: var(--wp--preset--color--ink-brown);
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-group {
	margin-bottom: 1rem;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-input--label label {
	display: inline-block;
	margin-bottom: 0.35em;
	color: var(--wp--preset--color--plum);
	font-weight: 600;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-is-required.asterisk-right label::after {
	color: var(--wp--preset--color--heart-red);
}

/* Fields: white, rounded, no heavy border, like the home page sign-up field. */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-form-control {
	box-sizing: border-box;
	width: 100%;
	min-height: var(--ylb-ff-height);
	padding: 0.55em 1.1em;
	border: 1px solid rgba(59, 26, 79, 0.14);
	border-radius: var(--ylb-ff-radius);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink-brown);
	font-family: inherit;
	font-size: clamp(15px, 1.22vw, 17px);
	line-height: 1.4;
	box-shadow: none;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) textarea.ff-el-form-control {
	min-height: 8em;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-form-control::placeholder {
	color: #6f6a70;
	opacity: 1;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-form-control:focus {
	border-color: var(--wp--preset--color--royal-purple);
	outline: 2px solid rgba(74, 31, 99, 0.25);
	outline-offset: 1px;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) input[type="checkbox"],
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) input[type="radio"] {
	accent-color: var(--wp--preset--color--royal-purple);
}

/* Submit button: purple gradient with a gold star, like "Subscribe ★". */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45em;
	min-height: var(--ylb-ff-height);
	padding: 0.55em 1.6em;
	border: 0;
	border-radius: var(--ylb-ff-radius);
	background: linear-gradient(180deg, #301537, #4a1f63);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--body);
	font-size: clamp(15px, 1.37vw, 19px);
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button)::after {
	content: "\2605";
	color: var(--wp--preset--color--gold);
	font-size: 1.05em;
	line-height: 1;
}

/* Hover, focus and press effects come from the shared assets/css/buttons.css. */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button):hover,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button):focus-visible {
	color: var(--wp--preset--color--white);
}

/* Hide the star with the "ylb-no-star" class in the block's Additional CSS class(es). */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-no-star :is(.ff-btn-submit, .ff_submit_btn_wrapper button)::after {
	content: none;
}

/*
 * One-field forms (an email sign-up): field and button joined in one row, at
 * every screen width. Fluent Forms builds these two ways, so both are covered:
 *   A. the field and button sit directly in the form;
 *   B. they sit in a two-column row (the built-in "Subscription Form").
 * Add "ylb-ff-stacked" in the block's Additional CSS class(es) to keep them
 * stacked, or "ylb-ff-inline" to join a field row with its button anyway.
 */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) {
	--ylb-ff-joined: 1;
	display: flex !important;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 0;
	width: 100%;
}

/* Cells and groups inside the joined row. */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) > .ff-t-cell {
	min-width: 0;
	margin: 0 !important;
	padding: 0;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))) > .ff-el-group:not(.ff_submit_btn_wrapper),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)) > .ff-t-cell:not(:has(> .ff_submit_btn_wrapper)),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) > .ff-t-cell:not(:has(> .ff_submit_btn_wrapper)) {
	flex: 1 1 auto !important;
	min-width: 0;
	margin-bottom: 0;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))) > .ff_submit_btn_wrapper,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)) > .ff-t-cell:has(> .ff_submit_btn_wrapper),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) > .ff-t-cell:has(> .ff_submit_btn_wrapper) {
	flex: 0 0 auto !important;
	width: auto;
	margin-bottom: 0;
}

/* Field and button shapes in the joined row. */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))) .ff-el-group,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)) .ff-el-group,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) .ff-el-group {
	margin-bottom: 0;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))) .ff-el-form-control,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)) .ff-el-form-control,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) .ff-el-form-control {
	border-right: 0;
	border-radius: var(--ylb-ff-radius) 0 0 var(--ylb-ff-radius);
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) fieldset:has(> .ff_submit_btn_wrapper):not(:has(> div:not(.ff-el-group))):not(:has(> .ff-el-group:not(.ff_submit_btn_wrapper) ~ .ff-el-group:not(.ff_submit_btn_wrapper))) :is(.ff-btn-submit, .ff_submit_btn_wrapper button),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)):not(.ylb-ff-stacked) .ff-t-container:has(> .ff-t-cell:first-child:nth-last-child(2)):has(> .ff-t-cell > .ff_submit_btn_wrapper):not(:has(> .ff-t-cell > .ff-el-group ~ .ff-el-group)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button),
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)).ylb-ff-inline .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) :is(.ff-btn-submit, .ff_submit_btn_wrapper button) {
	width: auto;
	margin: 0;
	border-radius: 0 var(--ylb-ff-radius) var(--ylb-ff-radius) 0;
	white-space: nowrap;
}

/* Small screens: a little less padding so the joined row fits. */
@media (max-width: 480px) {
	:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-btn-submit, .ff_submit_btn_wrapper button) {
		padding-inline: 1.1em;
	}
}

/* Inside the green newsletter band the field has no border, as in the design. */
.ylb-newsletter__form :is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-form-control {
	border-color: transparent;
}

.ylb-newsletter__form :is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-input--label label {
	color: #f7f3d6;
}

/* Messages. */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .error.text-danger,
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-el-is-error .text-danger {
	margin-top: 0.35em;
	color: var(--wp--preset--color--heart-red);
	font-size: 0.9em;
}

/*
 * Confirmation message (Fluent Forms > Settings > Confirmation Settings). It
 * sits on a light card, so its text is always dark plum, even inside the green
 * newsletter band where the form's other text is light cream.
 */
.ff-message-success {
	border: 0;
	border-left: 4px solid var(--wp--preset--color--gold);
	border-radius: clamp(8px, 0.8vw, 12px);
	background: rgba(255, 255, 255, 0.92);
	color: var(--wp--preset--color--plum);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	box-shadow: none;
	padding: 0.9em 1.2em;
}

.ff-message-success :is(p, span, li, strong, em, h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--plum);
}

.ff-message-success p:last-child {
	margin-bottom: 0;
}

.ff-message-success a {
	color: var(--wp--preset--color--royal-purple);
	text-decoration: underline;
}

/* Space between a joined field + button row and what follows it (e.g. a terms checkbox). */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper) + .ff-el-group {
	margin-top: 0.85rem;
}

/*
 * The submit button is inline-flex inside a block wrapper, so the wrapper adds a
 * line box under it (taller on small screens) and the button sits higher than
 * the field. A flex wrapper hugs the button, keeping field and button level.
 */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff_submit_btn_wrapper {
	display: flex;
	align-items: flex-end;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff_submit_btn_wrapper.ff-text-center {
	justify-content: center;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff_submit_btn_wrapper.ff-text-right {
	justify-content: flex-end;
}

/*
 * When a form is placed with a shortcode, WordPress adds empty paragraphs inside
 * it (for example between the hidden form title and the first row). Fluent Forms
 * never outputs paragraphs directly in the form, so these only wrap its hidden
 * fields and scripts and add stray spacing that pushed the fields off-centre.
 * Hide them (hidden fields are still sent with the form).
 */
.fluentform :is(form, fieldset) > p:not(:has(> :not(script):not(br):not(input[type="hidden"]))) {
	display: none;
}

/*
 * Joined field + button row: a validation message ("This field is required")
 * appears under the field. In the row it no longer makes the field's column
 * taller, so the button stays level with the field; the row makes room below
 * for the message instead, so it never spills out of its container.
 */
:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-t-container, fieldset):has(> .ff-t-cell > .ff_submit_btn_wrapper, > .ff_submit_btn_wrapper) .ff-el-input--content {
	position: relative;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) :is(.ff-t-container, fieldset):has(> .ff-t-cell > .ff_submit_btn_wrapper, > .ff_submit_btn_wrapper) .ff-el-input--content > :is(.error, .text-danger) {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 0.3em;
	white-space: nowrap;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) .ff-t-container:has(> .ff-t-cell > .ff_submit_btn_wrapper):has(.ff-el-is-error, .ff-el-input--content > .error) {
	margin-bottom: 1.8em;
}

:is(.fluentform.ff-inherit-theme-style, .ff_form_preview .fluentform:not(.ff-default)) fieldset:has(> .ff_submit_btn_wrapper):has(.ff-el-is-error, .ff-el-input--content > .error) {
	padding-bottom: 1.8em;
}
