/*
 * Two columns: the form, and a panel beside it.
 *
 * A short head, then the two columns on one pale wash that fades in from the
 * header and back out to white. On a phone they stack, form first. On a wide
 * screen the panel is a card of its own that stays in view as the page scrolls
 * past the form, its messages scrolling inside it — so what has been raised is
 * on screen the whole time somebody fills the form in.
 */

.donations-columns {
	/* Straight under the header: the title sits inside the wash, not above it. */
	margin-block-start: 0;
	padding-block: var(--wp--preset--spacing--60, 3rem) var(--wp--preset--spacing--70, 4rem);
	padding-inline: var(--wp--style--root--padding-left, 1.25rem) var(--wp--style--root--padding-right, 1.25rem);
	background: linear-gradient(180deg, #fff 0%, #f3f7ff 22%, #fff 100%);
}

.donations-columns__inner {
	max-width: 1180px;
	margin-inline: auto;
}

/* -- The head ------------------------------------------------------------- */

.donations-columns__head {
	text-align: center;
}

.donations-columns__head .donations-hero {
	margin-bottom: var(--wp--preset--spacing--50, 2.5rem);
}

.donations-columns__head .donations-hero img {
	max-height: 420px;
}

.donations-columns__title {
	margin: 0;
}

/* -- The form, as a card ------------------------------------------------- */

/*
 * White on the page's pale wash, drawn to the panel's radius, border and shadow
 * so the two read as a pair. The campaign's Description opens it: the one
 * passage on the page making the case, so it is lifted out of helper-text size.
 */
.donations-columns__form {
	box-sizing: border-box;
	padding: clamp(1.25rem, 3.5vw, 2.25rem);
	border: 1px solid var(--donations-line);
	border-radius: 20px;
	background: #fff;
	box-shadow: var(--donations-shadow);
}

.donations-columns__form .donations-story {
	margin-bottom: 1.5em;
	color: #101828;
	font-size: 1.12em;
	line-height: 1.45;
}

.donations-columns__form .donations-story > :first-child {
	margin-top: 0;
}

.donations-columns__form .donations-story > :last-child {
	margin-bottom: 0;
}

.donations-columns__form .donations-story :is(h1, h2, h3, h4) {
	margin: 0 0 0.45em;
	font-size: 1.3em;
	font-weight: 400;
	line-height: 1.25;
}

.donations-columns__form .donations-story p {
	margin: 0.45em 0 0;
}

/* -- The columns ---------------------------------------------------------- */

.donations-columns__grid {
	display: grid;
	gap: var(--wp--preset--spacing--40, 2rem);
	margin-top: var(--wp--preset--spacing--50, 2.5rem);
}

/* Without a panel the form stands alone, in the middle. */
.donations-columns__grid > :only-child {
	width: 100%;
	max-width: 720px;
	margin-inline: auto;
}

.donations-columns__panel {
	box-sizing: border-box;
	padding: 1.25em;
	border: 1px solid var(--donations-line);
	border-radius: 20px;
	background: #fff;
	box-shadow: var(--donations-shadow);
	font-size: 1rem;
}

/* One message per row in a column this narrow. */
.donations-columns__panel .donations-wall__list {
	grid-template-columns: 1fr;
}

@media (min-width: 782px) {
	/* `start`, so the panel is only as tall as itself and can stick beside the taller form. */
	.donations-columns__grid {
		grid-template-columns: minmax(0, 56fr) minmax(0, 44fr);
		column-gap: var(--wp--preset--spacing--50, 2.5rem);
		align-items: start;
	}

	.donations-columns__panel {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 1.5rem);
		display: flex;
		flex-direction: column;
		max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 3rem);
	}

	.donations-columns__panel .donations-columns__progress {
		flex: none;
	}

	/* The wall takes what is left of the panel, and scrolls inside it. */
	.donations-columns__panel .donations-wall {
		display: flex;
		flex: 1;
		flex-direction: column;
		min-height: 0;
	}

	.donations-columns__panel .donations-wall__heading {
		flex: none;
	}

	/*
	 * The cards fade out at the panel's edges rather than being sliced off by
	 * them. The padding is the same depth as each fade, so at rest the first and
	 * last cards sit clear of it and only a card on its way out is faded.
	 */
	.donations-columns__panel .donations-wall__scroller {
		--fade: 0.9rem;

		flex: 1;
		min-height: 0;
		/* Sideways room for a focused card's outline, which the box would clip. */
		margin: calc(var(--fade) * -1) -0.35em 0;
		padding: var(--fade) 0.35em var(--fade);
		overflow-y: auto;
		scrollbar-color: #d7dee9 transparent;
		scrollbar-width: thin;
		-webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
		mask-image: linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
	}

	.donations-columns__panel .donations-wall__scroller:focus-visible {
		border-radius: 12px;
	}
}
