/*
 * Event RSVP + sponsorship blocks and their shared checkout modal.
 *
 * The blocks render inside an event's post content, so they sit in the middle
 * of editor prose — they are boxed and tinted to read as controls rather than
 * as another paragraph. The modal mirrors the sponsorship page's, since it is
 * the same job with a different line item.
 *
 * Markup: template-parts/events/rsvp.php, sponsor.php, payment-modal.php.
 */

.evpay {
	margin: 2rem 0;
	padding: 1.5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--sand);
}

.evpay__heading {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	font-weight: 700;
}

.evpay__price {
	margin: 0 0 0.35rem;
	font-size: 1.1rem;
}

.evpay__price strong {
	color: var(--accent);
	font-size: 1.5rem;
	font-weight: 700;
}

.evpay__price span {
	color: var(--muted);
}

.evpay__deadline,
.evpay__note {
	margin: 0 0 0.35rem;
	color: var(--muted);
	font-size: 0.9rem;
}

.evpay__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

/*
 * Ticket types. One row per type — an evening with an adult, child and family
 * rate is three questions, and stacking them as rows keeps each price next to
 * the number it multiplies.
 */
.evpay__tickets {
	display: grid;
	gap: 0.5rem;
	margin-top: 1.25rem;
}

.evticket {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
}

.evticket__label {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: 600;
}

.evticket__price {
	margin-left: 0.5rem;
	color: var(--accent);
	font-weight: 700;
}

.evticket__qty {
	flex: 0 0 5rem;
	height: 40px;
	padding: 0 0.5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
	font-family: inherit;
	font-size: 15px;
}

.evpay__button {
	flex: 1 1 12rem;
}

.evmodal__attendees[hidden],
.evmodal [data-evpay-fields][hidden] {
	display: none;
}

/*
 * Sponsorship tiers. A list, not cards in a grid: on an event page these sit
 * under body copy and are a short price menu, so rows read faster than a wall
 * of boxes — and they stay readable at four tiers or at one.
 */
.evpay__tiers {
	margin: 1.25rem 0 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.5rem;
}

.evtier {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
}

.evtier__amount {
	/* Hugs its own price, with no floor under it. A fixed or minimum column
	   would line the Custom row's input up with the prices, but at the cost of
	   stranding "$100" a long way from the tier it belongs to — the pairing
	   matters more than the column edge. */
	flex: 0 0 auto;
	color: var(--accent);
	font-size: 1.15rem;
	font-weight: 700;
}

.evtier__name {
	flex: 1 1 auto;
	min-width: 0;
	font-weight: 600;
}

.evtier__button {
	flex: 0 0 auto;
}

/* No name span to carry the flex-grow that pushes the button to the right
   — give that job to the amount instead of letting the row collapse. */
.evtier--unnamed .evtier__amount {
	flex: 1 1 auto;
}

/*
 * Checkout modal. Same shape and motion as the sponsorship page's modal.
 */

.evmodal-open {
	overflow: hidden;
}

.evmodal[hidden] {
	display: none;
}

.evmodal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.evmodal__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(11 20 32 / 55%);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.evmodal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--bg);
	box-shadow: 0 24px 60px rgb(11 20 32 / 25%);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

@media (min-width: 640px) {
	.evmodal__dialog {
		max-width: 640px;
	}

	.evmodal__scroll {
		padding: 2.5rem;
	}
}

.evmodal--visible .evmodal__backdrop {
	opacity: 1;
}

.evmodal--visible .evmodal__dialog {
	opacity: 1;
	transform: none;
}

.evmodal__scroll {
	max-height: 90vh;
	overflow-y: auto;
	padding: 2rem;
}

.evmodal__close {
	position: absolute;
	z-index: 2;
	top: 0.75rem;
	right: 0.75rem;
	width: 2rem;
	height: 2rem;
	border: 0;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--muted);
}

.evmodal__header {
	margin: 0 0 1.5rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid var(--line);
}

.evmodal__title {
	margin: 0 0 0.2rem;
	font-size: 1.3rem;
	font-weight: 600;
}

.evmodal__event {
	margin: 0 0 0.4rem;
	color: var(--muted);
	font-size: 0.9rem;
}

.evmodal__amount {
	margin: 0;
	color: var(--accent);
	font-weight: 700;
	font-size: 1.2rem;
}

.evmodal__form .field {
	margin-bottom: 1rem;
}

.evmodal__section-title {
	margin: 0 0 0.85rem;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.evmodal__row {
	display: flex;
	gap: 0.75rem;
}

.evmodal__row .field {
	flex: 1;
	min-width: 0;
}

.evmodal__ifield {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 42px;
	border: 1px solid var(--line);
	border-radius: 6px;
	overflow: hidden;
}

.evmodal__row--card-meta select.field__input {
	box-sizing: border-box;
	width: 100%;
	height: 42px;
	padding: 0 0.5rem;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--bg);
	font-size: 15px;
	font-family: inherit;
}

.evmodal__error {
	display: block;
	min-height: 1.2em;
	margin-bottom: 0.5rem;
	color: #b3261e;
	font-size: 0.85rem;
}

.evmodal__secure {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.25rem;
	margin-bottom: 1.1rem;
	padding-top: 0.85rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.85rem;
}

.evmodal__lock {
	flex-shrink: 0;
	width: 15px;
	height: 15px;
	color: var(--accent);
}

.evmodal__cards {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-left: auto;
}

.evmodal__cards img {
	height: 20px;
	width: auto;
}

.evmodal__status {
	min-height: 1.2em;
	margin: 0 0 1rem;
	font-size: 0.9rem;
	color: var(--muted);
}

.evmodal__status--error {
	color: #b3261e;
}

/* Where the real Google badge lands (256x60 is its own fixed size). */
.evmodal__recaptcha-badge {
	display: flex;
	justify-content: center;
	min-height: 60px;
	margin: 0 0 1rem;
}

.evmodal__submit {
	width: 100%;
}

.evmodal__done[hidden] {
	display: none;
}

.evmodal__done {
	text-align: center;
	padding: 0.5rem 0 0;
}

.evmodal__done-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 1rem;
	display: block;
	transform: scale(0);
	animation: evpay-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.evmodal__done-icon-circle {
	stroke: #1e8e5a;
	stroke-width: 3;
	stroke-dasharray: 151;
	stroke-dashoffset: 151;
	animation: evpay-draw 0.5s ease-out forwards;
}

.evmodal__done-icon-check {
	stroke: #1e8e5a;
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 36;
	stroke-dashoffset: 36;
	animation: evpay-draw 0.3s ease-out 0.45s forwards;
}

.evmodal__done-title {
	margin: 0 0 0.5rem;
	font-size: 1.2rem;
	font-weight: 700;
	opacity: 0;
	animation: evpay-fade-up 0.4s ease-out 0.55s forwards;
}

.evmodal__done-text {
	margin: 0 0 1.5rem;
	line-height: 1.6;
	opacity: 0;
	animation: evpay-fade-up 0.4s ease-out 0.68s forwards;
}

.evmodal__done .button {
	opacity: 0;
	animation: evpay-fade-up 0.4s ease-out 0.8s forwards;
}

@keyframes evpay-bounce {
	0% {
		transform: scale(0);
	}
	60% {
		transform: scale(1.12);
	}
	100% {
		transform: scale(1);
	}
}

@keyframes evpay-draw {
	to {
		stroke-dashoffset: 0;
	}
}

@keyframes evpay-fade-up {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.evmodal__done-icon,
	.evmodal__done-icon-circle,
	.evmodal__done-icon-check,
	.evmodal__done-title,
	.evmodal__done-text,
	.evmodal__done .button {
		animation: none;
		stroke-dashoffset: 0;
		opacity: 1;
		transform: none;
	}
}

/*
 * The open "Custom" row. Laid out as a tier row is — amount column, name,
 * button hard right — with an input standing in for the printed price, so the
 * two read as alternatives in one list rather than a price list plus a
 * separate donation box.
 */
.evtier__custom-input {
	position: relative;
	/* Wide enough for four digits behind the $, and close enough to the price
	   column that the row still scans as one of the list. */
	flex: 0 0 5.5rem;
}

.evtier__currency {
	position: absolute;
	top: 50%;
	left: 0.65rem;
	transform: translateY(-50%);
	color: var(--muted);
	pointer-events: none;
}

.evtier__custom-input .field__input {
	width: 100%;
	height: 40px;
	padding: 0 0.5rem 0 1.5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
	font-family: inherit;
	font-size: 15px;
}

/* The label is a tier name in this row, so it carries the name's weight. */
.evtier--custom .evtier__name {
	cursor: pointer;
}

/* The RSVP contribution row: an amount box where a ticket row has its quantity
   picker, so the two read as the same kind of question. */
.evpay__tickets--contribution {
	margin-top: 0.5rem;
}

.evticket__amount-input {
	position: relative;
	flex: 0 0 6rem;
}

.evticket__currency {
	position: absolute;
	top: 50%;
	left: 0.65rem;
	transform: translateY(-50%);
	color: var(--muted);
	pointer-events: none;
}

.evticket__amount-input .field__input {
	width: 100%;
	height: 40px;
	padding: 0 0.5rem 0 1.5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--bg);
	font-family: inherit;
	font-size: 15px;
}
