/* ==========================================================================
   Post listings — the blog, category archives and search results.
   Loaded only on those views; the card grid is not used anywhere else.
   ========================================================================== */

.cb-archive { padding-block: 48px 96px; }

.cb-archive__head {
	max-width: 820px;
	margin-bottom: 48px;
}

.cb-archive__title {
	font-family: var(--cb-display);
	font-weight: 700;
	font-size: 56px;
	line-height: 64px;
	text-transform: uppercase;
	text-wrap: balance;
	color: var(--cb-ink);
}

.cb-archive__lead {
	margin-top: 18px;
	color: var(--cb-muted);
	font-size: 18px;
	line-height: 30px;
}

.cb-archive__lead > *:last-child { margin-bottom: 0; }

.cb-archive__empty {
	padding: 40px 0;
	color: var(--cb-muted);
	font-size: 18px;
}

/* --- Category strip ------------------------------------------------------- */

.cb-archive__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 32px;
}

.cb-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 100px;
	background: var(--cb-white);
	box-shadow: inset 0 0 0 1px var(--cb-line);
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	color: var(--cb-ink);
	transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.cb-chip:hover { box-shadow: inset 0 0 0 1.5px var(--cb-blue); color: var(--cb-blue); }

.cb-chip.is-current {
	background: var(--cb-blue);
	box-shadow: none;
	color: var(--cb-white);
}

.cb-chip__count { font-size: 11px; font-weight: 600; color: var(--cb-muted); }
.cb-chip.is-current .cb-chip__count { color: rgba(255, 255, 255, .7); }

/* --- The lead entry -------------------------------------------------------
   The newest post runs the full content width with the image beside the copy,
   so an archive opens on one thing rather than on a wall of equal tiles. */

/* Both classes, so this wins over the plain card's `display: flex` regardless of the
   order the two rules appear in. */
.cb-post-card.cb-post-card--lead {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: stretch;
	margin-bottom: 32px;
}

.cb-post-card--lead .cb-post-card__media { aspect-ratio: auto; height: 100%; }

.cb-post-card--lead .cb-post-card__body {
	justify-content: center;
	gap: 14px;
	padding: 40px;
}

.cb-post-card--lead .cb-post-card__title { font-size: 30px; line-height: 38px; }
.cb-post-card--lead .cb-post-card__excerpt { font-size: 16px; line-height: 26px; }

/* Without a featured image the lead has nothing to sit beside, so it becomes a
   single wide band instead of a half-empty two-column card. */
.cb-post-card.cb-post-card--lead:not(:has(.cb-post-card__media)) { grid-template-columns: minmax(0, 1fr); }

/* --- The grid ------------------------------------------------------------ */

.cb-post-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: start;
	gap: 32px;
}

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

.cb-post-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--cb-radius-lg);
	background: var(--cb-white);
	box-shadow: 0 0 0 1px var(--cb-line);
	transition: box-shadow .2s ease, transform .2s ease;
}

.cb-post-card:hover {
	box-shadow: 0 0 0 1.5px var(--cb-blue);
	transform: translateY(-2px);
}

.cb-post-card__media {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--cb-bg);
}

.cb-post-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease;
}

.cb-post-card:hover .cb-post-card__img { transform: scale(1.03); }

.cb-post-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	padding: 24px;
}

.cb-post-card__terms { display: flex; flex-wrap: wrap; gap: 8px; }

.cb-post-card__term {
	position: relative;
	z-index: 1;
	padding: 5px 12px;
	border-radius: 100px;
	background: var(--cb-orange);
	color: var(--cb-white);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	transition: filter .2s ease;
}

.cb-post-card__term:hover { filter: brightness(1.08); }

.cb-post-card__title {
	font-size: 20px;
	line-height: 28px;
	font-weight: 600;
	text-transform: uppercase;
}

.cb-post-card__link { color: var(--cb-ink); }
.cb-post-card:hover .cb-post-card__link { color: var(--cb-blue); }

/* Stretches the title's link over the whole card so the entire surface is clickable,
   while the markup keeps a single, honestly-labelled link for assistive tech. */
.cb-post-card__link::after {
	content: '';
	position: absolute;
	inset: 0;
}

.cb-post-card__excerpt {
	color: var(--cb-muted);
	font-size: 16px;
	line-height: 26px;
}

/* Cards size to their own content (align-items: start above), so the meta line sits
   under the excerpt rather than being pushed to the bottom of a stretched card — an
   entry with no featured image would otherwise open a hole the height of its
   neighbour's image. */
.cb-post-card__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-top: 4px;
	color: var(--cb-muted);
	font-size: 13px;
}

.cb-post-card__dot { color: var(--cb-line); }

/* --- Pagination ---------------------------------------------------------- */

.cb-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 48px;
}

.cb-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border-radius: 100px;
	background: var(--cb-white);
	box-shadow: inset 0 0 0 1px var(--cb-line);
	color: var(--cb-muted);
	font-size: 14px;
	font-weight: 600;
	transition: box-shadow .2s ease, color .2s ease, background-color .2s ease;
}

.cb-pagination .page-numbers:hover {
	box-shadow: inset 0 0 0 1.5px var(--cb-blue);
	color: var(--cb-blue);
}

.cb-pagination .page-numbers.current {
	background: var(--cb-blue);
	box-shadow: none;
	color: var(--cb-white);
}

.cb-pagination .page-numbers.dots { background: none; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
	.cb-post-card,
	.cb-post-card__img { transition: none; }
	.cb-post-card:hover { transform: none; }
	.cb-post-card:hover .cb-post-card__img { transform: none; }
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 1199px) {
	.cb-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
	.cb-archive__title { font-size: 44px; line-height: 52px; }
	.cb-post-card--lead .cb-post-card__body { padding: 28px; }
	.cb-post-card--lead .cb-post-card__title { font-size: 24px; line-height: 32px; }
}

@media (max-width: 767px) {
	.cb-archive { padding-block: 32px 64px; }
	.cb-archive__head { margin-bottom: 32px; }
	.cb-archive__title { font-size: 30px; line-height: 38px; }
	.cb-archive__lead { font-size: 16px; line-height: 27px; }
	.cb-post-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
	.cb-post-card__body { padding: 20px; gap: 10px; }
	.cb-post-card__title { font-size: 18px; line-height: 26px; }

	/* Stacked on a phone: two columns leave neither the image nor the copy usable. */
	.cb-post-card.cb-post-card--lead { grid-template-columns: minmax(0, 1fr); margin-bottom: 20px; }
	.cb-post-card--lead .cb-post-card__media { aspect-ratio: 16 / 9; height: auto; }
	.cb-post-card--lead .cb-post-card__body { padding: 20px; }
	.cb-post-card--lead .cb-post-card__title { font-size: 20px; line-height: 28px; }
	.cb-post-card--lead .cb-post-card__excerpt { font-size: 15px; line-height: 24px; }
	.cb-archive__cats { gap: 8px; margin-bottom: 24px; }
	.cb-chip { padding: 8px 14px; font-size: 12px; }
}
