/**
 * Appeal Give card (inc/give-card.php): the donation widget on country pages,
 * the Our Work program heroes and the albasar/appeal-give block.
 *
 * Base box: `.ab-hero-donate` in hero.css (loaded first). Loaded only where a
 * card renders (the renderer enqueues it). Colours: theme.json tokens only.
 */

/* The card is the home hero's quick-give box (hero.css) with UX refinements:
   readable unselected amounts, "/mo" while Monthly is on, a "$" Other field
   that shows when it is the chosen amount, a two-line Zakat choice, a hint and
   a trust line. give-card.js keeps the button label in step. */
.ab-hero-donate.ab-give-card {
	width: 100%;
	gap: 16px;
	padding: 20px;
	border-radius: 8px;
}

.ab-give-card .ab-hero-donate__freq-opt {
	font-weight: 500;
}

.ab-give-card .ab-hero-donate__label {
	display: flex;
	justify-content: space-between;
	width: 100%;
	margin-bottom: 2px;
	font-weight: 500;
	color: var(--wp--custom--neutral--900);
}

.ab-give-card .ab-hero-donate__currency {
	font-weight: 400;
	color: var(--wp--custom--neutral--700);
}

/* Unselected amounts read at AA contrast (hero.css greys them out). */
.ab-give-card .ab-hero-donate__amt {
	flex-direction: row;
	align-items: baseline;
	min-height: 52px;
	font-size: 17px;
	font-weight: 500;
	color: var(--wp--custom--neutral--900);
	background: var(--wp--preset--color--ab-white);
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.ab-give-card .ab-hero-donate__amt:hover {
	border-color: var(--wp--custom--action--500);
}

.ab-give-card .ab-hero-donate__amt-input:checked + .ab-hero-donate__amt {
	background: var(--wp--custom--action--bright);
	border-color: var(--wp--custom--action--500);
	color: var(--wp--preset--color--ab-white);
	font-weight: 600;
}

.ab-give-card .ab-hero-donate__per {
	display: none;
	margin-left: 1px;
	font-size: 12px;
	font-weight: 400;
}

.ab-give-card.is-monthly .ab-hero-donate__per {
	display: inline;
}

/* Other amount, "$" prefixed; styled as the choice once it has a value. */
.ab-give-card .ab-hero-donate__other-wrap {
	position: relative;
	grid-column: span 2;
}

.ab-give-card .ab-hero-donate__other-prefix {
	position: absolute;
	top: 50%;
	left: 12px;
	transform: translateY(-50%);
	font: 500 17px/1 var(--wp--preset--font-family--sans);
	color: var(--wp--custom--neutral--700);
	pointer-events: none;
}

.ab-give-card .ab-hero-donate__other {
	height: 100%;
	min-height: 52px;
	padding-left: 26px;
	font-size: 17px;
	background: var(--wp--preset--color--ab-white);
}

.ab-give-card .ab-hero-donate__other::placeholder {
	font-size: 15px;
	color: var(--wp--custom--neutral--700);
}

.ab-give-card.has-other .ab-hero-donate__other {
	border-color: var(--wp--custom--action--500);
	box-shadow: 0 0 0 1px var(--wp--custom--action--500);
	font-weight: 600;
}

.ab-give-card .ab-hero-donate__hint {
	min-height: 1.4em;
	margin: 2px 0 0;
	font: 400 13px/1.4 var(--wp--preset--font-family--sans);
	color: var(--wp--custom--neutral--700);
}

/* Zakat: the choice on one line, the reassurance under it. */
.ab-give-card .ab-hero-donate__zakat {
	align-items: flex-start;
	padding: 12px;
	text-transform: none;
}

.ab-give-card .ab-hero-donate__zakat-box {
	margin-top: 1px;
}

.ab-give-card .ab-hero-donate__zakat-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-weight: 500;
}

.ab-give-card .ab-hero-donate__zakat-text small {
	font-size: 13px;
	font-weight: 400;
	color: var(--wp--custom--neutral--700);
}

.ab-give-card .ab-hero-donate__submit {
	min-height: 52px;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-transform: none;
}

.ab-give-card .ab-hero-donate__trust {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: -4px 0 0;
	font: 400 12px/1.4 var(--wp--preset--font-family--sans);
	color: var(--wp--custom--neutral--700);
	text-align: center;
}

.ab-give-card .ab-hero-donate__trust svg {
	flex: 0 0 auto;
}

/* Heading at the top of the card ("Fund a mobile clinic"). */
.ab-give-card__title {
	margin: 0;
	font: 600 1.25rem/1.3 var(--wp--preset--font-family--serif);
	color: var(--wp--preset--color--ab-navy);
	text-align: center;
}

/* The large gift ("$60,000 · Fund a whole mobile clinic"): two cells wide,
   after the smaller presets; Other then takes its own row. */
.ab-give-card .ab-give-card__big {
	grid-column: span 2;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 0;
	padding: 6px 12px;
	text-align: left;
}

.ab-give-card__big-amt {
	line-height: 1.2;
}

.ab-give-card__big-label {
	font-size: 13px;
	text-transform: none;
	font-weight: 400;
	line-height: 1.25;
}

/* One-time only: hidden while Monthly is on (give-card.js also disables it). */
.ab-give-card.is-monthly .ab-give-card__big {
	display: none;
}

.ab-give-card--has-big .ab-hero-donate__other-wrap {
	grid-column: 1 / -1;
}

/* Editors only: the page's "Amounts to offer" field was refused. */
.ab-give-card__admin-note {
	margin: 0;
	padding: 8px 10px;
	border: 1px dashed var(--wp--preset--color--ab-orange-600);
	border-radius: 4px;
	font: 400 13px/1.4 var(--wp--preset--font-family--sans);
	color: var(--wp--preset--color--ab-ink);
	background: var(--wp--preset--color--ab-cream);
}

/* Why an amount was refused (also shown in the browser's bubble). */
.ab-give-card__error {
	margin: -6px 0 0;
	padding: 6px 10px;
	border-left: 3px solid var(--wp--preset--color--ab-orange-600);
	font: 500 13px/1.4 var(--wp--preset--font-family--sans);
	color: var(--wp--preset--color--ab-ink);
	background: var(--wp--preset--color--ab-cream);
}

/* Empty: out of sight but still in the accessibility tree, so the alert is
   announced the moment give-card.js writes into it. */
.ab-give-card__error:empty {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

/* The block's "card" layout: centred wherever an editor places it. */
.ab-give-block {
	display: flex;
	justify-content: center;
}

.ab-give-block > .ab-give-card {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * Program heroes: the card sits over the photo on desktop, so the whole widget
 * is on screen without scrolling; on phones it follows the headline and lede,
 * and the photo goes below it.
 * ------------------------------------------------------------------------- */
.ab-give-hero {
	box-sizing: border-box;
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	min-width: 0;
}

.ab-give-hero > .ab-give-card {
	width: 100%;
	max-width: 420px;
}

/* Permanent Hospitals / School Screening / Training (program.css: one column
   at 980px and below). */
@media (min-width: 981px) {
	.ab-prog-hero:has(> .ab-give-hero) > .ab-prog-hero__left {
		grid-column: 1;
		grid-row: 1;
	}

	.ab-prog-hero:has(> .ab-give-hero) > .ab-prog-hero__media,
	.ab-prog-hero > .ab-give-hero {
		grid-column: 2;
		grid-row: 1;
	}
}

@media (max-width: 980px) {
	.ab-prog-hero:has(> .ab-give-hero) > .ab-prog-hero__left {
		grid-row: 1;
		padding-top: 32px;
		padding-bottom: 20px;
	}

	.ab-prog-hero > .ab-give-hero {
		grid-row: 2;
		padding: 0 16px 32px;
		background: var(--wp--preset--color--ab-peach);
	}

	.ab-prog-hero:has(> .ab-give-hero) > .ab-prog-hero__media {
		grid-row: 3;
	}
}

/* Mobile Eye Clinic (mec.css: one column at 900px and below). */
@media (min-width: 901px) {
	.ab-mec-hero:has(> .ab-give-hero) > .ab-mec-hero__left {
		grid-column: 1;
		grid-row: 1;
		align-items: center;
	}

	.ab-mec-hero:has(> .ab-give-hero) > .ab-mec-hero__media,
	.ab-mec-hero > .ab-give-hero {
		grid-column: 2;
		grid-row: 1;
	}
}

@media (max-width: 900px) {
	.ab-mec-hero:has(> .ab-give-hero) > .ab-mec-hero__left {
		grid-row: 1;
		padding-top: 32px;
		padding-bottom: 20px;
	}

	.ab-mec-hero > .ab-give-hero {
		grid-row: 2;
		padding: 0 16px 32px;
		background: var(--wp--preset--color--ab-peach);
	}

	.ab-mec-hero:has(> .ab-give-hero) > .ab-mec-hero__media {
		grid-row: 3;
		order: 0;
	}
}

/* Country pages (country.css): the photo column is a one-cell grid, so the
   card shares the photo's cell: it sits over the photo and the column keeps
   the photo's size (no layout shift). No :has() here, so browsers without it
   still place the card; the extra class outranks country.css's flex column.
   WordPress stacks the hero columns below 782px: there the card comes first
   in the photo column, straight after the headline and lede, on the text
   column's dark background, and the photo follows it. */
.ab-cty-hero .ab-cty-hero__right.wp-block-column {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

.ab-cty-hero__right > .ab-cty-hero__photo,
.ab-cty-hero__right > .ab-give-hero {
	grid-column: 1;
	grid-row: 1;
}

@media (max-width: 781px) {
	/* A heading must not push the amounts below a phone's fold: smaller, and
	   closer to the Give Once / Monthly switch. */
	.ab-give-card__title {
		margin-bottom: -10px;
		font-size: 1.0625rem;
		line-height: 1.15;
	}

	.ab-cty-hero__right > .ab-give-hero {
		padding: 0 16px 32px;
		background: var(--wp--custom--neutral--900);
	}

	/* Below the card (an empty first row takes no space without one). */
	.ab-cty-hero__right > .ab-cty-hero__photo {
		grid-row: 2;
	}

	/* Cosmetic: a little tighter, so the first row of amounts is on screen at
	   380x800. */
	.ab-cty-hero__left:has(+ .ab-cty-hero__right > .ab-give-hero).wp-block-column {
		padding-top: 32px;
		padding-bottom: 20px;
	}

	.ab-cty-hero__left:has(+ .ab-cty-hero__right > .ab-give-hero) .ab-cty-hero__text {
		gap: 16px;
	}
}

/* The hero group's block gap must not open a stripe between the columns. */
.ab-prog-hero > .ab-give-hero,
.ab-mec-hero > .ab-give-hero,
.ab-cty-hero__right > .ab-give-hero {
	margin-block: 0;
}

/* ---------------------------------------------------------------------------
 * Hero photo behind the card: frosted and tinted navy, so the card reads
 * first and the photo stays as atmosphere. Only where the card sits over the
 * photo (desktop); browsers without backdrop-filter get the tint alone.
 * To revert, delete this block.
 * ------------------------------------------------------------------------- */
.ab-give-hero {
	--ab-give-hero-veil: linear-gradient(
		160deg,
		color-mix(in srgb, var(--wp--preset--color--ab-navy) 30%, transparent),
		color-mix(in srgb, var(--wp--preset--color--ab-navy) 60%, transparent)
	);
	--ab-give-hero-blur: blur(10px) saturate(0.85);
}

@media (min-width: 981px) {
	.ab-prog-hero > .ab-give-hero {
		background: var(--ab-give-hero-veil);
		-webkit-backdrop-filter: var(--ab-give-hero-blur);
		backdrop-filter: var(--ab-give-hero-blur);
	}
}

@media (min-width: 901px) {
	.ab-mec-hero > .ab-give-hero {
		background: var(--ab-give-hero-veil);
		-webkit-backdrop-filter: var(--ab-give-hero-blur);
		backdrop-filter: var(--ab-give-hero-blur);
	}
}

@media (min-width: 782px) {
	.ab-cty-hero__right > .ab-give-hero {
		background: var(--ab-give-hero-veil);
		-webkit-backdrop-filter: var(--ab-give-hero-blur);
		backdrop-filter: var(--ab-give-hero-blur);
	}
}

