/* Site alert banner (inc/alert-banner.php). Loaded only on pages showing one.
 *
 * Red is darker than the theme's `error` token (#E31937): the bar carries
 * body-size white text, and #B5212B gives 6.5:1 against white (AA at any size)
 * where `error` only clears 4.7:1. Blue reuses the `structure` token (7.2:1). */

.afc-alert-banner {
	--afc-alert-bg: #b5212b;
	--afc-alert-fg: var(--wp--preset--color--paper, #fff);

	position: relative;
	margin: 0;
	background: var(--afc-alert-bg);
	color: var(--afc-alert-fg);
	font-family: var(--wp--preset--font-family--inter);
	font-size: 1.125rem;
	line-height: 1.4;
	/* Match the site's root side padding so the bar lines up with the header. */
	padding: 1rem var(--wp--style--root--padding-right, clamp(1.25rem, 5vw, 5rem)) 1rem var(--wp--style--root--padding-left, clamp(1.25rem, 5vw, 5rem));
}

.afc-alert-banner--blue {
	--afc-alert-bg: var(--wp--preset--color--structure, #315889);
}

.afc-alert-banner__inner {
	display: flex;
	align-items: center;
	gap: 1rem 2.5rem;
	max-width: var(--wp--style--global--wide-size, 1312px);
	margin-inline: auto;
}

.afc-alert-banner__body {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	flex: 1 1 auto;
	margin: 0;
}

.afc-alert-banner__label {
	flex-shrink: 0;
	padding: 0.2em 0.6em;
	border-radius: 4px;
	background: var(--afc-alert-fg);
	color: var(--afc-alert-bg);
	font-weight: 700;
	line-height: 1.2;
}

/* Linked label: a compact version of the site button (theme.json
 * styles.elements.button — IBM Plex Sans 600, uppercase, 0.04em tracking,
 * 10px radius) in the dark-hero inversion: white pill with the bar's color
 * as text, flipping to an outlined white pill on hover. */
.afc-alert-banner__label--link {
	display: inline-flex;
	align-items: center;
	padding: 0.45em 1em;
	border: 2px solid var(--afc-alert-fg);
	border-radius: 10px;
	font-family: var(--wp--preset--font-family--ibm-plex-sans);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.afc-alert-banner__label--link:hover {
	background: transparent;
	color: var(--afc-alert-fg);
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	.afc-alert-banner__label--link {
		transition: none;
	}
}

/* Link: the style guide's secondary CTA — core/button "Text Link (arrow)"
 * (inc/block-styles.php, AFC-82) — in white, as on the dark hero: uppercase
 * IBM Plex Sans 600 with the brand arrow; underline + arrow slide on hover. */
.afc-alert-banner__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	color: inherit;
	font-family: var(--wp--preset--font-family--ibm-plex-sans);
	font-size: var(--wp--preset--font-size--button);
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
}

.afc-alert-banner__link svg {
	flex: none;
	width: 1em;
	height: 0.857em;
	transform: translateY(-0.06em);
	transition: transform 0.15s ease;
}

.afc-alert-banner__link:hover,
.afc-alert-banner__link:focus-visible {
	color: inherit;
	text-decoration: none;
}

.afc-alert-banner__link:hover .afc-alert-banner__link-text,
.afc-alert-banner__link:focus-visible .afc-alert-banner__link-text {
	text-decoration: underline;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 2px;
}

.afc-alert-banner__link:hover svg,
.afc-alert-banner__link:focus-visible svg {
	transform: translateY(-0.06em) translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
	.afc-alert-banner__link svg {
		transition: none;
	}
}

.afc-alert-banner__dismiss {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	margin: -0.5rem -0.75rem -0.5rem -1.25rem;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.afc-alert-banner__dismiss:hover {
	background: rgba(255, 255, 255, 0.15);
}

.afc-alert-banner__link:focus-visible,
.afc-alert-banner__dismiss:focus-visible {
	outline: 2px solid var(--afc-alert-fg);
	outline-offset: 4px;
}

/* Tablet/mobile: label + message on top, link below; close pinned top-right. */
@media (max-width: 781px) {
	.afc-alert-banner {
		font-size: 1rem;
		padding-top: 0.875rem;
		padding-bottom: 0.875rem;
	}

	.afc-alert-banner__inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.625rem;
	}

	.afc-alert-banner:has(.afc-alert-banner__dismiss) .afc-alert-banner__inner {
		padding-right: 2.25rem;
	}

	.afc-alert-banner__body {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}

	.afc-alert-banner__link {
		white-space: normal;
	}

	.afc-alert-banner__dismiss {
		position: absolute;
		top: 0.375rem;
		right: calc(var(--wp--style--root--padding-right, 1.25rem) - 0.75rem);
		margin: 0;
	}
}
