/*
 * CMW splash ad (full-screen interstitial advert).
 * Every rule is scoped to #cmw-splash-ad so nothing else on the site changes.
 */

#cmw-splash-ad[hidden] {
	display: none !important;
}

#cmw-splash-ad {
	--cmw-splash-navy: #170d2c;
	--cmw-splash-stone: #b3aaa5;
	--cmw-splash-white: #ffffff;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2147483000;
	margin: 0;
	padding: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: rgba(23, 13, 44, 0.95);
	color: var(--cmw-splash-white);
	font-family: 'Fustat', Arial, sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	text-align: left;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	opacity: 0;
	transition: opacity 0.3s ease;
}

#cmw-splash-ad.is-open {
	opacity: 1;
}

#cmw-splash-ad *,
#cmw-splash-ad *::before,
#cmw-splash-ad *::after {
	box-sizing: border-box;
}

#cmw-splash-ad .cmw-splash__dialog {
	display: flex;
	flex-direction: column;
	min-height: 100%;
	margin: 0;
	padding: 20px 32px 28px;
	padding-top: max(20px, env(safe-area-inset-top));
	padding-right: max(32px, env(safe-area-inset-right));
	padding-bottom: max(28px, env(safe-area-inset-bottom));
	padding-left: max(32px, env(safe-area-inset-left));
	outline: none;
}

/* Top bar: CMW logo and close button */
#cmw-splash-ad .cmw-splash__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex: 0 0 auto;
}

#cmw-splash-ad .cmw-splash__logo {
	display: block;
	width: 112px;
	max-width: none;
	height: auto;
	margin: 0;
	border: 0;
}

#cmw-splash-ad .cmw-splash__site {
	font-size: 16px;
	font-weight: 600;
	color: var(--cmw-splash-white);
}

#cmw-splash-ad .cmw-splash__close {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 50%;
	background: transparent;
	color: var(--cmw-splash-white);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#cmw-splash-ad .cmw-splash__close:hover {
	background: var(--cmw-splash-white);
	border-color: var(--cmw-splash-white);
	color: var(--cmw-splash-navy);
}

#cmw-splash-ad .cmw-splash__close svg {
	display: block;
	width: 20px;
	height: 20px;
}

/* Middle: the advert */
#cmw-splash-ad .cmw-splash__stage {
	display: flex;
	flex: 1 0 auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 0;
	padding: 16px 0 20px;
}

#cmw-splash-ad .cmw-splash__label {
	margin: 0 0 10px;
	padding: 0;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.03em;
	color: var(--cmw-splash-stone);
}

#cmw-splash-ad .cmw-splash__creative {
	display: block;
	max-width: 100%;
	line-height: 0;
	color: inherit;
	text-decoration: none;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

#cmw-splash-ad .cmw-splash__creative img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 230px);
	max-height: calc(100dvh - 230px);
	margin: 0;
	border: 0;
}

/* Bottom: countdown and continue button */
#cmw-splash-ad .cmw-splash__foot {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

#cmw-splash-ad .cmw-splash__progress {
	width: 280px;
	max-width: 100%;
	height: 2px;
	overflow: hidden;
	background: rgba(179, 170, 165, 0.35);
}

#cmw-splash-ad .cmw-splash__progress span {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--cmw-splash-white);
	transform: scaleX(1);
	transform-origin: left center;
	transition: transform 0.25s linear;
}

#cmw-splash-ad .cmw-splash__continue {
	display: inline-block;
	margin: 0;
	padding: 12px 24px;
	border: 0;
	border-radius: 999px;
	background: var(--cmw-splash-white);
	color: var(--cmw-splash-navy);
	font-family: 'Fustat', Arial, sans-serif;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.15s ease;
}

#cmw-splash-ad .cmw-splash__continue:hover {
	background: #e9e5e3;
}

#cmw-splash-ad .cmw-splash__timer {
	min-height: 1.4em;
	margin: 0;
	padding: 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--cmw-splash-stone);
}

#cmw-splash-ad.is-untimed .cmw-splash__progress,
#cmw-splash-ad.is-untimed .cmw-splash__timer {
	display: none;
}

/* Keyboard focus (the site's base styles remove outlines) */
#cmw-splash-ad a:focus-visible,
#cmw-splash-ad button:focus-visible {
	outline: 2px solid var(--cmw-splash-white);
	outline-offset: 4px;
}

/* Stop the page behind from scrolling while the ad is open */
html.cmw-splash-is-open,
html.cmw-splash-is-open body {
	overflow: hidden !important;
}

/* Mobile */
@media (max-width: 767px) {
	#cmw-splash-ad .cmw-splash__dialog {
		padding: 14px 16px 20px;
		padding-top: max(14px, env(safe-area-inset-top));
		padding-right: max(16px, env(safe-area-inset-right));
		padding-bottom: max(20px, env(safe-area-inset-bottom));
		padding-left: max(16px, env(safe-area-inset-left));
	}

	#cmw-splash-ad .cmw-splash__logo {
		width: 92px;
	}

	#cmw-splash-ad .cmw-splash__close {
		width: 40px;
		height: 40px;
	}

	#cmw-splash-ad .cmw-splash__stage {
		padding: 12px 0 16px;
	}

	#cmw-splash-ad .cmw-splash__creative img {
		max-height: calc(100vh - 200px);
		max-height: calc(100dvh - 200px);
	}

	#cmw-splash-ad .cmw-splash__continue {
		width: 100%;
		max-width: 340px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#cmw-splash-ad,
	#cmw-splash-ad .cmw-splash__progress span,
	#cmw-splash-ad .cmw-splash__close,
	#cmw-splash-ad .cmw-splash__continue {
		transition: none;
	}
}
