/* Blog listing, archives and single posts. The header overlays the page, so the top is a brand band. */

.sa-blog,
.sa-article {
	--sa-header: 150px;
	--sa-line: color-mix(in srgb, var(--theme-palette-color-3) 12%, transparent);
	padding: calc(var(--sa-header) + clamp(2rem, 5vw, 4rem)) 0 clamp(3rem, 6vw, 5rem);
	background: linear-gradient(var(--theme-palette-color-1) var(--sa-header), var(--theme-palette-color-6) var(--sa-header));
	color: var(--theme-palette-color-3);
}

.sa-blog .ct-container {
	display: grid;
	gap: 2rem;
}

.sa-blog h1,
.sa-blog p,
.sa-article h1,
.sa-related h2 {
	margin: 0;
}

.sa-blog__head {
	display: grid;
	gap: 0.85rem;
	max-width: 720px;
}

.sa-blog__intro {
	color: var(--theme-palette-color-4);
	font-size: 18px;
}

/* Category filter */

.sa-blog__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.sa-blog__filters a {
	padding: 0.5rem 1rem;
	border: 1px solid var(--sa-line);
	border-radius: 999px;
	background: var(--theme-palette-color-7);
	color: var(--theme-palette-color-3);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.sa-blog__filters a:hover {
	border-color: var(--theme-palette-color-1);
}

.sa-blog__filters a[aria-current="page"] {
	border-color: var(--theme-palette-color-1);
	background: var(--theme-palette-color-1);
	color: var(--theme-palette-color-7);
}

/* Cards */

.sa-blog__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: 1.5rem;
}

.sa-post-card {
	position: relative;
	display: grid;
	grid-template-rows: auto 1fr;
	overflow: hidden;
	border-radius: 8px;
	background: var(--theme-palette-color-7);
	transition: box-shadow 0.2s, transform 0.2s;
}

.sa-post-card:hover {
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.08);
	transform: translateY(-3px);
}

.sa-post-card__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 3 / 2;
	background: var(--theme-palette-color-6);
}

.sa-post-card__media img,
.sa-post-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.sa-post-card:hover .sa-post-card__media img {
	transform: scale(1.04);
}

.sa-post-card__placeholder {
	background: linear-gradient(135deg, var(--theme-palette-color-1), var(--theme-palette-color-2));
}

.sa-post-card__body {
	display: grid;
	gap: 0.6rem;
	align-content: start;
	padding: 1.25rem 1.5rem 1.5rem;
}

.sa-post-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin: 0;
	color: var(--theme-palette-color-4);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.sa-post-card__meta > :first-child {
	color: var(--theme-palette-color-1);
}

.sa-post-card__meta a {
	color: inherit;
	text-decoration: none;
}

.sa-post-card__title {
	margin: 0;
	font-family: "DM Sans", sans-serif;
	font-size: 21px;
	font-weight: 700;
	line-height: 1.25;
	text-transform: none;
}

.sa-post-card__title a {
	color: var(--theme-palette-color-3);
	text-decoration: none;
}

/* The whole card is clickable through the title link. */
.sa-post-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sa-post-card__title a:focus-visible {
	outline: none;
}

.sa-post-card:has(.sa-post-card__title a:focus-visible) {
	outline: 2px solid var(--theme-palette-color-1);
	outline-offset: 2px;
}

.sa-post-card__excerpt {
	margin: 0;
	color: var(--theme-palette-color-4);
	font-size: 15px;
	line-height: 1.55;
}

.sa-post-card__more {
	display: inline-flex;
	gap: 0.4rem;
	align-items: center;
	color: var(--theme-palette-color-1);
	font-size: 14px;
	font-weight: 700;
}

.sa-post-card__more svg {
	width: 14px;
	height: 14px;
}

/* First post on the blog spans the row with its image beside the text. */
@media (min-width: 900px) {
	.sa-post-card.is-featured {
		grid-column: 1 / -1;
		grid-template-columns: 3fr 2fr;
		grid-template-rows: none;
	}

	.sa-post-card.is-featured .sa-post-card__media {
		aspect-ratio: auto;
		min-height: 380px;
	}

	.sa-post-card.is-featured .sa-post-card__body {
		align-content: center;
		padding: 2.5rem;
	}

	.sa-post-card.is-featured .sa-post-card__title {
		font-size: 30px;
	}
}

/* Single post */

.sa-article .ct-container {
	display: grid;
	gap: 2rem;
}

.sa-article__head {
	display: grid;
	gap: 1rem;
	width: 100%;
	max-width: 780px;
	margin-inline: auto;
}

.sa-article__back {
	display: inline-flex;
	gap: 0.35rem;
	align-items: center;
	justify-self: start;
	color: var(--theme-palette-color-1);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.sa-article__lede {
	margin: 0;
	color: var(--theme-palette-color-4);
	font-size: 20px;
	line-height: 1.5;
}

.sa-article__media {
	margin: 0;
	overflow: hidden;
	border-radius: 8px;
}

.sa-article__media img {
	display: block;
	width: 100%;
	max-height: 640px;
	object-fit: cover;
}

.sa-article__body {
	width: 100%;
	max-width: 780px;
	margin-inline: auto;
	padding: clamp(1.5rem, 4vw, 3rem);
	border-radius: 8px;
	background: var(--theme-palette-color-7);
	font-size: 18px;
	line-height: 1.7;
}

.sa-article__body > * {
	max-width: none;
}

.sa-article__body img {
	border-radius: 6px;
}

.sa-article__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	align-items: center;
	width: 100%;
	max-width: 780px;
	margin-inline: auto;
}

.sa-article__foot p {
	margin: 0;
	font-weight: 700;
}

.sa-article__share {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.sa-article__share a,
.sa-article__share button {
	padding: 0.45rem 0.95rem;
	border: 1px solid var(--sa-line);
	border-radius: 999px;
	background: var(--theme-palette-color-7);
	color: var(--theme-palette-color-3);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.sa-article__share a:hover,
.sa-article__share button:hover {
	border-color: var(--theme-palette-color-1);
}

/* Related posts */

.sa-related {
	padding-block: clamp(2.5rem, 6vw, 4rem);
	background: var(--theme-palette-color-7);
}

.sa-related .ct-container {
	display: grid;
	gap: 1.5rem;
}

.sa-related .sa-post-card {
	border: 1px solid var(--sa-line);
}

@media (prefers-reduced-motion: reduce) {
	.sa-post-card,
	.sa-post-card__media img {
		transition: none;
	}
}
