/*
 * Sego donation widget — presentation.
 *
 * Geometry and colour replicate the six static Divi pill buttons + "Donate
 * now" button this widget replaced on the Give page (spec 44 §4 → spec 45):
 * pills are 44px tall (11px pad + 20px line + 1px border), radius 100px,
 * 700 20px/20px uppercase +1px tracking; selected = deep teal on white;
 * donate = 18px/40px pad, radius 4px, cream on deep teal. Colour tokens come
 * from tokens.css; nothing here hard-codes a brand hex.
 *
 * The "Other amount" field is NEW UI with no Figma comp (the comp is a static
 * frame) — it borrows the pill's own shape so it reads as part of the row.
 * Flagged for design sign-off in client-questions §A11.8.
 */

.sego-donate,
.sego-donate *,
.sego-donate *::before,
.sego-donate *::after {
	box-sizing: border-box;
}

.sego-donate {
	margin: 0 auto;
	font-family: var(--sego-font-body);
	text-align: center;
}

/* Visually hidden, available to assistive tech (legend + input label). */
.sego-donate__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* --- Amount pills ------------------------------------------------------- */

.sego-donate__amounts {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 16px;
	min-width: 0;
	border: 0;
	padding: 0;
	margin: 0 0 32px;
}

.sego-donate__pill {
	position: relative;
	display: inline-block;
	cursor: pointer;
}

/* The real radio: hidden but focusable, so keyboard and AT get native
   radio-group semantics (arrow keys, checked state) for free. */
.sego-donate__radio {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.sego-donate__pill-face {
	display: inline-block;
	padding: 11px 24px;
	border: 1px solid var(--sego-text-secondary);
	border-radius: 100px;
	background: var(--sego-white);
	color: var(--sego-text-secondary);
	font-weight: 700;
	font-size: 20px;
	line-height: 20px;
	letter-spacing: 1px;
	text-transform: uppercase;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sego-donate__pill:hover .sego-donate__pill-face {
	border-color: var(--sego-teal);
	color: var(--sego-teal);
}

.sego-donate__radio:checked + .sego-donate__pill-face {
	background: var(--sego-teal);
	border-color: var(--sego-teal);
	color: var(--sego-white);
}

.sego-donate__radio:focus-visible + .sego-donate__pill-face {
	outline: 2px solid var(--sego-teal);
	outline-offset: 2px;
}

/* --- Custom amount (revealed when "Other amount" is selected) ------------ */

.sego-donate__other {
	display: none;
	justify-content: center;
	margin: 0 0 32px;
}

/* JS toggles .is-open; the :has() rule keeps the reveal working without JS. */
.sego-donate__other.is-open,
.sego-donate:has(.sego-donate__radio[value="other"]:checked) .sego-donate__other {
	display: flex;
}

.sego-donate__other-field {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 20px;
	border: 1px solid var(--sego-text-secondary);
	border-radius: 100px;
	background: var(--sego-white);
}

.sego-donate__other-field:focus-within {
	border-color: var(--sego-teal);
	box-shadow: 0 0 0 1px var(--sego-teal);
}

.sego-donate__currency {
	font-weight: 700;
	font-size: 20px;
	line-height: 20px;
	color: var(--sego-text-secondary);
}

.sego-donate__input {
	width: 150px;
	border: 0;
	outline: none;
	background: transparent;
	padding: 11px 0;
	font-family: inherit;
	font-weight: 700;
	font-size: 20px;
	line-height: 20px;
	color: var(--sego-teal);
	-moz-appearance: textfield;
	appearance: textfield;
}

.sego-donate__input::-webkit-outer-spin-button,
.sego-donate__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* --- Donate button -------------------------------------------------------- */

.sego-donate__actions {
	display: flex;
	justify-content: center;
}

.sego-donate__button,
.sego-donate__button:visited {
	display: inline-block;
	padding: 18px 40px;
	border-radius: 4px;
	background: var(--sego-teal);
	color: var(--sego-cream);
	font-weight: 700;
	font-size: 16px;
	line-height: 19px;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.sego-donate__button:hover,
.sego-donate__button:focus-visible {
	background: var(--sego-teal-dark);
	color: var(--sego-cream);
}

.sego-donate__button:focus-visible {
	outline: 2px solid var(--sego-teal);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.sego-donate__pill-face,
	.sego-donate__button {
		transition: none;
	}
}
