/*
 * DWYPD Event Campaigns.
 *
 * Fonts come from the theme (.second_font on headings and tile names).
 * Colours match the events archive: the green of its "Find Event" button
 * and the navy of its event titles.
 */

.dwypd-ec {
	--dwypd-ec-brand: #076128;
	--dwypd-ec-ink: #202b5d;
	--dwypd-ec-muted: #62718d;
	--dwypd-ec-line: #e8e8e8;
}

.dwypd-ec .dwypd-ec-heading {
	margin: 0 0 24px;
	font-size: 28px;
	line-height: 1.2;
	color: var(--dwypd-ec-ink);
}

/* Tiles */

.dwypd-ec-campaigns {
	margin-bottom: 60px;
}

.dwypd-ec .dwypd-ec-tiles {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.dwypd-ec .dwypd-ec-tiles__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.dwypd-ec .dwypd-ec-tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.dwypd-ec .dwypd-ec-tiles {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.dwypd-ec .dwypd-ec-tile {
	display: flex;
	flex-direction: column;
	height: 100%;
	border: 1px solid var(--dwypd-ec-line);
	background: #fff;
	color: var(--dwypd-ec-ink);
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dwypd-ec .dwypd-ec-tile:focus-visible {
	outline: 3px solid var(--dwypd-ec-brand);
	outline-offset: 3px;
}

/* The green shows through when the latest event has no picture. */
.dwypd-ec-tile__media {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--dwypd-ec-brand);
}

.dwypd-ec .dwypd-ec-tile__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center top;
}

.dwypd-ec-tile__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	padding: 18px 20px 20px;
	border-top: 3px solid var(--dwypd-ec-brand);
}

.dwypd-ec-tile__name {
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--dwypd-ec-ink);
	transition: color 0.2s ease;
}

.dwypd-ec-tile__count {
	font-size: 15px;
	line-height: 1.4;
	color: var(--dwypd-ec-muted);
}

@media (hover: hover) {
	.dwypd-ec .dwypd-ec-tile:hover {
		border-color: var(--dwypd-ec-brand);
	}

	.dwypd-ec .dwypd-ec-tile:hover .dwypd-ec-tile__name {
		color: var(--dwypd-ec-brand);
	}
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.dwypd-ec .dwypd-ec-tile:hover {
		transform: translateY(-4px);
		box-shadow: 0 12px 28px rgba(32, 43, 93, 0.12);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dwypd-ec .dwypd-ec-tile,
	.dwypd-ec-tile__name {
		transition: none;
	}
}

/* Campaign page */

.dwypd-ec-campaign-head {
	margin-bottom: 32px;
}

.dwypd-ec .dwypd-ec-campaign-head .dwypd-ec-heading {
	margin-bottom: 12px;
}

.dwypd-ec .dwypd-ec-back {
	display: inline-block;
	margin-bottom: 14px;
	font-weight: 600;
	color: var(--dwypd-ec-brand);
	text-decoration: none;
}

.dwypd-ec .dwypd-ec-back:hover,
.dwypd-ec .dwypd-ec-back:focus-visible {
	text-decoration: underline;
}

.dwypd-ec-description {
	max-width: 70ch;
	color: var(--dwypd-ec-muted);
}

.dwypd-ec-description > :last-child {
	margin-bottom: 0;
}
