/**
 * Donara public (donor-facing) style foundation.
 *
 * This file establishes the CSS variable contract that the entire donor
 * experience is themed through. The Branding engine (Milestone 4) resolves
 * campaign overrides → organization branding → these Donara defaults, and
 * emits a small scoped style block of variable values per form. Components
 * built in Milestone 5+ must consume ONLY these variables — never hardcoded
 * colors — so an organization's brand applies everywhere automatically.
 *
 * The variable names below are public API for themes and integrations.
 */

.donara {
	/*
	 * Brand-controlled (organization/campaign overridable). The fallback
	 * values here are exactly what the Milestone 4 resolver emits for the
	 * Donara defaults, so a form styled without an emitted block matches a
	 * form styled with one:
	 * - button text defaults to charcoal — the accessible default button
	 *   treatment (charcoal on Donara teal is 5.82:1; white would be 2.54:1)
	 * - hover is darken(primary, 15%), soft/highlight is tint(primary, 92%)
	 * - primary-strong is the darkest-needed shade of primary that meets AA
	 *   4.5:1 on soft; used for brand-colored normal-size text so custom
	 *   brand colors can never render unreadable selected/link/fee text
	 */
	--donara-primary: #10b981;
	--donara-primary-hover: #0e9d6e;
	--donara-primary-strong: #0b8059;
	--donara-accent: #059669;
	--donara-secondary: #059669;
	--donara-heading: #1f2933;
	--donara-text: #6b7280;
	--donara-background: #ffffff;
	--donara-surface: #ffffff;
	--donara-border: #e5e7eb;
	--donara-button-text: #1f2933;

	/* Derived / system (computed by the branding engine) */
	--donara-soft: #ecf9f5;
	--donara-muted: #6b7280;
	--donara-highlight: #ecf9f5;
	--donara-focus-ring: var(--donara-primary-hover);
	--donara-error: #b91c1c;
	--donara-success: #047857;

	/* Shape & type foundation */
	--donara-radius: 12px;
	--donara-radius-small: 8px;
	--donara-font-heading: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--donara-font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

	color: var(--donara-text);
	font-family: var(--donara-font-body);
}

/*
 * Baseline accessibility guarantees for everything Donara renders publicly.
 * Donation form components arrive in Milestone 5.
 */

.donara :focus-visible {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 2px;
}

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

/* ================================================================== */
/* Donor-facing campaign page & donation form (Milestone 5)            */
/* Everything themes through the --donara-* variables above, so an     */
/* organization's brand reaches the whole experience automatically.    */
/* ================================================================== */

.donara-campaign-wrap {
	padding: clamp(16px, 4vw, 48px) 16px;
}

.donara-campaign {
	max-width: 640px;
	margin: 0 auto;
	line-height: 1.6;
}

.donara-campaign__card {
	background: var(--donara-surface);
	border: 1px solid var(--donara-border);
	border-radius: var(--donara-radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04), 0 10px 30px rgba(31, 41, 51, 0.06);
}

.donara-campaign__header {
	padding: clamp(20px, 5vw, 32px) clamp(20px, 5vw, 32px) 0;
}

.donara-campaign__logo {
	display: block;
	max-height: 48px;
	width: auto;
	margin-bottom: 20px;
}

.donara-campaign__cover {
	margin: 0 calc(-1 * clamp(20px, 5vw, 32px)) 24px;
}

.donara-campaign__cover img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 320px;
	object-fit: cover;
}

.donara-campaign__title {
	font-family: var(--donara-font-heading);
	font-size: clamp(22px, 5vw, 28px);
	font-weight: 700;
	line-height: 1.25;
	color: var(--donara-heading);
	margin: 0 0 8px;
}

.donara-campaign__lede {
	font-size: 16px;
	color: var(--donara-muted);
	margin: 0;
}

.donara-campaign__body {
	padding: clamp(20px, 5vw, 32px);
}

.donara-campaign__story {
	color: var(--donara-text);
	font-size: 15px;
	margin-bottom: 28px;
}

.donara-campaign__story p {
	margin: 0 0 12px;
}

.donara-campaign__story :where(h1, h2, h3, h4) {
	font-family: var(--donara-font-heading);
	color: var(--donara-heading);
}

.donara-campaign__story a {
	color: var(--donara-primary-strong);
	text-decoration: underline;
}

/* Progress ---------------------------------------------------------- */

.donara-progress-block {
	margin-bottom: 28px;
}

.donara-progress-block__figures {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.donara-progress-block__raised {
	font-family: var(--donara-font-heading);
	font-size: clamp(24px, 6vw, 32px);
	font-weight: 700;
	color: var(--donara-heading);
}

.donara-progress-block__goal {
	font-size: 14px;
	color: var(--donara-muted);
}

.donara-progress {
	height: 10px;
	border-radius: 999px;
	background: var(--donara-border);
	overflow: hidden;
}

.donara-progress__bar {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--donara-primary);
	transition: width 0.4s ease;
}

.donara-progress-block__meta {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
	font-size: 13px;
	font-weight: 600;
	color: var(--donara-muted);
}

/* Donation form ----------------------------------------------------- */

.donara-campaign__give {
	border-top: 1px solid var(--donara-border);
	padding-top: 28px;
}

.donara-form__group {
	border: 0;
	padding: 0;
	margin: 0 0 24px;
}

.donara-form__legend {
	font-family: var(--donara-font-heading);
	font-size: 15px;
	font-weight: 600;
	color: var(--donara-heading);
	padding: 0;
	margin-bottom: 12px;
}

.donara-amounts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 10px;
}

.donara-amount {
	position: relative;
	display: block;
}

.donara-amount__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.donara-amount__value {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: 8px 12px;
	border: 2px solid var(--donara-border);
	border-radius: var(--donara-radius-small);
	background: var(--donara-surface);
	color: var(--donara-heading);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.donara-amount__input:hover + .donara-amount__value {
	border-color: var(--donara-primary);
}

.donara-amount__input:checked + .donara-amount__value {
	border-color: var(--donara-primary);
	background: var(--donara-soft);
	color: var(--donara-primary-strong);
}

.donara-amount__input:focus-visible + .donara-amount__value {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 2px;
}

.donara-custom {
	margin-top: 12px;
}

.donara-custom__label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--donara-heading);
	margin-bottom: 6px;
}

.donara-custom__field {
	display: flex;
	align-items: center;
	border: 2px solid var(--donara-border);
	border-radius: var(--donara-radius-small);
	background: var(--donara-surface);
	overflow: hidden;
}

.donara-custom__field:focus-within {
	border-color: var(--donara-primary);
}

.donara-custom__symbol {
	padding: 0 4px 0 14px;
	font-size: 16px;
	font-weight: 600;
	color: var(--donara-muted);
}

.donara-custom__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 14px 14px 14px 4px;
	font-size: 16px;
	color: var(--donara-heading);
}

.donara-custom__input:focus {
	outline: none;
}

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

.donara-frequency {
	display: flex;
	gap: 10px;
}

.donara-frequency__option {
	flex: 1 1 0;
	position: relative;
}

.donara-frequency__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.donara-frequency__label {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	border: 2px solid var(--donara-border);
	border-radius: var(--donara-radius-small);
	background: var(--donara-surface);
	color: var(--donara-heading);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.donara-frequency__input:checked + .donara-frequency__label {
	border-color: var(--donara-primary);
	background: var(--donara-soft);
	color: var(--donara-primary-strong);
}

.donara-frequency__input:focus-visible + .donara-frequency__label {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 2px;
}

.donara-recurring-note {
	margin: 12px 0 0;
	padding: 10px 12px;
	background: var(--donara-soft);
	border-radius: var(--donara-radius-small);
	font-size: 13px;
	color: var(--donara-primary-strong);
}

/* Fee, fields, checks ---------------------------------------------- */

.donara-fee {
	margin-bottom: 24px;
}

.donara-fee__note {
	margin: 4px 0 0 26px;
	font-size: 12px;
	color: var(--donara-muted);
}

.donara-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	color: var(--donara-text);
	cursor: pointer;
}

.donara-check input {
	margin-top: 3px;
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	accent-color: var(--donara-primary);
}

.donara-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.donara-form__field {
	margin-bottom: 16px;
}

.donara-form__label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--donara-heading);
	margin-bottom: 6px;
}

.donara-form__required {
	color: var(--donara-error);
}

.donara-form__optional {
	font-weight: 400;
	color: var(--donara-muted);
}

.donara-form__input {
	width: 100%;
	box-sizing: border-box;
	border: 2px solid var(--donara-border);
	border-radius: var(--donara-radius-small);
	background: var(--donara-surface);
	color: var(--donara-heading);
	font-size: 16px;
	font-family: inherit;
	padding: 12px 14px;
}

.donara-form__input:focus {
	outline: none;
	border-color: var(--donara-primary);
}

.donara-form__input:focus-visible {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 1px;
}

.donara-form__help {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--donara-muted);
}

/* Summary & submit -------------------------------------------------- */

.donara-summary {
	padding: 12px 0;
	margin: 8px 0 16px;
	border-top: 1px solid var(--donara-border);
	border-bottom: 1px solid var(--donara-border);
}

.donara-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 4px 0;
}

.donara-summary__label {
	font-size: 14px;
	font-weight: 600;
	color: var(--donara-heading);
}

.donara-summary__value {
	font-size: 15px;
	font-weight: 600;
	color: var(--donara-heading);
}

.donara-summary__row--fee .donara-summary__label,
.donara-summary__row--fee .donara-summary__value {
	font-weight: 500;
	color: var(--donara-muted);
}

.donara-summary__value--total,
.donara-summary__row--total .donara-summary__label {
	font-family: var(--donara-font-heading);
	font-size: 18px;
	font-weight: 700;
	color: var(--donara-heading);
}

.donara-summary__amount {
	font-family: var(--donara-font-heading);
	font-size: 20px;
	font-weight: 700;
	color: var(--donara-heading);
}

.donara-fee__amount {
	font-weight: 600;
	color: var(--donara-primary-strong);
}

.donara-button--donate {
	display: block;
	width: 100%;
	border: 0;
	border-radius: var(--donara-radius-small);
	background: var(--donara-primary);
	color: var(--donara-button-text);
	font-family: var(--donara-font-body);
	font-size: 17px;
	font-weight: 700;
	padding: 16px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.donara-button--donate:hover:not([disabled]) {
	background: var(--donara-primary-hover);
}

.donara-button--donate:focus-visible {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 2px;
}

.donara-button--donate[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

.donara-form__reassure {
	margin: 12px 0 0;
	text-align: center;
	font-size: 12px;
	color: var(--donara-muted);
}

/*
 * Deliberately no `opacity` here. `--donara-muted` resolves to the
 * organization's own body text colour, which the branding contrast checker has
 * already verified against the surface at WCAG AA. Fading it afterwards would
 * silently undo the guarantee the checker just made — at 0.8 on white this line
 * measured 3.28:1 against a 4.5:1 requirement. It stays subtle through its size
 * and its muted colour instead.
 */
.donara-powered {
	margin: 20px 0 0;
	text-align: center;
	font-size: 11px;
	color: var(--donara-muted);
}

/* Notices ----------------------------------------------------------- */

.donara-notice {
	border-radius: var(--donara-radius-small);
	padding: 14px 16px;
	font-size: 14px;
}

.donara-notice p {
	margin: 0;
}

.donara-notice--info {
	background: var(--donara-soft);
	color: var(--donara-primary-strong);
}

.donara-notice--closed {
	background: var(--donara-highlight);
	border: 1px solid var(--donara-border);
	color: var(--donara-text);
	text-align: center;
}

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

@media (max-width: 480px) {
	.donara-form__row {
		grid-template-columns: 1fr;
		gap: 0;
	}
}

/* Donate button (M13): a standalone, inline call-to-action linking to a
   campaign's donor page. Solid and outline variants, brand-colored. */
.donara-donate-cta {
	margin: 0;
}

.donara-cta-button {
	display: inline-block;
	border: 2px solid var(--donara-primary);
	border-radius: var(--donara-radius-small);
	background: var(--donara-primary);
	color: var(--donara-button-text);
	font-family: var(--donara-font-body);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	padding: 12px 24px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.donara-cta-button:hover,
.donara-cta-button:focus {
	background: var(--donara-primary-hover);
	border-color: var(--donara-primary-hover);
	color: var(--donara-button-text);
}

.donara-cta-button:focus-visible {
	outline: 2px solid var(--donara-focus-ring);
	outline-offset: 2px;
}

.donara-cta-button--outline {
	background: transparent;
	border-color: var(--donara-primary-strong);
	color: var(--donara-primary-strong);
}

.donara-cta-button--outline:hover,
.donara-cta-button--outline:focus {
	background: var(--donara-primary);
	color: var(--donara-button-text);
}
