/* =========================================================================
   Matrix — Service Bulletins & Safety Notices
   Built from Figma: 6582_MTRX_PublicServiceNoticeandBulletinPage (14202:1382)

   Hand-written CSS rather than Tailwind utilities on purpose. The theme
   compiles Tailwind through Vite, so any new utility class would only exist
   after `npm run build` — this has to work as a straight cPanel file upload.

   Everything is namespaced under .mtrx-notices so it cannot leak into the
   rest of the Aedificus Primaris theme.
   ====================================================================== */

.mtrx-notices {
	/* --- Brand ------------------------------------------------------- */
	--mtrx-blue: #0062a8;
	--mtrx-blue-dark: #004b80;
	--mtrx-green: #388532;
	--mtrx-green-dark: #2b6727;

	/* --- Neutrals ---------------------------------------------------- */
	--mtrx-ink: #444444;
	--mtrx-ink-soft: #6b6b6b;
	--mtrx-line: #d8dde2;
	--mtrx-surface: #ffffff;

	/* --- Type -------------------------------------------------------- */
	--mtrx-font-body: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--mtrx-font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	/* --- Layout ------------------------------------------------------
	   Matches CONTENT_WIDTH in functions.php, so the card grid lines up
	   with the theme's LayoutContainer and with the PageHero above it.
	   The Figma frame was drawn at 1440 with a 35px inset; the gutter is
	   kept and the container widened to 1600 to match the live theme.   */
	--mtrx-container-max: 1600px;
	--mtrx-gutter: 35px;

	--mtrx-gap: 24px;
	--mtrx-radius-card: 12px;
	--mtrx-radius-control: 6px;

	background: var(--mtrx-surface);
	color: var(--mtrx-ink);
	font-family: var(--mtrx-font-body);
}

.mtrx-notices *,
.mtrx-notices *::before,
.mtrx-notices *::after {
	box-sizing: border-box;
}

.mtrx-notices__inner {
	max-width: var(--mtrx-container-max);
	margin-inline: auto;
	padding-inline: var(--mtrx-gutter);
}

.mtrx-notices__body {
	padding-block: 80px 100px;
}

.mtrx-icon {
	display: block;
	flex: none;
}

/* -------------------------------------------------------------------------
   Theme interop
   The cards carry post_class(), and #primary.site-main carries the theme's
   own layout rules. These few resets stop inherited article/list styling from
   shifting the grid. Narrow on purpose — nothing here reaches outside
   .mtrx-notices.
   ---------------------------------------------------------------------- */

.mtrx-notices .mtrx-card,
.mtrx-notices .mtrx-single {
	margin: 0;
	max-width: none;
	float: none;
}

.mtrx-notices .mtrx-chips {
	list-style: none;
}

.mtrx-notices .mtrx-chips li::before,
.mtrx-notices .mtrx-chips li::marker {
	content: none;
}

/* Visible only to screen readers. */
.mtrx-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* =========================================================================
   Hero
   Only used by the fallback hero in archive-mtrx_notice.php. If you swap in
   the theme's own hero template part, this whole block goes unused.
   ====================================================================== */

.mtrx-hero {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 560px;
	padding-block: 72px;
	background: #2e2a26 center / cover no-repeat;
	color: #fff;
	isolation: isolate;
}

.mtrx-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(90deg, rgba(20, 22, 25, 0.86) 0%, rgba(20, 22, 25, 0.55) 55%, rgba(20, 22, 25, 0.2) 100%);
}

.mtrx-hero__content {
	max-width: 690px;
}

.mtrx-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 18px;
	font-size: 16px;
	line-height: 1.4;
	color: #fff;
}

.mtrx-breadcrumb a {
	color: inherit;
	text-decoration: none;
}

.mtrx-breadcrumb a:hover,
.mtrx-breadcrumb a:focus-visible {
	text-decoration: underline;
}

.mtrx-breadcrumb__sep {
	opacity: 0.6;
}

.mtrx-breadcrumb__current {
	opacity: 0.85;
}

.mtrx-hero__title {
	margin: 0 0 24px;
	font-size: clamp(2.5rem, 4.4vw, 4rem);
	font-weight: 700;
	line-height: 1.08;
	letter-spacing: -0.01em;
	color: #fff;
}

.mtrx-hero__intro p {
	margin: 0 0 18px;
	max-width: 620px;
	font-size: 17px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.92);
}

.mtrx-hero__intro p:last-child {
	margin-bottom: 0;
}

/* The single-notice breadcrumb sits on white, so it needs dark text. */
.mtrx-breadcrumb--dark {
	margin-bottom: 24px;
	color: var(--mtrx-ink);
}

.mtrx-breadcrumb--dark a {
	color: var(--mtrx-blue);
}

/* When the theme's PageHero renders the banner, the grid sits directly under
   it and needs a little less headroom than the fallback hero leaves. */
.page-hero + .mtrx-notices__body {
	padding-top: 64px;
}

/* =========================================================================
   Filter bar
   Chips are the desktop control; the dropdown is the same taxonomy
   collapsed for narrow screens. Both write to the same filter state.
   ====================================================================== */

.mtrx-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px 32px;
	margin-bottom: 56px;
}

.mtrx-filters__controls {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 14px;
	width: 100%;
	max-width: 353px;
	margin-left: auto;
	order: 2;
}

/* --- Search ---------------------------------------------------------- */

.mtrx-search {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mtrx-search__field {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	padding: 0 14px;
	font-family: var(--mtrx-font-body);
	font-size: 14px;
	color: var(--mtrx-ink);
	background: var(--mtrx-surface);
	border: 1px solid var(--mtrx-line);
	border-radius: var(--mtrx-radius-control);
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mtrx-search__field::placeholder {
	color: var(--mtrx-ink-soft);
}

.mtrx-search__field:focus {
	outline: none;
	border-color: var(--mtrx-blue);
	box-shadow: 0 0 0 3px rgba(0, 98, 168, 0.15);
}

.mtrx-search__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	padding: 0;
	color: var(--mtrx-ink);
	background: none;
	border: 0;
	border-radius: var(--mtrx-radius-control);
	cursor: pointer;
	transition: color 0.15s ease;
}

.mtrx-search__submit:hover,
.mtrx-search__submit:focus-visible {
	color: var(--mtrx-blue);
}

/* --- Dropdown (mobile) ----------------------------------------------- */

.mtrx-select {
	display: none;
	width: 100%;
	height: 42px;
	padding: 0 44px 0 16px;
	font-family: var(--mtrx-font-ui);
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--mtrx-ink);
	background-color: var(--mtrx-surface);
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23444444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	border: 1px solid var(--mtrx-line);
	border-radius: var(--mtrx-radius-control);
	appearance: none;
	cursor: pointer;
}

.mtrx-select:focus {
	outline: none;
	border-color: var(--mtrx-blue);
	box-shadow: 0 0 0 3px rgba(0, 98, 168, 0.15);
}

/* --- Chips (desktop) -------------------------------------------------- */

.mtrx-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
	order: 1;
}

.mtrx-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	/* Padding-based sizing rather than a fixed height + line-height:1.
	   This keeps the label optically centred even if something downstream
	   overrides `display` and takes the flex centring away with it. */
	min-height: 32px;
	padding: 8px 20px;

	font-family: var(--mtrx-font-body);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.15;
	color: var(--mtrx-ink);
	text-decoration: none;
	white-space: nowrap;
	background: var(--mtrx-surface);
	border: 1px solid var(--mtrx-line);
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* The theme ships `li:not(.wp-social-link) > a { display: inline-block }`.
   Chips are <li><a>, and that selector (0,1,2) outranks a lone class (0,1,0),
   so it was quietly winning and dropping the pill out of flex layout — which
   is what pushed the label to the top of the pill. One extra ancestor class
   takes the specificity back. */
.mtrx-notices .mtrx-chip {
	display: inline-flex;
}

.mtrx-chip:hover,
.mtrx-chip:focus-visible {
	color: var(--mtrx-blue);
	border-color: var(--mtrx-blue);
}

.mtrx-chip.is-active,
.mtrx-chip[aria-pressed="true"] {
	color: #fff;
	background: var(--mtrx-blue);
	border-color: var(--mtrx-blue);
}

/* =========================================================================
   Card grid
   ====================================================================== */

.mtrx-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--mtrx-gap);
	align-items: start;
}

.mtrx-card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px;
	background: var(--mtrx-surface);
	border: 1px solid var(--mtrx-blue);
	border-radius: var(--mtrx-radius-card);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.mtrx-card:hover {
	box-shadow: 0 6px 20px rgba(0, 98, 168, 0.12);
	transform: translateY(-2px);
}

.mtrx-card[hidden] {
	display: none;
}

/* --- Meta row --------------------------------------------------------- */

.mtrx-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.mtrx-card__filetype {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--mtrx-font-ui);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--mtrx-ink);
}

.mtrx-card__tags {
	display: inline-flex;
	align-items: flex-start;
	gap: 6px;
}

.mtrx-tag {
	display: inline-flex;
	align-items: center;
	padding: 4px 8px;
	font-family: var(--mtrx-font-body);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	color: #fff;
	border-radius: var(--mtrx-radius-control);
}

.mtrx-tag--size {
	background: var(--mtrx-blue);
}

.mtrx-tag--date {
	background: var(--mtrx-green);
}

/* --- Content ---------------------------------------------------------- */

/* Deliberately NOT a flex container. CSS blockifies flex items, which turns
   the description's `display: -webkit-box` into `flow-root` and silently
   disables -webkit-line-clamp — the card would then grow to fit a long
   description instead of trimming to three lines. Block layout with a margin
   gives the same result and keeps the clamp working. */
.mtrx-card__content {
	flex: 1 1 auto;
}

.mtrx-card__title {
	margin: 0 0 8px;
	font-family: var(--mtrx-font-body);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--mtrx-blue);
	overflow-wrap: anywhere;
}

.mtrx-card__title a {
	color: inherit;
	text-decoration: none;
}

.mtrx-card__title a:hover,
.mtrx-card__title a:focus-visible {
	text-decoration: underline;
}

.mtrx-card__desc {
	margin: 0;
	font-family: var(--mtrx-font-body);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--mtrx-ink);

	/* Three lines, then an ellipsis — matches the Figma card height. */
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --- Actions ---------------------------------------------------------- */

.mtrx-card__actions {
	display: flex;
	gap: 8px;
	margin-top: auto;
}

.mtrx-btn {
	display: inline-flex;
	flex: 1 1 0;
	min-width: 0;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 44px;
	padding: 10px 16px;
	font-family: var(--mtrx-font-ui);
	line-height: 1;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	border-radius: var(--mtrx-radius-control);
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.mtrx-btn--view {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--mtrx-blue);
	background: transparent;
	border: 1px solid var(--mtrx-blue);
}

.mtrx-btn--view:hover,
.mtrx-btn--view:focus-visible {
	color: #fff;
	background: var(--mtrx-blue);
}

.mtrx-btn--download {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	background: var(--mtrx-green);
	border: 1px solid var(--mtrx-green);
}

.mtrx-btn--download:hover,
.mtrx-btn--download:focus-visible {
	color: #fff;
	background: var(--mtrx-green-dark);
	border-color: var(--mtrx-green-dark);
}

.mtrx-btn:focus-visible {
	outline: 2px solid var(--mtrx-blue);
	outline-offset: 2px;
}

.mtrx-btn.is-disabled {
	pointer-events: none;
	opacity: 0.45;
}

/* =========================================================================
   Empty state
   ====================================================================== */

.mtrx-empty {
	padding: 64px 24px;
	text-align: center;
	border: 1px dashed var(--mtrx-line);
	border-radius: var(--mtrx-radius-card);
}

.mtrx-empty__title {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--mtrx-blue);
}

.mtrx-empty p {
	margin: 0;
	font-size: 15px;
	color: var(--mtrx-ink-soft);
}

.mtrx-empty[hidden] {
	display: none;
}

/* =========================================================================
   Single notice
   ====================================================================== */

.mtrx-single {
	max-width: 820px;
}

.mtrx-single__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 20px;
}

.mtrx-single__title {
	margin: 0 0 20px;
	font-size: clamp(1.75rem, 3vw, 2.5rem);
	font-weight: 700;
	line-height: 1.15;
	color: var(--mtrx-blue);
}

.mtrx-single__lead {
	margin: 0 0 28px;
	font-size: 17px;
	line-height: 1.55;
	color: var(--mtrx-ink);
}

.mtrx-single__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 40px;
}

.mtrx-single__actions .mtrx-btn {
	flex: 0 0 auto;
	min-width: 210px;
}

.mtrx-single__content {
	font-size: 16px;
	line-height: 1.65;
}

.mtrx-single__content h2,
.mtrx-single__content h3 {
	color: var(--mtrx-blue);
}

.mtrx-single__back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 40px;
	font-family: var(--mtrx-font-ui);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--mtrx-blue);
	text-decoration: none;
}

.mtrx-single__back:hover,
.mtrx-single__back:focus-visible {
	text-decoration: underline;
}

/* =========================================================================
   Responsive
   ====================================================================== */

@media (max-width: 1100px) {
	.mtrx-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.mtrx-notices {
		--mtrx-gutter: 24px;
	}

	.mtrx-notices__body {
		padding-block: 48px 64px;
	}

	.mtrx-hero {
		min-height: 0;
		padding-block: 56px;
	}

	.mtrx-hero::after {
		background: rgba(20, 22, 25, 0.72);
	}

	.mtrx-filters {
		flex-direction: column;
		align-items: stretch;
		margin-bottom: 36px;
	}

	.mtrx-filters__controls {
		max-width: none;
		margin-left: 0;
		order: 1;
	}

	/* Chips give way to the dropdown on narrow screens. */
	.mtrx-chips {
		display: none;
	}

	.mtrx-select {
		display: block;
	}

	.mtrx-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.mtrx-single__actions .mtrx-btn {
		flex: 1 1 100%;
		min-width: 0;
	}
}

/* When JavaScript is off, the dropdown is a real form control and needs to
   stay visible at every width so the page is still filterable. */
.no-js .mtrx-select,
.mtrx-notices--nojs .mtrx-select {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.mtrx-notices *,
	.mtrx-notices *::before,
	.mtrx-notices *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}

	.mtrx-card:hover {
		transform: none;
	}
}

@media print {
	.mtrx-filters,
	.mtrx-card__actions {
		display: none;
	}

	.mtrx-card {
		break-inside: avoid;
	}
}
