/*
 * Promo popup.
 *
 * Written to survive dropping into any of the Signum themes, so every rule is
 * namespaced and nothing relies on the theme's grid, Bootstrap, or reset.
 */

.signum-promo {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.signum-promo[hidden] {
	display: none !important;
}

.signum-promo.is-open {
	opacity: 1;
}

.signum-promo__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.72 );
	cursor: pointer;
}

.signum-promo__dialog {
	position: relative;
	width: 100%;
	max-height: calc( 100vh - 40px );
	overflow: auto;
	background: transparent;
	transform: translateY( 12px ) scale( 0.98 );
	transition: transform 0.25s ease;
}

.signum-promo.is-open .signum-promo__dialog {
	transform: none;
}

/* Heading is for screen readers; the banner itself carries the message. */
.signum-promo__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset( 50% );
	white-space: nowrap;
}

.signum-promo__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.55 );
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.signum-promo__close:hover,
.signum-promo__close:focus-visible {
	background: rgba( 0, 0, 0, 0.8 );
}

.signum-promo__viewport {
	position: relative;
	display: grid;
}

/*
 * Slides are stacked so the popup never changes size as it advances, and the
 * dialog is sized by the tallest banner rather than jumping between them.
 */
.signum-promo__slide {
	grid-area: 1 / 1;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease;
}

.signum-promo__slide.is-active {
	opacity: 1;
	visibility: visible;
}

.signum-promo__link,
.signum-promo__slide {
	display: block;
}

/*
 * Promo banners are wide (commonly about 2.7:1). Width drives the size and the
 * height follows, but the banner is still capped to the window so a tall or
 * square one cannot overflow on a short screen.
 */
.signum-promo__img {
	display: block;
	width: 100%;
	height: auto;
	max-height: calc( 100vh - 40px );
	object-fit: contain;
	margin: 0 auto;
}

.signum-promo__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	transform: translateY( -50% );
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.45 );
	color: #fff;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.signum-promo__nav:hover,
.signum-promo__nav:focus-visible {
	background: rgba( 0, 0, 0, 0.75 );
}

.signum-promo__nav--prev { left: 10px; }
.signum-promo__nav--next { right: 10px; }

.signum-promo__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 8px;
}

.signum-promo__dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.45 );
	cursor: pointer;
	transition: background 0.15s ease;
}

.signum-promo__dot.is-active {
	background: #fff;
}

/* Keyboard focus must be visible on top of imagery of any colour. */
.signum-promo__close:focus-visible,
.signum-promo__nav:focus-visible,
.signum-promo__dot:focus-visible,
.signum-promo__link:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

@media ( max-width: 600px ) {
	.signum-promo { padding: 12px; }
	.signum-promo__nav { width: 36px; height: 36px; font-size: 24px; }
	.signum-promo__nav--prev { left: 4px; }
	.signum-promo__nav--next { right: 4px; }
}

/* Honour a stated preference for less motion. */
@media ( prefers-reduced-motion: reduce ) {
	.signum-promo,
	.signum-promo__dialog,
	.signum-promo__slide,
	.signum-promo__close,
	.signum-promo__nav,
	.signum-promo__dot {
		transition: none;
	}
}
