/*
 * Blog post layouts.
 *
 * Four shapes off one markup structure — the layout class on the wrapper is
 * the only difference — so a post card looks the same wherever it appears and
 * switching layout in Elementor never changes the styling of the card itself.
 *
 * Colours come from custom properties the widget's Style tab writes to, and
 * fall back to the theme's tokens when nothing is set.
 */

.csk-posts {
	--csk-surface: #ffffff;
	--csk-ink: var(--ch-ink, #0f172a);
	--csk-body: #334155;
	--csk-muted: var(--ch-muted, #64748b);
	--csk-accent: var(--ch-brand, #0b5ea8);
	--csk-line: var(--ch-line, #e2e8f0);

	display: grid;
	gap: 24px;
}

.csk-post {
	--csk-radius: 10px;

	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--csk-surface);
	border: 1px solid var(--csk-line);
	border-radius: var(--csk-radius);
	overflow: hidden;
	/* Border and shadow only — a transform would shift the grid on hover. */
	transition: border-color .18s ease, box-shadow .18s ease;
}

.csk-post:hover {
	border-color: color-mix(in srgb, var(--csk-accent) 40%, var(--csk-line));
	box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.csk-post-thumb {
	display: block;
	aspect-ratio: 1 / .62;
	overflow: hidden;
	background: color-mix(in srgb, var(--csk-line) 60%, transparent);
}

.csk-post-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.csk-post-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px 20px 20px;
	flex: 1 1 auto;
}

.csk-post-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: .78rem;
	color: var(--csk-muted);
}

.csk-post-cat {
	color: var(--csk-accent);
	text-decoration: none;
	font-weight: 600;
}
.csk-post-cat:hover { text-decoration: underline; }
.csk-dot { color: var(--csk-line); }

.csk-post-title {
	margin: 0;
	font-size: 1.12rem;
	line-height: 1.35;
	font-weight: 650;
	text-wrap: balance;
}

.csk-post-title a {
	color: var(--csk-ink);
	text-decoration: none;
}
.csk-post-title a:hover { color: var(--csk-accent); }

.csk-post-excerpt {
	margin: 0;
	color: var(--csk-body);
	font-size: .92rem;
	line-height: 1.6;
}

.csk-post-more {
	margin-top: auto;
	padding-top: 4px;
	align-self: flex-start;
	color: var(--csk-accent);
	font-size: .88rem;
	font-weight: 600;
	text-decoration: none;
}
.csk-post-more:hover { text-decoration: underline; }

.csk-post-more::after {
	content: " →";
	/* Keeps the arrow from wrapping onto its own line. */
	white-space: nowrap;
}

/* --- Grid --------------------------------------------------------------- */

.csk-posts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* --- List --------------------------------------------------------------- */

.csk-posts-list { grid-template-columns: minmax(0, 1fr); }

.csk-posts-list .csk-post { flex-direction: row; align-items: stretch; }

.csk-posts-list .csk-post-thumb {
	flex: 0 0 34%;
	aspect-ratio: auto;
	min-height: 100%;
}

/* --- Spotlight ---------------------------------------------------------- */

.csk-posts-spotlight { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.csk-posts-spotlight .csk-post.is-lead {
	grid-column: span 2;
	grid-row: span 2;
}

.csk-posts-spotlight .csk-post.is-lead .csk-post-title {
	font-size: 1.6rem;
	line-height: 1.25;
}

.csk-posts-spotlight .csk-post.is-lead .csk-post-thumb { aspect-ratio: 1 / .5; }

/* --- Minimal ------------------------------------------------------------ */

.csk-posts-minimal {
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
}

.csk-posts-minimal .csk-post {
	border: 0;
	border-bottom: 1px solid var(--csk-line);
	border-radius: 0;
	background: none;
}
.csk-posts-minimal .csk-post:last-child { border-bottom: 0; }
.csk-posts-minimal .csk-post:hover { box-shadow: none; }
.csk-posts-minimal .csk-post-body { padding: 14px 0; gap: 4px; }

.csk-posts-minimal .csk-post-title { font-size: 1rem; }

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

@media (max-width: 1024px) {
	.csk-posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.csk-posts-spotlight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.csk-posts-spotlight .csk-post.is-lead { grid-column: span 2; grid-row: auto; }
}

@media (max-width: 767px) {
	.csk-posts-grid,
	.csk-posts-spotlight { grid-template-columns: minmax(0, 1fr); }
	.csk-posts-spotlight .csk-post.is-lead { grid-column: auto; }

	/* Side-by-side becomes unreadable on a phone. */
	.csk-posts-list .csk-post { flex-direction: column; }
	.csk-posts-list .csk-post-thumb { flex: none; aspect-ratio: 1 / .55; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.csk-post { transition: none; }
}

.csk-empty {
	padding: 24px;
	text-align: center;
	border: 1px dashed var(--csk-line);
	border-radius: 8px;
	color: var(--csk-muted);
	font-size: .9rem;
}

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

.csk-pagination { margin-top: 32px; }
.csk-pagination ul {
	display: flex; flex-wrap: wrap; gap: 6px;
	list-style: none; margin: 0; padding: 0; justify-content: center;
}
.csk-pagination li { margin: 0; }
.csk-pagination a,
.csk-pagination span {
	display: flex; align-items: center; justify-content: center;
	/* 44px is the minimum comfortable touch target; page numbers are the
	   easiest thing in a blog to make too small to hit. */
	min-width: 44px; min-height: 44px; padding: 0 12px;
	border: 1px solid var(--csk-line, #e2e8f0);
	border-radius: 6px; text-decoration: none;
	font-size: 14px; line-height: 1;
	color: var(--csk-ink, #0f172a);
	background: var(--csk-surface, #fff);
	transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.csk-pagination a:hover { border-color: var(--csk-accent, #0b5ea8); color: var(--csk-accent, #0b5ea8); }
.csk-pagination a:focus-visible {
	outline: 2px solid var(--csk-accent, #0b5ea8); outline-offset: 2px;
}
.csk-pagination .current {
	background: var(--csk-accent, #0b5ea8);
	border-color: var(--csk-accent, #0b5ea8);
	color: var(--csk-accent-ink, #fff);
	font-weight: 600;
}
.csk-pagination .dots { border-color: transparent; background: none; }

@media (prefers-reduced-motion: reduce) {
	.csk-pagination a { transition: none; }
}
