/**
 * Time-delay signup popup.
 *
 * Four layouts and three colour treatments, chosen under Studio Mail →
 * Forms & popup. The layout classes only move the panel and change its
 * proportions; everything inside is shared, so the form never has to be
 * rebuilt per style.
 */

.em-popup {
	--em-surface: #fbfaf7;
	--em-ink: #1f1d1a;
	--em-rule: #dad4c8;
	--em-muted: #6c665c;
	--em-seal: #7a2e2a;
	--em-scrim: rgba(31, 29, 26, 0.45);

	bottom: 0;
	left: 0;
	position: fixed;
	right: 0;
	top: 0;
	z-index: 99999;
}

.em-popup[hidden] {
	display: none;
}

/*
 * Administrator preview is rendered already open by PHP, so it does not depend
 * on JavaScript to become visible.
 *
 * The :not([hidden]) matters. An unqualified `display: block !important` here
 * wins against the [hidden] rule above, so closing the panel — which works by
 * setting the hidden attribute — had no visible effect at all and the close
 * button appeared dead.
 */
.em-popup--preview:not([hidden]) {
	display: block;
	opacity: 1;
	visibility: visible;
}

.em-popup__scrim {
	background: var(--em-scrim);
	bottom: 0;
	cursor: pointer;
	left: 0;
	position: absolute;
	right: 0;
	top: 0;
}

.em-popup__panel {
	background: var(--em-surface);
	border-radius: 3px;
	box-shadow: 0 18px 50px rgba(31, 29, 26, 0.22);
	color: var(--em-ink);
	max-height: calc(100vh - 3rem);
	overflow-y: auto;
	position: absolute;
}

.em-popup__content {
	padding: 2rem 2rem 2.25rem;
}

.em-popup__close {
	background: transparent;
	border: 0;
	color: var(--em-muted);
	cursor: pointer;
	font-size: 1.5rem;
	line-height: 1;
	padding: 0.25rem 0.5rem;
	position: absolute;
	right: 0.75rem;
	top: 0.75rem;
	z-index: 2;
}

.em-popup__close:hover,
.em-popup__close:focus {
	color: var(--em-ink);
}

.em-popup__heading {
	font-size: 1.375rem;
	font-weight: 400;
	line-height: 1.2;
	margin: 0 0 0.5rem;
	padding-right: 1.5rem;
}

.em-popup__body {
	color: var(--em-muted);
	font-size: 0.9375rem;
	line-height: 1.6;
	margin: 0 0 1.25rem;
}

.em-popup__image img {
	display: block;
	height: auto;
	width: 100%;
}

.em-popup .em-form {
	max-width: none;
}

.em-popup .em-form__button {
	width: 100%;
}

/* ---------------------------------------------------------------------------
   Tones
   --------------------------------------------------------------------------- */

.em-popup--white {
	--em-surface: #ffffff;
}

/* Dark treatment. The form picks these up through the same custom properties,
   so it does not need a second stylesheet of its own. */

.em-popup--ink {
	--em-surface: #1f1d1a;
	--em-ink: #f7f5f1;
	--em-muted: #b3aca0;
	--em-rule: #4a453d;
	--em-scrim: rgba(15, 14, 12, 0.6);
}

.em-popup--ink .em-form {
	--em-rule: #4a453d;
	--em-muted: #b3aca0;

	color: #f7f5f1;
}

.em-popup--ink .em-form__input {
	color: #f7f5f1;
}

.em-popup--ink .em-form__button {
	background: #f7f5f1;
	border-color: #f7f5f1;
	color: #1f1d1a;
}

.em-popup--ink .em-form__button:hover,
.em-popup--ink .em-form__button:focus {
	background: transparent;
	color: #f7f5f1;
}

/* ---------------------------------------------------------------------------
   Layout: centred card
   --------------------------------------------------------------------------- */

.em-popup--card .em-popup__panel {
	animation: em-card-in 0.28s ease-out both;
	border: 1px solid var(--em-rule);
	left: 50%;
	max-width: 30rem;
	top: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 3rem);
}

@keyframes em-card-in {

	from {
		opacity: 0;
		transform: translate(-50%, -46%);
	}

	to {
		opacity: 1;
		transform: translate(-50%, -50%);
	}
}

/* ---------------------------------------------------------------------------
   Layout: bottom bar
   --------------------------------------------------------------------------- */

.em-popup--bar {
	bottom: 0;
	top: auto;
}

/* No dimming: the point of the bar is that the work behind it stays readable. */

.em-popup--bar .em-popup__scrim {
	display: none;
}

.em-popup--bar .em-popup__panel {
	animation: em-bar-in 0.3s ease-out both;
	border-radius: 0;
	border-top: 1px solid var(--em-rule);
	bottom: 0;
	box-shadow: 0 -6px 28px rgba(31, 29, 26, 0.14);
	left: 0;
	max-height: none;
	position: fixed;
	width: 100%;
}

.em-popup--bar .em-popup__content {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem 2rem;
	margin: 0 auto;
	max-width: 68rem;
	padding: 1.1rem 3.25rem 1.1rem 1.5rem;
}

.em-popup--bar .em-popup__heading {
	font-size: 1.0625rem;
	margin: 0;
	padding: 0;
}

.em-popup--bar .em-popup__body {
	flex: 1 1 16rem;
	font-size: 0.875rem;
	margin: 0;
}

.em-popup--bar .em-form {
	flex: 1 1 22rem;
}

.em-popup--bar .em-form__fields {
	align-items: flex-end;
	flex-direction: row;
	gap: 0.75rem;
}

.em-popup--bar .em-form__field {
	flex: 1 1 auto;
}

.em-popup--bar .em-form__button {
	flex: 0 0 auto;
	width: auto;
}

.em-popup--bar .em-form__label {
	clip: rect(1px, 1px, 1px, 1px);
	height: 1px;
	overflow: hidden;
	position: absolute;
	width: 1px;
}

.em-popup--bar .em-form__consent {
	flex: 1 1 100%;
	margin: 0;
}

@keyframes em-bar-in {

	from {
		transform: translateY(100%);
	}

	to {
		transform: translateY(0);
	}
}

/* ---------------------------------------------------------------------------
   Layout: corner card
   --------------------------------------------------------------------------- */

.em-popup--corner {
	bottom: 0;
	left: auto;
	top: auto;
}

.em-popup--corner .em-popup__scrim {
	display: none;
}

.em-popup--corner .em-popup__panel {
	animation: em-corner-in 0.3s ease-out both;
	border: 1px solid var(--em-rule);
	bottom: 1.5rem;
	max-height: calc(100vh - 3rem);
	position: fixed;
	right: 1.5rem;
	width: 22rem;
}

.em-popup--corner .em-popup__content {
	padding: 1.5rem 1.5rem 1.75rem;
}

.em-popup--corner .em-popup__heading {
	font-size: 1.1875rem;
}

@keyframes em-corner-in {

	from {
		opacity: 0;
		transform: translateY(1.25rem);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------------------------------------------------------------------------
   Layout: full screen
   --------------------------------------------------------------------------- */

.em-popup--full .em-popup__scrim {
	background: var(--em-surface);
}

.em-popup--full .em-popup__panel {
	animation: em-fade-in 0.3s ease-out both;
	border-radius: 0;
	bottom: 0;
	box-shadow: none;
	display: flex;
	flex-direction: column;
	justify-content: center;
	left: 0;
	max-height: none;
	right: 0;
	top: 0;
}

.em-popup--full .em-popup__content {
	margin: 0 auto;
	max-width: 30rem;
	padding: 2rem 1.5rem;
	width: 100%;
}

.em-popup--full .em-popup__heading {
	font-size: 1.875rem;
}

.em-popup--full .em-popup__image {
	margin: 0 auto;
	max-width: 30rem;
	width: 100%;
}

.em-popup--full .em-popup__close {
	right: 1.25rem;
	top: 1.25rem;
}

@keyframes em-fade-in {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* ---------------------------------------------------------------------------
   Phones
   --------------------------------------------------------------------------- */

/* Card and corner both become a sheet rising from the bottom edge, which is
   easier to reach and dismiss one-handed than a floating box. */

@media (max-width: 32em) {

	.em-popup--card .em-popup__panel,
	.em-popup--corner .em-popup__panel {
		animation: em-sheet-in 0.28s ease-out both;
		border-bottom: 0;
		border-radius: 6px 6px 0 0;
		bottom: 0;
		left: 0;
		max-height: 88vh;
		max-width: none;
		right: auto;
		top: auto;
		transform: none;
		width: 100%;
	}

	.em-popup--card .em-popup__content,
	.em-popup--corner .em-popup__content {
		padding: 1.75rem 1.25rem 1.5rem;
	}

	.em-popup--bar .em-popup__content {
		align-items: stretch;
		flex-direction: column;
		gap: 0.85rem;
		padding: 1.25rem 1.25rem 1.5rem;
	}

	.em-popup--bar .em-form__fields {
		flex-direction: column;
	}

	.em-popup--bar .em-form__button {
		width: 100%;
	}

	.em-popup--full .em-popup__heading {
		font-size: 1.5rem;
	}
}

@keyframes em-sheet-in {

	from {
		opacity: 0;
		transform: translateY(1.5rem);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {

	.em-popup__panel {
		animation: none !important;
	}
}

/* Preview-only status line. Never rendered for a visitor. */

.em-popup__debug {
	border-top: 1px dashed var(--em-rule);
	color: var(--em-muted);
	font-size: 0.75rem;
	line-height: 1.5;
	margin: 1.25rem 0 0;
	padding-top: 0.75rem;
}
