/*
 * Event card — shared by the archive/single templates AND the Event Card /
 * Events List Elementor widgets (charity_event_card_html() in
 * inc/events.php emits this exact markup everywhere). This file is the
 * plain (non-Elementor) fallback styling; the widgets add their own
 * {{WRAPPER}}-scoped Style-tab overrides on top.
 */

/* Flexbox rather than CSS Grid: a fixed-column grid leaves a partial last
   row (e.g. 3 items over 2 columns) pinned to the left with an awkward gap
   beside it. Flexbox with `justify-content: center` automatically centers
   that leftover row instead, while every full row still looks identical
   to a real grid (each card's flex-basis is computed to exactly 1/cols). */
.charity-event-grid {
	display: flex;
	flex-wrap: wrap;	
	gap: var(--charity-event-gap, 28px);
}
.charity-event-grid > .charity-event-card {
	box-sizing: border-box;
	flex: 0 1 calc((100% - (var(--charity-event-cols, 3) - 1) * var(--charity-event-gap, 28px)) / var(--charity-event-cols, 3));
	max-width: calc((100% - (var(--charity-event-cols, 3) - 1) * var(--charity-event-gap, 28px)) / var(--charity-event-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-event-grid[data-show-desktop="1"] > .charity-event-card:nth-child(n+2),
	.charity-event-grid[data-show-desktop="2"] > .charity-event-card:nth-child(n+3),
	.charity-event-grid[data-show-desktop="3"] > .charity-event-card:nth-child(n+4),
	.charity-event-grid[data-show-desktop="4"] > .charity-event-card:nth-child(n+5) {
		display: none;
	}
}
@media (min-width: 768px) and (max-width: 1024px) {
	.charity-event-grid[data-show-tablet="1"] > .charity-event-card:nth-child(n+2),
	.charity-event-grid[data-show-tablet="2"] > .charity-event-card:nth-child(n+3),
	.charity-event-grid[data-show-tablet="3"] > .charity-event-card:nth-child(n+4),
	.charity-event-grid[data-show-tablet="4"] > .charity-event-card:nth-child(n+5) {
		display: none;
	}
}
@media (max-width: 767px) {
	.charity-event-grid[data-show-mobile="1"] > .charity-event-card:nth-child(n+2),
	.charity-event-grid[data-show-mobile="2"] > .charity-event-card:nth-child(n+3),
	.charity-event-grid[data-show-mobile="3"] > .charity-event-card:nth-child(n+4),
	.charity-event-grid[data-show-mobile="4"] > .charity-event-card:nth-child(n+5) {
		display: none;
	}
}

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

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

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

.charity-event-card__date-badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
	line-height: 1.1;
}
.charity-event-card__date-day {
	font-size: 1.125rem;
	font-weight: 700;
	color: #1d1d1f;
}
.charity-event-card__date-month {
	font-size: .6875rem;
	font-weight: 600;
	text-transform: uppercase;
	color: #e8722c;
}

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

/* .charity-event-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. Same "Bootstrap
   grid" gutter technique as the Campaign Card, so two 50%-width rows
   (e.g. Joined Count + Button) always stay side by side regardless of
   column spacing or per-element margins. */
.charity-event-card__rows {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	align-items: flex-start;
	row-gap: 8px;
	margin: 0 calc(var(--charity-event-card-col-gap, 16px) / -2);
}

.charity-event-card__row {
	display: flex;
	align-items: flex-start;
	min-width: 0;
	box-sizing: border-box;
	padding: 0 calc(var(--charity-event-card-col-gap, 16px) / 2);
}


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

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

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

.charity-event-card__meta {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.charity-event-card__meta-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: .8125rem;
	color: #6e6e73;
}
.charity-event-card__meta-icon {
	display: inline-flex;
	color: #2a6b56;
	flex-shrink: 0;
}
.charity-event-card__meta-icon svg {
	display: block;
}

.charity-event-card__cta--button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	margin-top: 8px;
	padding: 11px 20px;
	border-radius: 999px;
	background: #e8722c;
	color: #fff;
	font-weight: 600;
	font-size: .9375rem;
	text-decoration: none;
	transition: filter .15s ease;
}
.charity-event-card__cta--button:hover {
	filter: brightness(1.08);
}

.charity-event-card__divider-el {
	display: block;
	width: 100%;
	height: 1px;
	background: #e5e7eb;
}

.charity-event-card__joined {
	font-size: .8125rem;
	color: #6e6e73;
}

.charity-event-card__cta--link {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-top: 0;
	padding: 0;
	background: none;
	border-radius: 0;
	color: #163F36;
	font-weight: 700;
	font-size: .9375rem;
	text-decoration: none;
	transition: color .15s ease;
}
.charity-event-card__cta--link:hover {
	filter: none;
	text-decoration: none;
}
.charity-event-card__cta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
}
.charity-event-card__cta-icon i {
	font-size: 1em;
	color: currentColor;
}
.charity-event-card__cta-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor !important;
	stroke: currentColor !important;
}
.charity-event-card__cta-icon svg * {
	fill: currentColor !important;
	stroke: currentColor !important;
}

.charity-event-card__cta-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 1.25em;
	line-height: 1;
}
.charity-event-card__cta-arrow i {
	font-size: 1em;
	color: currentColor;
}
.charity-event-card__cta-arrow svg {
	width: 1em;
	height: 1em;
	fill: currentColor !important;
	stroke: currentColor !important;
}
.charity-event-card__cta-arrow svg * {
	fill: currentColor !important;
	stroke: currentColor !important;
}

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

/* ── Single event page ── */
.charity-event-single__hero {
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	gap: 40px;
	align-items: start;
	margin-bottom: 40px;
}
.charity-event-single__media img {
	width: 100%;
	border-radius: 16px;
	display: block;
}
.charity-event-single__panel {
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 24px;
}

@media (max-width: 860px) {
	.charity-event-grid {
		--charity-event-cols: var(--charity-event-cols-tablet, 2);
	}
	.charity-event-single__hero {
		grid-template-columns: 1fr;
	}
	.charity-event-list .charity-event-card {
		flex-direction: column;
	}
	.charity-event-list .charity-event-card__media {
		width: 100%;
		aspect-ratio: 16 / 10;
	}
}

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

/* ── Single event: organizer, story, video, gallery, highlight stats ──
   Mirrors the campaign single (assets/css/campaigns.css) so an event page
   built from the same fields reads as the same family of page. Elementor
   Theme Builder templates use the widgets instead and never see these. */
.charity-event-single__organizer.charity-event-single__organizer {
	margin: 6px 0 0;
	font-size: .875rem;
	color: #6b7280;
}

.charity-event-single__story {
	margin: 32px 0;
}
.charity-event-single__story-title.charity-event-single__story-title {
	margin: 0 0 12px;
	font-size: 1.375rem;
}
.charity-event-single__story-body p:first-child {
	margin-top: 0;
}
.charity-event-single__story-body p:last-child {
	margin-bottom: 0;
}

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

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

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