/**
 * The shell every popup of this plugin is built from: the box itself, the form
 * inside it, one height for every control, the picker, the captions and the
 * error slots. A domain's own stylesheet adds only what is peculiar to it.
 *
 * Salient styles the controls; what it does not have an opinion about is the
 * form's structure. Two things had to be pinned down explicitly, both measured
 * in the browser rather than guessed:
 *
 *   - the popup is printed in the footer and inherits `line-height: 0` from
 *     that context, which throws off every height below it;
 *   - the theme claims label typography with !important, so the captions have
 *     to claim it back.
 */

/* --- the popup box ----------------------------------------------------- */

.etest-popup {
	/* One gap between controls and one caption size: everything vertical in the
	   form is derived from these two. */
	--etest-field-gap: 24px;
	--etest-label-size: 12px;
	--etest-label-line: 1.25;
	--etest-label-height: calc(var(--etest-label-size) * var(--etest-label-line));
	/* A caption belongs to the control under it, so it stands further from the
	   previous one than from its own: 13 above, 4 below. */
	--etest-caption-gap: 13px;
	--etest-caption-offset: 4px;

	position: relative;
	display: flex;
	flex-direction: column;
	max-width: 560px;
	max-height: 85vh;
	margin: 20px auto;
	padding: 24px;
	line-height: 1.5; /* the footer context sets 0 */
	background: #fff;
	border-radius: 6px;
}

.etest-popup__header {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 16px;
}

.etest-popup__title {
	flex: 1 1 auto;
	/* the first block brings the same space above its caption as any other */
	margin: 0;
}

.etest-form {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0; /* lets the body actually shrink and scroll */
}

.etest-form__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

.etest-form__actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 16px;
	margin-top: var(--etest-field-gap);
}

.etest-form__actions .etest-form__submit {
	margin: 0 0 0 auto;
}

/* The step's own button carries the accent; going back is secondary and stays
   black. Both are the theme's `.nectar-button`, whose colour comes from its own
   rules -- hence !important on the two properties we claim. */
.etest-popup .etest-form__submit {
	background-color: var(--nectar-accent-color) !important;
	color: #fff !important;
}

/* a link, not a button -- only its colour and size are ours */
.etest-popup .etest-form__back {
	font-size: var(--etest-label-size);
	color: #000;
}

/* the button is disabled until the step it belongs to is complete */
.etest-form__submit[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
}

/* The close button is the theme's `.nectar-close-btn` component: size, bars,
   animation and the hover circle all come from the theme. Placing the wrap is
   the consumer's job -- Salient does exactly this for its own review modal
   (`#review_form_wrapper.modal .nectar-close-btn-wrap` in css/custom.php). */
.etest-popup .nectar-close-btn-wrap {
	flex: 0 0 auto;
}

/* the component's box: the anchor holds no content of its own (the cross is
   absolutely centred inside it), so give it one to click on */
.etest-popup .nectar-close-btn {
	height: 30px;
}

/* the component's bars are white, for the dark surfaces it normally sits on */
.etest-popup .nectar-close-btn .close-line {
	background: #545454;
}

/* --- one height for every control -------------------------------------- */

.etest-popup input[type="text"],
.etest-popup input[type="email"],
.etest-popup input[type="password"] {
	min-height: 46px;
	margin: 0;
	padding: 12px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.25;
}

/* --- the picker ---------------------------------------------------------
   Every picker is an input with a list under it, so the controls need no
   reconciling: they are the same element. The list copies the metrics the
   theme gives its own dropdowns -- white, no border, `0 0 6px rgba(0,0,0,.2)`,
   200px tall with its own scroll, rows at 6px, highlight #f0f0f0. */

.etest-combo {
	position: relative;
}

.etest-popup .etest-combo__input {
	padding-right: 34px; /* room for the arrow */
}

/* the same triangle the theme draws on its own dropdowns */
.etest-combo__arrow {
	position: absolute;
	top: 50%;
	right: 12px;
	width: 0;
	height: 0;
	margin-top: -2px;
	border-color: #888 transparent transparent transparent;
	border-style: solid;
	border-width: 5px 4px 0 4px;
	pointer-events: auto;
	cursor: pointer;
}

/* fixed, and placed by the script: the scrolling form body would clip an
   absolutely positioned list. 1100 clears Magnific's own layers. */
.etest-combo__list {
	position: fixed;
	z-index: 1100;
	/* ten rows: 6 + 6 padding + 16 * 1.35 line = 33.6 each */
	max-height: 336px;
	margin: 2px 0 0;
	padding: 0;
	overflow-y: auto;
	list-style: none;
	color: #000;
	background: #fff;
	/* the field's corners and shadow, without its border: an outlined list
	   next to an outlined field read as two boxes, not one control */
	border-radius: 4px;
	box-shadow: rgba(0, 0, 0, 0.11) 0 0 10px;
}

.etest-combo__option,
.etest-combo__status,
.etest-combo__more {
	margin: 0;
	padding: 6px 12px;
	font-size: 16px;
	line-height: 1.35;
}

.etest-combo__option {
	cursor: pointer;
}

.etest-combo__option:hover,
.etest-combo__option.is-active {
	background-color: #f0f0f0;
}

.etest-combo__status,
.etest-combo__more {
	color: #777;
}

/* --- reveal button ------------------------------------------------------
   Sits inside the field's right edge; the input gives it room so typed text
   never runs under it. `button` gets theme styling, hence the explicit reset. */

.etest-field__control {
	position: relative;
}

/* only where a toggle actually sits -- the type flips to text when revealed,
   so the class carries this, not the selector */
.etest-popup .etest-field__control--reveal input {
	padding-right: 46px;
}

.etest-popup .etest-field__reveal {
	position: absolute;
	top: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	opacity: 0.5;
	cursor: pointer;
}

.etest-popup .etest-field__reveal:hover,
.etest-popup .etest-field__reveal:focus-visible {
	background: none;
	opacity: 1;
}

/* while the password is on screen the toggle is not a hint but a state */
.etest-popup .etest-field__reveal[aria-pressed="true"] {
	opacity: 1;
	color: #000;
}

.etest-field__reveal svg {
	width: 20px;
	height: 20px;
}

/* --- captions -----------------------------------------------------------
   Every caption sits above its control, always: no floating, no state. The
   field's own top margin plus the caption's bottom margin add up to one
   distance between controls: offset + caption + offset = --etest-field-gap. */

.etest-field {
	margin: var(--etest-caption-gap) 0 0;
}

/* The theme claims label typography with !important (`form label` in
   salient-dynamic-styles.css), so these claim it back -- three classes and
   the rest. */
.etest-popup .etest-field .etest-field__label,
.etest-popup .etest-field legend {
	display: block;
	float: none;
	width: 100%;
	margin: 0 0 var(--etest-caption-offset);
	padding: 0;
	font-size: var(--etest-label-size) !important;
	font-weight: 500 !important;
	line-height: var(--etest-label-line) !important;
	color: #444 !important;
}

/* --- notes and errors ---------------------------------------------------

   Author `display` beats the browser's `[hidden] { display: none }`, so every
   rule below would quietly un-hide the element it styles. The form leans on the
   `hidden` attribute throughout (steps, notices, the error slots), hence this
   one guard. */

.etest-popup [hidden] {
	display: none !important;
}

.etest-field__error {
	display: block;
	margin-top: 5px;
	font-size: var(--etest-label-size);
	line-height: 1.4;
	color: #a12020;
}

/* Same distance above and below, on the form's own scale; the success message
   shares the element, so only the colour tells the two apart. */
.etest-form__notice {
	margin: var(--etest-caption-gap) 0;
	font-size: 13px;
	line-height: 1.4;
	color: #a12020;
}

.etest-form__notice.is-success {
	color: #1c7c3c;
}

/* --- phones: full screen ------------------------------------------------ */

@media (max-width: 767px) {
	.etest-mfp .mfp-container {
		padding: 0;
	}

	.etest-mfp .mfp-content {
		width: 100%;
		height: 100%;
		vertical-align: top;
	}

	.etest-popup {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		margin: 0;
		padding: 20px;
		border-radius: 0;
	}
}
