/**
 * Columns block style "Donation" (SANKLUKA_0001-13).
 *
 * Two-column layout: image (Cover block) in the first column, the
 * OnlineFundraising (OF) form in the second. Plain CSS on purpose — it is
 * loaded on its own (only when the style is used), not through the webpack bundle.
 */

/* OF injects its iframe into #fund. Undo the theme's global iframe rule
   (max-width + vertical margins from components/embed.css). Height is set
   by OF's bundled iframe-resizer, so never fix it here. */
#fund iframe {
	display: block;
	width: 100% !important;
	max-width: none;
	margin: 0;
	border: 0;
}

/* The "basic" hero renders no visible content (its H1 is visually hidden) but
   adds ~175px of padding/margin. On donation pages collapse it so the form
   starts right under the breadcrumb bar; the hidden H1 stays in the DOM. */
.has-donation-layout .hero.hero-layout--basic {
	min-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	margin-bottom: 0;
}

.wp-block-columns.is-style-donation {
	gap: var(--spacing-4, 2.5rem);
	align-items: stretch;
	margin-top: var(--spacing-5, 3.125rem);
	margin-bottom: var(--spacing-4, 2.5rem);
}

/* The theme's alignwide keeps a 680px text column with a big right padding
   (container-content-page mixin). For the donation layout use the full page
   width, centred, so the form column gets ~550px on desktop. */
.wp-block-columns.alignwide.is-style-donation {
	max-width: calc(var(--max-width-content-page, 70.625rem) + (2 * var(--spacing-2, 1.25rem)));
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--spacing-2, 1.25rem);
	padding-right: var(--spacing-2, 1.25rem);
}

/* Image column: the Cover fills the column height, so it always matches the
   form, whatever step OF is on. */
.wp-block-columns.is-style-donation > .wp-block-column:first-child {
	display: flex;
	flex-direction: column;
}

.wp-block-columns.is-style-donation > .wp-block-column:first-child > .wp-block-cover,
.wp-block-columns.is-style-donation > .wp-block-column:first-child > .wp-block-image {
	flex: 1 1 auto;
	margin: 0;
}

/* Fallback if an editor uses a plain Image block instead of a Cover. */
.wp-block-columns.is-style-donation > .wp-block-column:first-child > .wp-block-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wp-block-columns.is-style-donation > .wp-block-column:last-child {
	min-width: 0;
}

/* Below core's column breakpoint (782px) the columns stack:
   form first (80% of donations are on mobile), image as a short banner after it. */
@media (max-width: 781.98px) {
	.wp-block-columns.is-style-donation {
		gap: var(--spacing-3, 1.875rem);
		margin-top: var(--spacing-3, 1.875rem);
	}

	.wp-block-columns.is-style-donation > .wp-block-column:last-child {
		order: -1;
	}

	.wp-block-columns.is-style-donation > .wp-block-column:first-child > .wp-block-cover {
		/* !important beats the Cover's inline styles (min-height:480px; aspect-ratio:unset). */
		min-height: 0 !important;
		aspect-ratio: 3 / 2 !important;
	}

	.wp-block-columns.is-style-donation > .wp-block-column:first-child > .wp-block-image img {
		height: auto;
		aspect-ratio: 3 / 2;
	}
}
