/**
 * Campaign Grid — block styles.
 *
 * Uses --ambh-cg-columns custom property (set inline by Block.php) to drive
 * the CSS Grid column count. Mirrors the FundraiserGrid card design language.
 *
 * @package AmbassadorHub\Campaigns\Blocks\CampaignGrid
 */

/* ── Editor canvas preview ─────────────────────────────────────────────── */

.ambh-campaign-grid.ambh-block-preview {
	padding: 2rem;
	background: #f0f0f1;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-align: center;
}

/* ── Grid layout ────────────────────────────────────────────────────────── */

.ambh-campaign-grid {
	display: grid;
	grid-template-columns: repeat( var( --ambh-cg-columns, 3 ), 1fr );
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media ( max-width: 768px ) {
	.ambh-campaign-grid {
		grid-template-columns: repeat( min( var( --ambh-cg-columns, 3 ), 2 ), 1fr );
	}
}

@media ( max-width: 480px ) {
	.ambh-campaign-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.ambh-cg-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--ambh-border-color, #e0e0e0);
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.ambh-cg-card:hover {
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -2px );
}

.ambh-cg-card__link {
	display: flex;
	flex-direction: column;
	flex: 1;
	text-decoration: none;
	color: inherit;
}

.ambh-cg-card__link:hover,
.ambh-cg-card__link:focus {
	text-decoration: none;
	color: inherit;
}

/* ── Card image ─────────────────────────────────────────────────────────── */

.ambh-cg-card__image img,
.ambh-cg-card__placeholder {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.ambh-cg-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ambh-bg-subtle, #f0f0f1);
	color: var(--ambh-text-muted, #a7aaad);
}

.ambh-cg-card__placeholder svg {
	width: 3rem;
	height: 3rem;
}

/* ── Card body ──────────────────────────────────────────────────────────── */

.ambh-cg-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 1rem;
	gap: 0.5rem;
}

.ambh-cg-card__title {
	margin: 0;
	font-size: var(--ambh-font-base, 1rem);
	font-weight: 600;
	line-height: 1.4;
}

/* ── Status badge ───────────────────────────────────────────────────────── */

.ambh-cg-card__badge {
	display: inline-block;
	padding: 0.15em 0.55em;
	border-radius: 3px;
	font-size: var(--ambh-font-xs, 0.75rem);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	align-self: flex-start;
}

.ambh-cg-card__badge--ended {
	background: #f0f0f1;
	color: #50575e;
}

/* ── Stats row ──────────────────────────────────────────────────────────── */

.ambh-cg-card__stats {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
	font-size: var(--ambh-font-sm, 0.875rem);
}

.ambh-cg-card__raised {
	font-weight: 600;
	color: var(--ambh-text-color, #1e1e1e);
}

.ambh-cg-card__target {
	color: var(--ambh-text-muted, #646970);
}

/* ── Progress bar ───────────────────────────────────────────────────────── */

.ambh-cg-card__progress {
	height: 6px;
	border-radius: 3px;
	background: var(--ambh-border-color, #e0e0e0);
	overflow: hidden;
	margin-top: auto;
}

.ambh-cg-card__progress-fill {
	height: 100%;
	border-radius: 3px;
	background: var(--ambh-color-progress, #00a32a);
	transition: width 0.3s ease;
	min-width: 2px;
}
