/*
 * To Shopify WebUX — front-end form
 * ---------------------------------------------------------------------------
 * Mobile-first. Three rules keep the layout still on a phone, which is what
 * the previous version got wrong:
 *
 *   1. Every control is at least 16px. Below that, iOS Safari zooms the page
 *      when a field takes focus — the single most common cause of a form
 *      that "jumps around" on an iPhone.
 *   2. Nothing animates position. Steps cross-fade in place; they never
 *      translate, so the page never shifts under a thumb.
 *   3. Every flex/grid child gets `min-width: 0` and wrapping text. Long
 *      option labels and URLs then wrap instead of widening the page and
 *      creating sideways scroll.
 *
 * Colors come from custom properties set inline from the settings screen.
 */

.tsw-wrap {
	/* Overridden per-install by wp_add_inline_style(). */
	--tsw-accent: #e0b352;
	--tsw-btn: #111111;
	--tsw-btn-text: #ffffff;

	--tsw-ink: #14161a;
	--tsw-ink-soft: #5b6169;
	--tsw-ink-faint: #8b9199;
	--tsw-line: #e4e7ec;
	--tsw-line-strong: #cfd4dc;
	--tsw-surface: #ffffff;
	--tsw-surface-alt: #f8f9fb;
	--tsw-danger: #d92d20;
	--tsw-radius: 12px;
	--tsw-radius-sm: 10px;
	--tsw-gap: 22px;

	/* Fallback for browsers without color-mix(); refined just below. */
	--tsw-accent-soft: var(--tsw-surface-alt);
	--tsw-accent-ring: rgba(0, 0, 0, .12);

	max-width: 720px;
	margin-inline: auto;
	padding: 0;
	color: var(--tsw-ink);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.6;
	scroll-margin-top: 24px;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.tsw-wrap {
		--tsw-accent-soft: color-mix(in srgb, var(--tsw-accent) 10%, #fff);
		--tsw-accent-ring: color-mix(in srgb, var(--tsw-accent) 32%, transparent);
	}
}

.tsw-wrap *,
.tsw-wrap *::before,
.tsw-wrap *::after {
	box-sizing: border-box;
}

.tsw-wrap [hidden] {
	display: none !important;
}

/* Anything that can hold long user text wraps rather than pushing the page. */
.tsw-wrap p,
.tsw-wrap li,
.tsw-wrap label,
.tsw-wrap legend,
.tsw-wrap h1,
.tsw-wrap h2 {
	overflow-wrap: break-word;
	word-break: break-word;
}

/* --------------------------------------------------------------- Card */

.tsw-form {
	background: var(--tsw-surface);
	border: 1px solid var(--tsw-line);
	border-radius: var(--tsw-radius);
	padding: 22px 18px 26px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .10);
	margin: 0;
}

/* ------------------------------------------------------------- Header */

.tsw-header {
	margin-bottom: 20px;
}

.tsw-brand {
	display: flex;
	align-items: center;
	min-height: 32px;
	margin-bottom: 14px;
}

.tsw-logo {
	max-height: 38px;
	width: auto;
	height: auto;
	max-width: 65%;
	display: block;
}

.tsw-brand-name {
	font-size: 18px;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	line-height: 1.2;
}

.tsw-title {
	margin: 0 0 10px;
	font-size: 24px;
	line-height: 1.25;
	font-weight: 800;
	letter-spacing: -0.015em;
	color: var(--tsw-ink);
}

.tsw-intro {
	margin: 0;
	color: var(--tsw-ink-soft);
	font-size: 15px;
	line-height: 1.65;
}

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

.tsw-progress {
	margin: 0 0 24px;
	padding-top: 20px;
	border-top: 1px solid var(--tsw-line);
}

.tsw-progress-meta {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .01em;
}

.tsw-progress-step {
	color: var(--tsw-ink-soft);
}

.tsw-progress-num {
	color: var(--tsw-ink);
	font-variant-numeric: tabular-nums;
}

.tsw-progress-bar {
	height: 6px;
	border-radius: 999px;
	background: var(--tsw-line);
	overflow: hidden;
}

.tsw-progress-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--tsw-accent);
	transition: width .35s cubic-bezier(.4, 0, .2, 1);
}

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

/*
 * The steps container never changes height mid-transition: the outgoing step
 * is removed from flow in the same frame the incoming one appears, and only
 * opacity animates. No translate, no reflow, no scroll jump.
 */
.tsw-steps {
	position: relative;
}

.tsw-step {
	animation: tsw-fade .22s ease-out;
}

@keyframes tsw-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.tsw-step-title {
	margin: 0 0 6px;
	font-size: 20px;
	line-height: 1.3;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.tsw-step-title:focus {
	outline: none;
}

.tsw-step-desc {
	margin: 0 0 20px;
	color: var(--tsw-ink-soft);
	font-size: 15px;
}

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

.tsw-field {
	margin: 0 0 var(--tsw-gap);
	min-width: 0;
	/* Reset the fieldset used for radio/checkbox groups. */
	border: 0;
	padding: 0;
}


.tsw-label {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--tsw-ink);
}

.tsw-req {
	color: var(--tsw-danger);
	margin-left: 3px;
	font-weight: 700;
}

.tsw-help {
	margin: 0 0 12px;
	color: var(--tsw-ink-faint);
	font-size: 14px;
	line-height: 1.55;
}

.tsw-input {
	display: block;
	width: 100%;
	min-width: 0;
	/* 16px minimum — anything smaller makes iOS zoom the page on focus. */
	font-size: 16px;
	font-family: inherit;
	line-height: 1.5;
	color: var(--tsw-ink);
	padding: 13px 14px;
	min-height: 50px;
	background: var(--tsw-surface);
	border: 1px solid var(--tsw-line-strong);
	border-radius: var(--tsw-radius-sm);
	appearance: none;
	-webkit-appearance: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.tsw-input::placeholder {
	color: #a7adb6;
}

.tsw-input:hover {
	border-color: #b6bcc6;
}

.tsw-input:focus {
	outline: none;
	border-color: var(--tsw-accent);
	box-shadow: 0 0 0 4px var(--tsw-accent-ring);
}

.tsw-textarea {
	min-height: 116px;
	resize: vertical;
}

/* Native select needs its own chevron once appearance is reset. */
.tsw-select-wrap {
	position: relative;
}

.tsw-select-wrap::after {
	content: "";
	position: absolute;
	right: 16px;
	top: 50%;
	width: 9px;
	height: 9px;
	margin-top: -6px;
	border-right: 2px solid var(--tsw-ink-soft);
	border-bottom: 2px solid var(--tsw-ink-soft);
	transform: rotate(45deg);
	pointer-events: none;
}

.tsw-select {
	padding-right: 42px;
	cursor: pointer;
	background-image: none;
}

/* Date inputs are wider than their box on iOS unless this is set. */
input.tsw-input[type="date"] {
	-webkit-appearance: none;
	min-height: 50px;
}

/* Side-by-side pairs: one column on phones, two from 640px up. */
.tsw-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0;
}

.tsw-row > .tsw-field {
	min-width: 0;
}

/* ------------------------------------------------- Radio / checkbox */

.tsw-options {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	min-width: 0;
}

.tsw-option {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	/* Comfortable thumb target on a phone. */
	min-height: 52px;
	padding: 14px 16px;
	background: var(--tsw-surface);
	border: 1px solid var(--tsw-line);
	border-radius: var(--tsw-radius-sm);
	cursor: pointer;
	font-size: 15px;
	line-height: 1.45;
	-webkit-tap-highlight-color: transparent;
	transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.tsw-option:hover {
	border-color: var(--tsw-line-strong);
	background: var(--tsw-surface-alt);
}

/* The real input stays in the layout (never display:none) so it keeps
   receiving focus and stays reachable by keyboard and screen readers. */
.tsw-option input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	/* 16px here too: belt and braces against iOS focus zoom. */
	font-size: 16px;
	pointer-events: none;
}

.tsw-option-mark {
	flex: 0 0 auto;
	position: relative;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	border: 2px solid var(--tsw-line-strong);
	border-radius: 50%;
	background: #fff;
	transition: border-color .15s ease, background-color .15s ease;
}

.tsw-checks .tsw-option-mark,
.tsw-consent .tsw-option-mark {
	border-radius: 6px;
}

.tsw-option-text {
	min-width: 0;
	overflow-wrap: break-word;
}

.tsw-option input:checked ~ .tsw-option-mark {
	border-color: var(--tsw-btn);
	background: var(--tsw-btn);
}

.tsw-option input[type="radio"]:checked ~ .tsw-option-mark::after {
	content: "";
	position: absolute;
	inset: 0;
	width: 8px;
	height: 8px;
	margin: auto;
	border-radius: 50%;
	background: #fff;
}

.tsw-checks .tsw-option input:checked ~ .tsw-option-mark::after,
.tsw-consent input:checked ~ .tsw-option-mark::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 5px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.tsw-option:has(input:checked) {
	border-color: var(--tsw-accent);
	background: var(--tsw-accent-soft);
}

.tsw-option:has(input:checked) .tsw-option-text {
	font-weight: 600;
}

/* Keyboard focus must be visible even though the input itself is hidden. */
.tsw-option:focus-within {
	box-shadow: 0 0 0 4px var(--tsw-accent-ring);
	border-color: var(--tsw-accent);
}

.tsw-consent {
	border: 0;
	background: none;
	padding: 2px 0;
	min-height: 0;
	align-items: center;
}

.tsw-consent:hover {
	background: none;
}

/* ------------------------------------------------------- File upload */

.tsw-file {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 26px 16px;
	text-align: center;
	color: var(--tsw-ink-soft);
	background: var(--tsw-surface-alt);
	border: 1.5px dashed var(--tsw-line-strong);
	border-radius: var(--tsw-radius-sm);
	transition: border-color .15s ease, background-color .15s ease;
}

.tsw-file.is-drag,
.tsw-file:focus-within {
	border-color: var(--tsw-accent);
	background: var(--tsw-accent-soft);
}

.tsw-file-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.tsw-file-icon {
	color: var(--tsw-ink-faint);
	line-height: 0;
}

.tsw-file-label {
	font-weight: 600;
	font-size: 15px;
	color: var(--tsw-ink);
}

.tsw-file-hint {
	font-size: 13px;
	color: var(--tsw-ink-faint);
}

.tsw-file-names {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	width: 100%;
	display: grid;
	gap: 6px;
}

.tsw-file-names:empty {
	margin: 0;
}

.tsw-file-names li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid var(--tsw-line);
	border-radius: 8px;
	font-size: 13px;
	text-align: left;
	color: var(--tsw-ink);
	/* Above the invisible file input, so its own controls stay clickable. */
	position: relative;
	z-index: 1;
}

.tsw-file-names .tsw-file-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tsw-file-names .tsw-file-remove {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--tsw-surface-alt);
	color: var(--tsw-ink-soft);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

.tsw-file-names .tsw-file-remove:hover {
	background: #fee4e2;
	color: var(--tsw-danger);
}

.tsw-file-names .tsw-file-remove:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--tsw-accent-ring);
}

.tsw-file-names .tsw-file-size {
	flex: 0 0 auto;
	color: var(--tsw-ink-faint);
	font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------ Location gate */

/*
 * The gate is the first and only thing a visitor sees. It is deliberately
 * short — one question, one button — so a visitor in a region we don't serve
 * finds out immediately rather than after four steps of typing.
 */
.tsw-gate {
	padding-top: 20px;
	border-top: 1px solid var(--tsw-line);
}

.tsw-gate-title {
	margin: 0 0 6px;
	font-size: 20px;
	line-height: 1.3;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.tsw-gate-help {
	margin: 0 0 18px;
	color: var(--tsw-ink-soft);
	font-size: 15px;
}

.tsw-gate .tsw-nav {
	border-top: 0;
	padding-top: 0;
	margin-top: 18px;
}

/* The country chip above the form, once a country has been chosen. */
.tsw-chosen {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-bottom: 18px;
	padding: 10px 14px;
	background: var(--tsw-surface-alt);
	border: 1px solid var(--tsw-line);
	border-radius: var(--tsw-radius-sm);
	font-size: 14px;
}

.tsw-chosen-label {
	font-weight: 650;
}

.tsw-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--tsw-ink-soft);
	font: inherit;
	font-size: 13.5px;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.tsw-link:hover {
	color: var(--tsw-ink);
}

/* ------------------------------------------- Unserved region panel */

.tsw-blocked {
	margin-top: 20px;
	padding: 24px 18px;
	border: 1px solid var(--tsw-line);
	border-radius: var(--tsw-radius);
	background: var(--tsw-surface-alt);
	text-align: center;
}

.tsw-blocked-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	margin-bottom: 14px;
	border-radius: 50%;
	background: var(--tsw-accent-soft);
	color: var(--tsw-accent);
}

.tsw-blocked-title {
	margin: 0 0 8px;
	font-size: 19px;
	font-weight: 800;
	line-height: 1.3;
}

.tsw-blocked-text {
	margin: 0 auto 22px;
	max-width: 48ch;
	color: var(--tsw-ink-soft);
	font-size: 15px;
	line-height: 1.65;
}

/* The waitlist itself is a normal form, left-aligned inside the panel. */
.tsw-waitlist {
	max-width: 420px;
	margin: 0 auto;
	text-align: start;
}

.tsw-waitlist .tsw-field {
	margin-bottom: 16px;
}

.tsw-waitlist .tsw-nav {
	border-top: 0;
	padding-top: 0;
	margin-top: 18px;
}

.tsw-waitlist-error {
	margin-top: 14px;
	padding: 12px 14px;
	border: 1px solid #f3b9b4;
	border-radius: var(--tsw-radius-sm);
	background: #fef3f2;
	color: #912018;
	font-size: 14px;
	text-align: start;
}

.tsw-waitlist-done {
	padding: 8px 0 4px;
}

.tsw-waitlist-done .tsw-success-icon {
	width: 54px;
	height: 54px;
	margin-bottom: 14px;
}

.tsw-waitlist-done-text {
	margin: 0 auto;
	max-width: 44ch;
	font-size: 15.5px;
	color: var(--tsw-ink);
}

/* ------------------------------------------------------ Nav / buttons */

.tsw-nav {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 26px;
	padding-top: 22px;
	border-top: 1px solid var(--tsw-line);
}

.tsw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 52px;
	padding: 14px 20px;
	border: 1px solid transparent;
	border-radius: var(--tsw-radius-sm);
	background: var(--tsw-btn);
	color: var(--tsw-btn-text);
	font-family: inherit;
	font-size: 16px;
	font-weight: 650;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: opacity .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.tsw-btn:hover {
	opacity: .88;
}

.tsw-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px var(--tsw-accent-ring);
}

.tsw-btn[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

.tsw-outline {
	background: var(--tsw-surface);
	color: var(--tsw-ink);
	border-color: var(--tsw-line-strong);
}

.tsw-outline:hover {
	opacity: 1;
	background: var(--tsw-surface-alt);
}

/* --------------------------------------------------------- Validation */

.tsw-field.has-error .tsw-input,
.tsw-field.has-error .tsw-file {
	border-color: var(--tsw-danger);
}

.tsw-field.has-error .tsw-option {
	border-color: #f3b9b4;
}

.tsw-error-msg {
	display: none;
	margin-top: 7px;
	color: var(--tsw-danger);
	font-size: 13.5px;
	line-height: 1.5;
	font-weight: 500;
}

.tsw-field.has-error .tsw-error-msg {
	display: block;
}

.tsw-form-error {
	margin-top: 18px;
	padding: 13px 15px;
	border: 1px solid #f3b9b4;
	border-radius: var(--tsw-radius-sm);
	background: #fef3f2;
	color: #912018;
	font-size: 14.5px;
}

/* ------------------------------------------------------------ Success */

.tsw-success {
	text-align: center;
	padding: 34px 8px 12px;
}

.tsw-success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 66px;
	height: 66px;
	margin-bottom: 18px;
	border-radius: 50%;
	background: var(--tsw-accent);
	color: #fff;
}

.tsw-success-title {
	margin: 0 0 8px;
	font-size: 21px;
	font-weight: 800;
}

.tsw-success-text {
	margin: 0 auto;
	max-width: 46ch;
	color: var(--tsw-ink-soft);
	font-size: 15.5px;
}

/* --------------------------------------------------------- Honeypot */

/*
 * Collapsed rather than display:none — some bots skip hidden inputs but fill
 * anything that is technically rendered. Clipping in place (instead of the
 * old left:-9999px trick) means it can never widen the page on a phone.
 */
.tsw-hp,
.tsw-hp input {
	font-size: 16px;
}

.tsw-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* reCAPTCHA is 304px wide and will overflow a narrow phone otherwise. */
.tsw-type-recaptcha {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ========================================================== ≥ 480px */

@media (min-width: 480px) {
	.tsw-form {
		padding: 28px 26px 30px;
	}
	.tsw-title {
		font-size: 27px;
	}
	.tsw-cols-2 {
		grid-template-columns: 1fr 1fr;
	}
	.tsw-nav {
		flex-direction: row-reverse;
		justify-content: flex-end;
	}
	.tsw-btn {
		width: auto;
		min-width: 150px;
	}
}

/* ========================================================== ≥ 640px */

@media (min-width: 640px) {
	.tsw-form {
		padding: 34px 34px 36px;
	}
	.tsw-row {
		grid-template-columns: 1fr 1fr;
		gap: 0 18px;
	}
	.tsw-step-title {
		font-size: 22px;
	}
	.tsw-label {
		font-size: 17px;
	}
}

/* ================================================ Reduced motion */

@media (prefers-reduced-motion: reduce) {
	.tsw-wrap *,
	.tsw-wrap *::before,
	.tsw-wrap *::after {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
}

/* ================================================ Right to left */

/*
 * Arabic and Urdu visitors get the whole form mirrored. Only the handful of
 * places with a hard-coded side need overriding — everything else already
 * uses logical properties or is symmetrical.
 */
.tsw-wrap[dir="rtl"] .tsw-select-wrap::after {
	right: auto;
	left: 16px;
}

.tsw-wrap[dir="rtl"] .tsw-select {
	padding-right: 14px;
	padding-left: 42px;
}

.tsw-wrap[dir="rtl"] .tsw-req {
	margin-left: 0;
	margin-right: 3px;
}

.tsw-wrap[dir="rtl"] .tsw-checks .tsw-option input:checked ~ .tsw-option-mark::after,
.tsw-wrap[dir="rtl"] .tsw-consent input:checked ~ .tsw-option-mark::after {
	left: auto;
	right: 5px;
}

.tsw-wrap[dir="rtl"] .tsw-file-names .tsw-file-name {
	text-align: right;
}
