/* ==========================================================================
   Donation form - the XD design (steps 1-5)

   The plugin's own styling, so the form doesn't depend on the child theme:
   only the fonts are inherited (Montserrat headings and tiles, Encode Sans
   fields, through the theme's variables). Colours are the site's two greens.

   Theme interplay, kept deliberately small:
   - Heart restyles fields once they hold a value (input.filled, :focus) at
     the same weight as a two-class rule, so the field rules are scoped by
     the form's id (#donation-form) to stay ours.
   - Heart wraps every <select> in .select_container (init.js:292) with its
     own arrow and hides bare selects until then; the wrapper is neutralised
     and the select draws its own chevron.
   - Heart hides checkboxes and radios except inside a <label>
     (skins/default/css/style.css:3241); every input here sits in its label.
   ========================================================================== */

.cdon {
	--cdon-lime:       #8CC63F;
	--cdon-green:      #1F764D;
	--cdon-white:      #FFFFFF;
	--cdon-ink:        #000000;
	--cdon-muted:      #707070;
	--cdon-field-bg:   #F4F4F4;
	--cdon-line:       #C9C9C9;
	--cdon-error:      #E2231A;
	--cdon-field-h:    52px;
	--cdon-gap:        16px;
	--cdon-tile-w:     192px;
	--cdon-tile-h:     74px;
	--cdon-head-font:  var(--theme-font-h3_font-family, Montserrat, sans-serif);
	--cdon-field-font: var(--theme-font-input_font-family, "Encode Sans", sans-serif);

	/* The full width of the content column, as the rest of the page; the
	   amount tiles stay their own size, centred. */
	margin: 40px 0 0;
	color: var(--cdon-ink);
	font-family: var(--cdon-field-font);
	text-align: left;
}
.cdon *,
.cdon *:before,
.cdon *:after {
	box-sizing: border-box;
}
.cdon [hidden] {
	display: none !important;
}

/* Steps, numbered by a counter over the visible ones. */
.cdon__form {
	counter-reset: cdon-step;
}
.cdon__step {
	margin: 0 0 48px;
	counter-increment: cdon-step;
}
.cdon__step[hidden] {
	counter-increment: none;
}
.cdon .cdon__title {
	margin: 0 0 22px;
	font-family: var(--cdon-head-font);
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: var(--cdon-ink);
}
.cdon__title:before {
	content: counter(cdon-step) ". ";
}

/* Visually hidden, read by screen readers. */
.cdon__sr,
.cdon__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* --- 1-2. Tiles ---------------------------------------------------------- */

.cdon__tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, var(--cdon-tile-w)));
	gap: 17px 16px;
	justify-content: center;
}
.cdon__tile {
	position: relative;
	display: block;
	margin: 0;
	cursor: pointer;
}
.cdon .cdon__tile input {
	position: absolute !important;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}
.cdon__tile span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--cdon-tile-h);
	padding: 10px 14px;
	border-radius: 2px;
	background: var(--cdon-lime);
	color: var(--cdon-white);
	font-family: var(--cdon-head-font);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	transition: background-color .2s ease;
}
.cdon__tile:hover span,
.cdon__tile input:checked + span {
	background: var(--cdon-green);
}
.cdon__tile input:focus-visible + span {
	outline: 2px solid var(--cdon-green);
	outline-offset: 3px;
}

/* "Altă sumă" with an underline field, aligned with the tiles. */
.cdon__other {
	display: flex;
	align-items: flex-end;
	gap: 18px;
	width: calc(var(--cdon-tile-w) * 2 + 16px);
	max-width: 100%;
	margin: 30px auto 0;
}
.cdon__other label {
	flex: 0 0 auto;
	margin: 0;
	font-size: 15px;
	line-height: 26px;
}
.cdon__other-input {
	flex: 1 1 auto;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	border-bottom: 1px solid var(--cdon-line);
}
.cdon__other-input:focus-within {
	border-bottom-color: var(--cdon-green);
}
.cdon .cdon__other input {
	flex: 1 1 auto;
	min-width: 0;
	height: 30px;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: 16px;
	line-height: 30px;
}
.cdon .cdon__other input:focus {
	outline: none;
}
.cdon__unit {
	font-size: 15px;
	line-height: 30px;
	color: var(--cdon-muted);
}
.cdon__other.is-active .cdon__unit {
	color: var(--cdon-ink);
}

/* --- 3-4. Fields --------------------------------------------------------- */

.cdon__row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 20px;
}
.cdon__field {
	margin: 0 0 var(--cdon-gap);
}
#donation-form .cdon__field input,
#donation-form .cdon__field select,
#donation-form .cdon__field textarea {
	display: block;
	width: 100%;
	height: var(--cdon-field-h);
	margin: 0;
	padding: 0 24px;
	border: 1px solid transparent;
	border-radius: 999px;
	background-color: var(--cdon-field-bg);
	color: var(--cdon-ink);
	font-family: var(--cdon-field-font);
	font-size: 16px;
	line-height: normal;
	box-shadow: none;
}
#donation-form .cdon__field input::placeholder,
#donation-form .cdon__field textarea::placeholder {
	color: var(--cdon-muted);
	opacity: 1;
}
#donation-form .cdon__field input:focus,
#donation-form .cdon__field select:focus,
#donation-form .cdon__field textarea:focus {
	border-color: var(--cdon-green);
	outline: none;
}
.cdon .cdon__field.is-invalid input,
.cdon .cdon__field.is-invalid select,
.cdon .cdon__field.is-invalid textarea {
	border-color: var(--cdon-error);
}

/* Selects: our chevron; the theme's wrapper is made plain. */
#donation-form .cdon__field select {
	visibility: visible;
	padding-right: 52px;
	-webkit-appearance: none;
	appearance: none;
	/* !important against `.select_container select { background: ... !important }` */
	background-color: var(--cdon-field-bg) !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23333' stroke-width='1.6'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 24px center !important;
	cursor: pointer;
}
#donation-form .cdon__field select:invalid,
#donation-form .cdon__field select.is-placeholder {
	color: var(--cdon-muted);
}
#donation-form .cdon__field select option {
	color: var(--cdon-ink);
}
#donation-form .cdon__field select:disabled {
	cursor: default;
	opacity: .7;
}
.cdon .select_container {
	position: static;
	width: auto;
}
.cdon .select_container:before,
.cdon .select_container:after {
	display: none;
}

/* The message box. */
.cdon__field--area {
	margin-top: 8px;
}
.cdon__label {
	display: block;
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.4;
}
#donation-form .cdon__field textarea {
	height: auto;
	min-height: 310px;   /* the whole template, as in the design */
	padding: 18px 24px;
	border-radius: 26px;
	line-height: 1.55;
	resize: vertical;
}
.cdon__count {
	margin: 6px 24px 0 0;
	font-size: 13px;
	line-height: 1.4;
	text-align: right;
	color: var(--cdon-muted);
}

.cdon .cdon__help {
	margin: calc(-1 * var(--cdon-gap) + 6px) 0 var(--cdon-gap) 4px;
	font-size: 13px;
	line-height: 1.4;
}
.cdon__step[data-step="gift"] > .cdon__help[data-memoriam-only] {
	margin: 0 0 12px 4px;
}
/* "Already giving monthly? Manage your donation here", under the frequency tiles. */
.cdon .cdon__help--manage {
	margin: 14px 0 0;
	font-size: 14px;
	text-align: center;
}
.cdon .cdon__help--manage a {
	color: var(--cdon-green);
	text-decoration: underline;
}
.cdon .cdon__error {
	margin: 6px 0 0 4px;
	color: var(--cdon-error);
	font-size: 13px;
	line-height: 1.4;
}
.cdon .cdon__error--center {
	margin: 14px 0 0;
	text-align: center;
}
/* The e-mail's error sits above its help line, as in the design. */
.cdon__field[data-field="email"] .cdon__error,
.cdon__field[data-field="recipient_email"] .cdon__error {
	margin-bottom: 6px;
}

/* Checkboxes: plain squares, as in the design. */
.cdon__checks {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 26px;
	margin: 8px 0 0;
}
.cdon__check {
	display: inline-flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	font-size: 14px;
	line-height: 20px;
	font-weight: 400;
	cursor: pointer;
}
.cdon .cdon__check input[type=checkbox] {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 2px 0 0 !important;
	padding: 0 !important;
	accent-color: var(--cdon-green);
	appearance: auto;
	-webkit-appearance: checkbox;
	opacity: 1;
	position: static !important;
	clip: auto;
	cursor: pointer;
}
.cdon .cdon__check input[type=checkbox]:before,
.cdon .cdon__check input[type=checkbox]:after {
	display: none;
}

/* E-card photos: four across, a radio dot in the corner. */
.cdon__photos {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
	margin: 18px 0 0;
	padding: 0;
	border: 0;
}
.cdon__photo {
	position: relative;
	display: block;
	margin: 0;
	aspect-ratio: 143 / 98;
	overflow: hidden;
	cursor: pointer;
}
#donation-form .cdon__photo img {   /* id: the theme's img { height: auto } would win */
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: opacity .2s ease;
}
.cdon .cdon__photo input[type=radio] {
	position: absolute !important;
	z-index: 1;
	top: 7px;
	left: 7px;
	width: 14px;
	height: 14px;
	margin: 0 !important;
	appearance: none;
	-webkit-appearance: none;
	clip: auto;
	border: 1px solid var(--cdon-muted);
	border-radius: 50%;
	background: var(--cdon-white);
	cursor: pointer;
}
.cdon .cdon__photo input[type=radio]:checked {
	border: 4px solid var(--cdon-green);
}
.cdon__photo:has(input:checked) {
	outline: 3px solid var(--cdon-green);
	outline-offset: -3px;
}
.cdon__photos.is-off .cdon__photo {
	pointer-events: none;
}
.cdon__photos.is-off img {
	opacity: .35;
}

/* --- 5. Payment ---------------------------------------------------------- */

.cdon__stripe {
	min-height: 120px;
	padding: 0 6px;
}
.cdon__actions {
	margin: 34px 0 34px;
	text-align: center;
}
/* The lines above the button: the monthly charge, and the privacy notice. */
.cdon .cdon__notice {
	max-width: 640px;
	margin: 0 auto 8px;
	color: var(--cdon-muted);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
}
.cdon .cdon__stripe + .cdon__error + .cdon__hp + .cdon__notice,
.cdon .cdon__stripe + .cdon__error + .cdon__hp + .cdon__notice[hidden] + .cdon__notice,
.cdon .cdon__checks--newsletter + .cdon__error + .cdon__hp + .cdon__notice,
.cdon .cdon__checks--newsletter + .cdon__error + .cdon__hp + .cdon__notice[hidden] + .cdon__notice {
	margin-top: 28px;
}
/* The newsletter box sits right under the card fields, lined up with them
   (.cdon__stripe has 6px side padding). */
.cdon .cdon__checks--newsletter {
	margin: 16px 6px 0;
}
.cdon .cdon__notice strong {
	color: var(--cdon-ink);
	font-weight: 600;
}
.cdon .cdon__notice a {
	color: var(--cdon-green);
	text-decoration: underline;
}
.cdon .cdon__notice + .cdon__actions {
	margin-top: 20px;
}
.cdon .cdon__submit {
	display: inline-block;
	min-width: 136px;
	padding: 14px 40px;
	border: 0;
	border-radius: 0;
	background: var(--cdon-lime);
	color: var(--cdon-white);
	font-family: var(--cdon-field-font);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .2s ease;
}
.cdon .cdon__submit:hover,
.cdon .cdon__submit:focus-visible {
	background: var(--cdon-green);
	color: var(--cdon-white);
}
.cdon .cdon__submit[disabled] {
	opacity: .6;
	cursor: wait;
}

.cdon__bank {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 20px;
	margin: 0 0 18px;
	font-size: 16px;
}
.cdon__bank dt {
	font-weight: 600;
}
.cdon__bank dd {
	margin: 0;
	overflow-wrap: anywhere;
}

/* --- Phones -------------------------------------------------------------- */

@media (max-width: 600px) {
	.cdon {
		--cdon-tile-h: 64px;
		margin-top: 28px;
	}
	.cdon__tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
	.cdon__tile span {
		font-size: 16px;
	}
	.cdon__other {
		width: 100%;
	}
	.cdon__row {
		grid-template-columns: minmax(0, 1fr);
	}
	.cdon__photos {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
	.cdon__checks {
		flex-direction: column;
	}
	.cdon .cdon__submit {
		width: 100%;
	}
}
