/* KDLX Home Sections — post card grid */

.kdlx-home-section {
	margin-bottom: 2.5em;
}

.kdlx-home-section-heading {
	font-size: 1.5rem;
	font-weight: 700;
	text-transform: uppercase;
	margin-bottom: 0.8em;
	padding-bottom: 0.4em;
	position: relative;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5em;
}

/* Accent underline — width/color/thickness are CSS vars so the
   Customizer can tune it per section. */
.kdlx-home-section-heading::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	height: var(--kdlx-hlt, 2px);
	width: var(--kdlx-hlw, 100%);
	background: var(--kdlx-hlc, #1e73be);
}

.kdlx-hl-none .kdlx-home-section-heading::after {
	display: none;
}

/* "Title width" modes hang the line under the title element instead. */
.kdlx-hl-title .kdlx-home-section-heading::after {
	display: none;
}

.kdlx-hl-title .kdlx-home-section-heading > a:first-child,
.kdlx-hl-title .kdlx-home-section-heading > span {
	position: relative;
}

.kdlx-hl-title .kdlx-home-section-heading > a:first-child::after,
.kdlx-hl-title .kdlx-home-section-heading > span::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -4px;
	height: var(--kdlx-hlt, 2px);
	width: var(--kdlx-hlw, 100%);
	background: var(--kdlx-hlc, #1e73be);
}

/* "View all" link visibility. */
.kdlx-val-none .kdlx-home-section-more {
	display: none;
}

@media (max-width: 576px) {
	.kdlx-val-desktop .kdlx-home-section-more {
		display: none;
	}
}

.kdlx-home-section-heading a {
	color: inherit;
	text-decoration: none;
}

.kdlx-home-section-heading a:hover {
	color: var(--accent);
	text-decoration: none;
}

.kdlx-home-section-more {
	font-size: 0.75rem;
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
	opacity: 0.8;
}

.kdlx-post-cards {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
}

.kdlx-post-cards-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.kdlx-post-cards-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.kdlx-post-cards-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

.kdlx-post-cards-cols-5 {
	grid-template-columns: repeat(5, 1fr);
}

.kdlx-post-cards-cols-6 {
	grid-template-columns: repeat(6, 1fr);
}

.kdlx-post-card-image {
	margin-bottom: 0.5em;
	overflow: hidden;
}

.kdlx-post-card-image img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease;
}

.kdlx-post-card:hover .kdlx-post-card-image img {
	transform: scale(1.03);
}

.kdlx-post-card-title {
	font-size: 1rem;
	line-height: 1.35;
	margin: 0 0 0.3em;
	font-weight: 600;
}

.kdlx-post-card .kdlx-post-card-title a {
	color: inherit;
	text-decoration: none;
}

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

.kdlx-post-card-meta {
	font-size: 0.8rem;
	opacity: 0.75;
}

.kdlx-post-card-excerpt {
	margin-top: 0.5em;
	font-size: 0.9em;
	opacity: 0.8;
	line-height: 1.5;
}

@media (max-width: 992px) {
	.kdlx-post-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 576px) {
	.kdlx-post-cards {
		grid-template-columns: 1fr;
	}
}

/* Per-device grid overrides — Customizer "columns/posts on tablet|mobile"
   settings emit these classes; '' (Same as desktop) emits nothing. */
@media (max-width: 992px) {
	.kdlx-post-cards.kdlx-cols-t-1 { grid-template-columns: 1fr; }
	.kdlx-post-cards.kdlx-cols-t-2 { grid-template-columns: repeat(2, 1fr); }
	.kdlx-post-cards.kdlx-cols-t-3 { grid-template-columns: repeat(3, 1fr); }
	.kdlx-post-cards.kdlx-cols-t-4 { grid-template-columns: repeat(4, 1fr); }
	.kdlx-post-cards.kdlx-cols-t-5 { grid-template-columns: repeat(5, 1fr); }
	.kdlx-post-cards.kdlx-cols-t-6 { grid-template-columns: repeat(6, 1fr); }

	.kdlx-hide-t { display: none !important; }
}

@media (max-width: 576px) {
	.kdlx-post-cards.kdlx-cols-m-1 { grid-template-columns: 1fr; }
	.kdlx-post-cards.kdlx-cols-m-2 { grid-template-columns: repeat(2, 1fr); }
	.kdlx-post-cards.kdlx-cols-m-3 { grid-template-columns: repeat(3, 1fr); }
	.kdlx-post-cards.kdlx-cols-m-4 { grid-template-columns: repeat(4, 1fr); }
	.kdlx-post-cards.kdlx-cols-m-5 { grid-template-columns: repeat(5, 1fr); }
	.kdlx-post-cards.kdlx-cols-m-6 { grid-template-columns: repeat(6, 1fr); }

	.kdlx-hide-m { display: none !important; }
}

/* Mobile card-look overrides — set via Customizer "Mobile grid look"
   controls; emitted as scoped CSS vars/classes on the grid wrapper so
   the same markup restyles itself at the breakpoint. The [style*=]
   attribute + descendant selectors outrank the dynamic inline CSS. */
@media (max-width: 576px) {
	.kdlx-post-cards[style*="--kdlx-pcr-m"] .kdlx-post-card-image img {
		aspect-ratio: var(--kdlx-pcr-m);
		object-fit: cover;
		width: 100%;
		display: block;
	}

	.kdlx-post-cards[style*="--kdlx-pcl-m"] .kdlx-post-card-title {
		display: -webkit-box;
		-webkit-line-clamp: var(--kdlx-pcl-m);
		-webkit-box-orient: vertical;
		overflow: hidden;
		min-height: calc(var(--kdlx-pcl-m) * 1.3em);
		min-height: calc(var(--kdlx-pcl-m) * 1lh);
	}

	.kdlx-post-cards.kdlx-nodate-m .kdlx-post-card-date { display: none; }
	.kdlx-post-cards.kdlx-noexc-m .kdlx-post-card-excerpt { display: none; }

	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card {
		background: #fff;
		border: 1px solid rgba(0, 0, 0, .09);
		border-radius: 12px;
		overflow: hidden;
		box-shadow: 0 1px 4px rgba(0, 0, 0, .07);
		display: flex;
		flex-direction: column;
	}

	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-image { margin: 0; }
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-image img { border-radius: 0; }
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-title,
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-meta,
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-excerpt { padding-left: 1em; padding-right: 1em; }
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-title { margin-top: .75em; }
	.kdlx-post-cards.kdlx-cs-m-1 .kdlx-post-card .kdlx-post-card-meta { margin-bottom: 1em; }

	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card {
		background: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		display: block;
	}

	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card .kdlx-post-card-image { margin-bottom: .5em; }
	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card .kdlx-post-card-title,
	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card .kdlx-post-card-meta,
	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card .kdlx-post-card-excerpt { padding: 0; }
	.kdlx-post-cards.kdlx-cs-m-0 .kdlx-post-card .kdlx-post-card-meta { margin-bottom: 0; }
}

@media (max-width: 992px) {
	.kdlx-post-cards[style*="--kdlx-pcr-t"] .kdlx-post-card-image img {
		aspect-ratio: var(--kdlx-pcr-t);
		object-fit: cover;
		width: 100%;
		display: block;
	}

	.kdlx-post-cards[style*="--kdlx-pcl-t"] .kdlx-post-card-title {
		display: -webkit-box;
		-webkit-line-clamp: var(--kdlx-pcl-t);
		-webkit-box-orient: vertical;
		overflow: hidden;
		min-height: calc(var(--kdlx-pcl-t) * 1.3em);
		min-height: calc(var(--kdlx-pcl-t) * 1lh);
	}

	.kdlx-post-cards.kdlx-nodate-t .kdlx-post-card-date { display: none; }
}
