/*
 * Volunteer blocks: structural, neutral styles.
 *
 * The theme owns the look. This file only makes the form and the role cards
 * usable everywhere: on paper and on ink sections (colors derive from
 * currentColor), on a 320px phone (mobile-first, single column), and with a
 * keyboard (visible focus). Inputs are 16px+ so iOS does not zoom.
 *
 * Every value reads a theme.json preset first and falls back to a sane value.
 */

.wtr-apply,
.wtr-roles {
	--wtr-v-line: var(--wp--preset--color--line, color-mix(in srgb, currentColor 18%, transparent));
	--wtr-v-soft: color-mix(in srgb, currentColor 6%, transparent);
	--wtr-v-muted: color-mix(in srgb, currentColor 68%, transparent);
	--wtr-v-accent: var(--wp--preset--color--orange, #FF5A1F);
	--wtr-v-urgent: var(--wp--preset--color--red, #C8102E);
	--wtr-v-radius: 2px;
	--wtr-v-gap: var(--wp--preset--spacing--30, 1rem);
	--wtr-v-mono: var(--wp--preset--font-family--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	box-sizing: border-box;
}
.wtr-apply *,
.wtr-roles * {
	box-sizing: inherit;
}

/* ---------- Application form ---------- */

.wtr-apply {
	max-width: 46rem;
	margin-inline: auto;
}
.wtr-apply__header {
	margin-bottom: var(--wtr-v-gap);
}
.wtr-apply__intro {
	color: var(--wtr-v-muted);
}
.wtr-apply__steps {
	display: grid;
	gap: calc(var(--wtr-v-gap) * 2);
}
.wtr-apply__step,
.wtr-apply__group {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
.wtr-apply__step[hidden],
.wtr-apply [hidden] {
	display: none !important;
}
.wtr-apply__legend {
	font-family: var(--wp--preset--font-family--display, inherit);
	font-size: clamp(1.5rem, 4vw, 2rem);
	line-height: 1.15;
	padding: 0;
	margin-bottom: var(--wtr-v-gap);
}
.wtr-apply__legend:focus {
	outline: none;
}
.wtr-apply__legend:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}
.wtr-apply__group {
	margin-top: calc(var(--wtr-v-gap) * 1.25);
}
.wtr-apply__group > .wtr-apply__label {
	padding: 0;
	margin-bottom: .5rem;
}
.wtr-apply__row {
	display: grid;
	gap: 0 var(--wtr-v-gap);
}
@media (min-width: 640px) {
	.wtr-apply__row {
		grid-template-columns: 1fr 1fr;
		align-items: start;
	}
}
.wtr-apply__field {
	margin-bottom: var(--wtr-v-gap);
}
.wtr-apply__label {
	display: block;
	font-weight: 600;
	margin-bottom: .35rem;
}
.wtr-apply__optional,
.wtr-apply__hint {
	font-weight: 400;
	color: var(--wtr-v-muted);
	font-size: .9em;
}
.wtr-apply__hint {
	margin: 0 0 .5rem;
}
.wtr-apply__hint--lived {
	border-inline-start: 3px solid var(--wtr-v-accent);
	padding-inline-start: .75rem;
	color: inherit;
}
.wtr-apply__input {
	display: block;
	width: 100%;
	font: inherit;
	font-size: max(16px, 1rem);
	line-height: 1.4;
	padding: .7rem .8rem;
	color: inherit;
	background: var(--wtr-v-soft);
	border: 1px solid var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
	min-height: 48px;
}
textarea.wtr-apply__input {
	min-height: 6rem;
	resize: vertical;
}
select.wtr-apply__input {
	appearance: auto;
}
.wtr-apply__input:focus-visible,
.wtr-apply__check input:focus-visible,
.wtr-apply__choice input:focus-visible + .wtr-apply__choice-body {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.wtr-apply__input[aria-invalid="true"],
.wtr-apply__group[aria-invalid="true"] .wtr-apply__choice {
	border-color: var(--wtr-v-urgent);
}
.wtr-apply__error {
	color: var(--wtr-v-urgent);
	font-size: .9em;
	margin: .35rem 0 0;
}
.wtr-apply__check {
	display: flex;
	gap: .6rem;
	align-items: flex-start;
	cursor: pointer;
	padding: .35rem 0;
	min-height: 44px;
}
.wtr-apply__check input {
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	margin: .15rem 0 0;
	accent-color: currentColor;
}
.wtr-apply__grid {
	display: grid;
	gap: 0 var(--wtr-v-gap);
}
@media (min-width: 520px) {
	.wtr-apply__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Role choice cards: the whole card is the click target. */
.wtr-apply__choices {
	display: grid;
	gap: .75rem;
}
@media (min-width: 640px) {
	.wtr-apply__choices {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
.wtr-apply__choice {
	position: relative;
	display: flex;
	gap: .75rem;
	align-items: flex-start;
	padding: 1rem;
	border: 1px solid var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}
.wtr-apply__choice input {
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	margin: .1rem 0 0;
	accent-color: currentColor;
}
.wtr-apply__choice:hover {
	border-color: currentColor;
}
.wtr-apply__choice:has(input:checked) {
	border-color: currentColor;
	background: var(--wtr-v-soft);
	box-shadow: inset 4px 0 0 var(--wtr-v-accent);
}
.wtr-apply__choice-body {
	display: grid;
	gap: .2rem;
}
.wtr-apply__choice-title {
	font-weight: 700;
}
.wtr-apply__choice-meta {
	font-size: .9em;
	color: var(--wtr-v-muted);
}
.wtr-apply__badge,
.wtr-role__badge,
.wtr-role__hub {
	display: inline-block;
	font-family: var(--wtr-v-mono);
	font-size: .72rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: .2rem .45rem;
	border: 1px solid var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
	justify-self: start;
	line-height: 1.3;
}
.wtr-apply__badge--secure,
.wtr-role__badge--secure {
	border-color: currentColor;
	font-weight: 700;
}
.wtr-apply__statement {
	padding: 1rem;
	border: 1px solid var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
	background: var(--wtr-v-soft);
	margin-bottom: .5rem;
}
.wtr-apply__statement p {
	margin: 0;
}

/* Honeypot: off-screen for people, present for bots. */
.wtr-apply__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Notes for the no-JavaScript form; hidden once the script takes over. */
.wtr-apply.is-enhanced .wtr-apply__nojs {
	display: none;
}

/* Progress. */
.wtr-apply__progress {
	margin-bottom: calc(var(--wtr-v-gap) * 1.5);
}
.wtr-apply__progress-label {
	font-family: var(--wtr-v-mono);
	font-size: .78rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin: 0 0 .5rem;
}
.wtr-apply__progress-bar {
	height: 4px;
	background: var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
	overflow: hidden;
}
.wtr-apply__progress-bar span {
	display: block;
	height: 100%;
	background: currentColor;
	transition: width .25s ease;
}
.wtr-apply__progress-steps {
	display: none;
	list-style: none;
	margin: .6rem 0 0;
	padding: 0;
	gap: var(--wtr-v-gap);
	font-size: .85rem;
	color: var(--wtr-v-muted);
}
@media (min-width: 720px) {
	.wtr-apply__progress-steps {
		display: flex;
		flex-wrap: wrap;
	}
}
.wtr-apply__progress-steps .is-current {
	color: inherit;
	font-weight: 700;
}
.wtr-apply__progress-steps .is-done::before {
	content: "✓ ";
}

/* Navigation. */
.wtr-apply__nav {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem;
	margin-top: calc(var(--wtr-v-gap) * 1.5);
}
.wtr-apply__button {
	font: inherit;
	font-weight: 700;
	font-size: max(16px, 1rem);
	min-height: 48px;
	padding: .75rem 1.4rem;
	border-radius: var(--wtr-v-radius);
	border: 1px solid currentColor;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.wtr-apply__button--next,
.wtr-apply__button--submit {
	margin-inline-start: auto;
	/* Orange with ink text reads on both paper and ink sections. */
	color: var(--wp--preset--color--ink, #0b0b0c);
	background: var(--wtr-v-accent);
	border-color: var(--wp--preset--color--ink, #0b0b0c);
}
.wtr-apply__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}
.wtr-apply__button[disabled] {
	opacity: .6;
	cursor: progress;
}
@media (max-width: 479px) {
	.wtr-apply__nav .wtr-apply__button {
		flex: 1 1 auto;
	}
}

/* Status, error summary, thank you. */
.wtr-apply__status:focus {
	outline: none;
}
.wtr-apply__status:empty {
	display: none;
}
.wtr-apply.is-enhanced .wtr-apply__status:not(:has(.wtr-apply__summary)) {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.wtr-apply__summary {
	border: 2px solid var(--wtr-v-urgent);
	border-radius: var(--wtr-v-radius);
	padding: 1rem 1.2rem;
	margin-bottom: var(--wtr-v-gap);
}
.wtr-apply__summary ul {
	margin: .25rem 0 0;
	padding-inline-start: 1.2rem;
}
.wtr-apply__summary a {
	color: inherit;
}
.wtr-apply__thanks {
	padding: calc(var(--wtr-v-gap) * 1.5);
	border: 1px solid var(--wtr-v-line);
	border-inline-start: 4px solid var(--wtr-v-accent);
	border-radius: var(--wtr-v-radius);
}
.wtr-apply__thanks:focus {
	outline: none;
}

/* ---------- Roles grid ---------- */

.wtr-roles {
	display: grid;
	gap: var(--wtr-v-gap);
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
	.wtr-roles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (min-width: 1024px) {
	.wtr-roles {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
.wtr-role {
	display: flex;
	flex-direction: column;
	gap: .6rem;
	padding: 1.25rem;
	border: 1px solid var(--wtr-v-line);
	border-radius: var(--wtr-v-radius);
}
.wtr-role--single {
	border: 0;
	padding: 0;
}
.wtr-role__meta {
	display: flex;
	flex-wrap: wrap;
	gap: .35rem;
	margin: 0;
}
.wtr-role__title {
	margin: 0;
	font-size: 1.35rem;
	line-height: 1.2;
}
.wtr-role__title a {
	color: inherit;
	text-decoration: none;
}
.wtr-role__title a:hover {
	text-decoration: underline;
}
.wtr-role__excerpt,
.wtr-role__commit {
	margin: 0;
}
.wtr-role__commit {
	font-family: var(--wtr-v-mono);
	font-size: .8rem;
	letter-spacing: .04em;
	color: var(--wtr-v-muted);
}
.wtr-role__cta {
	margin-top: auto;
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: .6rem 1.1rem;
	border: 1px solid currentColor;
	border-radius: var(--wtr-v-radius);
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}
.wtr-role__cta:hover,
.wtr-role__cta:focus-visible {
	background: var(--wtr-v-soft);
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.wtr-roles__empty {
	grid-column: 1 / -1;
}

@media (prefers-reduced-motion: reduce) {
	.wtr-apply *,
	.wtr-roles * {
		transition: none !important;
	}
}
