/*
 * Liston Stripe Checkout — front-end styles.
 *
 * Defaults are a neutral teal.  To match a different site,
 * override the four variables below in the theme's own stylesheet or
 * in Appearance → Customise → Additional CSS. Nothing else needs
 * touching.
 */

.ls-pay {
	--ls-accent: #E66D25;
	--ls-accent-hover: #e05807;
	--ls-on-accent: #ffffff;
	--ls-error: #202A44;

	margin: 1.5rem 0;
}

/* ---------- Button ---------- */

.ls-pay-button {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.85em 1.6em;
	border: 0;
	border-radius: 999px;
	background: var(--ls-accent);
	color: var(--ls-on-accent);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: background-color 160ms ease, transform 160ms ease;
}

.ls-pay-button:hover,
.ls-pay-button:focus-visible {
	background: var(--ls-accent-hover);
}

.ls-pay-button:focus-visible {
	outline: 2px solid var(--ls-accent);
	outline-offset: 3px;
}

.ls-pay-button:active {
	transform: translateY(1px);
}

.ls-pay-button[disabled] {
	cursor: progress;
	opacity: 0.75;
}

/* ---------- Working state ---------- */

.ls-pay-button__spinner {
	display: none;
	width: 0.9em;
	height: 0.9em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ls-pay-spin 700ms linear infinite;
}

.ls-pay-button.is-working .ls-pay-button__spinner {
	display: block;
}

@keyframes ls-pay-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.ls-pay-button,
	.ls-pay-button__spinner {
		transition: none;
		animation: none;
	}
	.ls-pay-button.is-working .ls-pay-button__spinner {
		border-right-color: currentColor;
		opacity: 0.5;
	}
}

/* ---------- Messages ---------- */

.ls-pay-error {
	margin: 0.75rem 0 0;
	color: var(--ls-error);
	font-size: 0.95em;
}

.ls-pay-testmode {
	margin: 0.5rem 0 0;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.6;
}

.ls-pay-notice {
	padding: 0.9em 1.1em;
	border-left: 3px solid currentColor;
	background: rgba(0, 0, 0, 0.03);
	font-size: 0.95em;
}

.ls-pay-notice--error {
	color: #b3403a;
}

/* ---------- Receipt ---------- */

.ls-receipt {
	max-width: 34rem;
	margin: 2rem 0;
}

.ls-receipt__lead {
	margin: 0 0 1.25rem;
	font-size: 1.35em;
	font-weight: 600;
}

.ls-receipt__detail {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.4rem 1.5rem;
	margin: 0 0 1.25rem;
	padding: 1rem 0;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.ls-receipt__detail dt {
	font-size: 0.85em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.65;
}

.ls-receipt__detail dd {
	margin: 0;
	font-weight: 600;
}

.ls-receipt__detail code {
	font-size: 0.85em;
	font-weight: 400;
	word-break: break-all;
}

.ls-receipt__note {
	margin: 0;
	opacity: 0.8;
}

/* ---------- Invoice form ---------- */

.ls-invoice {
	--ls-accent: #E66D25;
	--ls-accent-hover: #e05807;
	--ls-on-accent: #ffffff;
	--ls-error: #b3403a;
	--ls-line: rgba(0, 0, 0, 0.18);

	max-width: 30rem;
	margin: 2rem 0;
}

.ls-invoice__heading {
	margin: 0 0 0.5rem;
}

.ls-invoice__intro {
	margin: 0 0 1.75rem;
	opacity: 0.85;
}

.ls-field {
	margin-bottom: 1.35rem;
}

.ls-field label {
	display: block;
	margin-bottom: 0.4rem;
	font-size: 0.9em;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.ls-field input[type="text"],
.ls-field input[type="number"] {
	width: 100%;
	box-sizing: border-box;
	padding: 0.7em 0.85em;
	border: 1px solid var(--ls-line);
	border-radius: 6px;
	background: #fff;
	color: inherit;
	font: inherit;
	/* 16px minimum stops iOS zooming the page on focus. */
	font-size: max(1rem, 16px);
	transition: border-color 140ms ease, box-shadow 140ms ease;
}

.ls-field input:focus {
	border-color: var(--ls-accent);
	outline: none;
	box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.18);
}

.ls-field input[aria-invalid="true"] {
	border-color: var(--ls-error);
}

/* Amount field with its currency symbol tucked inside.
 *
 * The symbol is a flex sibling, not absolutely positioned over the
 * input. Overlaying it means relying on the input's padding-left,
 * which any theme with its own `input` rule will happily override —
 * and then the symbol sits on top of the first digit. As flex
 * children they physically cannot overlap, whatever the theme does.
 *
 * The wrapper carries the border and background; the input inside is
 * stripped bare and inherits the box. */

.ls-field__money {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--ls-line);
	border-radius: 6px;
	background: #fff;
	overflow: hidden;
	transition: border-color 140ms ease, box-shadow 140ms ease;
}

.ls-field__money:focus-within {
	border-color: var(--ls-accent);
	box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.18);
}

.ls-invoice .ls-field__symbol {
	display: flex;
	align-items: center;
	padding: 0 0.15em 0 0.85em;
	font-size: max(1rem, 16px);
	line-height: 1;
	opacity: 0.55;
	pointer-events: none;
	user-select: none;
	margin-left -10px;
}

/* Specificity here is deliberate — it needs to outrank a theme's
 * generic input styling without reaching for !important. */
.ls-invoice .ls-field__money input[type="number"] {
	flex: 1 1 auto;
	min-width: 0;
	padding-left: 0.25em;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.ls-invoice .ls-field__money input[type="number"]:focus {
	border: 0;
	outline: none;
	box-shadow: none;
}

/* Strip the spinner arrows — they're useless on a money field */
.ls-field__money input::-webkit-outer-spin-button,
.ls-field__money input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
}

.ls-field__money input {
	-moz-appearance: textfield;
	appearance: textfield;
}

.ls-field__hint {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.85em;
	line-height: 1.45;
	opacity: 0.65;
}

/* Honeypot — off-screen rather than display:none, since some bots
   skip anything hidden outright. */
.ls-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ls-invoice .ls-pay-button {
	width: 100%;
	justify-content: center;
	margin-top: 0.25rem;
}

.ls-invoice__reassure {
	margin: 1rem 0 0;
	font-size: 0.85em;
	line-height: 1.5;
	text-align: center;
	opacity: 0.65;
}

.ls-invoice .ls-pay-error {
	text-align: center;
}
