/* The checkout shell, first built for Events Manager Pro's payment page, which now uses this one. Its root is .em-checkout with the em, pixelbones and input classes, and every rule selects by class only, so a shell printed inside another lays out on its own.
   Pixelbones (core's .em.pixelbones.input) styles the inputs, labels and buttons and the icon tokens (--icon-*) come from the main stylesheet; this file adds only the layout, review box, payment accordion, summary rail, badges, toggle, banners, primary action and overlay.
   Pixelbones rules carry !important, so the overrides here do too, under the same .em.pixelbones prefix plus .em-checkout.
   Modifiers on the root: wide (the main column at full width beside a fixed-width aside), no-summary, mode-overlay; states the shell script sets: ready, summary-open. */
$root: '.em.pixelbones.em-checkout';
$wide: 1000px;
$medium: 750px;

@mixin column {
	box-sizing: border-box;
	width: 100%;
	max-width: calc(580px + 32px);
	margin-inline: auto;
	padding-left: 16px;
	padding-right: 16px;

	@media (min-width: $medium) {
		max-width: calc(580px + 42px);
		padding-left: 21px;
		padding-right: 21px;
	}

	@media (min-width: $wide) {
		max-width: calc(580px + 76px);
		margin-inline-end: 0;
		padding-left: 38px;
		padding-right: 38px;
	}
}

// an em-icon span or a pseudo-element drawn from an --icon-* token in its text color
@mixin icon-mask( $token ) {
	background-color: currentColor;
	background-image: none;
	-webkit-mask: var($token) no-repeat center / contain;
	mask: var($token) no-repeat center / contain;
}

@mixin icon-size( $size ) {
	width: $size;
	height: $size;
	margin: 0;
}

// the primary action of a checkout: the submit input of a form, or a flow's own button or link (.em-checkout-button)
@mixin pay-button {
	display: block;
	box-sizing: border-box;
	width: 100% !important;
	height: 56px !important;
	margin: 0 !important;
	padding: 0 16px !important;
	border: 1px solid var(--em-checkout-accent) !important;
	border-radius: var(--em-checkout-radius) !important;
	background-color: var(--em-checkout-accent) !important;
	color: var(--button-primary-color, #fff) !important;
	font-family: inherit !important;
	font-size: 16px !important;
	font-weight: 600 !important;
	line-height: 54px !important;
	letter-spacing: 0 !important;
	text-align: center;
	text-decoration: none !important;
	text-transform: none !important;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;

	&:hover, &:focus {
		border-color: var(--em-checkout-accent-hover) !important;
		background-color: var(--em-checkout-accent-hover) !important;
		color: var(--button-primary-color, #fff) !important;
	}

	&:focus-visible {
		outline: 2px solid var(--em-checkout-accent) !important;
		outline-offset: 2px !important;
	}

	&:active {
		filter: brightness(0.92);
	}

	&:disabled, &.disabled {
		opacity: 0.5 !important;
		cursor: not-allowed;
		pointer-events: none;
	}
}

// the primary action's container while it is processing: the button keeps its place and a spinner shows over it
@mixin pay-button-processing {
	input[type="submit"], .em-checkout-button {
		opacity: 1 !important;
		color: transparent !important;
		pointer-events: none;
	}

	&::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		box-sizing: border-box;
		width: 20px;
		height: 20px;
		margin: -10px 0 0 -10px;
		border: 2px solid rgba(255, 255, 255, 0.45);
		border-top-color: #fff;
		border-radius: 50%;
		animation: em-checkout-spin 0.7s linear infinite;
	}
}

/* The standalone document */

body.em-checkout-page {
	margin: 0 !important;
	padding: 0 !important;
	background: #fff !important;
}

/* Checkout */

#{$root} {
	--em-checkout-accent: var(--accent-color, #3a7bec);
	--em-checkout-accent-hover: var(--accent-color-hover, #2a64c9);
	--em-checkout-accent-tint: rgba(58, 123, 236, 0.05);
	--em-checkout-text: var(--text-color-normal, #222);
	--em-checkout-text-strong: var(--text-color-richer, #0d0d0d);
	--em-checkout-muted: #707070;
	--em-checkout-border: #dedede;
	--em-checkout-surface: #fff;
	--em-checkout-aside: #f5f5f5;
	--em-checkout-panel: rgba(0, 0, 0, 0.045);
	--em-checkout-radius: 5px;
	--em-checkout-error: #dd1d1d;
	--em-checkout-error-bg: #fff4f4;
	--em-checkout-success: #1e6b37;
	--em-checkout-success-bg: #eef8f1;
	--em-checkout-warning: #7a5a00;
	--em-checkout-warning-bg: #fff8e5;
	--em-checkout-info: #1f4f8f;
	--em-checkout-info-bg: #f2f6fd;
	--font-size: 14px;
	--line-height: 21px;
	--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

	display: grid !important;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "header" "toggle" "aside" "main" "footer";
	grid-template-rows: auto auto auto 1fr auto;
	min-height: 100vh;
	margin: 0 !important;
	background-color: var(--em-checkout-surface) !important;
	color: var(--em-checkout-text) !important;
	-webkit-font-smoothing: antialiased;

	@supports (color: color-mix(in srgb, red 5%, white)) {
		--em-checkout-accent-tint: color-mix(in srgb, var(--em-checkout-accent) 5%, var(--em-checkout-surface));
	}

	@media (min-width: $wide) {
		grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
		grid-template-areas: "header aside" "main aside" "footer aside";
		grid-template-rows: auto 1fr auto;
	}

	&.no-summary {
		@media (min-width: $wide) {
			grid-template-columns: minmax(0, 1fr);
			grid-template-areas: "header" "main" "footer";

			> .em-checkout-header,
			> .em-checkout-main > .em-checkout-main-inner,
			> .em-checkout-footer {
				margin-inline-end: auto;
			}
		}
	}

	p {
		margin: 0 !important;
		line-height: var(--line-height) !important;
	}

	ul, ol, dl {
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	li {
		margin: 0 !important;
	}

	dd {
		margin: 0;
	}

	a {
		text-decoration: none;

		&:hover {
			text-decoration: underline;
		}
	}

	a, button, input, [tabindex] {
		&:focus-visible {
			outline: 2px solid var(--em-checkout-accent) !important;
			outline-offset: 2px;
		}
	}

	.em-icon {
		flex: none;
	}

	// the main area at full width beside a fixed-width aside, such as a seat map beside its rail
	&.wide {
		@media (min-width: $wide) {
			grid-template-columns: minmax(0, 1fr) minmax(0, calc(420px + 76px));
		}

		> .em-checkout-header,
		> .em-checkout-main > .em-checkout-main-inner,
		> .em-checkout-footer {
			max-width: none;
		}
	}

	// selects keep their arrow on the side the text does not start from
	[dir="rtl"] &.input select:not([multiple]) {
		background-position-x: 5px !important;
		padding-left: 30px !important;
	}

	[hidden] {
		display: none !important;
	}

	/* Header */

	.em-checkout-header {
		grid-area: header;
		padding-top: 16px;
		padding-bottom: 16px;
		border-bottom: 1px solid var(--em-checkout-border);
		@include column;

		@media (min-width: $wide) {
			padding-top: 38px;
			padding-bottom: 0;
			border-bottom: 0;
		}
	}

	.em-checkout-header-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		min-height: 40px;
	}

	a.em-checkout-brand {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		color: var(--em-checkout-text-strong) !important;
		font-size: 21px;
		font-weight: 600;
		line-height: 1.25;
		text-decoration: none;

		&:hover {
			text-decoration: none;
		}
	}

	.em-checkout-logo {
		display: block;
		width: auto;
		max-width: 240px;
		height: auto;
		max-height: 40px;
	}

	.em-checkout-site-icon {
		width: 32px;
		height: 32px;
		border-radius: 6px;
	}

	a.em-checkout-header-link {
		flex: none;
		color: var(--em-checkout-muted) !important;
		font-size: 14px;
	}

	// a link back to the page the checkout came from, or a button closing a dialog in the page, looking the same
	.em-checkout-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: none;
		box-sizing: border-box;
		width: 40px;
		height: 40px;
		margin: 0 !important;
		margin-inline-end: -8px !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 50%;
		background: none !important;
		color: var(--em-checkout-text) !important;
		font: inherit;
		cursor: pointer;
		transition: background-color 0.15s ease;

		&:hover {
			background-color: var(--em-checkout-panel) !important;
		}

		.em-icon {
			@include icon-size(20px);
			@include icon-mask(--icon-close);
		}
	}

	.em-checkout-meta {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		margin-top: 12px !important;
		color: var(--em-checkout-muted);
		font-size: 12px;
		line-height: 18px !important;

		@media (min-width: $wide) {
			margin-top: 24px !important;
		}
	}

	.em-checkout-pill {
		display: inline-block;
		padding: 1px 10px;
		border-radius: 999px;
		background: #ededed;
		color: var(--em-checkout-text);
		font-size: 12px;
		font-weight: 500;
		line-height: 20px;
		white-space: nowrap;

		&.em-checkout-pill-pending {
			background: var(--em-checkout-warning-bg);
			color: var(--em-checkout-warning);
		}

		&.em-checkout-pill-paid {
			background: var(--em-checkout-success-bg);
			color: var(--em-checkout-success);
		}

		&.em-checkout-pill-cancelled {
			background: var(--em-checkout-error-bg);
			color: var(--em-checkout-error);
		}
	}

	/* Booking summary toggle, small screens only */

	button.em-checkout-summary-toggle {
		grid-area: toggle;
		display: none;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		width: 100%;
		margin: 0 !important;
		// lines the label and amount up with the centered content column
		padding: 16px max(16px, calc((100% - 580px) / 2)) !important;
		border: 0 !important;
		border-top: 1px solid var(--em-checkout-border) !important;
		border-bottom: 1px solid var(--em-checkout-border) !important;
		border-radius: 0;
		background: var(--em-checkout-aside) !important;
		color: var(--em-checkout-accent) !important;
		font: inherit;
		font-size: 14px;
		text-align: start;
		cursor: pointer;

		@media (min-width: $medium) {
			padding-left: max(21px, calc((100% - 580px) / 2)) !important;
			padding-right: max(21px, calc((100% - 580px) / 2)) !important;
		}

		@media (min-width: $wide) {
			display: none !important;
		}

		&:focus-visible {
			outline-offset: -4px;
		}
	}

	&.ready > button.em-checkout-summary-toggle {
		display: flex;
	}

	// the full-width toggle bar draws the line under the header, which is only as wide as the column
	&.ready:not(.no-summary) > .em-checkout-header {
		@media (max-width: $wide - 1px) {
			border-bottom: 0;
		}
	}

	.em-checkout-summary-toggle-label {
		display: inline-flex;
		align-items: center;
		gap: 6px;
	}

	.em-checkout-summary-toggle-hide,
	.em-checkout-summary-toggle[aria-expanded="true"] .em-checkout-summary-toggle-show {
		display: none;
	}

	.em-checkout-summary-toggle[aria-expanded="true"] .em-checkout-summary-toggle-hide {
		display: inline;
	}

	.em-checkout-summary-toggle-label > .em-icon {
		@include icon-size(14px);
		@include icon-mask(--icon-chevron-down);
		transition: transform 0.25s ease-out;
	}

	.em-checkout-summary-toggle[aria-expanded="true"] .em-checkout-summary-toggle-label > .em-icon {
		transform: rotate(180deg);
	}

	.em-checkout-summary-toggle-amount {
		color: var(--em-checkout-text-strong);
		font-size: 17px;
		font-weight: 600;
		white-space: nowrap;
	}

	/* Booking summary */

	.em-checkout-aside {
		grid-area: aside;
		box-sizing: border-box;
		background: var(--em-checkout-aside);
		border-bottom: 1px solid var(--em-checkout-border);

		@media (min-width: $wide) {
			grid-row: 1 / -1;
			border-bottom: 0;
			border-inline-start: 1px solid var(--em-checkout-border);
		}
	}

	&.ready > .em-checkout-aside {
		@media (max-width: $wide - 1px) {
			height: 0;
			overflow: hidden;
			border-bottom-width: 0;
			transition: height 0.25s ease-out;
		}
	}

	&.ready.summary-open > .em-checkout-aside {
		@media (max-width: $wide - 1px) {
			border-bottom-width: 1px;
		}
	}

	.em-checkout-aside-inner {
		box-sizing: border-box;
		max-width: calc(580px + 32px);
		margin: 0 auto;
		padding: 16px;

		@media (min-width: $medium) {
			max-width: calc(580px + 42px);
			padding: 21px;
		}

		@media (min-width: $wide) {
			position: sticky;
			top: 0;
			max-width: calc(420px + 76px);
			max-height: 100vh;
			margin: 0;
			padding: 38px;
			overflow-y: auto;
		}
	}

	.em-checkout-summary-title {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: -1px !important;
		padding: 0;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.em-checkout-items {
		display: grid;
		gap: 16px;
		margin-bottom: 20px !important;
	}

	.em-checkout-item-head {
		display: grid;
		grid-template-columns: 64px minmax(0, 1fr);
		gap: 14px;
		align-items: center;
	}

	.em-checkout-thumb {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		width: 64px;
		height: 64px;
		border: 1px solid rgba(0, 0, 0, 0.1);
		border-radius: 8px;
		background: #fff;
		color: var(--em-checkout-muted);

		img {
			display: block;
			width: 100%;
			height: 100%;
			border-radius: 7px;
			object-fit: cover;
		}

		> .em-icon {
			@include icon-size(28px);
			@include icon-mask(--icon-calendar-empty);
		}
	}

	.em-checkout-thumb-badge {
		position: absolute;
		top: -8px;
		inset-inline-end: -8px;
		box-sizing: border-box;
		min-width: 21px;
		height: 21px;
		padding: 0 6px;
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.56);
		color: #fff;
		font-size: 12px;
		font-weight: 600;
		line-height: 21px;
		text-align: center;
	}

	.em-checkout-item-name {
		color: var(--em-checkout-text-strong);
		font-weight: 500;
	}

	.em-checkout-item-meta {
		color: var(--em-checkout-muted);
		font-size: 12px;
		line-height: 18px !important;
	}

	.em-checkout-tickets {
		display: grid;
		gap: 4px;
		margin: 10px 0 0 !important;
		margin-inline-start: 78px !important;
	}

	.em-checkout-ticket {
		display: flex;
		justify-content: space-between;
		gap: 12px;
	}

	.em-checkout-ticket-qty {
		color: var(--em-checkout-muted);
		white-space: nowrap;
	}

	.em-checkout-ticket-price {
		white-space: nowrap;
	}

	.em-checkout-coupons {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		margin-bottom: 16px !important;
	}

	.em-checkout-coupon {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 2px 8px;
		border-radius: 4px;
		background: #e6e6e6;
		color: var(--em-checkout-text);
		font-size: 12px;
		font-weight: 600;
		line-height: 20px;
		text-transform: uppercase;

		> .em-icon {
			@include icon-size(14px);
			@include icon-mask(--icon-coupon);
		}
	}

	.em-checkout-total {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 16px;
		margin-top: 16px;
		padding-top: 16px;
		border-top: 1px solid var(--em-checkout-border);
	}

	/* Main column */

	.em-checkout-main {
		grid-area: main;
		min-width: 0;
	}

	.em-checkout-main-inner {
		padding-top: 8px;
		padding-bottom: 8px;
		@include column;
	}

	.em-checkout-section {
		margin-top: 32px;
	}

	.em-checkout-main-inner > .em-checkout-notice:first-child {
		margin-top: 24px !important;
	}

	h2.em-checkout-section-title {
		margin: 0 0 16px !important;
		color: var(--em-checkout-text-strong) !important;
		font-family: inherit !important;
		font-size: 21px !important;
		font-weight: 600 !important;
		line-height: 1.3 !important;
		letter-spacing: 0 !important;
	}

	.em-checkout-secure {
		margin: -10px 0 16px !important;
		color: var(--em-checkout-muted);
		font-size: 12px;
	}

	/* Review box */

	.em-checkout-review {
		border: 1px solid var(--em-checkout-border);
		border-radius: var(--em-checkout-radius);
		background: var(--em-checkout-surface);
	}

	.em-checkout-review + .em-checkout-review {
		margin-top: 12px !important;
	}

	.em-checkout-review-row {
		display: grid;
		grid-template-columns: 90px minmax(0, 1fr);
		gap: 4px 16px;
		padding: 12px 16px;

		& + .em-checkout-review-row {
			border-top: 1px solid var(--em-checkout-border);
		}

		dt {
			color: var(--em-checkout-muted);
			font-weight: 400;
		}

		dd {
			color: var(--em-checkout-text-strong);
			overflow-wrap: anywhere;
		}

		@media (max-width: 479px) {
			grid-template-columns: minmax(0, 1fr);

			dt {
				font-size: 12px;
			}
		}
	}

	.em-checkout-review-strong {
		font-weight: 500;
	}

	.em-checkout-review-list {
		display: grid;
		gap: 8px;
	}

	/* Payment */

	.em-checkout-form-wrap {
		position: relative;

		> .em-loading {
			display: none !important;
		}
	}

	.em-payment-gateways {
		overflow: hidden;
		margin: 0 !important;
		border: 1px solid var(--em-checkout-border);
		border-radius: var(--em-checkout-radius);
		background: var(--em-checkout-surface);

		> p:empty,
		> .em-payment-gateway-selector:empty {
			display: none;
		}

		fieldset.em-payment-gateway-options {
			min-width: 0;
			margin: 0 !important;
			padding: 0 !important;
			border: 0 !important;
		}
	}

	.em-payment-gateway-option-radio,
	.em-checkout-gateway-single {
		position: relative;
		display: flex;
		align-items: center;
		gap: 12px;
		box-sizing: border-box;
		min-height: 52px;
		padding: 14px 16px;
		background: var(--em-checkout-surface);
		transition: background-color 0.15s ease, box-shadow 0.15s ease;

		input[type="radio"] {
			flex: none;
			width: 18px;
			height: 18px;
			margin: 0 !important;
			border-radius: 50%;
			accent-color: var(--em-checkout-accent);
			cursor: pointer;
		}

		label {
			flex: 1;
			margin: 0 !important;
			color: var(--em-checkout-text-strong);
			font-size: 14px !important;
			font-weight: 500 !important;
			line-height: 20px !important;
			cursor: pointer;
		}
	}

	.em-checkout-gateway-single {
		color: var(--em-checkout-text-strong);
		font-weight: 500;
	}

	.em-payment-gateway-option-radio ~ .em-payment-gateway-option-radio,
	.em-payment-gateway-form ~ .em-payment-gateway-option-radio,
	.em-payment-gateway-options ~ .em-payment-gateway-form {
		border-top: 1px solid var(--em-checkout-border);
	}

	.em-payment-gateway-option-radio.selected {
		z-index: 1;
		background: var(--em-checkout-accent-tint);
		box-shadow: inset 0 0 0 1px var(--em-checkout-accent);
	}

	.em-payment-gateway-form {
		padding: 16px;
		border-top: 1px solid var(--em-checkout-border);
		background: var(--em-checkout-panel);

		&.hidden {
			display: none !important;
		}

		&.empty {
			display: none !important;
		}

		.em-payment-gateway-form-info:empty,
		.em-payment-gateway-form-data:empty {
			display: none;
		}

		.em-notice {
			margin: 0 0 12px !important;
			padding: 10px 12px !important;
			font-size: 13px;
		}
	}

	.em-checkout-gateway-single + .em-payment-gateway-form {
		border-top: 1px solid var(--em-checkout-border);
	}

	.em-checkout-redirect-note {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 12px;
		max-width: 360px;
		margin: 4px auto !important;
		color: var(--em-checkout-text);
		text-align: center;

		&::before {
			content: "";
			display: block;
			width: 48px;
			height: 32px;
			color: var(--em-checkout-muted);
			@include icon-mask(--icon-redirect);
		}
	}

	.em-checkout-due {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 16px;
		margin-top: 20px;
		color: var(--em-checkout-text-strong);

		.em-checkout-due-amount {
			font-size: 16px;
			font-weight: 600;
		}

		@media (min-width: $wide) {
			display: none;
		}
	}

	.em-checkout-pay {
		position: relative;
		margin-top: 16px;

		@media (min-width: $wide) {
			margin-top: 24px;
		}
	}

	&.input input[type="submit"].em-checkout-pay-button,
	&.input .em-checkout-button {
		@include pay-button;
	}

	.em-checkout-pay.loading {
		@include pay-button-processing;
	}

	&.busy .em-payment-gateway-options {
		pointer-events: none;
		opacity: 0.6;
	}

	.em-checkout-noscript {
		margin-top: 12px !important;
		color: var(--em-checkout-error);
	}

	// Pay later leaves the booking as it is, so there is nothing to pay
	.em-checkout-form.paying-later {
		.em-checkout-due,
		.em-checkout-pay {
			display: none;
		}
	}

	// the gateway styles space an info block from the form below it, and Pay later has no form
	.em-payment-gateway-form .em-checkout-pay-later-info {
		margin-bottom: 0 !important;

		p + p {
			margin-top: 8px !important;
		}
	}

	.em-checkout-pay-later {
		margin-top: 16px;
		padding: 14px 16px;
		border: 1px solid var(--em-checkout-border);
		border-radius: var(--em-checkout-radius);

		.em-checkout-pay-later-title {
			margin-bottom: 6px !important;
			color: var(--em-checkout-text-strong);
			font-weight: 500;
		}

		.em-checkout-pay-later-info {
			color: var(--em-checkout-text);

			p + p {
				margin-top: 8px !important;
			}
		}
	}

	/* Banners: the page's own and the booking form script's messages */

	.em-checkout-notice,
	.em-booking-message {
		box-sizing: border-box;
		margin: 0 0 16px !important;
		padding: 12px 16px !important;
		border: 1px solid var(--em-checkout-info) !important;
		border-radius: var(--em-checkout-radius) !important;
		background: var(--em-checkout-info-bg) !important;
		color: var(--em-checkout-text-strong) !important;
		font-size: 14px;

		// a banner the page focuses is read out, it is not a control
		&:focus,
		&:focus-visible {
			outline: none !important;
		}
	}

	.em-checkout-notice-title {
		font-weight: 600;
	}

	.em-checkout-notice-message {
		margin-top: 2px !important;
	}

	.em-checkout-notice-error,
	.em-booking-message-error {
		border-color: var(--em-checkout-error) !important;
		background: var(--em-checkout-error-bg) !important;
	}

	.em-booking-message-error {
		position: relative;
		padding-inline-start: 44px !important;

		&::before {
			content: "";
			position: absolute;
			top: 14px;
			inset-inline-start: 16px;
			width: 18px;
			height: 18px;
			color: var(--em-checkout-error);
			@include icon-mask(--icon-warning);
		}

		p {
			margin: 0 !important;
		}

		p + p {
			margin-top: 4px !important;
		}
	}

	.em-checkout-notice-success,
	.em-booking-message-success {
		border-color: var(--em-checkout-success) !important;
		background: var(--em-checkout-success-bg) !important;
	}

	.em-checkout-notice-warning {
		border-color: #e0b400 !important;
		background: var(--em-checkout-warning-bg) !important;
	}

	.em-checkout-notice-panel {
		margin-top: 24px !important;
		padding: 20px !important;

		.em-checkout-notice-title {
			font-size: 16px;
		}
	}

	.em-checkout-notice-actions {
		display: flex;
		flex-wrap: wrap;
		gap: 8px 16px;
		margin-top: 12px !important;
	}

	a.em-checkout-notice-action {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		min-height: 40px;
		padding: 9px 16px;
		border: 1px solid var(--em-checkout-accent);
		border-radius: var(--em-checkout-radius);
		background: var(--em-checkout-surface);
		color: var(--em-checkout-accent) !important;
		font-weight: 500;
		line-height: 20px;
		text-decoration: none !important;
		transition: background-color 0.15s ease;

		&:hover {
			background: var(--em-checkout-accent-tint);
		}
	}

	// an action with its own markup, such as the event page's Add To Calendar button with its dropdown, looks like the others rather than a form control
	.em-checkout-notice-action-html > button.em-tooltip-ddm {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		gap: 6px;
		box-sizing: border-box;
		width: auto !important;
		height: auto !important;
		min-height: 40px !important;
		margin: 0 !important;
		padding: 9px 16px !important;
		border: 1px solid var(--em-checkout-accent) !important;
		border-radius: var(--em-checkout-radius) !important;
		background: var(--em-checkout-surface) !important;
		box-shadow: none !important;
		color: var(--em-checkout-accent) !important;
		font-size: inherit !important;
		font-weight: 500 !important;
		line-height: 20px !important;
		letter-spacing: 0 !important;
		text-transform: none !important;
		cursor: pointer;
		transition: background-color 0.15s ease;

		&:hover {
			background: var(--em-checkout-accent-tint) !important;
		}

		.em-icon {
			margin: 0 !important;
		}
	}

	/* Footer */

	.em-checkout-footer {
		grid-area: footer;
		margin-top: 48px;
		padding-bottom: 32px;
		@include column;

		> * {
			padding-top: 16px;
			border-top: 1px solid var(--em-checkout-border);
		}

		@media (min-width: $wide) {
			margin-top: 64px;
		}
	}

	.em-checkout-footer-links {
		display: flex;
		flex-wrap: wrap;
		gap: 8px 16px;
		font-size: 12px;

		a {
			color: var(--em-checkout-accent) !important;
		}
	}
}

@keyframes em-checkout-spin {
	to {
		transform: rotate(360deg);
	}
}

/* The overlay a flow opens the checkout in over the page it came from (an .em root, for the icon tokens) */

html.em-checkout-overlay-open,
html.em-checkout-overlay-open body {
	overflow: hidden !important;
}

.em-checkout-overlay {
	position: fixed;
	inset: 0;
	// above EM's tooltips and dropdowns, which use z-index 1000000
	z-index: 2147483000;
	display: block;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	background: #fff;
	opacity: 0;
	transition: opacity 0.2s ease-out;

	&.active {
		opacity: 1;
	}

	iframe.em-checkout-overlay-frame {
		display: block;
		box-sizing: border-box;
		width: 100%;
		height: 100%;
		margin: 0;
		border: 0;
		background: #fff;
		// not visibility, which would stop the checkout focusing its first control while it loads
		opacity: 0;
	}

	&.loaded iframe.em-checkout-overlay-frame,
	&.ready iframe.em-checkout-overlay-frame {
		opacity: 1;
	}

	&.loaded .em-checkout-overlay-loading {
		display: none;
	}

	.em-checkout-overlay-loading {
		position: absolute;
		top: 50%;
		left: 50%;
		box-sizing: border-box;
		width: 32px;
		height: 32px;
		margin: -16px 0 0 -16px;
		border: 3px solid #e2e2e2;
		border-top-color: var(--accent-color, #3a7bec);
		border-radius: 50%;
		animation: em-checkout-spin 0.8s linear infinite;
	}

	&.ready .em-checkout-overlay-loading,
	&.ready .em-checkout-overlay-close {
		display: none;
	}

	button.em-checkout-overlay-close {
		position: absolute;
		top: 16px;
		inset-inline-end: 16px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		width: 40px;
		height: 40px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: transparent;
		color: #222;
		cursor: pointer;

		&:hover {
			background: rgba(0, 0, 0, 0.06);
		}

		&:focus-visible {
			outline: 2px solid var(--accent-color, #3a7bec);
			outline-offset: 2px;
		}

		.em-icon {
			@include icon-size(20px);
			@include icon-mask(--icon-close);
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	#{$root} {
		*, *::before, *::after {
			transition: none !important;
			animation-duration: 1.5s !important;
		}
	}

	.em-checkout-overlay {
		transition: none;
	}
}
