/**
 * WRC Partner Logos.
 *
 * Replaces the plain Elementor image grid on the RDI Projects page with a
 * card showcase: equal-height cards, centred logos, filtering, search and a
 * staggered reveal.
 *
 * Colours are the WRC brand set, used sparingly for accents and hover states.
 *
 * Note on !important: the parent theme styles headings, buttons and inputs
 * globally with higher-specificity selectors (and paints all button text
 * white). Everything here is scoped to .wrc-partners so nothing else moves.
 */

.wrc-partners {
	--wrc-blue:       #094E9C;
	--wrc-lightblue:  #00AEEF;
	--wrc-green:      #A9CC4F;
	--wrc-ink:        #1D2B3A;
	--wrc-muted:      #666666;
	--wrc-font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

	position: relative;
	margin: 0;
	padding: 0;
	font-family: var( --wrc-font );
}

/* Above the section that follows, so a label overhanging the stage is still
   drawn on top of it rather than behind its background. */
.wrc-partners {
	position: relative;
	z-index: 3;
}

/* A soft water-inspired wash rather than flat white. Two very light radial
   tints plus a vertical gradient — cheap to paint, no image request. */
/* The stage runs full-bleed so its background band still spans the window, but
   its horizontal padding tracks the site-wide alignment line, so the logos line
   up with the section content above and with the contact cards below.
   See wrc-container.css for --wrc-content-inset, and wrc-contact.css. */
.wrc-partners__stage {
	position: relative;
	/*
	 * The bottom padding is 34px + room for the hover label (2026-09-09). The
	 * label sits 8px under its card and runs to two lines, and with only 34px
	 * it overhung the stage by ~19px — where the *next* Elementor section
	 * painted over it, so hovering a logo in a single-row group showed nothing.
	 */
	padding: 30px var( --wrc-content-inset, 5% ) 92px;
	border-radius: 16px;
	background:
		radial-gradient( 620px 300px at 12% 0%,   rgba( 0, 174, 239, 0.10 ), transparent 60% ),
		radial-gradient( 520px 280px at 88% 100%, rgba( 169, 204, 79, 0.10 ), transparent 60% ),
		linear-gradient( 180deg, #F7FCFF 0%, #EDFAFF 100% );

	/*
	 * NOT overflow: hidden (2026-09-09). It was here to keep the 3px rule below
	 * inside the 16px corner radius, but it also clipped the name tooltip: the
	 * tooltip sits above its card, and for the top row of logos that is outside
	 * the stage — 38 of its 79px were cut off, which is the "name is not
	 * visible on hover" report. The rule now rounds its own top corners
	 * instead, and the tooltip can escape.
	 *
	 * The gradients above do not need it: a background is clipped to the
	 * padding box by border-radius whatever overflow says.
	 */
	overflow: visible;
}

/* Alternating band so consecutive groups read as separate sections. */
.wrc-partners--alt .wrc-partners__stage {
	background:
		radial-gradient( 560px 280px at 85% 0%, rgba( 9, 78, 156, 0.08 ), transparent 62% ),
		linear-gradient( 180deg, #FFFFFF 0%, #F5FAFD 100% );
}

/* Thin brand rule along the top of each stage. */
.wrc-partners__stage::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	/* Its own corners, now that the stage no longer clips it. */
	border-radius: 16px 16px 0 0;
	background: linear-gradient( 90deg, var( --wrc-blue ), var( --wrc-lightblue ) 55%, var( --wrc-green ) );
}

/* ==========================================================================
 * Controls — filters + search
 * ========================================================================== */

.wrc-partners__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin: 0 0 22px;
}

.wrc-partners__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wrc-partners .wrc-partners__filter {
	display: inline-flex !important;
	align-items: center;
	gap: 7px;
	width: auto !important;
	min-width: 0 !important;
	padding: 9px 16px !important;
	border: 1px solid #D5E3EF !important;
	border-radius: 999px !important;
	background: #fff !important;
	background-image: none !important;
	color: var( --wrc-ink ) !important;
	font-family: var( --wrc-font ) !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-indent: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: background-color 250ms ease, border-color 250ms ease, color 250ms ease;
}

.wrc-partners .wrc-partners__filter:hover,
.wrc-partners .wrc-partners__filter:focus-visible {
	border-color: var( --wrc-lightblue ) !important;
	color: var( --wrc-blue ) !important;
}

.wrc-partners .wrc-partners__filter[aria-pressed="true"] {
	background: var( --wrc-blue ) !important;
	border-color: var( --wrc-blue ) !important;
	color: #fff !important;
}

.wrc-partners__filter-count {
	font-size: 11px;
	font-weight: 700;
	opacity: 0.7;
}

/* ------------------------------------------------------------------ search */

.wrc-partners__search {
	position: relative;
	flex: 0 1 260px;
}

.wrc-partners .wrc-partners__search-input {
	width: 100% !important;
	padding: 10px 14px 10px 36px !important;
	border: 1px solid #D5E3EF !important;
	border-radius: 999px !important;
	background: #fff !important;
	font-family: var( --wrc-font ) !important;
	/* 16px avoids the iOS focus zoom. */
	font-size: 16px !important;
	color: var( --wrc-ink ) !important;
	box-shadow: none !important;
}

.wrc-partners .wrc-partners__search-input:focus {
	outline: none;
	border-color: var( --wrc-lightblue ) !important;
	box-shadow: 0 0 0 3px rgba( 0, 174, 239, 0.18 ) !important;
}

.wrc-partners__search-icon {
	position: absolute;
	top: 50%;
	left: 13px;
	width: 15px;
	height: 15px;
	margin-top: -7px;
	color: var( --wrc-lightblue );
	pointer-events: none;
}

/* ==========================================================================
 * Grid
 * ========================================================================== */

.wrc-partners__grid {
	display: grid;
	/* 6 per row on desktop. */
	grid-template-columns: repeat( 6, minmax( 0, 1fr ) );
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * A stacking base for the item, so the hover rule below can lift a card and its
 * label over the cards that follow it. Without it the label was painted *behind*
 * the next row: every item carries a transform for the reveal, which makes it a
 * stacking context, and later siblings paint over earlier ones whatever z-index
 * the label itself has.
 */
.wrc-partners__item {
	display: block;
	position: relative;
	margin: 0;
}

.wrc-partners__item:hover,
.wrc-partners__item:focus-within {
	z-index: 30;
}

/* ------------------------------------------------------------------- card */

.wrc-partners__card {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	/* Equal height whatever the logo's own dimensions. */
	height: 118px;
	padding: 16px;
	background: #fff;
	border: 1px solid #E7EEF4;
	border-radius: 14px;
	box-shadow: 0 2px 10px rgba( 9, 78, 156, 0.07 );
	text-decoration: none;
	transition:
		transform 280ms ease,
		box-shadow 280ms ease,
		border-color 280ms ease;
}

.wrc-partners__card:hover,
.wrc-partners__card:focus-visible {
	transform: translateY( -6px );
	border-color: var( --wrc-lightblue );
	box-shadow: 0 16px 34px rgba( 9, 78, 156, 0.18 );
	outline: none;
}

.wrc-partners__card:focus-visible {
	box-shadow:
		0 16px 34px rgba( 9, 78, 156, 0.18 ),
		0 0 0 3px rgba( 0, 174, 239, 0.35 );
}

/* ------------------------------------------------------------------- logo */

.wrc-partners__logo {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	/* contain: never stretch or distort a logo. */
	object-fit: contain;
	transition: transform 280ms ease;
}

.wrc-partners__card:hover .wrc-partners__logo,
.wrc-partners__card:focus-visible .wrc-partners__logo {
	transform: scale( 1.05 );
}

/* --------------------------------------------------------------- tooltip */

.wrc-partners__name {
	position: absolute;
	left: 50%;
	/*
	 * Below the card, not above (2026-09-09). Above, the top row's tooltip had
	 * nowhere to go: it was clipped by the stage, and once that was fixed it
	 * floated up over the section heading instead. Below, every row behaves the
	 * same and the label stays inside its own section — it overlays the row
	 * beneath, which is what a tooltip is for.
	 */
	top: calc( 100% + 8px );
	z-index: 5;
	/*
	 * width: max-content because an absolutely positioned box with only `left`
	 * shrink-wraps to the space between that edge and its container's — 107px
	 * inside a 215px card. `max-width: 220px` never got a chance to apply, so
	 * a name like "Water JPI (Water Joint Programming Initiative)" became a
	 * four-line tower. Two lines now, and less of it to clip.
	 */
	width: max-content;
	max-width: min( 240px, 72vw );
	padding: 7px 11px;
	border-radius: 8px;
	background: var( --wrc-blue );
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.35;
	text-align: center;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	transform: translate( -50%, -4px );
	transition: opacity 250ms ease, transform 250ms ease, visibility 250ms;
	pointer-events: none;
}

.wrc-partners__name::after {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 50%;
	margin-left: -5px;
	border: 5px solid transparent;
	border-bottom-color: var( --wrc-blue );
}

.wrc-partners__card:hover .wrc-partners__name,
.wrc-partners__card:focus-visible .wrc-partners__name {
	opacity: 1;
	visibility: visible;
	transform: translate( -50%, 0 );
}

/* ----------------------------------------------------------------- badge */

.wrc-partners__badge {
	position: absolute;
	top: 8px;
	right: 9px;
	padding: 3px 8px;
	border-radius: 999px;
	background: rgba( 0, 174, 239, 0.12 );
	color: var( --wrc-blue );
	font-size: 9.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0;
	transition: opacity 250ms ease;
}

.wrc-partners__card:hover .wrc-partners__badge,
.wrc-partners__card:focus-visible .wrc-partners__badge {
	opacity: 1;
}

/* ==========================================================================
 * Reveal + filtering animation
 * ========================================================================== */

.wrc-partners__item {
	opacity: 0;
	transform: translateY( 14px );
	transition: opacity 420ms ease, transform 420ms ease;
}

.wrc-partners__item.is-visible {
	opacity: 1;
	transform: none;
}

/* Hidden by a filter or the search box. */
.wrc-partners__item.is-filtered {
	display: none;
}

.wrc-partners__empty {
	grid-column: 1 / -1;
	padding: 26px 4px;
	color: var( --wrc-muted );
	font-size: 14px;
	text-align: center;
}

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

@media ( max-width: 1199px ) {
	.wrc-partners__grid {
		grid-template-columns: repeat( 5, minmax( 0, 1fr ) );
	}
}

@media ( max-width: 1023px ) {
	.wrc-partners__grid {
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
		gap: 15px;
	}

	.wrc-partners__card {
		height: 104px;
		padding: 13px;
	}
}

@media ( max-width: 767px ) {
	/* --wrc-content-inset is already the 16px mobile gutter here; only the
	   vertical padding and the corner radius change on phones. */
	.wrc-partners__stage {
		padding: 22px var( --wrc-content-inset, 16px ) 74px;
		border-radius: 12px;
	}

	.wrc-partners__grid {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
		gap: 12px;
	}

	.wrc-partners__card {
		height: 92px;
		padding: 11px;
		border-radius: 12px;
	}

	.wrc-partners__controls {
		gap: 12px;
	}

	.wrc-partners__search {
		flex: 1 1 100%;
	}
}

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

/* ==========================================================================
 * Reduced motion — honour the user's system preference
 * ========================================================================== */

@media ( prefers-reduced-motion: reduce ) {
	.wrc-partners__item,
	.wrc-partners__card,
	.wrc-partners__logo,
	.wrc-partners__name,
	.wrc-partners__badge,
	.wrc-partners .wrc-partners__filter {
		transition: none !important;
	}

	.wrc-partners__item {
		opacity: 1;
		transform: none;
	}

	.wrc-partners__card:hover,
	.wrc-partners__card:focus-visible {
		transform: none;
	}

	.wrc-partners__card:hover .wrc-partners__logo,
	.wrc-partners__card:focus-visible .wrc-partners__logo {
		transform: none;
	}
}
