/**
 * Bespoke Walk Booking Form
 *
 * Deliberately low-contrast with the host theme: it inherits the page's font
 * and accent colour rather than imposing its own, so it sits inside whatever
 * design the site already has.
 *
 * @since 1.20.0
 */

.tpopb-bespoke {
	--tpopb-bespoke-accent: var(--tpopb-accent, #2f6f4e);
	--tpopb-bespoke-border: #d9d9d9;
	--tpopb-bespoke-muted: #666;
	--tpopb-bespoke-error: #b32d2e;
	--tpopb-bespoke-radius: 6px;

	max-width: 720px;
	margin: 0 auto;
	font-size: 1rem;
	line-height: 1.5;
}

.tpopb-bespoke *,
.tpopb-bespoke *::before,
.tpopb-bespoke *::after {
	box-sizing: border-box;
}

.tpopb-bespoke-title {
	margin: 0 0 0.5em;
}

.tpopb-bespoke-intro {
	margin: 0 0 1.5em;
	color: var(--tpopb-bespoke-muted);
}

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

.tpopb-bespoke-step {
	margin: 0 0 1.75em;
	padding: 0;
	border: 0;
}

.tpopb-bespoke-legend {
	padding: 0;
	margin: 0 0 0.75em;
	font-size: 1.15em;
	font-weight: 600;
}

.tpopb-bespoke-help {
	margin: -0.25em 0 1em;
	font-size: 0.9em;
	color: var(--tpopb-bespoke-muted);
}

.tpopb-bespoke-note {
	margin: 0.75em 0 0;
	font-size: 0.9em;
	color: var(--tpopb-bespoke-muted);
}

/* Fields ----------------------------------------------------------------- */

.tpopb-bespoke-field {
	margin: 0 0 1em;
}

.tpopb-bespoke-grid {
	display: grid;
	gap: 0 1em;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tpopb-bespoke-label {
	display: block;
	margin: 0 0 0.35em;
	font-weight: 600;
}

.tpopb-bespoke-required {
	color: var(--tpopb-bespoke-error);
}

.tpopb-bespoke-optional {
	font-weight: 400;
	color: var(--tpopb-bespoke-muted);
}

.tpopb-bespoke-input,
.tpopb-bespoke-select,
.tpopb-bespoke-textarea,
.tpopb-bespoke input.tpopb-bespoke-dates {
	width: 100%;
	padding: 0.65em 0.75em;
	font: inherit;
	color: inherit;
	background: #fff;
	border: 1px solid var(--tpopb-bespoke-border);
	border-radius: var(--tpopb-bespoke-radius);
}

.tpopb-bespoke-textarea {
	resize: vertical;
}

.tpopb-bespoke-input:focus,
.tpopb-bespoke-select:focus,
.tpopb-bespoke-textarea:focus,
.tpopb-bespoke-dates:focus {
	outline: 2px solid var(--tpopb-bespoke-accent);
	outline-offset: 1px;
}

/* Price tiers ------------------------------------------------------------- */

.tpopb-bespoke-tiers {
	display: grid;
	gap: 0.75em;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.tpopb-bespoke-tier {
	display: block;
	cursor: pointer;
}

.tpopb-bespoke-tier input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.tpopb-bespoke-tier-body {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	align-items: center;
	padding: 1em 0.75em;
	text-align: center;
	background: #fff;
	border: 2px solid var(--tpopb-bespoke-border);
	border-radius: var(--tpopb-bespoke-radius);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tpopb-bespoke-tier:hover .tpopb-bespoke-tier-body {
	border-color: var(--tpopb-bespoke-accent);
}

.tpopb-bespoke-tier input:checked + .tpopb-bespoke-tier-body {
	border-color: var(--tpopb-bespoke-accent);
	box-shadow: inset 0 0 0 1px var(--tpopb-bespoke-accent);
}

.tpopb-bespoke-tier input:focus-visible + .tpopb-bespoke-tier-body {
	outline: 2px solid var(--tpopb-bespoke-accent);
	outline-offset: 2px;
}

.tpopb-bespoke-tier-size {
	font-size: 0.9em;
	color: var(--tpopb-bespoke-muted);
}

.tpopb-bespoke-tier-price {
	font-size: 1.35em;
	font-weight: 700;
}

/* Dates ------------------------------------------------------------------- */

/* In static mode flatpickr wraps the input in an inline-block of its own, which
   otherwise collapses the field to its default text width. */
.tpopb-bespoke .flatpickr-wrapper {
	display: block;
	width: 100%;
}

.tpopb-bespoke .flatpickr-calendar.static {
	width: 100%;
	max-width: 100%;
}

.tpopb-bespoke-dates-status {
	margin: 0.4em 0 0;
	font-size: 0.9em;
	color: var(--tpopb-bespoke-muted);
}

.tpopb-bespoke-dates-status.is-complete {
	font-weight: 600;
	color: var(--tpopb-bespoke-accent);
}

/* Checkboxes -------------------------------------------------------------- */

.tpopb-bespoke-checkbox {
	margin: 0 0 0.75em;
}

.tpopb-bespoke-checkbox label {
	display: flex;
	gap: 0.6em;
	align-items: flex-start;
	cursor: pointer;
}

.tpopb-bespoke-checkbox input {
	flex: 0 0 auto;
	margin-top: 0.3em;
}

/* Summary ----------------------------------------------------------------- */

.tpopb-bespoke-summary {
	padding: 1.25em;
	background: rgba(0, 0, 0, 0.03);
	border-radius: var(--tpopb-bespoke-radius);
}

.tpopb-bespoke-total {
	display: flex;
	gap: 1em;
	align-items: baseline;
	justify-content: space-between;
	margin: 0 0 1em;
}

.tpopb-bespoke-total-label {
	font-weight: 600;
}

.tpopb-bespoke-total-value {
	font-size: 1.6em;
	font-weight: 700;
}

.tpopb-bespoke-submit {
	display: block;
	width: 100%;
	padding: 0.85em 1.5em;
	font: inherit;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
	background: var(--tpopb-bespoke-accent);
	border: 0;
	border-radius: var(--tpopb-bespoke-radius);
}

.tpopb-bespoke-submit:hover:not(:disabled) {
	filter: brightness(1.08);
}

.tpopb-bespoke-submit:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.tpopb-bespoke-submit.is-loading::after {
	content: '…';
}

.tpopb-bespoke-reassurance {
	margin: 0.85em 0 0;
	font-size: 0.85em;
	text-align: center;
	color: var(--tpopb-bespoke-muted);
}

/* Errors ------------------------------------------------------------------ */

.tpopb-bespoke-error {
	margin: 0.35em 0 0;
	font-size: 0.9em;
	color: var(--tpopb-bespoke-error);
}

.tpopb-bespoke-form-error {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	color: var(--tpopb-bespoke-error);
	background: rgba(179, 45, 46, 0.08);
	border-radius: var(--tpopb-bespoke-radius);
}

.tpopb-bespoke-form-error.is-notice {
	color: inherit;
	background: rgba(0, 0, 0, 0.05);
}


/* Trigger button and modal -------------------------------------------------
   The default layout is a single "Book now" button; the form itself lives in
   a dialog that opens over the page, so the pricing on the page stays put. */

.tpopb-bespoke-trigger-wrap {
	text-align: center;
}

.tpopb-bespoke-trigger {
	display: inline-block;
	padding: 0.9em 2.5em;
	font: inherit;
	font-size: 1.05em;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
	background: var(--tpopb-bespoke-accent);
	border: 0;
	border-radius: var(--tpopb-bespoke-radius);
}

.tpopb-bespoke-trigger:hover {
	filter: brightness(1.08);
}

.tpopb-bespoke-trigger:focus-visible {
	outline: 3px solid var(--tpopb-bespoke-accent);
	outline-offset: 3px;
}

.tpopb-bespoke-trigger-note {
	margin: 0.75em 0 0;
	font-size: 0.85em;
	color: var(--tpopb-bespoke-muted);
}

.tpopb-bespoke--modal .tpopb-bespoke-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(0, 0, 0, 0.55);
}

.tpopb-bespoke--modal .tpopb-bespoke-panel {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: 99999;
	width: min(720px, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	padding: 2rem;
	overflow-y: auto;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
	transform: translate(-50%, -50%);
	-webkit-overflow-scrolling: touch;
}

.tpopb-bespoke .tpopb-bespoke-close {
	position: absolute;
	top: 0.5rem;
	right: 0.75rem;
	padding: 0.2em 0.4em;
	font-size: 1.8rem;
	line-height: 1;
	color: var(--tpopb-bespoke-muted);
	cursor: pointer;
	background: none;
	border: 0;
}

.tpopb-bespoke .tpopb-bespoke-close:hover {
	color: inherit;
}

.tpopb-bespoke .tpopb-bespoke-close:focus-visible {
	outline: 2px solid var(--tpopb-bespoke-accent);
	outline-offset: 2px;
}

/* Stops the page behind the dialog scrolling with it. */
body.tpopb-bespoke-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.tpopb-bespoke--modal .tpopb-bespoke-panel {
		top: 0;
		left: 0;
		width: 100vw;
		max-width: none;
		height: 100%;
		max-height: none;
		padding: 3rem 1.25rem 2rem;
		border-radius: 0;
		transform: none;
	}
}

/* Some themes set a display on every element and undo the hidden attribute. */
.tpopb-bespoke [hidden] {
	display: none !important;
}
