/**
 * Promotions grid.
 *
 * Colours come from the active theme's palette variables with neutral
 * fallbacks, so the plugin reskins with the theme rather than fighting it.
 */

.cp-grid {
	display: grid;
	grid-template-columns: repeat(var(--cp-cols, 3), 1fr);
	gap: var(--wp--preset--spacing--30, 20px);
}

.cp-card {
	display: flex;
	flex-direction: column;
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--hairline, #e0e0e0);
	border-radius: 8px;
	overflow: hidden;
}

.cp-card:hover { border-color: var(--wp--preset--color--accent, #037e21); }

.cp-card__media { display: block; }

.cp-card__media img {
	width: 100%;
	/* 414 x 243 — the source banner ratio. */
	aspect-ratio: 414 / 243;
	object-fit: cover;
	display: block;
}

.cp-card__placeholder {
	display: block;
	aspect-ratio: 414 / 243;
	background: repeating-linear-gradient(
		45deg,
		var(--wp--preset--color--hairline, #e0e0e0),
		var(--wp--preset--color--hairline, #e0e0e0) 10px,
		transparent 10px,
		transparent 20px
	);
}

.cp-card__body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.cp-card__title {
	margin: 0 0 4px;
	font-size: 16px;
	line-height: 1.3;
}

.cp-card__title a { text-decoration: none; }

.cp-card__value {
	margin: 0 0 8px;
	font-weight: 700;
	font-size: 20px;
	color: var(--wp--preset--color--accent, #037e21);
}

.cp-card__terms {
	margin: 0 0 12px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--wp--preset--color--muted, #666);
}

.cp-card__actions {
	margin-top: auto;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.cp-btn {
	display: inline-block;
	padding: 10px 22px;
	border-radius: 8px;
	background: var(--wp--preset--color--action, #efbf01);
	color: #000;
	font-weight: 700;
	font-size: 14px;
	text-decoration: none;
}

.cp-btn:hover { filter: brightness(1.05); }

.cp-link { font-size: 13px; }

.cp-card__expiry {
	margin: 10px 0 0;
	font-size: 11px;
	color: var(--wp--preset--color--muted, #666);
}

.cp-expired {
	display: block;
	padding: 14px 16px;
	margin-bottom: 24px;
	border-radius: 8px;
	border: 1px solid #f0c0c0;
	background: #fdf0f0;
	color: #8a2020;
	font-size: 14px;
}

.cp-empty {
	padding: 24px;
	border: 1px dashed var(--wp--preset--color--hairline, #ccc);
	border-radius: 8px;
	color: var(--wp--preset--color--muted, #666);
}

@media (max-width: 900px) {
	.cp-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
	.cp-grid { grid-template-columns: 1fr; }
}
