/*
 * Site Alert — per-site bar under the department menu.
 *
 * Self-contained on purpose: the network alert's stylesheet only loads while
 * the network alert is on, and two of the sites run a different theme, so
 * nothing here may assume either is present. Every class is prefixed
 * wnmu-site-alert-, so neither bar's rules can reach the other.
 *
 * CONTRAST (measured)            white text   gold level label
 *   notice   #232c75 navy          12.4:1        7.3:1
 *   warning  #2d0f52 deep purple   16.1:1        9.5:1
 *   urgent   #7a1f14 dark red      10.3:1        6.1:1
 *
 * Unlike the network alert, the colours are fixed per level rather than picked
 * freely by whoever raises it, so an unreadable pair cannot be chosen. The level
 * is also printed as a word and changes the left-edge weight, so nothing depends
 * on telling the colours apart.
 */

.wnmu-site-alert {
	--wsa-bg: #2d0f52;
	--wsa-edge: 10px;
	position: relative;           /* NOT sticky: the menu above already is, and two */
	z-index: 40;                  /* sticky bars would permanently cover the page. */
	background: var(--wsa-bg);
	color: #fff;
	border-left: var(--wsa-edge) solid #FCBC31;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
	font-size: 15px;
	line-height: 1.45;
}
.wnmu-site-alert[hidden] { display: none; }

.wnmu-site-alert.is-notice  { --wsa-bg: #232c75; --wsa-edge: 6px; }
.wnmu-site-alert.is-warning { --wsa-bg: #2d0f52; --wsa-edge: 10px; }
.wnmu-site-alert.is-urgent  { --wsa-bg: #7a1f14; --wsa-edge: 16px; }

.wnmu-site-alert-inner {
	display: flex;
	align-items: center;
	gap: 10px 16px;
	flex-wrap: wrap;
	max-width: 1520px;
	margin: 0 auto;
	padding: 10px 20px;
}

/*
   Colours restated on the text itself, not just inherited: some themes set
   `p { color: … }` as an element rule, which beats inheritance and once turned
   the same kind of bar black-on-purple at 1.30:1.
*/
.wnmu-site-alert-text { margin: 0; flex: 1 1 auto; color: #fff; }
.wnmu-site-alert-title { color: #fff; font-weight: 600; }

.wnmu-site-alert-level {
	display: inline-block;
	margin-right: 8px;
	color: #FCBC31;
	font-size: .8em;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.wnmu-site-alert-more,
.wnmu-site-alert-dismiss,
.wnmu-site-alert-box-close {
	font: inherit;
	color: #fff;
	background: transparent;
	cursor: pointer;
}
.wnmu-site-alert-more {
	flex: none;
	padding: 4px 14px;
	border: 2px solid currentColor;
	border-radius: 4px;
	font-size: .875em;
	font-weight: 600;
	white-space: nowrap;
}
.wnmu-site-alert-more:hover { background: rgba(255, 255, 255, .15); }

/* 44×44: the WCAG 2.5.5 target size. */
.wnmu-site-alert-dismiss,
.wnmu-site-alert-box-close {
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 4px;
	font-size: 1.6rem;
	line-height: 1;
}
.wnmu-site-alert-dismiss:hover { border-color: currentColor; }

/* Explicit focus rings — the default can vanish on a dark ground. */
.wnmu-site-alert :focus-visible,
.wnmu-site-alert-overlay :focus-visible {
	outline: 3px solid #FCBC31;
	outline-offset: 2px;
}

/* Two sites run a theme without WordPress's screen-reader-text rule. */
.wnmu-site-alert .screen-reader-text,
.wnmu-site-alert-overlay .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* Fallback placement (theme has no wnmu_after_subheader hook): top of the page,
   under the network bar if that is showing — the script handles the order. */
.wnmu-site-alert.is-floating-top { border-left-width: var(--wsa-edge); }

/* ── Details dialog ─────────────────────────────────────────────────────── */

.wnmu-site-alert-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000001;             /* above the network modal's 1000000 */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, .55);
}
.wnmu-site-alert-overlay[hidden] { display: none; }

.wnmu-site-alert-box {
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 40px);
	overflow: auto;
	background: #fff;
	color: #111;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}
.wnmu-site-alert-box-header {
	--wsa-bg: #2d0f52;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 12px 12px 20px;
	background: var(--wsa-bg);
	color: #fff;
}
.wnmu-site-alert-box-header.is-notice { --wsa-bg: #232c75; }
.wnmu-site-alert-box-header.is-urgent { --wsa-bg: #7a1f14; }
.wnmu-site-alert-box-header h2 { margin: 0; font-size: 1.2rem; color: #fff; }
.wnmu-site-alert-box-body { padding: 20px; }
.wnmu-site-alert-box-body > :first-child { margin-top: 0; }
.wnmu-site-alert-box-body > :last-child  { margin-bottom: 0; }

@media (max-width: 800px) {
	.wnmu-site-alert-inner { padding: 10px 14px; }
}

/* Forced-colours mode discards our palette; keep the bar a distinct region. */
@media (forced-colors: active) {
	.wnmu-site-alert { border: 2px solid CanvasText; }
}

@media print {
	.wnmu-site-alert, .wnmu-site-alert-overlay { display: none !important; }
}
