/* stylelint-disable selector-class-pattern -- BEM classes match the approved alert markup contract. */

.butler-alert-banner {
	position: relative;
	width: 100%;
	border-bottom: 1px solid var(--wp--preset--color--custom-white);
}

.butler-alert-banner__inner {
	display: flex;
	align-items: center;
	justify-content: center;
}

.butler-alert-banner__message {
	flex: 1;
	margin: 0;
	padding: 1rem 1.5rem;
	text-align: center;
	font-size: var(--wp--preset--font-size--medium);
}

.butler-alert-banner__message a {
	color: inherit;
	text-decoration: underline;
}

.butler-alert-banner__dismiss {
	position: relative;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 2.75rem;
	height: 2.75rem;
	margin-right: 1rem;
	padding: 0;
	color: inherit;
	font: inherit;
	background: transparent;
	border: none;
	border-radius: 50%;
	cursor: pointer;
}

/* Match accordion open-state close icon: X from rotated plus inside a circle. */
.butler-alert-banner__dismiss::before,
.butler-alert-banner__dismiss::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.butler-alert-banner__dismiss::before {
	width: 15px;
	height: 15px;
	transform: translate(-50%, -50%) rotate(-45deg);
	background:
		linear-gradient(currentcolor, currentcolor) center / 1px 100% no-repeat,
		linear-gradient(currentcolor, currentcolor) center / 100% 1px no-repeat;
}

.butler-alert-banner__dismiss::after {
	width: 30px;
	height: 30px;
	border: 1px solid currentcolor;
	border-radius: 50%;
}

.butler-alert-modal {
	position: fixed;
	z-index: 100000;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	color: #fff;
	background: rgb(0 0 0 / 85%);
}

.butler-alert-modal[hidden] {
	display: none;
}

.butler-alert-modal__panel {
	width: min(100%, 42rem);
	padding: 2rem;
	color: #fff;
	background: #8b0015;
	border: 4px solid #fff;
	box-shadow: 0 1rem 3rem rgb(0 0 0 / 50%);
}

.butler-alert-modal__panel h2 {
	margin-top: 0;
	color: inherit;
}

.butler-alert-modal__message {
	font-size: 1.125rem;
}

.butler-alert-modal__message a {
	color: #fff;
	text-decoration: underline;
}

.butler-alert-modal__acknowledge {
	margin-top: 1.5rem;
	padding: 0.75rem 1rem;
	color: #111;
	font: inherit;
	font-weight: 700;
	background: #fff;
	border: 2px solid #fff;
	cursor: pointer;
}

.butler-alert-banner__message a:focus-visible,
.butler-alert-banner__dismiss:focus-visible,
.butler-alert-modal__acknowledge:focus-visible {
	outline: 3px solid currentcolor;
	outline-offset: 3px;
}

@media (max-width: 37.5rem) {

	.butler-alert-banner__inner {
		align-items: stretch;
		flex-direction: column;
	}

	.butler-alert-banner__dismiss {
		align-self: center;
		margin: 0 1rem 1rem;
	}
}

/*
 * Alert is prepended as a sibling before the header template part inside
 * .wp-site-blocks. Core's :first-child margin reset then no longer applies to
 * the header — keep header flush when the banner is present.
 */
 .wp-site-blocks > .butler-alert-banner + * {
	margin-block-start: 0;
}
