/**
 * FormsHub: the login and register overlay.
 *
 * Ported from OSS CE Modules v3.9.1. D-097.
 *
 * ── Layout that cannot jump ─────────────────────────────────────────────────
 *
 * A full-viewport scroll area with fixed top padding, and a dialog at
 * `margin: 0 auto`. The dialog's top edge stays the same distance from the top
 * of the scroll area however tall it grows; when it outgrows the viewport the
 * scroll area scrolls rather than the dialog repositioning.
 *
 * Centring with flex or transforms instead is what produces the jump when a
 * validation message appears and the form gets taller.
 */

.occ-fh-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

/*
 * Two classes, not one. `is-visible` puts it in the layout, `is-open` fades it
 * in, and the script forces a reflow between them. Collapsing them into a
 * single class means the browser batches the change and the transition never
 * runs.
 */
.occ-fh-overlay.is-visible {
	display: block;
}

.occ-fh-overlay.is-open {
	opacity: 1;
}

.occ-fh-overlay-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(11, 11, 11, 0.6);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.occ-fh-overlay-scroll {
	position: relative;
	height: 100%;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 5vh 16px;
	box-sizing: border-box;
}

.occ-fh-overlay-dialog {
	position: relative;
	width: 600px;
	max-width: 100%;
	margin: 0 auto;
	transition: width 0.2s ease;
}

/* Login is a two-field form and reads stretched at the register width. */
.occ-fh-overlay-dialog[data-active="login"] {
	width: 460px;
}

.occ-fh-overlay-panel {
	display: none;
}

.occ-fh-overlay-panel.is-active {
	display: block;
}

/*
 * Positioned against the dialog rather than the panel, so it does not move when
 * the active panel changes width.
 *
 * **Dark, not white.** It was white because it sat over the form's burgundy
 * header. That header was removed and this was never revisited, leaving a white
 * glyph on a white card: still clickable, findable only by someone who knew
 * where it was. Found by item 1.8, which passes on the letter of the item
 * because the button does close the overlay.
 *
 * The hover wash flipped with it. A white wash on a white card was invisible
 * for the same reason.
 */
.occ-fh-overlay-close {
	position: absolute;
	top: 12px;
	right: 14px;
	z-index: 5;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #1d2327;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.occ-fh-overlay-close:hover,
.occ-fh-overlay-close:focus {
	opacity: 1;
	background: rgba(0, 0, 0, 0.08);
}

.rtl .occ-fh-overlay-close {
	right: auto;
	left: 14px;
}

/*
 * Body scroll lock. The script compensates for the scrollbar's width in
 * padding-right, so the page does not reflow wider when this lands.
 */
body.occ-fh-overlay-open {
	overflow: hidden;
}

/*
 * Our card is the single rounded white surface in the overlay.
 *
 * The form sets its own max-width for standalone shortcode use, which would
 * fight the dialog's width here, and on a page it inherits a background from
 * whatever contains it. Inside the overlay there is no container, so it has to
 * bring its own or the fields float directly on the blurred backdrop.
 *
 * `overflow: hidden` so the burgundy header's square corners are clipped to the
 * card's radius rather than poking out of it.
 */
.occ-fh-overlay .occ-rg-form-wrap {
	width: 100%;
	max-width: none;
	margin: 0;
	background: #fff;
	border: 0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

@media (max-width: 600px) {
	.occ-fh-overlay-scroll {
		padding: 16px 12px;
	}

	.occ-fh-overlay-dialog,
	.occ-fh-overlay-dialog[data-active="login"] {
		width: 100%;
	}
}

/*
 * Honour a system preference for less movement. The overlay still appears and
 * still closes; only the fade and the width change stop animating.
 */
@media (prefers-reduced-motion: reduce) {
	.occ-fh-overlay,
	.occ-fh-overlay-dialog {
		transition: none;
	}
}
