/**
 * Internal Global Message — front-end styles.
 *
 * Colours come from per-message custom properties printed inline by
 * Config\Css::build_for_message(), so this file stays static and cacheable.
 *
 * Bars and popups start hidden and are revealed by the script once it has read
 * the visitor's dismissal state. That avoids a dismissed bar flashing on screen
 * on every page load, which is the cost of keeping the HTML identical for
 * everyone so it stays safe to page-cache.
 */

:root {
	--igm-top: 0px;
	--igm-bar-z: 9000;
	--igm-popup-z: 9100;
	--igm-radius: 4px;
	--igm-overlay: #000000;
}

/* ── Announcement bar ──────────────────────────────────────────────────────── */

.igm-bars {
	display: none;
	width: 100%;
}

html.igm-ready .igm-bars {
	display: block;
}

.igm-bars--sticky {
	position: fixed;
	top: var(--igm-top);
	left: 0;
	right: 0;
	z-index: var(--igm-bar-z);
}

.igm-bar {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	padding: 12px 44px;
	background: var(--igm-bg, #1e40af);
	color: var(--igm-text, #ffffff);
	font-size: 15px;
	line-height: 1.45;
}

.igm-bar[hidden] {
	display: none;
}

.igm-bar__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	margin: 0 auto;
	max-width: 100%;
}

.igm-bar--width-contained .igm-bar__inner {
	max-width: 1200px;
}

.igm-bar--align-left .igm-bar__inner {
	justify-content: flex-start;
}

.igm-bar--align-center .igm-bar__inner {
	justify-content: center;
}

.igm-bar--align-right .igm-bar__inner {
	justify-content: flex-end;
}

.igm-bar__text {
	margin: 0;
}

.igm-bar__text a {
	color: inherit;
	text-decoration: underline;
}

.igm-bar__button {
	display: inline-block;
	padding: 7px 16px;
	border-radius: var(--igm-radius);
	background: var(--igm-button-bg, #ffffff);
	color: var(--igm-button-text, #1e40af);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
}

.igm-bar__button:hover,
.igm-bar__button:focus {
	color: var(--igm-button-text, #1e40af);
	opacity: 0.88;
}

.igm-bar__close {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	padding: 4px 10px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.75;
}

.igm-bar__close:hover,
.igm-bar__close:focus {
	opacity: 1;
}

/* ── Popup ─────────────────────────────────────────────────────────────────── */

.igm-popup {
	position: fixed;
	inset: 0;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: var(--igm-popup-z);
	display: flex;
	padding: 20px;
	box-sizing: border-box;
}

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

.igm-popup__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: var(--igm-overlay, #000000);
	opacity: 0.55;
}

.igm-popup--no-overlay .igm-popup__overlay {
	display: none;
}

.igm-popup--no-overlay {
	pointer-events: none;
}

.igm-popup--no-overlay .igm-popup__dialog {
	pointer-events: auto;
}

.igm-popup__dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-height: calc(100vh - 40px);
	padding: 28px 32px;
	overflow-y: auto;
	border-radius: var(--igm-radius);
	background: var(--igm-bg, #ffffff);
	color: var(--igm-text, #111827);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.igm-popup--small .igm-popup__dialog {
	max-width: 420px;
}

.igm-popup--medium .igm-popup__dialog {
	max-width: 620px;
}

.igm-popup--large .igm-popup__dialog {
	max-width: 900px;
}

.igm-popup--pos-center {
	align-items: center;
	justify-content: center;
}

.igm-popup--pos-top {
	align-items: flex-start;
	justify-content: center;
}

.igm-popup--pos-bottom-right {
	align-items: flex-end;
	justify-content: flex-end;
}

.igm-popup--pos-bottom-left {
	align-items: flex-end;
	justify-content: flex-start;
}

.igm-popup__close {
	position: absolute;
	top: 8px;
	right: 10px;
	padding: 4px 10px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
}

.igm-popup__close:hover,
.igm-popup__close:focus {
	opacity: 1;
}

.igm-popup__heading {
	margin: 0 0 12px;
	color: inherit;
	font-size: 22px;
	line-height: 1.25;
}

.igm-popup__content > *:first-child {
	margin-top: 0;
}

.igm-popup__content > *:last-child {
	margin-bottom: 0;
}

/* ── Animation ─────────────────────────────────────────────────────────────── */

.igm-popup--anim-fade .igm-popup__dialog {
	animation: igm-fade 0.22s ease-out;
}

.igm-popup--anim-slide .igm-popup__dialog {
	animation: igm-slide 0.26s ease-out;
}

@keyframes igm-fade {
	from {
		opacity: 0;
	}
}

@keyframes igm-slide {
	from {
		opacity: 0;
		transform: translateY(24px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.igm-popup__dialog {
		animation: none !important;
	}
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */

/* Device targeting is done here rather than in PHP: deciding it server-side
   would make the markup vary by user agent and break page caching. */
@media (max-width: 782px) {
	.igm--hide-mobile {
		display: none !important;
	}
}

@media print {
	.igm-bars,
	.igm-popup {
		display: none !important;
	}
}
