/*
 * Messages SV styles
 *
 * Moved out of the inline <style> blocks that used to be echoed from
 * messages.php. Dynamic, per-message colours (set in the ACF fields) are passed
 * in through CSS custom properties instead of inline style rules:
 *   --msg-border / --msg-bg / --msg-color  -> message container
 *   --msg-logo-bg                          -> logo badge background
 */

.custom-msg p {
	margin-bottom: 0;
}

.custom-msg.has-image img {
	display: block;
	width: 100%;
	max-width: 450px;
	height: auto;
	aspect-ratio: 450 / 285;
	margin-right: auto;
	margin-left: auto;
}

@media (max-width: 768px) {
	.custom-msg.has-image {
		/* Reserve the mobile promo banner height before the image file loads.
		   custom.css gives .custom-msg 20px side padding and the image 15px top
		   margin on mobile, so include those values in the reserved box. */
		min-height: min(300px, calc(((100vw - 40px) * 0.633333) + 15px));
	}
}

/* Framed (non-image) message: coloured box driven by the ACF colour fields. */
.custom-msg.has-frame {
	border: 1px solid var(--msg-border, transparent);
	background: var(--msg-bg, transparent);
	color: var(--msg-color, inherit);
	padding: 10px;
	border-radius: 3px;
}

.custom-msg .msg-logo {
	background: var(--msg-logo-bg, transparent);
	padding: 3px 10px;
	display: inline-block;
	border-radius: 5px;
	margin-right: 10px;
}

.custom-msg .msg-logo img {
	height: 25px;
}

/* Layout fix applied (mobile) when no message bar is rendered. */
.no-custom-msg #wrapper-navbar {
	position: initial;
}

.no-custom-msg:not(.home) .wrapper {
	margin-top: 0;
}
