/*
 * Campaign card — shared by the archive/single templates AND the
 * Campaign Card / Campaign Grid Elementor widgets (charity_campaign_card_html()
 * in inc/campaigns.php emits this exact markup everywhere). Elementor-widget
 * usage adds its own {{WRAPPER}}-scoped style overrides on top of these
 * base rules; this file is what a plain (non-Elementor) archive page gets.
 */

/* Flexbox rather than CSS Grid, with each card's flex-basis computed to
   exactly 1/cols so every row lines up like a real grid.

   No `justify-content: center`: it centred a partial last row, which reads
   as a broken grid — a single leftover card floated to the middle of the
   row instead of sitting under the first column. Cards start from the
   leading edge and a short last row simply ends early, which is what a
   grid does. */
.charity-campaign-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: var(--charity-campaign-gap, 28px);
}
.charity-campaign-grid > .charity-campaign-card {
	box-sizing: border-box;
	flex: 0 1 calc((100% - (var(--charity-campaign-cols, 3) - 1) * var(--charity-campaign-gap, 28px)) / var(--charity-campaign-cols, 3));
	max-width: calc((100% - (var(--charity-campaign-cols, 3) - 1) * var(--charity-campaign-gap, 28px)) / var(--charity-campaign-cols, 3));
}

/* "Cards to Show" (widget's visible_count control) — purely visual hiding
   of extra cards past N, per breakpoint. Can't be generated from Elementor
   controls directly (its {{VALUE}} placeholder only substitutes on the
   declaration side of a rule, not inside a :nth-child() selector), so the
   widget outputs data-show-{device} attributes instead and these static
   rules do the hiding. Breakpoints match Elementor's own defaults
   (Mobile ≤767px, Tablet 768–1024px, Desktop ≥1025px). */
@media (min-width: 1025px) {
	.charity-campaign-grid[data-show-desktop="1"] > .charity-campaign-card:nth-child(n+2),
	.charity-campaign-grid[data-show-desktop="2"] > .charity-campaign-card:nth-child(n+3),
	.charity-campaign-grid[data-show-desktop="3"] > .charity-campaign-card:nth-child(n+4),
	.charity-campaign-grid[data-show-desktop="4"] > .charity-campaign-card:nth-child(n+5) {
		display: none;
	}
}
@media (min-width: 768px) and (max-width: 1024px) {
	.charity-campaign-grid[data-show-tablet="1"] > .charity-campaign-card:nth-child(n+2),
	.charity-campaign-grid[data-show-tablet="2"] > .charity-campaign-card:nth-child(n+3),
	.charity-campaign-grid[data-show-tablet="3"] > .charity-campaign-card:nth-child(n+4),
	.charity-campaign-grid[data-show-tablet="4"] > .charity-campaign-card:nth-child(n+5) {
		display: none;
	}
}
@media (max-width: 767px) {
	.charity-campaign-grid[data-show-mobile="1"] > .charity-campaign-card:nth-child(n+2),
	.charity-campaign-grid[data-show-mobile="2"] > .charity-campaign-card:nth-child(n+3),
	.charity-campaign-grid[data-show-mobile="3"] > .charity-campaign-card:nth-child(n+4),
	.charity-campaign-grid[data-show-mobile="4"] > .charity-campaign-card:nth-child(n+5) {
		display: none;
	}
}

.charity-campaign-list {
	display: flex;
	flex-direction: column;
	gap: 20px;
}
.charity-campaign-list .charity-campaign-card {
	flex-direction: row;
}
.charity-campaign-list .charity-campaign-card__media {
	width: 220px;
	flex-shrink: 0;
	aspect-ratio: auto;
}
.charity-campaign-list .charity-campaign-card__body {
	flex: 1;
}

.charity-campaign-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 20px 0 28px;
}
.charity-campaign-filter__pill {
	display: inline-flex;
	align-items: center;
	padding: 8px 18px;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	background: #fff;
	font-size: .875rem;
	font-weight: 600;
	color: #4b5563;
	text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.charity-campaign-filter__pill:hover {
	border-color: #2a6b56;
	color: #2a6b56;
}
.charity-campaign-filter__pill.is-active {
	background: #2a6b56;
	border-color: #2a6b56;
	color: #fff;
}

.charity-campaign-pagination {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 24px;
	font-size: 0.9375rem;
	font-weight: 600;
}
.charity-campaign-pagination a {
	color: #2a6b56;
	text-decoration: none;
}
.charity-campaign-pagination a:hover {
	text-decoration: none;
}
.charity-campaign-pagination span {
	color: #cdc9bd;
	cursor: default;
}

@media (max-width: 640px) {
	.charity-campaign-list .charity-campaign-card {
		flex-direction: column;
	}
	.charity-campaign-list .charity-campaign-card__media {
		width: 100%;
		aspect-ratio: 16 / 10;
	}
}

.charity-campaign-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow .2s ease, transform .2s ease;
}
.charity-campaign-card:hover {
	box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.charity-campaign-card__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	background: #f2f2f2;
	overflow: hidden;
}
.charity-campaign-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.charity-campaign-card__img--placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e4efe9, #cdd9d3);
}

.charity-campaign-card__body {
	padding: 18px 20px 22px;
	flex: 1;
}

/* .charity-campaign-card__rows is the actual flex-wrap container for the
   per-element "rows" (kept separate from __body, which only carries the
   Body Padding inset) — column gaps live as PADDING inside each row
   rather than a true CSS `gap`, with a matching negative margin here to
   cancel that padding back out at the left/right edges. This is the
   classic "Bootstrap grid" technique, deliberately NOT plain `gap`:
   with a true gap, two 50%-width rows need `50% + 50% + gap` of space,
   and once content can't shrink enough to absorb that overflow, the
   browser wraps the second row onto its own line instead of sitting
   beside the first. Padding-based gutters can't do that — 50% + 50%
   always equals exactly 100%, gap or no gap, so two 50/50 rows always
   stay side by side regardless of column spacing or element margins. */
.charity-campaign-card__rows {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	align-items: flex-start; /* Without this, two side-by-side rows (e.g. Category/Location) stretch to match whichever one is taller — e.g. Location wrapping to 2 lines would stretch the Category badge tall too. */
	row-gap: 10px;
	margin: 0 calc(var(--charity-card-col-gap, 16px) / -2);
}

.charity-campaign-card__row {
	display: flex;
	align-items: flex-start; /* Same reason, one level down: don't stretch this row's own single child (badge/text) to the row's full height. */
	min-width: 0;
	box-sizing: border-box;
	padding: 0 calc(var(--charity-card-col-gap, 16px) / 2);
}

.charity-campaign-card__title.charity-campaign-card__title {
	margin: 0;
	font-size: 1.125rem;
	line-height: 1.3;
}
.charity-campaign-card__title a {
	color: inherit;
	text-decoration: none;
	transition: color .2s ease;
}
.charity-campaign-card__title a:hover {
	text-decoration: none;
}

.charity-campaign-card__excerpt.charity-campaign-card__excerpt {
	margin: 0;
	font-size: .875rem;
	color: #6e6e73;
	line-height: 1.5;
}

.charity-campaign-card__category {
	display: inline-flex;
	align-items: center;
	padding: 5px 14px;
	border-radius: 999px;
	background: var(--charity-donate-bg, #e8722c);
	color: #fff;
	font-size: .75rem;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.charity-campaign-card__urgent {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 14px;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: .75rem;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.charity-campaign-card__urgent-icon {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}
.charity-campaign-card__urgent-icon i {
	font-size: 14px;
	color: currentColor;
}
.charity-campaign-card__urgent-icon svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
	stroke: currentColor;
}

.charity-campaign-card__location {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: .8125rem;
	font-weight: 600;
	color: #6e6e73;
	white-space: nowrap;
}
.charity-campaign-card__location-icon {
	display: inline-flex;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}
.charity-campaign-card__location-icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.charity-campaign-card__stat {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.charity-campaign-card__stat-label {
	font-size: .75rem;
	font-weight: 600;
	color: #8b8578;
}
.charity-campaign-card__stat-value {
	font-size: 1rem;
	font-weight: 700;
	color: var(--charity-campaign-fill, #2a6b56);
}

.charity-campaign-card__bar {
	width: 100%;
	height: 8px;
	border-radius: 999px;
	background: #eceae4;
	overflow: hidden;
	align-self: center;
}
.charity-campaign-card__bar-fill {
	height: 100%;
	border-radius: 999px;
	background: var(--charity-campaign-fill, #2a6b56);
	transition: width .4s ease;
}

/* Not used by the card anymore (see __stat/__stat-label/__stat-value
   above) — kept for single-charity_campaign.php's own hero stats panel,
   which renders its own markup with these classes directly rather than
   going through charity_campaign_card_html(). */
.charity-campaign-card__progress {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 4px;
}
.charity-campaign-card__stats {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: .875rem;
	font-weight: 600;
}
.charity-campaign-card__percent {
	color: var(--charity-campaign-fill, #2a6b56);
}
.charity-campaign-card__goal,
.charity-campaign-card__donors {
	font-size: .75rem;
	color: #8b8578;
}

/* Elements with "Overlay on Image" enabled float in one of the image's
   4 corners instead of flowing in the body — e.g. Category/Location
   badges shown directly on the photo. */
.charity-campaign-card__overlay {
	position: absolute;
	display: flex;
	flex-direction: column;
	gap: 6px;
	z-index: 2;
}
.charity-campaign-card__overlay--top-left {
	top: 12px;
	left: 12px;
	align-items: flex-start;
}
.charity-campaign-card__overlay--top-right {
	top: 12px;
	right: 12px;
	align-items: flex-end;
}
.charity-campaign-card__overlay--bottom-left {
	bottom: 12px;
	left: 12px;
	align-items: flex-start;
}
.charity-campaign-card__overlay--bottom-right {
	bottom: 12px;
	right: 12px;
	align-items: flex-end;
}


.charity-campaign-card__cta.charity-campaign-card__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 10px;
	padding: 11px 20px;
	border: none;
	border-radius: 999px;
	background: var(--charity-donate-bg, #e8722c);
	color: var(--charity-donate-color, #fff);
	font-family: inherit;
	font-weight: 600;
	font-size: .9375rem;
	text-decoration: none;
	cursor: pointer;
	transition: filter .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.charity-campaign-card__cta:hover {
	filter: brightness(1.08);
}

/* Shown instead of a live Donate button when a campaign's Status (Campaign
   Details → Settings) isn't Active — Upcoming/Ended/Paused campaigns
   shouldn't collect donations, so this reads as a plain label, not a
   clickable control. */
.charity-campaign-card__cta--disabled {
	background: #eceae4;
	color: #767b7f;
	cursor: default;
	pointer-events: none;
}
.charity-campaign-card__cta--disabled:hover {
	filter: none;
}

/* ── Sticky Donate Bar (Customizer → Fundraising → Sticky Donate Bar) —
   slides in from the bottom once assets/js/sticky-donate.js detects the
   main Donate button (in the hero) has scrolled out of view. ── */
.charity-sticky-donate {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 200;
	background: var(--charity-sticky-bg, #ffffff);
	color: var(--charity-sticky-text, #1d2327);
	box-shadow: 0 -6px 24px rgba(0, 0, 0, .12);
	transform: translateY(100%);
	transition: transform .25s ease;
	padding: 12px 20px;
}
.charity-sticky-donate.is-visible {
	transform: translateY(0);
}
.charity-sticky-donate__inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.charity-sticky-donate__info {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.charity-sticky-donate__title {
	font-weight: 600;
	font-size: .9375rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.charity-sticky-donate__progress {
	display: flex;
	align-items: center;
	gap: 8px;
}
.charity-sticky-donate__bar {
	width: 120px;
	height: 5px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .08);
	overflow: hidden;
}
.charity-sticky-donate__bar-fill {
	height: 100%;
	border-radius: 999px;
	background: var(--charity-sticky-btn-bg, #e8722c);
}
.charity-sticky-donate__percent {
	font-size: .75rem;
	opacity: .75;
	white-space: nowrap;
}
.charity-sticky-donate__cta.charity-sticky-donate__cta {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 22px;
	border: none;
	border-radius: 999px;
	background: var(--charity-sticky-btn-bg, #e8722c);
	color: var(--charity-sticky-btn-color, #fff);
	font-family: inherit;
	font-weight: 600;
	font-size: .9375rem;
	text-decoration: none;
	cursor: pointer;
}
.charity-sticky-donate__cta:hover {
	filter: brightness(1.08);
}
@media (max-width: 560px) {
	.charity-sticky-donate__progress {
		display: none;
	}
	.charity-sticky-donate__title {
		font-size: .875rem;
	}
}

/* ── Campaign Story (Problem / Solution / How Donations Help) ── */
.charity-campaign-single__story {
	margin: 32px 0;
}
.charity-campaign-single__story-title.charity-campaign-single__story-title {
	margin: 0 0 12px;
	font-size: 1.375rem;
}
.charity-campaign-single__story-body p:first-child {
	margin-top: 0;
}
.charity-campaign-single__story-body p:last-child {
	margin-bottom: 0;
}

/* ── Impact & Transparency ── */
.charity-campaign-single__impact {
	margin: 32px 0;
}
.charity-campaign-single__impact-title.charity-campaign-single__impact-title {
	margin: 0 0 18px;
	font-size: 1.375rem;
}
.charity-campaign-single__impact-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 20px;
}
.charity-campaign-single__impact-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 18px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	text-align: center;
}
.charity-campaign-single__impact-number {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--charity-campaign-fill, #2a6b56);
}
.charity-campaign-single__impact-label {
	font-size: .875rem;
	color: #6b7280;
}

/* ── Recent Donors ── */
.charity-campaign-single__donors {
	margin-top: 40px;
}
.charity-campaign-single__donors-title.charity-campaign-single__donors-title {
	margin: 0 0 18px;
	font-size: 1.375rem;
}
.charity-recent-donors__empty {
	color: #767b7f;
	font-size: .9375rem;
}
.charity-recent-donors__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.charity-recent-donors__item {
	display: flex;
	align-items: center;
	gap: 12px;
}
.charity-recent-donors__avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background: #eceae4;
	color: #2a6b56;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: .9375rem;
}
.charity-recent-donors__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.charity-recent-donors__name {
	font-weight: 600;
	font-size: .9375rem;
	color: #1d1d1f;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.charity-recent-donors__date {
	font-size: .8125rem;
	color: #8b8578;
}
.charity-recent-donors__amount {
	flex-shrink: 0;
	font-weight: 700;
	font-size: .9375rem;
	color: #2a6b56;
}

/* Icon inside the Donate button — sized to match the text and always
   recolored to the button's own text color, whether it's a Font Awesome
   glyph (already follows `color` natively) or an inlined uploaded SVG
   (needs `fill`/`stroke` forced explicitly — see charity_render_icon_inline()
   in inc/campaigns.php for why it's inlined rather than an <img>). */
.charity-campaign-card__cta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
}
.charity-campaign-card__cta-icon i {
	font-size: 1em;
	color: currentColor;
}
.charity-campaign-card__cta-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor !important;
	stroke: currentColor !important;
}
.charity-campaign-card__cta-icon svg * {
	fill: currentColor !important;
	stroke: currentColor !important;
}

/* ── Single campaign page ── */
.charity-campaign-single__hero {
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	gap: 40px;
	align-items: start;
	margin-bottom: 40px;
}
.charity-campaign-single__media img {
	width: 100%;
	border-radius: 16px;
	display: block;
}
.charity-campaign-single__panel {
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 24px;
}
.charity-campaign-single__organizer.charity-campaign-single__organizer {
	margin: 6px 0 0;
	font-size: .875rem;
	color: #6b7280;
}
.charity-campaign-single__deadline.charity-campaign-single__deadline {
	margin: 10px 0 0;
	font-size: .8125rem;
	color: #8b8578;
}

.charity-campaign-single__video {
	margin: 32px 0;
	aspect-ratio: 16 / 9;
	border-radius: 16px;
	overflow: hidden;
	background: #f2f2f2;
}
.charity-campaign-single__video iframe,
.charity-campaign-single__video embed,
.charity-campaign-single__video object {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}
.charity-campaign-single__video-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #2a6b56;
	font-weight: 600;
	text-decoration: none;
}
.charity-campaign-single__video-link:hover {
	text-decoration: underline;
}

.charity-campaign-single__gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
	margin: 32px 0;
}
.charity-campaign-single__gallery-item {
	display: block;
	aspect-ratio: 1;
	border-radius: 10px;
	overflow: hidden;
}
.charity-campaign-single__gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .2s ease;
}
.charity-campaign-single__gallery-item:hover img {
	transform: scale(1.05);
}

@media (max-width: 860px) {
	.charity-campaign-grid {
		--charity-campaign-cols: var(--charity-campaign-cols-tablet, 2);
	}
	.charity-campaign-single__hero {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 560px) {
	.charity-campaign-grid {
		--charity-campaign-cols: 1;
	}
}
