/*
 * Styles for the pages this plugin renders: events, and a donor's own account.
 *
 * Deliberately restrained: these pages sit inside the charity's own theme, and
 * a plugin that imposes its own typography and colours makes them look bolted
 * on. Everything inherits font and colour from the theme; only layout,
 * spacing and the progress bar are specified here. Every rule is scoped under
 * .givio so nothing leaks into the rest of the site.
 */

.givio {
	/*
	 * Concrete colours, not currentColor.
	 *
	 * `--givio-accent: currentColor` looks like it inherits the theme, but a
	 * custom property holding a CSS-wide keyword is resolved against the
	 * element that *uses* it — so on a button whose rule also sets
	 * `color: #fff`, `background: var(--givio-accent)` became white behind
	 * white text. The buttons were invisible and nothing errored.
	 *
	 * A theme can still override these two variables, or the button classes
	 * outright, which is the supported way to restyle this.
	 */
	--givio-accent: #1f2937;
	--givio-on-accent: #ffffff;
	--givio-muted: rgba(0, 0, 0, 0.12);
	max-width: 46rem;
	margin-inline: auto;
}

/* Follow the theme into dark mode rather than staying on a light palette. */
@media (prefers-color-scheme: dark) {
	.givio {
		--givio-accent: #e5e7eb;
		--givio-on-accent: #111827;
		--givio-muted: rgba(255, 255, 255, 0.18);
	}
}

.givio * {
	box-sizing: border-box;
}

.givio-panel__title,
.givio-subhead {
	margin: 1.5em 0 0.6em;
}

.givio-eyebrow {
	margin: 0 0 0.35em;
	font-size: 0.9em;
	opacity: 0.75;
}

.givio-aside {
	font-size: 0.9em;
	opacity: 0.75;
}

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

.givio-progress {
	margin: 1em 0;
}

.givio-progress__amounts {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	flex-wrap: wrap;
}

.givio-progress__amounts strong {
	font-size: 1.6em;
	line-height: 1.1;
}

.givio-progress__track {
	margin-top: 0.5em;
	height: 0.6rem;
	border-radius: 999px;
	background: var(--givio-muted);
	overflow: hidden;
}

.givio-progress__bar {
	height: 100%;
	border-radius: 999px;
	background: var(--givio-accent);
	/* A zero-width bar is still meaningful, so keep it visible. */
	min-width: 0.6rem;
}

.givio-progress__meta {
	margin-top: 0.4em;
	font-size: 0.85em;
	opacity: 0.75;
}

/* Layout -------------------------------------------------------------- */

.givio-fundraiser__head {
	display: grid;
	gap: 1.25rem;
}

@media (min-width: 40rem) {
	.givio-fundraiser__head {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		align-items: start;
	}
}

.givio-cover {
	width: 100%;
	height: auto;
	border-radius: 0.75rem;
	display: block;
}

.givio-story {
	margin: 1.5em 0;
}

/* Buttons ------------------------------------------------------------- */

.givio-button {
	display: inline-block;
	padding: 0.7em 1.4em;
	border: 1px solid transparent;
	border-radius: 0.5rem;
	text-decoration: none;
	font-weight: 600;
	cursor: pointer;
	background: var(--givio-accent);
	color: var(--givio-on-accent);
}

.givio-button--ghost {
	background: transparent;
	color: inherit;
	border-color: currentColor;
}

.givio-button--small {
	padding: 0.4em 0.9em;
	font-size: 0.9em;
}

/* Choices ------------------------------------------------------------- */

.givio-choices {
	display: grid;
	gap: 0.75rem;
	margin: 1.5em 0;
}

.givio-choice {
	display: block;
	padding: 1rem 1.15rem;
	border: 1px solid var(--givio-muted);
	border-radius: 0.75rem;
	text-decoration: none;
	color: inherit;
}

.givio-choice:hover,
.givio-choice:focus-visible {
	border-color: currentColor;
}

.givio-choice__title {
	display: block;
	font-weight: 600;
}

.givio-choice__hint {
	display: block;
	margin-top: 0.2em;
	font-size: 0.9em;
	opacity: 0.75;
}

/* Steps --------------------------------------------------------------- */

.givio-steps {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin: 0 0 1.5em;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

.givio-steps__item {
	display: flex;
	align-items: center;
	gap: 0.45em;
	opacity: 0.5;
}

.givio-steps__item.is-active {
	opacity: 1;
	font-weight: 600;
}

.givio-steps__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.6em;
	height: 1.6em;
	border-radius: 999px;
	background: var(--givio-muted);
}

/* Forms --------------------------------------------------------------- */

.givio-field {
	display: block;
	margin: 0 0 1.1em;
}

.givio-field label,
.givio-field legend {
	display: block;
	margin-bottom: 0.3em;
	font-weight: 600;
}

.givio-field input,
.givio-field textarea {
	width: 100%;
	padding: 0.6em 0.75em;
	border: 1px solid var(--givio-muted);
	border-radius: 0.5rem;
	font: inherit;
	color: inherit;
	background: transparent;
}

.givio-radio {
	display: block;
	font-weight: 400;
	margin-bottom: 0.3em;
}

.givio-required {
	opacity: 0.6;
}

/* Wide and spaced, so six digits are easy to read back and check. */
.givio-code {
	max-width: 10em;
	font-size: 1.5em;
	letter-spacing: 0.4em;
	text-align: center;
}

.givio-inline-form {
	margin: 0;
}

/*
 * Resending a code sends an email, so it is a form button, not a link — but it
 * should read as a link, because that is what it looks like it does.
 */
.givio-linkbutton {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Lists --------------------------------------------------------------- */

.givio-list,
.givio-donations {
	list-style: none;
	margin: 1em 0;
	padding: 0;
}

.givio-list li,
.givio-donation {
	padding: 0.7em 0;
	border-bottom: 1px solid var(--givio-muted);
}

/* The account's own navigation reads as a stack of destinations. */
.givio-list--nav a {
	display: block;
	text-decoration: none;
	font-weight: 600;
}

.givio-back {
	font-size: 0.9em;
	text-decoration: none;
}

/* A donor's account ---------------------------------------------------- */

.givio-lead {
	margin: 0 0 1em;
}

/*
 * Two figures side by side, wrapping rather than shrinking. Someone reading a
 * total on a phone should not get "£1,4" with the rest cut off.
 */
.givio-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1em 0;
}

.givio-stat,
.givio-card {
	flex: 1 1 10rem;
	padding: 0.9em 1em;
	border: 1px solid var(--givio-muted);
	border-radius: 0.6rem;
}

.givio-card {
	flex-basis: 100%;
	margin: 1em 0;
}

.givio-stat__label {
	display: block;
	font-size: 0.85em;
	opacity: 0.75;
}

.givio-stat__value {
	display: block;
	font-size: 1.6em;
	line-height: 1.2;
}

.givio-card__line {
	margin: 0.25em 0;
}

.givio-donation__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0.6em 0 0;
}

.givio-fieldset {
	margin: 1.25em 0;
	padding: 0;
	border: 0;
}

.givio-checkbox {
	display: block;
	margin: 0.4em 0;
}

/* Events -------------------------------------------------------------- */

.givio-event__facts {
	display: grid;
	gap: 0.6rem;
	margin: 1.25em 0;
}

.givio-event__fact {
	display: flex;
	gap: 0.75rem;
	align-items: baseline;
}

.givio-event__fact dt {
	flex: 0 0 5.5rem;
	font-weight: 600;
}

.givio-event__fact dd {
	margin: 0;
}

/* Share --------------------------------------------------------------- */

.givio-share {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin: 1.5em 0;
}

.givio-share__label {
	font-weight: 600;
}

.givio-share__link {
	padding: 0.35em 0.8em;
	border: 1px solid var(--givio-muted);
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.9em;
	color: inherit;
}

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

.givio-notice {
	padding: 0.85em 1em;
	border-radius: 0.5rem;
	border: 1px solid var(--givio-muted);
	margin: 1em 0;
}

.givio-notice--error {
	border-color: #dc2626;
}

.givio-embed {
	display: block;
	margin: 1em 0;
}
