/**
 * Blog listing — the posts page and the category / tag / author / date
 * archives.
 *
 *   bar       topic chips (with post counts) and a compact search
 *   featured  the newest post on page one, wide: image left, story right
 *   grid      even cards: category chip on the photo, date and reading time,
 *             a clamped title and excerpt, the author and a "Read story" cue
 *   sidebar   stays in view on wide screens
 *
 * Each card is one click target: its title link is stretched over the card,
 * and the category chip and author link sit above it with their own targets.
 */

.gx-blog {
	--gb-accent: var(--color-primary, #1273C4);
	--gb-ink: var(--color-black, #0C2338);
	--gb-body: var(--color-body, #5A7387);
	--gb-line: var(--color-border, #E2EAF1);
	--gb-tint: var(--color-tint, #F2F6FA);
	--gb-font: var(--font-title, inherit);
	--gb-ease: cubic-bezier(.22, .61, .36, 1);
	--gb-radius: 22px;

	padding: clamp(48px, 6vw, 90px) 0 clamp(64px, 8vw, 110px);
}

.gx-blog *,
.gx-blog *::before,
.gx-blog *::after {
	box-sizing: border-box;
}

.gx-blog svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

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

.gx-blog__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
	margin-bottom: clamp(28px, 3.5vw, 44px);
}

.gx-blog__topics {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-width: 0;
}

.gx-blog__topic {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 42px;
	padding: 0 16px;
	border: 1px solid var(--gb-line);
	border-radius: 999px;
	background-color: #fff;
	font-family: var(--gb-font);
	font-size: 14px;
	font-weight: 600;
	color: var(--gb-ink);
	text-decoration: none;
	white-space: nowrap;
	transition: border-color .25s, background-color .25s, color .25s, transform .3s var(--gb-ease);
}

.gx-blog__topic:hover,
.gx-blog__topic:focus-visible {
	border-color: var(--gb-accent);
	color: var(--gb-accent);
	transform: translateY(-1px);
}

.gx-blog__topic.is-current {
	border-color: var(--gb-ink);
	background-color: var(--gb-ink);
	color: #fff;
}

.gx-blog__topic-count {
	display: inline-grid;
	place-items: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background-color: var(--gb-tint);
	font-size: 11.5px;
	font-weight: 700;
	color: var(--gb-body);
}

.gx-blog__topic.is-current .gx-blog__topic-count {
	background-color: rgba(255, 255, 255, .16);
	color: #fff;
}

.gx-blog__search {
	display: flex;
	flex: 0 1 300px;
	align-items: center;
	gap: 8px;
	height: 46px;
	padding: 0 16px;
	border: 1px solid var(--gb-line);
	border-radius: 999px;
	background-color: #fff;
	color: var(--gb-body);
	transition: border-color .25s, box-shadow .25s;
}

.gx-blog__search:focus-within {
	border-color: var(--gb-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--gb-accent) 14%, transparent);
}

.gx-blog__search svg {
	flex: none;
	width: 18px;
	height: 18px;
}

.gx-blog .gx-blog__search input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-size: 14.5px;
	color: var(--gb-ink);
	outline: none;
}

/* ----------------------------------------------------------------- layout */

.gx-blog__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(32px, 4vw, 56px);
	align-items: start;
}

@media (min-width: 992px) {
	.gx-blog--sidebar .gx-blog__layout {
		grid-template-columns: minmax(0, 1fr) 340px;
	}

	.gx-blog__sidebar {
		position: sticky;
		top: 110px;
	}
}

.gx-blog__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(22px, 2.4vw, 32px);
}

.gx-blog--sidebar .gx-blog__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1199px) {
	.gx-blog__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 991px) {
	.gx-blog--sidebar .gx-blog__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.gx-blog__grid,
	.gx-blog--sidebar .gx-blog__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ------------------------------------------------------------------- card */

.gx-post {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--gb-line);
	border-radius: var(--gb-radius);
	background-color: #fff;
	transition: transform .5s var(--gb-ease), box-shadow .5s var(--gb-ease), border-color .3s;
	animation: gx-post-in .8s var(--gb-ease) both;
}

.gx-post:nth-child(2) { animation-delay: .06s; }
.gx-post:nth-child(3) { animation-delay: .12s; }
.gx-post:nth-child(4) { animation-delay: .18s; }
.gx-post:nth-child(5) { animation-delay: .24s; }
.gx-post:nth-child(n + 6) { animation-delay: .3s; }

@keyframes gx-post-in {
	from { opacity: 0; transform: translateY(24px); }
}

.gx-post:hover,
.gx-post:focus-within {
	border-color: transparent;
	transform: translateY(-5px);
	box-shadow: 0 30px 60px -32px rgba(12, 35, 56, .4);
}

.gx-post__media {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background-color: var(--gb-tint);
}

.gx-blog .gx-post__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 1.1s var(--gb-ease);
}

.gx-post:hover .gx-post__media img {
	transform: scale(1.06);
}

.gx-post__placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background:
		radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .22), transparent 50%),
		linear-gradient(135deg, var(--gb-accent), color-mix(in srgb, var(--gb-accent) 55%, #0A1F3A));
	color: rgba(255, 255, 255, .8);
}

.gx-post__placeholder svg {
	width: 44px;
	height: 44px;
	fill: currentColor;
	stroke: none;
	transform: rotate(45deg);
}

.gx-post__cat,
.gx-post__pin {
	position: absolute;
	top: 16px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	height: 30px;
	padding: 0 13px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: .02em;
	text-decoration: none;
}

.gx-post__cat {
	left: 16px;
	background-color: rgba(255, 255, 255, .92);
	color: var(--gb-ink);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	transition: background-color .25s, color .25s;
}

.gx-post__cat:hover,
.gx-post__cat:focus-visible {
	background-color: var(--gb-accent);
	color: #fff;
}

.gx-post__pin {
	right: 16px;
	background-color: var(--color-accent, #F0A93B);
	color: #1d1400;
}

.gx-post__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: 22px 24px 20px;
}

.gx-post__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0 0 10px;
	padding: 0;
	list-style: none;
	font-size: 13px;
	color: var(--gb-body);
}

.gx-post__meta li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.gx-post__meta svg {
	width: 15px;
	height: 15px;
	color: var(--gb-accent);
}

.gx-post__title {
	margin: 0 0 10px;
	font-family: var(--gb-font);
	font-size: clamp(18px, 1.4vw, 21px);
	font-weight: 700;
	line-height: 1.32;
	letter-spacing: -.01em;
}

.gx-post__title a {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	color: var(--gb-ink);
	text-decoration: none;
	transition: color .25s;
}

/* The whole card clicks through to the story. */
.gx-post__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.gx-post:hover .gx-post__title a {
	color: var(--gb-accent);
}

.gx-post__title a:focus-visible {
	outline: none;
}

.gx-post:has(.gx-post__title a:focus-visible) {
	outline: 3px solid var(--gb-accent);
	outline-offset: 3px;
}

.gx-post__excerpt {
	display: -webkit-box;
	margin: 0 0 18px;
	overflow: hidden;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	font-size: 15px;
	line-height: 1.7;
	color: var(--gb-body);
}

.gx-post__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--gb-line);
}

.gx-post__author {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--gb-ink);
	text-decoration: none;
}

.gx-post__author span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gx-post__author:hover,
.gx-post__author:focus-visible {
	color: var(--gb-accent);
}

.gx-blog .gx-post__avatar {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
}

.gx-post__more {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 8px;
	font-family: var(--gb-font);
	font-size: 14px;
	font-weight: 700;
	color: var(--gb-accent);
}

.gx-post__more svg {
	width: 16px;
	height: 16px;
	stroke-width: 2;
	transition: transform .35s var(--gb-ease);
}

.gx-post:hover .gx-post__more svg {
	transform: translateX(4px);
}

/* --------------------------------------------------------------- featured */

.gx-post--featured {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.gx-post--featured .gx-post__media {
	aspect-ratio: auto;
	min-height: 360px;
}

.gx-post--featured .gx-post__body {
	justify-content: center;
	padding: clamp(26px, 3.4vw, 48px);
}

.gx-post__eyebrow {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
	padding: 6px 14px 6px 10px;
	border-radius: 999px;
	background-color: color-mix(in srgb, var(--gb-accent) 10%, transparent);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--gb-accent);
}

.gx-post__eyebrow-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background-color: currentColor;
}

.gx-post--featured .gx-post__title {
	font-size: clamp(24px, 2.4vw, 34px);
	line-height: 1.2;
	letter-spacing: -.02em;
}

.gx-post--featured .gx-post__title a {
	-webkit-line-clamp: 3;
}

.gx-post--featured .gx-post__excerpt {
	font-size: 16px;
	-webkit-line-clamp: 4;
}

.gx-post--featured .gx-post__foot {
	margin-top: 8px;
}

@media (max-width: 767px) {
	.gx-post--featured {
		grid-template-columns: minmax(0, 1fr);
	}

	.gx-post--featured .gx-post__media {
		aspect-ratio: 16 / 10;
		min-height: 0;
	}
}

/* ------------------------------------------------------------- pagination */

.gx-blog__pagination {
	margin-top: clamp(36px, 4vw, 56px);
}

.gx-blog__pagination .pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gx-blog__pagination .page-item {
	margin: 0;
}

.gx-blog__pagination .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 46px;
	height: 46px;
	padding: 0 12px;
	border: 1px solid var(--gb-line);
	border-radius: 14px;
	background-color: #fff;
	font-family: var(--gb-font);
	font-size: 15px;
	font-weight: 700;
	color: var(--gb-ink);
	text-decoration: none;
	transition: border-color .25s, background-color .25s, color .25s, transform .3s var(--gb-ease);
}

.gx-blog__pagination a.page-numbers:hover,
.gx-blog__pagination a.page-numbers:focus-visible {
	border-color: var(--gb-accent);
	color: var(--gb-accent);
	transform: translateY(-2px);
}

.gx-blog__pagination .page-numbers.current {
	border-color: var(--gb-accent);
	background-color: var(--gb-accent);
	color: #fff;
}

.gx-blog__pagination .page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

.gx-blog__pagination .page-numbers svg {
	width: 18px;
	height: 18px;
	stroke-width: 2.2;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 767px) {
	.gx-blog__bar {
		flex-direction: column;
		align-items: stretch;
	}

	/* One swipeable row of topics instead of a wrapped block. */
	.gx-blog__topics {
		flex-wrap: nowrap;
		margin-inline: -4px;
		padding: 2px 4px 6px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.gx-blog__topics::-webkit-scrollbar {
		display: none;
	}

	.gx-blog__search {
		flex-basis: auto;
	}

	.gx-post__body {
		padding: 20px 20px 18px;
	}
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.gx-post__eyebrow {
		background-color: rgba(18, 115, 196, .1);
	}

	.gx-post__placeholder {
		background: linear-gradient(135deg, #1273C4, #0B4A80);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gx-blog *,
	.gx-blog *::before,
	.gx-blog *::after,
	.gx-post {
		animation: none !important;
		transition: none !important;
	}
}
