/*
 * The news card (prototype news.html Press / Events / Reports, article.html Related, the category archive). A Group with
 * this style is the post template's card in a Query Loop:
 *
 *   core/group  is-style-news-card (tagName article, background = the card colour)
 *     core/post-featured-image   aspect ratio set in the block (418/219 Press and Events, 418/279 Reports)
 *     core/group  .news-card__body
 *       core/paragraph .news-card__tag ("Press", "Event" …) or core/post-terms .news-card__tag (the category; .is-pill)
 *       core/post-title .news-card__title (link; its ::after makes the whole card the link, prototype .card-link)
 *       core/group  .news-card__meta: core/post-date + core/paragraph .card-cta ("Read release", not a link)
 *
 * Also the grid of cards (post template class .news-grid), the archive section (.news-archive) and its pagination.
 * This file loads wherever a card renders.
 */
.wp-block-group.is-style-news-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 15px;
	height: 100%;
	padding-bottom: 25px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--card);
}

.is-style-news-card > .wp-block-post-featured-image {
	margin: 0;
}

.is-style-news-card > .wp-block-post-featured-image img {
	display: block;
	width: 100%;
}

.is-style-news-card .news-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
	padding-inline: 30px;
}

/* tag: square on Press / Events / Reports, a pill (.is-pill) on the featured and related cards */
.news-card__tag {
	width: fit-content;
	padding: 5px 7px 2px;
	border-radius: var(--wp--custom--radius--btn);
	background-color: var(--wp--preset--color--greige);
	color: var(--wp--preset--color--white);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: var(--wp--custom--letter-spacing--caption);
	text-transform: uppercase;
}

.news-card__tag.is-pill {
	padding-inline: 12px;
	border-radius: var(--wp--custom--radius--pill);
}

.news-card__tag a {
	color: inherit;
	text-decoration: none;
}

.news-card__title {
	font-weight: 600;
}

/* prototype 8i: the whole headline underlines (text-decoration follows every line), fading in */
.news-card__title a,
.card-cta {
	text-decoration-line: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
	text-decoration-color: transparent;
	transition: text-decoration-color 350ms var(--wp--custom--ease);
}

.news-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

:is(.is-style-news-card, .news-featured__card):hover :is(.news-card__title a, .card-cta),
.news-card__title a:focus-visible,
:is(.is-style-news-card, .news-featured__card):has(.news-card__title a:focus-visible) .card-cta {
	text-decoration-color: currentColor;
}

/* the 1px rule and the date / CTA row, pushed to the bottom of the card (two classes: core's
   ":root :where(.is-layout-flow) > *" margin reset is 0,1,0 and prints later) */
.news-card__body > .news-card__meta,
.news-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid var(--wp--preset--color--greige);
}

.card-cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: var(--wp--custom--letter-spacing--eyebrow);
	text-transform: uppercase;
}

.card-cta::after {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
}

.card-cta.is-external::after {
	width: 20px;
	height: 20px;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E");
}

/* Related (article.html): pill tag, image rounded at the bottom and zooming on hover, 430px tall from 1024px with the
   image taking what the copy leaves; the rule sits 24px under the title instead of at the bottom */
.news-card--related > .wp-block-post-featured-image {
	overflow: hidden;
	border-radius: 0 0 var(--wp--custom--radius--card) var(--wp--custom--radius--card);
}

.news-card--related > .wp-block-post-featured-image img {
	aspect-ratio: 418 / 245;
	object-fit: cover;
	transition: transform 500ms var(--wp--custom--ease);
}

.news-card--related:is(:hover, :focus-within) > .wp-block-post-featured-image img {
	transform: scale(1.05);
}

.is-style-news-card.news-card--related .news-card__body {
	flex: none;
}

.news-card--related .news-card__body > .news-card__meta {
	align-items: flex-end;
	margin-top: 12px;
}

@media (width >= 1024px) {
	.wp-block-group.is-style-news-card.news-card--related {
		height: 430px;
	}

	.news-card--related > .wp-block-post-featured-image {
		flex: 1;
		min-height: 0;
	}

	.news-card--related > .wp-block-post-featured-image img {
		height: 100%;
		aspect-ratio: auto;
	}
}

/* The grid: 1 column, 2 from 768px, 3 from 1024px (prototype grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-21) */
.wp-block-post-template.news-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 21px;
}

.wp-block-post-template.news-grid--related {
	gap: 30px;
}

@media (width >= 768px) {
	.wp-block-post-template.news-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (width >= 1024px) {
	.wp-block-post-template.news-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* Category archive (templates/category.html): pagination under the grid */
.news-archive .news-pagination {
	gap: 10px;
	margin-top: 40px;
	font-size: var(--wp--preset--font-size--text-10);
	font-weight: 600;
	letter-spacing: var(--wp--custom--letter-spacing--eyebrow);
	text-transform: uppercase;
}

.news-archive .news-pagination :is(a, .current) {
	display: inline-flex;
	min-width: 40px;
	height: 40px;
	align-items: center;
	justify-content: center;
	padding-inline: 12px;
	border: 1px solid var(--wp--preset--color--greige);
	border-radius: var(--wp--custom--radius--btn);
	color: var(--wp--preset--color--charcoal);
	text-decoration: none;
	transition: background-color 300ms var(--wp--custom--ease);
}

.news-archive .news-pagination a:is(:hover, :focus-visible) {
	background-color: var(--wp--preset--color--off-white);
}

.news-archive .news-pagination .current {
	border-color: var(--wp--preset--color--charcoal);
	background-color: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--white);
}

.news-archive .news-pagination .page-numbers.dots {
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.news-card__title a,
	.card-cta,
	.news-card--related > .wp-block-post-featured-image img {
		transition: none;
	}
}
