/**
 * Hero — Donate style
 *
 * Full-bleed photo with a white donation panel over it. Frequency is a JazzyTabs tab set —
 * each tab swaps the whole .top panel. Amounts stay radio inputs with their labels styled
 * as pills, so amount selection is pure CSS.
 */

.module.hero.style-donate {
	display: grid;
	isolation: isolate;
	padding: calc(var(--header-height) + var(--module-spacing-small)) 0 var(--module-spacing-xlarge);
	position: relative;
}

.module.hero.style-donate .media {
	aspect-ratio: auto;
	inset: 0;
	position: absolute;
	z-index: -1;
}

.module.hero.style-donate .intro {
	max-width: 620px;
}

.module.hero.style-donate .intro > :is(h1, h2, h3, h4, h5, h6) {
	margin: 0 0 var(--text-spacing-medium);
	text-align: center;
}

/*** Panel ***/

.module.hero.style-donate .panel {
	--tab-overlap: 24px;
	display: flex;
	flex-direction: column;
}

.module.hero.style-donate .top,
.module.hero.style-donate .bottom {
	background: var(--white);
	padding: 0 56px;
}

.module.hero.style-donate .top {
	align-items: center;
	border-radius: 10px 10px 0 0;
	display: flex;
	flex-direction: column;
	gap: var(--text-spacing-small);
	padding-top: 72px;
	text-align: center;
}

.module.hero.style-donate .bottom {
	align-items: center;
	border-radius: 0 0 10px 10px;
	display: flex;
	flex-direction: column;
	gap: var(--text-spacing-xsmall);
	padding-bottom: 56px;
	padding-top: var(--text-spacing-large);
	text-align: center;
}

.module.hero.style-donate .top > *,
.module.hero.style-donate .bottom > * {
	margin: 0;
}

.module.hero.style-donate .disclaimer > :first-child {
	margin-top: 0;
}

.module.hero.style-donate .disclaimer > :last-child {
	margin-bottom: 0;
}

.module.hero.style-donate .text {
	display: flex;
	flex-direction: column;
	gap: var(--text-spacing-xxsmall);
}

.module.hero.style-donate .text > * {
	margin: 0;
}

/*** Tabs ***/

.module.hero.style-donate .tabs {
	align-self: center;
	display: flex;
	gap: var(--text-spacing-xxsmall);
	margin-bottom: calc(var(--tab-overlap) * -1);
	position: relative;
	z-index: 1;
}

.module.hero.style-donate .tabs button {
	align-items: center;
	background: var(--charcoal-pale);
	border: 0;
	border-radius: 60px;
	color: var(--text-gray);
	display: flex;
	font-family: var(--body-font);
	font-size: calc(14rem / 16);
	font-weight: 700;
	justify-content: center;
	letter-spacing: 1.8px;
	line-height: calc(16 / 14);
	padding: 16.5px var(--text-spacing-small) 15.5px;
	text-transform: uppercase;
	transition: background-color var(--motion) var(--ease-out), color var(--motion) var(--ease-out);
	width: 180px;
}

.module.hero.style-donate .tabs button:not([aria-selected="true"]):hover {
	background: color-mix(in srgb, var(--charcoal) 10%, var(--charcoal-pale));
	color: var(--charcoal);
}

.module.hero.style-donate .tabs button[aria-selected="true"] {
	background: var(--charcoal);
	color: var(--white);
}

/*** Panels ***/

.module.hero.style-donate .top[hidden] {
	display: none;
}

.module.hero.style-donate .embed {
	width: 100%;
}

/*** Amounts ***/

/* A wrapping row rather than three fixed columns, so a short second row centres under the first
   instead of leaving a hole on the right. The pills are a third of the row apiece, which is the
   same three-up a grid gives. */
.module.hero.style-donate .amounts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--text-spacing-xxsmall);
	justify-content: center;
	width: 100%;
}

.module.hero.style-donate .amounts input {
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.module.hero.style-donate .amounts label {
	align-items: center;
	background: var(--tea-green-pale);
	border-radius: 60px;
	color: var(--charcoal);
	cursor: pointer;
	display: flex;
	flex: 0 0 calc((100% - var(--text-spacing-xxsmall) * 2) / 3);
	justify-content: center;
	/* `.form-amount` is a type class written for a label beside a radio, and hangs 16px off its
	   left for that; here it put 24 between pills against the 8 between rows. */
	margin-left: 0;
	padding: var(--text-spacing-xsmall) 0;
	transition: background-color var(--motion) var(--ease-out);
}

.module.hero.style-donate .amounts input:not(:checked) + label:hover {
	background: color-mix(in srgb, var(--tea-green) 30%, var(--tea-green-pale));
}

.module.hero.style-donate .amounts input:checked + label {
	background: var(--tea-green);
}

.module.hero.style-donate .amounts input:focus-visible + label {
	outline: 2px solid var(--focus-ring);
	outline-offset: 2px;
}

/*** Other amount ***/

.module.hero.style-donate .gift {
	width: 100%;
}

/* Collapsed to nothing rather than hidden, so choosing Other opens the field instead of
   dropping it into the panel and pushing the button down under the pointer. */
.module.hero.style-donate .other {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--motion) var(--ease-out);
}

.module.hero.style-donate .other .field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	overflow: hidden;
	text-align: left;
	transition: visibility var(--motion);
	visibility: hidden;
}

.module.hero.style-donate .amounts:has(input[value="other"]:checked) + .other {
	grid-template-rows: 1fr;
}

.module.hero.style-donate .amounts:has(input[value="other"]:checked) + .other .field {
	visibility: visible;
}

.module.hero.style-donate .other label {
	margin-top: var(--text-spacing-xsmall);
}

.module.hero.style-donate .other input:focus-visible {
	box-shadow: 0 0 0 2px var(--focus-halo);
	outline: 2px solid var(--focus-ring);
	outline-offset: 2px;
}

.module.hero.style-donate .other input[aria-invalid="true"] {
	border-color: var(--error-color);
}

.module.hero.style-donate .other .minimum {
	color: var(--text-gray);
	margin-left: var(--text-spacing-xsmall);
}

.module.hero.style-donate .other input[aria-invalid="true"] ~ .minimum {
	color: var(--error-color);
}

/*** Badges ***/

.module.hero.style-donate .badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--text-spacing-xsmall);
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.module.hero.style-donate .badges img {
	display: block;
	height: 56px;
	object-fit: contain;
	width: 56px;
}

/***************************************************************************************************************************************************************************************/
/* REDUCED MOTION */
/***************************************************************************************************************************************************************************************/

@media (prefers-reduced-motion: reduce) {

	.module.hero.style-donate .other,
	.module.hero.style-donate .other .field {
		transition: none;
	}

}

/***************************************************************************************************************************************************************************************/
/* MQ MAX-WIDTH 950 - Tablet Sizes */
/***************************************************************************************************************************************************************************************/

@media only screen and (max-width: calc(950rem/16)) {

	/* The copy runs the container rather than a 620 column. On desktop that column is sized to sit
	   the panel beside the photograph's subject; at tablet it left the headline and the panel
	   hugging the left of the screen with a column's worth of photograph beside them. Full width,
	   the headline centres on the page and the tabs, already centred on the panel, come with it. */
	.module.hero.style-donate .intro {
		max-width: none;
	}

}

/***************************************************************************************************************************************************************************************/
/* MQ MIN-WIDTH 651 - Above Mobile Sizes */
/***************************************************************************************************************************************************************************************/

/* The amounts read at body size from tablet up; the type class's 12 is a form label's, and on a
   pill this wide it was a whisper. A phone keeps the smaller cut its narrower pills need. */
@media only screen and (min-width: calc(651rem/16)) {

	.module.hero.style-donate .amounts label {
		font-size: calc(16rem / 16);
	}

}

/***************************************************************************************************************************************************************************************/
/* MQ 651-950 - Tablet Sizes, the panel held in from the edges */
/***************************************************************************************************************************************************************************************/

/* Bounded, because a phone needs the panel's whole width for three amounts a row — at three quarters
   of a phone the pills would be cramped. On a tablet the full container read as a slab across the
   photograph; three quarters of it, centred, leaves the photograph showing either side and keeps
   everything inside centred on its own. The headline takes a bigger step down to the tabs. */
@media only screen and (min-width: calc(651rem/16)) and (max-width: calc(950rem/16)) {

	.module.hero.style-donate .intro > :is(h1, h2, h3, h4, h5, h6) {
		margin-bottom: var(--text-spacing-xlarge);
	}

	.module.hero.style-donate .panel {
		margin-inline: auto;
		width: 75%;
	}

}

/***************************************************************************************************************************************************************************************/
/* MQ MAX-WIDTH 650 - Mobile Sizes */
/***************************************************************************************************************************************************************************************/

@media only screen and (max-width: calc(650rem/16)) {

	.module.hero.style-donate .top,
	.module.hero.style-donate .bottom {
		padding-inline: var(--text-spacing-small);
	}

	.module.hero.style-donate .top {
		padding-top: var(--text-spacing-xxlarge);
	}

	.module.hero.style-donate .bottom {
		padding-bottom: var(--text-spacing-xlarge);
	}

	/* The tabs are the sticky bar's pills at this width, as the events tabs are: at their own size
	   two of them stretched across a phone read as slabs rather than as a choice. The overlap goes
	   to half the shorter pill, so the panel's edge still runs through their middle. */
	.module.hero.style-donate .panel {
		--tab-overlap: 20px;
	}

	.module.hero.style-donate .tabs button {
		font-size: calc(12rem / 16);
		letter-spacing: 1px;
		line-height: calc(16 / 12);
		padding: 12.5px var(--text-spacing-small) 11.5px;
		width: auto;
	}


}
