/**
 * 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; }
}

/* --- Wide banner header on a single promotion page ------------------------
   A 3.5:1 banner with the offer text overlaid as HTML, so the values stay
   editable and translatable. Falls back cleanly when only a card exists. --- */

.cp-banner {
	position: relative;
	width: 100%;
	overflow: hidden;
	margin-bottom: 28px;
	border-radius: 8px;
	background: #062E10;
}

.cp-banner img {
	width: 100%;
	height: auto;
	display: block;
	/* Cap the height so a very wide banner does not push the offer terms
	   below the fold on a large screen. */
	max-height: 420px;
	object-fit: cover;
	object-position: center;
}

.cp-banner__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	/* Scrim only on the left, so the artwork on the right stays visible. */
	background: linear-gradient(
		90deg,
		rgba(2, 24, 8, 0.88) 0%,
		rgba(2, 24, 8, 0.62) 34%,
		rgba(2, 24, 8, 0.08) 56%,
		rgba(2, 24, 8, 0) 70%
	);
}

/* Flex parent shrinks its child to content width; force full width so the
   copy pins left rather than centring. */
.cp-banner__overlay > * { width: 100%; }

.cp-banner__inner {
	padding: 24px clamp(20px, 5vw, 56px);
	max-width: 46%;
	margin-right: auto;
	color: #fff;
	text-align: left;
}

.cp-banner__kicker {
	margin: 0 0 6px;
	font-size: clamp(14px, 1.6vw, 18px);
	font-weight: 600;
	color: rgba(255, 255, 255, 0.9);
	line-height: 1.3;
}

.cp-banner__value {
	margin: 0 0 18px;
	font-size: clamp(24px, 3.6vw, 44px);
	font-weight: 800;
	line-height: 1.1;
	color: #fff;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.cp-banner__cta {
	display: inline-block;
	background: var(--wp--preset--color--action, #efbf01);
	color: #000;
	font-weight: 800;
	font-size: clamp(15px, 1.8vw, 19px);
	padding: clamp(12px, 1.6vw, 18px) clamp(28px, 4vw, 52px);
	border-radius: 8px;
	text-decoration: none;
	box-shadow: 0 4px 0 rgba(150, 110, 0, 0.5), 0 10px 26px rgba(0, 0, 0, 0.32);
	transition: transform 0.15s ease, filter 0.15s ease;
}

.cp-banner__cta:hover {
	filter: brightness(1.06);
	transform: translateY(-1px);
}

@media (max-width: 780px) {
	.cp-banner img { max-height: 260px; }
	.cp-banner__overlay {
		background: linear-gradient(
			180deg,
			rgba(2, 24, 8, 0.25) 0%,
			rgba(2, 24, 8, 0.82) 60%
		);
		align-items: flex-end;
	}
	.cp-banner__inner { max-width: 100%; padding: 18px 20px 22px; }
}

/* --- FAQ ------------------------------------------------------------------- */

.cp-faq { margin-block: 40px; }

.cp-faq__heading {
	font-size: clamp(20px, 3vw, 28px);
	font-weight: 700;
	margin: 0 0 18px;
}

.cp-faq__item {
	background: var(--wp--preset--color--surface, #fff);
	border: 1px solid var(--wp--preset--color--hairline, #e0e0e0);
	border-radius: 8px;
	margin-bottom: 8px;
	overflow: hidden;
}

.cp-faq__q {
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.4;
}

.cp-faq__q::-webkit-details-marker { display: none; }

.cp-faq__q::after {
	content: "+";
	flex: none;
	font-size: 22px;
	line-height: 1;
	font-weight: 400;
	color: var(--wp--preset--color--accent, #037e21);
	transition: transform 0.2s ease;
}

.cp-faq__item[open] .cp-faq__q::after { transform: rotate(45deg); }

.cp-faq__item[open] .cp-faq__q {
	border-bottom: 1px solid var(--wp--preset--color--hairline, #e0e0e0);
}

.cp-faq__a {
	padding: 16px 20px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--wp--preset--color--muted, #555);
}

.cp-faq__a p:last-child { margin-bottom: 0; }

.cp-faq__q:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, #037e21);
	outline-offset: -2px;
}

@media (max-width: 600px) {
	.cp-faq__q { padding: 14px 16px; font-size: 14px; }
	.cp-faq__a { padding: 14px 16px; }
}
