/**
 * Warp Scan — real scanner (form, progress, error).
 *
 * Tokens: one neutral ink scale, one brand blue (from warpperformance.com),
 * semantic green/amber/red. Depth comes from borders; one soft shadow on
 * the input bar and cards.
 */

.ws-root {
	--ws-accent: #2563eb;
	--ws-brand: #3b82f6;
	--ws-accent-hover: #1d4ed8;
	--ws-accent-ink: #ffffff;
	--ws-ink: #0f0f0f;
	--ws-ink-2: #4a4a4a;
	--ws-ink-3: #6d6d6d;
	--ws-line: #e6e6e6;
	--ws-surface: #ffffff;
	--ws-field: #ffffff;
	--ws-ok: #15803d;
	--ws-warn: #b45309;
	--ws-bad: #b91c1c;
	--ws-focus: #2563eb;
	--ws-radius: 14px;
	--ws-radius-sm: 10px;
	--ws-shadow: 0 1px 2px rgba(11, 13, 14, 0.04), 0 8px 24px -12px rgba(11, 13, 14, 0.18);
	--ws-font: var(--warp-font, "DM Sans", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
	--ws-display: var(--warp-display-font, "Plus Jakarta Sans", "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
	--ws-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

	box-sizing: border-box;
	color: var(--ws-ink);
	font-family: var(--ws-font);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-align: center;
	max-width: 720px;
	margin-inline: auto;
}

.ws-root *,
.ws-root *::before,
.ws-root *::after {
	box-sizing: border-box;
}

.ws-root [hidden] {
	display: none !important;
}

.ws-root.ws-align-left {
	text-align: left;
	margin-inline: 0;
}

.ws-root.ws-theme-dark,
.ws-root .ws-card {
	--ws-ink: #f6f8fc;
	--ws-ink-2: #d4d4d4;
	--ws-ink-3: #a3a3a3;
	--ws-line: #2e2e2e;
	--ws-surface: #1a1a1a;
	--ws-field: #1a1a1a;
	--ws-ok: #6ee7a0;
	--ws-warn: #f5b942;
	--ws-bad: #ff8a7a;
	--ws-focus: #93c5fd;
	--ws-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.6);
}

.ws-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Form ---------- */

.ws-root .ws-heading {
	margin: 0 0 12px;
	color: var(--ws-ink);
	font-family: var(--ws-display);
	font-size: clamp(32px, 5vw, 52px);
	font-weight: 650;
	line-height: 1.08;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

.ws-scanner--compact .ws-heading {
	font-size: clamp(24px, 3.4vw, 34px);
	letter-spacing: -0.02em;
}

.ws-root .ws-sub {
	margin: 0 auto 28px;
	max-width: 46ch;
	color: var(--ws-ink-2);
	font-size: 18px;
	line-height: 1.5;
}

.ws-align-left .ws-sub {
	margin-inline: 0;
}

.ws-root .ws-form {
	margin: 0;
}

.ws-form__row {
	display: flex;
	gap: 6px;
	padding: 6px;
	background: var(--ws-field);
	border: 1px solid var(--ws-line);
	border-radius: var(--ws-radius);
	box-shadow: var(--ws-shadow);
	transition: border-color 0.15s ease-out;
}

.ws-form__row:focus-within {
	border-color: var(--ws-ink-3);
}

.ws-root .ws-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 52px;
	margin: 0;
	padding: 0 14px;
	color: var(--ws-ink);
	font-family: var(--ws-font);
	font-size: 17px;
	line-height: 1.2;
	background: transparent;
	border: 0;
	border-radius: var(--ws-radius-sm);
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.ws-root .ws-input::placeholder {
	color: var(--ws-ink-3);
	opacity: 1;
}

.ws-root .ws-input:focus-visible {
	outline: 2px solid var(--ws-focus);
	outline-offset: 0;
}

.ws-root .ws-input[readonly] {
	color: var(--ws-ink-2);
}

.ws-scanner--compact .ws-input {
	height: 46px;
	font-size: 16px;
}

.ws-root .ws-btn {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 52px;
	margin: 0;
	padding: 0 22px;
	color: var(--ws-accent-ink);
	font-family: var(--ws-font);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.005em;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	background: var(--ws-accent);
	border: 1px solid transparent;
	border-radius: var(--ws-radius-sm);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}

.ws-scanner--compact .ws-btn {
	height: 46px;
	padding: 0 18px;
}

.ws-root .ws-btn:hover {
	color: var(--ws-accent-ink);
	background: var(--ws-accent-hover);
}

.ws-root .ws-btn:active {
	transform: translateY(1px);
}

.ws-root .ws-btn:focus-visible {
	outline: 2px solid var(--ws-focus);
	outline-offset: 2px;
}

.ws-root .ws-btn:disabled {
	cursor: progress;
	opacity: 0.75;
}

.ws-root.is-busy .ws-btn::before {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ws-spin 0.7s linear infinite;
}

.ws-root .ws-btn--ghost {
	color: var(--ws-ink);
	background: transparent;
	border-color: var(--ws-line);
}

.ws-root .ws-btn--ghost:hover {
	color: var(--ws-ink);
	background: rgba(255, 255, 255, 0.06);
	border-color: var(--ws-ink-3);
}

.ws-turnstile {
	display: flex;
	justify-content: center;
	margin-top: 12px;
}

.ws-align-left .ws-turnstile {
	justify-content: flex-start;
}

.ws-root .ws-status {
	min-height: 1.5em;
	margin: 10px 0 0;
	color: var(--ws-ink-2);
	font-size: 15px;
}

.ws-root .ws-status--error {
	color: var(--ws-bad);
	font-weight: 500;
}

.ws-root .ws-status--error::before {
	content: "! ";
	font-weight: 700;
}

.ws-root .ws-note {
	margin: 2px 0 0;
	color: var(--ws-ink-3);
	font-size: 15px;
}

.ws-root .ws-micro {
	margin: 6px 0 0;
	color: var(--ws-ink-3);
	font-size: 13px;
	letter-spacing: 0.01em;
}

.ws-root .ws-checks {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 22px;
	margin: 36px 0 0;
	padding: 0;
	list-style: none;
	color: var(--ws-ink-2);
	font-size: 15px;
}

.ws-root .ws-checks li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.ws-root .ws-checks li::before {
	content: "";
	width: 10px;
	height: 6px;
	margin-top: -3px;
	border-left: 2px solid var(--ws-ok);
	border-bottom: 2px solid var(--ws-ok);
	transform: rotate(-45deg);
}

/* ---------- Progress & error cards ---------- */

.ws-root .ws-card {
	padding: 32px;
	color: var(--ws-ink);
	text-align: left;
	background: #0f0f0f;
	border: 1px solid var(--ws-line);
	border-radius: 16px;
	box-shadow: var(--ws-shadow);
}

.ws-root .ws-eyebrow {
	margin: 0 0 4px;
	color: var(--ws-ink-3);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ws-root .ws-eyebrow--warn {
	color: var(--ws-warn);
}

.ws-root .ws-progress__host,
.ws-root .ws-error__host {
	margin: 0 0 24px;
	color: var(--ws-ink);
	font-size: clamp(22px, 4vw, 30px);
	font-weight: 650;
	line-height: 1.2;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
	outline: none;
}

.ws-root .ws-error__host:empty {
	display: none;
}

.ws-bar {
	height: 8px;
	overflow: hidden;
	background: var(--ws-line);
	border-radius: 999px;
}

.ws-bar__fill {
	display: block;
	width: 0;
	height: 100%;
	background: var(--ws-brand);
	border-radius: inherit;
	transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.ws-progress__meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 16px;
	margin: 12px 0 28px;
	color: var(--ws-ink-2);
	font-size: 15px;
}

.ws-progress__numbers {
	color: var(--ws-ink-3);
	font-family: var(--ws-mono);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.ws-root .ws-steps {
	display: grid;
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ws-root .ws-step {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 0;
	color: var(--ws-ink-3);
	font-size: 16px;
	transition: color 0.2s ease-out;
}

.ws-step__icon {
	position: relative;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	border: 2px solid var(--ws-line);
	border-radius: 50%;
	transition: border-color 0.2s ease-out, background-color 0.2s ease-out;
}

.ws-step[data-state="running"] {
	color: var(--ws-ink);
	font-weight: 550;
}

.ws-step[data-state="running"] .ws-step__icon {
	border-color: var(--ws-brand);
}

.ws-step[data-state="running"] .ws-step__icon::after {
	content: "";
	position: absolute;
	inset: 3px;
	background: var(--ws-brand);
	border-radius: 50%;
	animation: ws-pulse 1.2s ease-in-out infinite;
}

.ws-step[data-state="done"] {
	color: var(--ws-ink-2);
}

.ws-step[data-state="done"] .ws-step__icon {
	background: var(--ws-ok);
	border-color: var(--ws-ok);
}

.ws-step[data-state="done"] .ws-step__icon::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 9px;
	height: 5px;
	border-left: 2px solid #0f0f0f;
	border-bottom: 2px solid #0f0f0f;
	transform: rotate(-45deg);
}

.ws-root .ws-progress__hint {
	margin: 28px 0 0;
	padding-top: 20px;
	color: var(--ws-ink-3);
	font-size: 14px;
	border-top: 1px solid var(--ws-line);
}

.ws-root .ws-error__message {
	margin: 0 0 24px;
	color: var(--ws-ink);
	font-size: 18px;
	line-height: 1.5;
	outline: none;
}

.ws-error__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.ws-error__actions .ws-btn {
	height: 46px;
}

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

@keyframes ws-pulse {
	0%,
	100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(0.6);
		opacity: 0.6;
	}
}

@media (max-width: 480px) {
	.ws-form__row {
		flex-direction: column;
	}

	.ws-root .ws-btn {
		width: 100%;
	}

	.ws-root .ws-card {
		padding: 24px 20px;
	}

	.ws-error__actions .ws-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ws-root *,
	.ws-root *::before,
	.ws-root *::after {
		animation: none !important;
		transition: none !important;
	}
}

/* Theme input styles (centred text, uppercase, etc.) must not leak in. */
.ws-root .ws-input {
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
}

/* bare="true": only the URL bar. Width and alignment come from the container. */
.ws-root.ws-scanner--bare {
	max-width: none;
	margin-inline: 0;
}

.ws-scanner--bare .ws-status:empty {
	min-height: 0;
	margin: 0;
}

.ws-scanner--bare .ws-status {
	text-align: left;
}

.ws-root .ws-optout {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 10px 0 0;
	color: var(--ws-ink-3);
	font-size: 14px;
	cursor: pointer;
}

.ws-root .ws-optout input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--ws-brand);
}
