/**
 * NPO Donation Form
 *
 * Scoped entirely under .ndf so it does not leak into the host theme, and
 * inherits the theme's font stack rather than importing one — a donation form
 * should look like part of the site it sits on.
 */

.ndf {
	--ndf-accent: #f1580c;
	--ndf-accent-ink: #ffffff;
	--ndf-highlight: #2bb8e0;
	--ndf-track: #e8e8e8;
	--ndf-card: #ffffff;
	--ndf-ink: #2f2f2f;
	--ndf-muted: #7c7c7c;
	--ndf-placeholder: #9d9d9d;
	--ndf-hairline: #ececec;
	--ndf-radius-card: 12px;
	--ndf-gap: 12px;

	box-sizing: border-box;
	max-width: 440px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--ndf-ink);
	line-height: 1.4;
}

.ndf *,
.ndf *::before,
.ndf *::after {
	box-sizing: inherit;
}

.ndf__heading {
	margin: 0 0 var(--ndf-gap);
	font-size: 1.25rem;
	font-weight: 700;
}

/* Visually hidden but focusable ------------------------------------- */

.ndf__freq-input,
.ndf__amount-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Frequency toggle --------------------------------------------------- */

.ndf__freq {
	display: flex;
	gap: 4px;
	padding: 5px;
	margin-bottom: 20px;
	background: var(--ndf-track);
	border-radius: 999px;
}

.ndf__freq-label {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 13px 10px;
	border-radius: 999px;
	font-size: 1.05rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	color: var(--ndf-ink);
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.ndf__freq-label:hover {
	background: rgba(255, 255, 255, 0.5);
}

/* Inset ring rather than a border, so selecting does not shift layout. */
.ndf__freq-input:checked + .ndf__freq-label {
	background: var(--ndf-card);
	box-shadow: inset 0 0 0 2px var(--ndf-highlight);
	color: var(--ndf-accent);
	font-weight: 700;
}

.ndf__freq-input:focus-visible + .ndf__freq-label {
	outline: 3px solid var(--ndf-accent);
	outline-offset: 2px;
}

.ndf__heart {
	flex: none;
	color: var(--ndf-accent);
	opacity: 0;
	transform: scale(0.6);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.ndf__freq-input:checked + .ndf__freq-label .ndf__heart {
	opacity: 1;
	transform: scale(1);
}

/* Amount grid -------------------------------------------------------- */

.ndf__amounts {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--ndf-gap);
	margin-bottom: 22px;
}

.ndf__amount {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60px;
	padding: 14px 8px;
	background: var(--ndf-card);
	border: 1px solid var(--ndf-hairline);
	border-radius: var(--ndf-radius-card);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	font-size: 1.05rem;
	font-weight: 500;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.ndf__amount:hover {
	border-color: #dcdcdc;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
}

.ndf__amount-input:checked + .ndf__amount {
	background: var(--ndf-accent);
	border-color: var(--ndf-accent);
	color: var(--ndf-accent-ink);
	font-weight: 700;
	box-shadow: 0 2px 8px color-mix(in srgb, var(--ndf-accent) 35%, transparent);
}

.ndf__amount-input:focus-visible + .ndf__amount {
	outline: 3px solid var(--ndf-accent);
	outline-offset: 2px;
}

/* Custom amount ------------------------------------------------------ */

.ndf__other {
	display: flex;
	align-items: center;
	min-height: 60px;
	padding-left: 16px;
	background: var(--ndf-card);
	border: 1px solid var(--ndf-hairline);
	border-radius: var(--ndf-radius-card);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ndf__amounts--span-1 .ndf__other { grid-column: span 1; }
.ndf__amounts--span-2 .ndf__other { grid-column: span 2; }
.ndf__amounts--span-3 .ndf__other { grid-column: span 3; }

.ndf__other:focus-within {
	border-color: var(--ndf-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ndf-accent) 22%, transparent);
}

.ndf__other-symbol {
	flex: none;
	margin-right: 10px;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--ndf-ink);
}

.ndf__other-input {
	flex: 1;
	width: 100%;
	min-width: 0;
	padding: 14px 16px 14px 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 1.05rem;
	color: var(--ndf-ink);
	appearance: none;
}

.ndf__other-input:focus {
	outline: none;
}

.ndf__other-input::placeholder {
	color: var(--ndf-placeholder);
	opacity: 1;
}

/* Comment ------------------------------------------------------------ */

.ndf__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.ndf__comment {
	margin: -6px 0 20px;
}

.ndf__comment-summary {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 2px;
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--ndf-muted);
	cursor: pointer;
	list-style: none;
	transition: color 0.16s ease;
}

.ndf__comment-summary::-webkit-details-marker {
	display: none;
}

.ndf__comment-summary:hover {
	color: var(--ndf-accent);
}

.ndf__comment-summary:focus-visible {
	outline: 3px solid var(--ndf-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.ndf__comment-icon {
	flex: none;
	transition: transform 0.2s ease;
}

.ndf__comment[open] .ndf__comment-summary {
	color: var(--ndf-accent);
}

.ndf__comment[open] .ndf__comment-icon {
	transform: rotate(45deg);
}

.ndf__comment-body {
	margin-top: 8px;
}

.ndf__comment-input {
	display: block;
	width: 100%;
	min-height: 88px;
	padding: 14px 16px;
	background: var(--ndf-card);
	border: 1px solid var(--ndf-hairline);
	border-radius: var(--ndf-radius-card);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--ndf-ink);
	resize: vertical;
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ndf__comment-input::placeholder {
	color: var(--ndf-placeholder);
	opacity: 1;
}

.ndf__comment-input:focus {
	outline: none;
	border-color: var(--ndf-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ndf-accent) 22%, transparent);
}

.ndf__comment-count {
	margin: 6px 2px 0;
	font-size: 0.78rem;
	text-align: right;
	color: var(--ndf-placeholder);
}

.ndf__comment-count--full {
	color: var(--ndf-accent);
}

/* Call to action ----------------------------------------------------- */

.ndf__cta {
	display: block;
	width: 100%;
	padding: 22px 16px;
	border: 0;
	border-radius: 10px;
	background: var(--ndf-accent);
	color: var(--ndf-accent-ink);
	font-family: inherit;
	font-size: 1.1rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.16s ease, transform 0.08s ease;
}

.ndf__cta:hover {
	background: color-mix(in srgb, var(--ndf-accent) 88%, #000);
}

.ndf__cta:active {
	transform: translateY(1px);
}

.ndf__cta:focus-visible {
	outline: 3px solid var(--ndf-ink);
	outline-offset: 3px;
}

.ndf__cta[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Reassurance -------------------------------------------------------- */

.ndf__secure {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 12px 0 0;
	font-size: 0.88rem;
	font-style: italic;
	color: var(--ndf-muted);
}

.ndf__lock {
	flex: none;
}

/* Errors ------------------------------------------------------------- */

.ndf__error {
	margin: 0 0 16px;
	padding: 12px 14px;
	border-radius: 8px;
	background: #fdeceb;
	border: 1px solid #f5c6c3;
	color: #8f2019;
	font-size: 0.95rem;
}

/* Frequency-driven visibility ---------------------------------------- */

.ndf:has(.ndf__freq-input[value="once"]:checked) .ndf__amounts--monthly,
.ndf:has(.ndf__freq-input[value="once"]:checked) .ndf__cta-label--monthly,
.ndf:has(.ndf__freq-input[value="monthly"]:checked) .ndf__amounts--once,
.ndf:has(.ndf__freq-input[value="monthly"]:checked) .ndf__cta-label--once {
	display: none;
}

/* Class-based mirror, set by JS. Belt and braces for older engines. */
.ndf--once .ndf__amounts--monthly,
.ndf--once .ndf__cta-label--monthly,
.ndf--monthly .ndf__amounts--once,
.ndf--monthly .ndf__cta-label--once {
	display: none;
}

.ndf--once-only .ndf__cta-label--monthly {
	display: none;
}

/* Responsive --------------------------------------------------------- */

@media (max-width: 400px) {
	.ndf__amounts {
		grid-template-columns: repeat(2, 1fr);
	}

	.ndf__amounts .ndf__other {
		grid-column: span 2;
	}

	.ndf__freq-label,
	.ndf__amount,
	.ndf__other-input,
	.ndf__other-symbol {
		font-size: 1rem;
	}

	.ndf__cta {
		padding: 19px 14px;
		font-size: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ndf *,
	.ndf *::before,
	.ndf *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
