/**
 * Press Releases listing.
 *
 * Scoped under `.wrc-press-releases`, a body class added only on the Press
 * Releases page (wrc_pr_body_class() in inc/press-releases.php), so nothing here
 * reaches the Elementor header, the footer, or any other page.
 *
 * Palette and Montserrat come from the same tokens wrc-etools.css,
 * wrc-article.css and wrc-waterwheel.css use. The dark title band, breadcrumbs
 * and headings are the parent theme's, untouched.
 */

/* ==========================================================================
 * 1. Tokens
 * ========================================================================== */

.wrc-press-releases .wrc-pr {
	--pr-blue:      #094E9C;
	--pr-lightblue: #00AEEF;
	--pr-green:     #A9CC4F;
	--pr-white:     #FFFFFF;

	--pr-ink:       #16202C;
	--pr-ink-soft:  #4A5764;
	--pr-grey-bg:   #F4F7FA;
	--pr-grey-line: #E1E8EF;

	--pr-radius:    12px;
	--pr-radius-sm: 8px;
	--pr-shadow:    0 1px 2px rgba( 9, 78, 156, .04 ), 0 8px 24px rgba( 9, 78, 156, .07 );

	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var( --pr-ink );
	display: block;
}

/* ==========================================================================
 * 2. List
 * ========================================================================== */

.wrc-press-releases .wrc-pr__title {
	margin: 0 0 24px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.25;
	color: var( --pr-blue );
}

.wrc-press-releases .wrc-pr__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	counter-reset: none;
}

.wrc-press-releases .wrc-pr__list > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wrc-press-releases .wrc-pr__list > li::before,
.wrc-press-releases .wrc-pr__list > li::marker {
	content: none;
}

/* ==========================================================================
 * 3. Panel — a release with a statement to read
 * ========================================================================== */

.wrc-press-releases .wrc-pr__panel,
.wrc-press-releases .wrc-pr__row {
	background: var( --pr-white );
	border: 1px solid var( --pr-grey-line );
	border-radius: var( --pr-radius );
	box-shadow: var( --pr-shadow );
	overflow: hidden;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.wrc-press-releases .wrc-pr__panel:hover,
.wrc-press-releases .wrc-pr__row:hover,
.wrc-press-releases .wrc-pr__panel[open] {
	border-color: var( --pr-lightblue );
}

.wrc-press-releases .wrc-pr__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 20px 24px;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

/* The default disclosure triangle — replaced by the chevron below. */
.wrc-press-releases .wrc-pr__summary::-webkit-details-marker { display: none; }
.wrc-press-releases .wrc-pr__summary::marker { content: none; }

.wrc-press-releases .wrc-pr__summary:focus-visible,
.wrc-press-releases .wrc-pr__row:focus-visible {
	outline: 3px solid var( --pr-lightblue );
	outline-offset: -3px;
}

/* ==========================================================================
 * 4. Row — a release that is only a document
 * ========================================================================== */

.wrc-press-releases .wrc-pr__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 20px 24px;
	text-decoration: none;
	color: inherit;
}

.wrc-press-releases .wrc-pr__row:hover .wrc-pr__name,
.wrc-press-releases .wrc-pr__summary:hover .wrc-pr__name {
	color: var( --pr-blue );
}

/* ==========================================================================
 * 5. Title and date
 * ========================================================================== */

.wrc-press-releases .wrc-pr__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.wrc-press-releases .wrc-pr__name {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.4;
	color: var( --pr-ink );
	transition: color .18s ease;
}

.wrc-press-releases .wrc-pr__date {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .02em;
	color: var( --pr-ink-soft );
}

/* ==========================================================================
 * 6. Chevron
 * ========================================================================== */

.wrc-press-releases .wrc-pr__chevron {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var( --pr-grey-bg );
	color: var( --pr-blue );
	transition: background .18s ease, color .18s ease, transform .18s ease;
}

.wrc-press-releases .wrc-pr__chevron svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wrc-press-releases .wrc-pr__panel[open] .wrc-pr__chevron {
	background: var( --pr-blue );
	color: var( --pr-white );
	transform: rotate( 180deg );
}

.wrc-press-releases .wrc-pr__row:hover .wrc-pr__chevron,
.wrc-press-releases .wrc-pr__summary:hover .wrc-pr__chevron {
	background: var( --pr-lightblue );
	color: var( --pr-white );
}

/* ==========================================================================
 * 7. Body
 * ========================================================================== */

.wrc-press-releases .wrc-pr__body {
	padding: 4px 24px 24px;
	border-top: 1px solid var( --pr-grey-line );
	margin-top: -1px;
}

.wrc-press-releases .wrc-pr__body > *:first-child {
	margin-top: 18px;
}

.wrc-press-releases .wrc-pr__body p,
.wrc-press-releases .wrc-pr__body li {
	font-size: 15px;
	line-height: 1.7;
	color: var( --pr-ink-soft );
}

.wrc-press-releases .wrc-pr__body strong {
	color: var( --pr-ink );
	font-weight: 600;
}

/* Links inside the statement — but never the download button, which sits in the
   same container and would otherwise be given blue text on its blue ground.
   `:not()` rather than a later override because both selectors would otherwise
   carry the same weight and the outcome would depend on source order. */
.wrc-press-releases .wrc-pr__body a:not( .wrc-pr__download ) {
	color: var( --pr-blue );
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ==========================================================================
 * 8. Download button
 * ========================================================================== */

.wrc-press-releases .wrc-pr__actions {
	margin: 20px 0 0;
}

/* Every state is pinned, and the label is white in all of them. The parent theme
   and the content styles both colour `a`, so leaving :link/:visited to inherit
   is what made this button read as a solid blue block with no text. */
.wrc-press-releases .wrc-pr__body a.wrc-pr__download,
.wrc-press-releases .wrc-pr__body a.wrc-pr__download:link,
.wrc-press-releases .wrc-pr__body a.wrc-pr__download:visited {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 11px 20px;
	border-radius: var( --pr-radius-sm );
	background: var( --pr-blue );
	color: #FFFFFF;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background .18s ease, transform .18s ease;
}

.wrc-press-releases .wrc-pr__body a.wrc-pr__download:hover,
.wrc-press-releases .wrc-pr__body a.wrc-pr__download:focus,
.wrc-press-releases .wrc-pr__body a.wrc-pr__download:active {
	background: var( --pr-lightblue );
	color: #FFFFFF;
	text-decoration: none;
}

.wrc-press-releases .wrc-pr__body a.wrc-pr__download:focus-visible {
	outline: 3px solid var( --pr-blue );
	outline-offset: 2px;
}

.wrc-press-releases .wrc-pr__icon {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ==========================================================================
 * 8b. Card grid
 *
 * The alternative to the panel list, in the shape of the CSIR media hub:
 * picture, date, headline, a couple of lines of the statement, then the action.
 * Whole card is one link — a reader should not have to find the small button.
 * ========================================================================== */

.wrc-press-releases .wrc-pr__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 320px, 1fr ) );
	gap: 28px;
}

.wrc-press-releases .wrc-pr__grid > li {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
}

.wrc-press-releases .wrc-pr__grid > li::before,
.wrc-press-releases .wrc-pr__grid > li::marker {
	content: none;
}

.wrc-press-releases .wrc-pr__card-link {
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var( --pr-white );
	border: 1px solid var( --pr-grey-line );
	border-radius: var( --pr-radius );
	box-shadow: var( --pr-shadow );
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.wrc-press-releases .wrc-pr__card-link:hover,
.wrc-press-releases .wrc-pr__card-link:focus-visible {
	transform: translateY( -4px );
	border-color: var( --pr-lightblue );
	box-shadow: 0 2px 4px rgba( 9, 78, 156, .06 ), 0 16px 36px rgba( 9, 78, 156, .13 );
	text-decoration: none;
}

.wrc-press-releases .wrc-pr__card-link:focus-visible {
	outline: 3px solid var( --pr-lightblue );
	outline-offset: 2px;
}

/* -- picture ---------------------------------------------------------- */

.wrc-press-releases .wrc-pr__media {
	display: block;
	position: relative;
	aspect-ratio: 16 / 10;
	background: var( --pr-grey-bg );
	overflow: hidden;
}

.wrc-press-releases .wrc-pr__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}

.wrc-press-releases .wrc-pr__card-link:hover .wrc-pr__img {
	transform: scale( 1.04 );
}

/* A rendered document page is portrait and its content sits at the top, so it is
   anchored there — centring it would crop away the letterhead and headline,
   which are the only part of the page readable at this size. The inset and hair
   border keep it reading as a sheet of paper rather than a photograph. */
.wrc-press-releases .wrc-pr__img--doc {
	object-position: top center;
	background: #FFFFFF;
	border-bottom: 1px solid var( --pr-grey-line );
}

/* Releases with no featured image: a branded panel naming the file type,
   rather than a stock photo implying something the release does not say. */
.wrc-press-releases .wrc-pr__fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: linear-gradient( 135deg, var( --pr-blue ) 0%, #0B6FC4 55%, var( --pr-lightblue ) 100% );
	color: var( --pr-white );
}

.wrc-press-releases .wrc-pr__fallback-icon {
	width: 44px;
	height: 44px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: .92;
}

.wrc-press-releases .wrc-pr__fallback-label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: .95;
}

/* -- body ------------------------------------------------------------- */

.wrc-press-releases .wrc-pr__card-body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 22px 22px 24px;
	flex: 1 1 auto;
}

.wrc-press-releases .wrc-pr__card-date {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var( --pr-ink-soft );
}

.wrc-press-releases .wrc-pr__card-title {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
	color: var( --pr-ink );

	/* Two lines, so every card in a row keeps the same rhythm. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color .18s ease;
}

.wrc-press-releases .wrc-pr__card-link:hover .wrc-pr__card-title {
	color: var( --pr-blue );
}

.wrc-press-releases .wrc-pr__card-text {
	font-size: 14px;
	line-height: 1.65;
	color: var( --pr-ink-soft );

	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* -- action ----------------------------------------------------------- */

.wrc-press-releases .wrc-pr__card-action {
	margin-top: auto;
	padding-top: 6px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	align-self: flex-start;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .03em;
	color: var( --pr-blue );
}

.wrc-press-releases .wrc-pr__card-icon {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform .18s ease;
}

.wrc-press-releases .wrc-pr__card-link:hover .wrc-pr__card-icon {
	transform: translateX( 2px );
}

/* ==========================================================================
 * 8c. Media listing
 *
 * The UCT newsroom shape (news.uct.ac.za media releases): a grid of compact
 * rows rather than tall cards — square picture on the left, headline, two lines
 * of the statement, then the date and a category chip. Three across on a wide
 * screen, two on a tablet, one on a phone, which is what that listing does with
 * its col-xs-12 col-sm-6 col-lg-4.
 * ========================================================================== */

.wrc-press-releases .wrc-pr__media-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 4px 32px;
}

.wrc-press-releases .wrc-pr__media-list > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wrc-press-releases .wrc-pr__media-list > li::before,
.wrc-press-releases .wrc-pr__media-list > li::marker {
	content: none;
}

@media ( min-width: 768px ) {
	.wrc-press-releases .wrc-pr__media-list { grid-template-columns: repeat( 2, 1fr ); }
}

@media ( min-width: 1200px ) {
	.wrc-press-releases .wrc-pr__media-list { grid-template-columns: repeat( 3, 1fr ); }
}

.wrc-press-releases .wrc-pr__media-link {
	display: flex;
	gap: 16px;
	height: 100%;
	padding: 18px 0;
	border-bottom: 1px solid var( --pr-grey-line );
	text-decoration: none;
	color: inherit;
}

.wrc-press-releases .wrc-pr__media-link:hover,
.wrc-press-releases .wrc-pr__media-link:focus-visible {
	text-decoration: none;
}

.wrc-press-releases .wrc-pr__media-link:focus-visible {
	outline: 3px solid var( --pr-lightblue );
	outline-offset: 2px;
}

/* -- square picture ---------------------------------------------------- */

.wrc-press-releases .wrc-pr__thumb {
	position: relative;
	flex: 0 0 auto;
	width: 96px;
	height: 96px;
	border-radius: var( --pr-radius-sm );
	background: var( --pr-grey-bg );
	overflow: hidden;
}

.wrc-press-releases .wrc-pr__thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* A rendered first page is a portrait sheet: anchor it to the top so the
   letterhead and headline survive the square crop. */
.wrc-press-releases .wrc-pr__thumb-img--doc {
	object-position: top center;
	background: #FFFFFF;
}

.wrc-press-releases .wrc-pr__thumb-fallback {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient( 135deg, var( --pr-blue ) 0%, var( --pr-lightblue ) 100% );
	color: var( --pr-white );
}

.wrc-press-releases .wrc-pr__thumb-fallback svg {
	width: 30px;
	height: 30px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* The download marker UCT puts over the picture when the link leaves the site. */
.wrc-press-releases .wrc-pr__thumb-badge {
	position: absolute;
	right: 4px;
	bottom: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba( 9, 78, 156, .92 );
	color: var( --pr-white );
}

.wrc-press-releases .wrc-pr__thumb-badge svg {
	width: 13px;
	height: 13px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* -- text -------------------------------------------------------------- */

.wrc-press-releases .wrc-pr__media-text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	flex: 1 1 auto;
}

.wrc-press-releases .wrc-pr__media-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.45;
	color: var( --pr-blue );
	transition: color .18s ease;

	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wrc-press-releases .wrc-pr__media-link:hover .wrc-pr__media-title {
	color: var( --pr-lightblue );
}

.wrc-press-releases .wrc-pr__media-excerpt {
	font-size: 13px;
	line-height: 1.6;
	color: var( --pr-ink-soft );

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wrc-press-releases .wrc-pr__media-meta {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12px;
	color: var( --pr-ink-soft );
}

.wrc-press-releases .wrc-pr__media-tag {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	background: var( --pr-blue );
	color: var( --pr-white );
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	white-space: nowrap;
}

@media ( max-width: 600px ) {

	.wrc-press-releases .wrc-pr__thumb {
		width: 76px;
		height: 76px;
	}

	.wrc-press-releases .wrc-pr__media-link {
		gap: 12px;
		padding: 14px 0;
	}
}

/* ==========================================================================
 * 9. Empty state
 * ========================================================================== */

.wrc-press-releases .wrc-pr__empty {
	margin: 0;
	padding: 32px 24px;
	background: var( --pr-grey-bg );
	border-radius: var( --pr-radius );
	color: var( --pr-ink-soft );
	text-align: center;
}

/* ==========================================================================
 * 10. Narrow screens
 * ========================================================================== */

@media ( max-width: 600px ) {

	.wrc-press-releases .wrc-pr__grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.wrc-press-releases .wrc-pr__card-body {
		padding: 18px 18px 20px;
	}

	.wrc-press-releases .wrc-pr__summary,
	.wrc-press-releases .wrc-pr__row {
		padding: 16px 18px;
		gap: 12px;
	}

	.wrc-press-releases .wrc-pr__name { font-size: 16px; }
	.wrc-press-releases .wrc-pr__body { padding: 4px 18px 20px; }

	.wrc-press-releases .wrc-pr__chevron {
		width: 30px;
		height: 30px;
	}

	.wrc-press-releases .wrc-pr__download {
		width: 100%;
		justify-content: center;
	}
}

/* Users who prefer less motion keep the state changes, not the movement. */
@media ( prefers-reduced-motion: reduce ) {

	.wrc-press-releases .wrc-pr__panel,
	.wrc-press-releases .wrc-pr__row,
	.wrc-press-releases .wrc-pr__chevron,
	.wrc-press-releases .wrc-pr__name,
	.wrc-press-releases .wrc-pr__download,
	.wrc-press-releases .wrc-pr__card-link,
	.wrc-press-releases .wrc-pr__img,
	.wrc-press-releases .wrc-pr__card-icon,
	.wrc-press-releases .wrc-pr__media-title {
		transition: none;
	}

	.wrc-press-releases .wrc-pr__panel[open] .wrc-pr__chevron {
		transform: none;
	}

	.wrc-press-releases .wrc-pr__card-link:hover {
		transform: none;
	}

	.wrc-press-releases .wrc-pr__card-link:hover .wrc-pr__img {
		transform: none;
	}
}
