/**
 * MSA Announcement Bar.
 *
 * Three placements off one block of markup. The doodle wash uses the same mask
 * technique as the hero sections: the PNG supplies the shape only and the colour
 * comes from CSS, so one asset works on every accent.
 */

.msa-announce {
	/* Filled in per accent below. */
	--announce-fill: var(--msa-crimson, #C42031);
	--announce-ink: #FFFFFF;
	--announce-btn-ink: var(--msa-crimson, #C42031);

	--announce-pad-y: 16px;
	--announce-pad-x: clamp(20px, 4vw, 40px);

	font-family: var(--msa-body, "Roboto", Arial, sans-serif);
	color: var(--announce-ink);
	box-sizing: border-box;
}

.msa-announce *,
.msa-announce *::before,
.msa-announce *::after {
	box-sizing: inherit;
}

/* Shown by the script once it knows this announcement has not been dismissed.
   Hidden by default so it never flashes up and disappears again. */
.msa-announce[hidden] {
	display: none !important;
}

/* ------------------------------------------------------------- The surface */

.msa-announce__inner {
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	gap: clamp(14px, 2.5vw, 28px);
	padding: var(--announce-pad-y) var(--announce-pad-x);
	background: var(--announce-fill);
}

/* The copy and the controls sit above the doodle wash. */
.msa-announce__inner > * {
	position: relative;
	z-index: 1;
}

/* --------------------------------------------------------- The doodle wash */

/*
 * Shape from the PNG, colour from here -- the same trick the hero sections use,
 * which is why one set of assets covers all six accents.
 */
@supports (mask-image: linear-gradient(#000, #000)) or (-webkit-mask-image: linear-gradient(#000, #000)) {

	.msa-announce__inner::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 0;
		pointer-events: none;
		background-color: rgba(255, 255, 255, var(--announce-doodle-alpha, 0.16));

		-webkit-mask-image:
			url("megaphone.png"),
			url("speech-bubble.png"),
			url("lightning-bolt.png");
		mask-image:
			url("megaphone.png"),
			url("speech-bubble.png"),
			url("lightning-bolt.png");

		-webkit-mask-repeat: no-repeat;
		mask-repeat: no-repeat;

		-webkit-mask-size: 150px auto, 74px auto, 52px auto;
		mask-size: 150px auto, 74px auto, 52px auto;

		/* Kept to the right, away from the copy, and cropped by the bar's own
		   overflow so they read as a pattern rather than as clip art. */
		-webkit-mask-position:
			right -34px top -40px,
			right 168px bottom -26px,
			right 116px top -14px;
		mask-position:
			right -34px top -40px,
			right 168px bottom -26px,
			right 116px top -14px;
	}
}

/* --------------------------------------------------------------- The mark */

/*
 * The megaphone again, solid this time, as the announcement's icon. It is the
 * one piece of the design that says what this is before a word is read.
 */
.msa-announce__mark {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	background-color: var(--announce-ink);

	-webkit-mask: url("megaphone.png") no-repeat center / contain;
	mask: url("megaphone.png") no-repeat center / contain;
}

/* Without mask support there is no icon rather than a coloured square. */
@supports not ((mask-image: linear-gradient(#000, #000)) or (-webkit-mask-image: linear-gradient(#000, #000))) {
	.msa-announce__mark {
		display: none;
	}
}

/* ----------------------------------------------------------------- Copy */

.msa-announce__copy {
	flex: 1 1 auto;
	min-width: 0;
}

.msa-announce__title {
	margin: 0;
	font-family: var(--msa-display, "Bebas Neue", Impact, sans-serif);
	font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem);
	line-height: 1.15;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.msa-announce__text {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
}

.msa-announce__text p {
	margin: 0;
}

.msa-announce__text p + p {
	margin-top: 0.4em;
}

.msa-announce__title + .msa-announce__text {
	margin-top: 4px;
}

.msa-announce__text a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.msa-announce__text a:hover {
	text-decoration-thickness: 2px;
}

/* --------------------------------------------------------------- Button */

.msa-announce__actions {
	flex: 0 0 auto;
	margin: 0;
}

.msa-announce__btn {
	display: inline-block;
	padding: 11px 22px;
	border-radius: var(--msa-pill, 999px);
	background: var(--announce-ink);
	color: var(--announce-btn-ink);
	font-weight: 700;
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.msa-announce__btn:hover,
.msa-announce__btn:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
	color: var(--announce-btn-ink);
}

/* ---------------------------------------------------------------- Close */

/*
 * Scoped copy of the theme's screen-reader class. Most themes define one, but
 * this cannot depend on that: where it is missing the close button's label
 * prints as visible text across the middle of the bar.
 */
.msa-announce .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/*
 * This is a button, so a global button style will otherwise colour it -- on the
 * live site it came through as a pink cross on a transparent field. The repeated
 * class lifts specificity above ordinary theme rules, and every state sets
 * background, border and text together so none of them can be picked up from
 * somewhere else.
 *
 * The four colour properties are also marked important, which the rest of this
 * stylesheet never does. This one control renders inside whatever the theme and
 * Elementor bring with them, there is no wrapper of ours between it and their
 * button styling, and a close button that cannot be seen is a bar that cannot be
 * closed. The accent overrides further down are more specific, so they still win.
 */
.msa-announce__close.msa-announce__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0 !important;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16) !important;
	color: var(--announce-ink) !important;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease;

	/* No native button chrome underneath any of the above. */
	-webkit-appearance: none;
	appearance: none;
}

.msa-announce__close.msa-announce__close:hover,
.msa-announce__close.msa-announce__close:focus-visible {
	background: rgba(255, 255, 255, 0.3) !important;
	border: 0 !important;
	color: var(--announce-ink) !important;
	box-shadow: none;
}

.msa-announce__close.msa-announce__close svg {
	display: block;
	width: 17px;
	height: 17px;
}

/*
 * The stroke is set here rather than left to the markup's currentColor. An
 * inherited colour is exactly what leaks in from a global button rule, and on
 * crimson that showed up as a pink cross.
 */
.msa-announce__close.msa-announce__close svg path {
	stroke: var(--announce-ink) !important;
	fill: none !important;
}

/* A visible focus ring on a coloured field, on every accent. */
.msa-announce :focus-visible {
	outline: 3px solid var(--announce-ink);
	outline-offset: 3px;
}

/* --------------------------------------------------------- Top and bottom */

/*
 * The top bar is in the document, not over it: it is the first element in the
 * body, so the header simply starts below it. Nothing is measured and nothing
 * can fall out of sync with a sticky header.
 */
.msa-announce--top {
	position: relative;
	z-index: 1;
}

.msa-announce--bottom {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	/* Under the header (900) and its mega menu (9990), over the anchor bar (500). */
	z-index: 800;
	box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.16);
}

/*
 * The bottom bar reserves its own height at the end of the page, so it never
 * covers the last of the footer. The script measures the bar and sets the
 * variable; this rule is what spends it.
 */
body.msa-has-announce-bottom {
	padding-bottom: var(--msa-announce-height, 0px);
}

/* ----------------------------------------------------------------- Popup */

.msa-announce--popup {
	position: fixed;
	inset: 0;
	/* Above the mega menu: it is modal, so nothing should sit over it. */
	z-index: 9995;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 5vw, 48px);
}

.msa-announce__scrim {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.msa-announce--popup .msa-announce__inner {
	--announce-pad-y: clamp(28px, 4vw, 40px);

	position: relative;
	z-index: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 18px;
	width: min(560px, 100%);
	max-height: calc(100vh - 2 * clamp(16px, 5vw, 48px));
	overflow-y: auto;
	border-radius: var(--msa-radius, 10px);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.msa-announce--popup .msa-announce__mark {
	width: 52px;
	height: 52px;
}

.msa-announce--popup .msa-announce__title {
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
}

.msa-announce--popup .msa-announce__text {
	font-size: 1rem;
}

/* Out of the flow in the corner, so the copy is not indented around it. */
.msa-announce--popup .msa-announce__close.msa-announce__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
}

.msa-announce--popup .msa-announce__inner::after {
	-webkit-mask-size: 190px auto, 92px auto, 62px auto;
	mask-size: 190px auto, 92px auto, 62px auto;

	-webkit-mask-position:
		right -46px top -54px,
		right 26px bottom -30px,
		right 150px top 10px;
	mask-position:
		right -46px top -54px,
		right 26px bottom -30px,
		right 150px top 10px;
}

/* Stops the page behind a popup from scrolling under it. */
body.msa-has-announce-popup {
	overflow: hidden;
}

/* --------------------------------------------------------------- Accents */

/*
 * Brand values as fills. Yellow is the exception everywhere on this site: it
 * fails contrast as a background for white type, so it takes ink instead.
 */
.msa-announce.msa-accent--crimson {
	--announce-fill: var(--msa-crimson, #C42031);
	--announce-btn-ink: var(--msa-crimson-text, #A81A29);
}

.msa-announce.msa-accent--blue {
	--announce-fill: var(--msa-blue, #264398);
	--announce-btn-ink: var(--msa-blue-text, #264398);
}

.msa-announce.msa-accent--teal {
	--announce-fill: var(--msa-teal, #00B1BA);
	--announce-btn-ink: var(--msa-teal-text, #00767C);
}

.msa-announce.msa-accent--purple {
	--announce-fill: var(--msa-purple, #A73C96);
	--announce-btn-ink: var(--msa-purple-text, #8A2F7C);
}

.msa-announce.msa-accent--grey {
	--announce-fill: var(--msa-grey, #414141);
	--announce-btn-ink: var(--msa-grey, #414141);
}

.msa-announce.msa-accent--yellow {
	--announce-fill: var(--msa-yellow, #FFD508);
	--announce-ink: var(--msa-ink, #1A1A1A);
	--announce-btn-ink: var(--msa-yellow, #FFD508);
	--announce-doodle-alpha: 0.2;
}

/* On yellow the wash and the controls are dark, not white. */
.msa-announce.msa-accent--yellow .msa-announce__inner::after {
	background-color: rgba(0, 0, 0, var(--announce-doodle-alpha, 0.14));
}

.msa-announce.msa-accent--yellow .msa-announce__btn {
	background: var(--msa-ink, #1A1A1A);
	color: var(--msa-yellow, #FFD508);
}

.msa-announce.msa-accent--yellow .msa-announce__close.msa-announce__close {
	background: rgba(0, 0, 0, 0.12) !important;
}

.msa-announce.msa-accent--yellow .msa-announce__close.msa-announce__close:hover,
.msa-announce.msa-accent--yellow .msa-announce__close.msa-announce__close:focus-visible {
	background: rgba(0, 0, 0, 0.22) !important;
}

/* --------------------------------------------------------------- Motion */

.msa-announce--popup .msa-announce__inner {
	animation: msa-announce-rise 0.28s ease-out both;
}

.msa-announce--popup .msa-announce__scrim {
	animation: msa-announce-fade 0.28s ease-out both;
}

@keyframes msa-announce-rise {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@keyframes msa-announce-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

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

	.msa-announce--popup .msa-announce__inner,
	.msa-announce--popup .msa-announce__scrim {
		animation: none;
	}

	.msa-announce__btn {
		transition: none;
	}

	.msa-announce__btn:hover,
	.msa-announce__btn:focus-visible {
		transform: none;
	}
}

/* --------------------------------------------------------------- Narrow */

@media (max-width: 860px) {

	.msa-announce--top .msa-announce__inner,
	.msa-announce--bottom .msa-announce__inner {
		flex-wrap: wrap;
		gap: 12px 16px;
	}

	/* The copy takes the full width and the button drops below it, rather than
	   both being squeezed into a strip too narrow for either. */
	.msa-announce--top .msa-announce__copy,
	.msa-announce--bottom .msa-announce__copy {
		flex: 1 1 100%;
		order: 2;
	}

	.msa-announce--top .msa-announce__mark,
	.msa-announce--bottom .msa-announce__mark {
		order: 1;
		width: 32px;
		height: 32px;
	}

	.msa-announce--top .msa-announce__actions,
	.msa-announce--bottom .msa-announce__actions {
		order: 3;
	}

	.msa-announce--top .msa-announce__close.msa-announce__close,
	.msa-announce--bottom .msa-announce__close.msa-announce__close {
		order: 1;
		margin-left: auto;
	}

	/* At this width the wash crowds the text more than it decorates. */
	.msa-announce__inner::after {
		opacity: 0.55;
	}
}

@media (max-width: 480px) {

	.msa-announce {
		--announce-pad-x: 16px;
	}

	.msa-announce__btn {
		display: block;
		text-align: center;
	}
}
