/**
 * Engineers Projects Manager — the updates page.
 *
 * The accent, the ink, the hairline and the surface all come from frontend.css,
 * so the page belongs to the site rather than to a stylesheet of its own.
 * Everything is written in logical properties, so the Arabic page reads right to
 * left without a second rule anywhere.
 */

.edp-updates {
	padding-block: clamp(6px, 1.4vw, 16px) clamp(34px, 5vw, 72px);
}

/* ------------------------------------------------------------------- Intro */

.edp-updates-intro {
	max-width: 660px;
	margin-bottom: clamp(20px, 2.4vw, 30px);
}

.edp-updates-heading {
	margin: 0;
	font-size: clamp(24px, 2.6vw, 34px);
}

.edp-updates-text {
	margin: 10px 0 0;
	font-size: 15.5px;
	line-height: 1.7;
	color: var(--edp-text);
}

/* ------------------------------------------------------------- Filter bar */

.edp-updates-bar {
	margin-bottom: clamp(20px, 2.6vw, 32px);
}

.edp-updates-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 24px;
}

.edp-updates-facets {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.edp-updates .edp-facet {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 18px;
	border: 1px solid var(--edp-line);
	border-radius: 999px;
	background: var(--edp-white);
	color: var(--edp-text);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.28s ease, border-color 0.28s ease, color 0.28s ease;
}

.edp-updates .edp-facet:hover {
	border-color: var(--edp-accent);
	color: var(--edp-ink);
}

.edp-updates .edp-facet.is-active {
	background: var(--edp-ink);
	border-color: transparent;
	color: #fff;
}

.edp-updates .edp-facet-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding-inline: 5px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--edp-ink) 8%, transparent);
	font-size: 11px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* Before the script has counted, the pill carries no bubble at all. */
.edp-updates .edp-facet-count:empty {
	display: none;
}

.edp-updates .edp-facet.is-active .edp-facet-count {
	background: color-mix(in srgb, #fff 22%, transparent);
	color: #fff;
}

.edp-updates .edp-facet.is-empty {
	opacity: 0.35;
	pointer-events: none;
}

/* -------------------------------------------------------------------- Grid */

.edp-updates-grid {
	display: grid;
	gap: clamp(20px, 2.2vw, 30px);
	grid-template-columns: repeat(var(--edp-updates-cols, 3), minmax(0, 1fr));
	align-items: stretch;
}

.edp-ucard.is-hidden {
	display: none;
}

/* Few cards fill the row all the same: the picture flattens rather than the
   card turning into a poster, and a single one lies down as a spread. */
@media (min-width: 861px) {
	.edp-updates-grid.is-two .edp-ucard-frame {
		aspect-ratio: 16 / 10;
	}

	.edp-updates-grid.is-two .edp-ucard-title {
		font-size: clamp(19px, 1.6vw, 23px);
	}

	.edp-updates-grid.is-two .edp-ucard-desc {
		font-size: 15px;
	}
}

/* -------------------------------------------------------------------- Card */

.edp-ucard {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--edp-white);
	border: 1px solid var(--edp-line);
	border-radius: var(--edp-radius-lg);
	box-shadow: 0 1px 2px color-mix(in srgb, var(--edp-ink) 5%, transparent);
	transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease, border-color 0.5s ease;
}

.edp-ucard:hover {
	transform: translateY(-6px);
	border-color: color-mix(in srgb, var(--edp-accent) 45%, var(--edp-line));
	box-shadow: 0 30px 54px -32px color-mix(in srgb, var(--edp-ink) 55%, transparent);
}

.edp-ucard.is-quiet:hover {
	transform: none;
	box-shadow: 0 1px 2px color-mix(in srgb, var(--edp-ink) 5%, transparent);
	border-color: var(--edp-line);
}

/* The picture */

.edp-ucard-frame {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: var(--edp-surface);
}

.edp-ucard-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.edp-ucard:hover .edp-ucard-img {
	transform: scale(1.06);
}

.edp-ucard-veil {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, color-mix(in srgb, var(--edp-ink) 42%, transparent), transparent 45%);
	opacity: 0;
	transition: opacity 0.5s ease;
	pointer-events: none;
}

.edp-ucard:hover .edp-ucard-veil {
	opacity: 1;
}

/* Where it was published, and the one held first. */

.edp-ucard-tags {
	position: absolute;
	inset-block-start: 14px;
	inset-inline-start: 14px;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.edp-ucard-source,
.edp-ucard-pin {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 26px;
	padding-inline: 11px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1;
	white-space: nowrap;
}

.edp-ucard-source {
	background: color-mix(in srgb, var(--edp-white) 88%, transparent);
	backdrop-filter: blur(10px);
	color: var(--edp-ink);
	box-shadow: 0 2px 10px -4px color-mix(in srgb, var(--edp-ink) 60%, transparent);
}

.edp-ucard-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--edp-accent);
}

.edp-ucard-pin {
	background: var(--edp-accent);
	color: #fff;
}

/* The words */

.edp-ucard-body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1 1 auto;
	padding: clamp(20px, 1.9vw, 26px);
}

.edp-ucard-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--edp-muted);
}

.edp-ucard-cat {
	color: var(--edp-accent);
}

.edp-ucard-sep {
	width: 16px;
	height: 1px;
	background: var(--edp-line);
	flex: 0 0 16px;
}

.edp-ucard-title {
	margin: 0;
	font-size: clamp(17.5px, 1.45vw, 20.5px);
	line-height: 1.3;
	font-weight: 700;
	color: var(--edp-ink);
	font-family: var(--e-global-typography-accent-font-family, inherit);
	/* A pasted headline with no spaces in it must not stretch the card. */
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.edp-ucard-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.edp-ucard:hover .edp-ucard-title a {
	color: var(--edp-accent);
}

.edp-ucard-desc {
	margin: 0;
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--edp-text);
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* The foot: a hairline, the words, and the arrow in its ring. */

.edp-ucard-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--edp-line);
}

.edp-ucard-more {
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--edp-ink);
	transition: color 0.3s ease;
}

.edp-ucard-go {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 1px solid var(--edp-line);
	border-radius: 50%;
	color: var(--edp-ink);
	transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, transform 0.4s ease;
}

.edp-ucard-go .edp-svg {
	width: 17px;
	height: 17px;
}

/* The arrow leans the way the language runs. The attribute selector carries
   older browsers; :dir() catches a page that only sets direction in CSS. */
[dir="rtl"] .edp-ucard-go .edp-svg,
.edp-ucard-go .edp-svg:dir(rtl) {
	transform: scaleX(-1);
}

.edp-ucard:hover .edp-ucard-more {
	color: var(--edp-accent);
}

.edp-ucard:hover .edp-ucard-go {
	background: var(--edp-accent);
	border-color: transparent;
	color: #fff;
	transform: rotate(45deg);
}

/* An update with no picture leans on its words instead. */

.edp-ucard.is-bare {
	background: linear-gradient(150deg, var(--edp-surface), var(--edp-white) 70%);
}

.edp-ucard.is-bare .edp-ucard-body {
	justify-content: center;
	padding-block: clamp(26px, 2.8vw, 36px);
	gap: 12px;
}

/* A hairline of the accent stands in for the picture it has not got. */
.edp-ucard.is-bare::before {
	content: "";
	position: absolute;
	inset-block-start: 0;
	inset-inline: 0;
	height: 3px;
	background: var(--edp-accent);
	opacity: 0.85;
}

.edp-ucard.is-bare .edp-ucard-title {
	-webkit-line-clamp: 3;
	font-size: clamp(19px, 1.6vw, 23px);
}

.edp-ucard.is-bare .edp-ucard-desc {
	-webkit-line-clamp: 5;
}

/* …and a soft wash in the corner, so the room the picture would have taken is
   not simply blank. */
.edp-ucard.is-bare::after {
	content: "";
	position: absolute;
	inset-block-end: -70px;
	inset-inline-end: -70px;
	width: 240px;
	height: 240px;
	border-radius: 50%;
	background: radial-gradient(circle at center, color-mix(in srgb, var(--edp-accent) 16%, transparent), transparent 68%);
	pointer-events: none;
}

/* The one held first takes the full width and reads as a spread. */

.edp-ucard.is-wide {
	grid-column: 1 / -1;
}

@media (min-width: 861px) {
	.edp-ucard.is-wide,
	.edp-updates-grid.is-one .edp-ucard {
		flex-direction: row;
		align-items: stretch;
	}

	.edp-updates-grid.is-one .edp-ucard-frame {
		flex: 0 0 54%;
		aspect-ratio: auto;
		min-height: 320px;
	}

	.edp-updates-grid.is-one .edp-ucard-body {
		justify-content: center;
		padding: clamp(28px, 3vw, 46px);
	}

	.edp-updates-grid.is-one .edp-ucard-title {
		font-size: clamp(22px, 2vw, 29px);
		-webkit-line-clamp: 3;
	}

	.edp-ucard.is-wide .edp-ucard-frame {
		flex: 0 0 54%;
		aspect-ratio: auto;
		min-height: 340px;
	}

	.edp-ucard.is-wide .edp-ucard-body {
		justify-content: center;
		gap: 14px;
		padding: clamp(28px, 3vw, 48px);
	}

	.edp-ucard.is-wide .edp-ucard-title {
		font-size: clamp(23px, 2.1vw, 31px);
		-webkit-line-clamp: 3;
	}

	.edp-ucard.is-wide .edp-ucard-desc {
		font-size: 15.5px;
		-webkit-line-clamp: 4;
	}

	.edp-ucard.is-wide .edp-ucard-foot {
		margin-top: 8px;
	}
}

/* ------------------------------------------------------------ Empty state */

.edp-updates-empty {
	margin-top: 4px;
}

/* -------------------------------------------------------------- Narrower */

@media (max-width: 1080px) {
	.edp-updates-grid {
		grid-template-columns: repeat(min(var(--edp-updates-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 700px) {
	.edp-updates-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.edp-updates-facets {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		margin-inline: calc(clamp(16px, 4vw, 44px) * -1);
		padding-inline: clamp(16px, 4vw, 44px);
	}

	.edp-updates-facets::-webkit-scrollbar {
		display: none;
	}

	.edp-updates .edp-facet {
		flex: 0 0 auto;
	}

	.edp-ucard-frame {
		aspect-ratio: 16 / 10;
	}
}

/* Whoever asked their system for less motion gets less of it. */
@media (prefers-reduced-motion: reduce) {
	.edp-ucard,
	.edp-ucard-img,
	.edp-ucard-go,
	.edp-ucard-veil {
		transition: none;
	}

	.edp-ucard:hover,
	.edp-ucard:hover .edp-ucard-img,
	.edp-ucard:hover .edp-ucard-go {
		transform: none;
	}
}
