/*
 * Mobile sign-in screen (page-otp-login.php).
 *
 * Built only from tokens.css + the base components (.btn, .field, .section-bar,
 * .home-hero-badge, .form-notice), so a site that re-colours its tokens
 * re-colours this screen too. The navy, gridded panel is the homepage hero's
 * ground (app.css .home-hero) on purpose: the visitor lands on the same
 * world they left.
 *
 * Desktop: form column + visual panel side by side, filling the viewport
 * under the sticky header. Under 1024px: the panel becomes a compact band
 * on top and the form card rides up over its lower edge. Phones (760px and
 * under) put the form first and the panel after it, as a card.
 */

.otp-stage {
	--otp-ease: cubic-bezier(.22, 1, .36, 1);
	--otp-spring: cubic-bezier(.34, 1.56, .64, 1);
	display: grid;
	grid-template-columns: minmax(400px, 520px) minmax(0, 1fr); /* RTL: first column sits on the right */
	min-height: calc(100vh - var(--header-h));
	min-height: calc(100dvh - var(--header-h));
	background: var(--white);
}

/* ===================================================================
 * Form column
 * ================================================================ */
.otp-form-col {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px clamp(24px, 3.4vw, 56px);
	background: var(--white);
	position: relative;
	z-index: 2;
}
.otp-form-inner { width: 100%; max-width: 420px; }

.otp-head { margin-bottom: 24px; }
.otp-head h1 { font-size: 30px; font-weight: var(--fw-black); line-height: 1.4; margin-top: 8px; }
.otp-head .muted { margin-top: 8px; font-size: 15px; line-height: 1.9; }
.otp-phone-echo { direction: ltr; unicode-bidi: isolate; font-weight: var(--fw-bold); color: var(--text); letter-spacing: .5px; }

.otp-notice { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 18px; }
.otp-notice svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }

.otp-form .field { margin-bottom: 18px; }

/* Phone field */
.otp-phone {
	position: relative;
	display: flex;
	align-items: center;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-control);
	background: var(--white);
	transition: border-color .2s, box-shadow .2s;
	direction: ltr;
}
.otp-phone:hover { border-color: var(--icon); }
.otp-phone:focus-within { border-color: var(--navy-700); box-shadow: 0 0 0 4px color-mix(in srgb, var(--navy-700) 10%, transparent); }
.otp-phone.is-error { border-color: var(--alert); box-shadow: 0 0 0 4px var(--alert-soft); }
.field .otp-phone input {
	flex: 1;
	min-width: 0;
	min-height: 56px;
	border: 0;
	padding: 0 14px;
	background: transparent;
	font-family: var(--font-latin);
	font-size: 20px;
	font-weight: var(--fw-bold);
	letter-spacing: 1.5px;
	direction: ltr;
	text-align: left;
	font-variant-numeric: tabular-nums;
}
.field .otp-phone input:focus { outline: none; }
.field .otp-phone input::placeholder { color: #B5C0CE; font-weight: var(--fw-medium); letter-spacing: 1px; }
.otp-phone-ic { display: grid; place-items: center; width: 52px; align-self: stretch; color: var(--icon); border-inline-end: 1px solid var(--line); flex: none; }
.otp-phone:focus-within .otp-phone-ic { color: var(--navy-700); }
.otp-phone-ok {
	display: grid; place-items: center; flex: none;
	width: 24px; height: 24px; margin-inline-end: 14px;
	border-radius: 50%; background: var(--verified); color: var(--white);
	scale: 0; transition: scale .35s var(--otp-spring);
}
.otp-phone-ok svg { width: 14px; height: 14px; stroke-width: 3; }
.otp-phone.is-valid .otp-phone-ok { scale: 1; }
.otp-hint { font-size: 13px; color: var(--muted); }
.otp-field-err { font-size: 13.5px; font-weight: var(--fw-semibold); color: var(--alert); }
.otp-field-err[hidden] { display: none; }

/* Primary button: amber, with a loading state */
.otp-submit { position: relative; min-height: 54px; font-size: 16px; overflow: hidden; }
.otp-submit svg { transition: transform .25s var(--otp-ease); }
.otp-submit:hover svg { transform: translateX(-4px); }
.otp-spinner {
	display: none; width: 20px; height: 20px; border-radius: 50%;
	border: 2.5px solid color-mix(in srgb, var(--navy-800) 25%, transparent); border-top-color: var(--navy-800);
	animation: otp-spin .7s linear infinite;
}
.otp-submit.is-loading { pointer-events: none; }
.otp-submit.is-loading .otp-spinner { display: block; }
.otp-submit.is-loading .otp-submit-label,
.otp-submit.is-loading svg { display: none; }
@keyframes otp-spin { to { transform: rotate(360deg); } }

.otp-alt { margin-top: 12px; gap: 10px; }
.otp-alt svg { color: var(--icon); }

/* "After you sign in" */
.otp-perks-title { display: flex; align-items: center; gap: 12px; margin: 28px 0 14px; font-size: 12.5px; color: var(--muted); }
.otp-perks-title::before, .otp-perks-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp-perks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.otp-perks li {
	display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
	padding: 14px 8px; border: 1px solid var(--line); border-radius: var(--r-card);
	font-size: 12.5px; line-height: 1.7; color: var(--text-soft); font-weight: var(--fw-medium);
}
.otp-perks svg { color: var(--accent-ink); width: 22px; height: 22px; }

.otp-biz {
	display: flex; align-items: center; gap: 12px; margin-top: 14px;
	padding: 14px 16px; border-radius: var(--r-card);
	background: var(--accent-soft); border: 1px solid var(--accent-soft-border); color: var(--text);
	transition: border-color .2s, transform .2s var(--otp-ease);
}
.otp-biz:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--text); }
.otp-biz-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-control); background: var(--accent); color: var(--on-accent, var(--navy-800)); }
.otp-biz-text { display: flex; flex-direction: column; line-height: 1.6; }
.otp-biz-text b { font-size: 14.5px; font-weight: var(--fw-bold); }
.otp-biz-text small { font-size: 12.5px; color: var(--accent-ink); }
.otp-biz-chev { margin-inline-start: auto; color: var(--accent-ink); }

/* ---------- Verify step ---------- */
.otp-debug {
	display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
	margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r-control);
	background: var(--warn-soft); border: 1px dashed var(--warn-soft-border);
	font-size: 13px; line-height: 1.8; color: var(--warn);
}
.otp-debug-code { font-family: var(--font-latin); font-size: 20px; font-weight: var(--fw-black); letter-spacing: 5px; color: var(--navy-800); direction: ltr; }

/* One real input (keeps paste, SMS autofill and no-JS working) drawn as one box per digit (--otp-len, set by otp-login.js). */
.otp-code { position: relative; }
.field .otp-code-input {
	font-family: var(--font-latin); font-size: 24px; font-weight: var(--fw-bold);
	letter-spacing: 10px; text-align: center; direction: ltr; min-height: 60px;
}
.otp-slots { display: none; }
.js .otp-code .otp-slots { display: grid; grid-template-columns: repeat(var(--otp-len, 5), minmax(0, 1fr)); gap: 10px; direction: ltr; }
.js .field .otp-code-input {
	position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; min-height: 0;
	opacity: 0; border: 0; padding: 0; cursor: text; caret-color: transparent;
	letter-spacing: 0; font-size: 16px; /* 16px keeps iOS from zooming the page */
}
.otp-slot {
	display: grid; place-items: center; aspect-ratio: 1 / 1.15;
	border: 1px solid var(--line-strong); border-radius: var(--r-card); background: var(--white);
	font-family: var(--font-latin); font-size: 26px; font-weight: var(--fw-black); color: var(--navy-800);
	transition: border-color .15s, box-shadow .15s, transform .2s var(--otp-spring), background .15s;
}
.otp-slot.is-filled { border-color: var(--navy-700); transform: translateY(-2px); }
.otp-slot.is-active { border-color: var(--navy-700); box-shadow: 0 0 0 4px color-mix(in srgb, var(--navy-700) 10%, transparent); }
.otp-slot.is-active:empty::after { content: ""; width: 2px; height: 26px; background: var(--accent); animation: otp-blink 1s steps(1) infinite; }
.otp-code.is-error .otp-slot { border-color: var(--alert); background: #FFF8F7; }
.otp-code.is-error .otp-slots { animation: otp-shake .45s; }
.otp-code.is-done .otp-slot { border-color: var(--verified); background: var(--verified-soft); }
@keyframes otp-blink { 50% { opacity: 0; } }
@keyframes otp-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.otp-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.otp-resend { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.otp-timer { display: inline-flex; align-items: center; gap: 8px; }
.otp-timer[hidden], .otp-resend-ask[hidden] { display: none; }
.otp-timer b { color: var(--text); font-variant-numeric: tabular-nums; }
.otp-timer-ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.otp-timer-ring circle { fill: none; stroke-width: 3; }
.otp-timer-ring .bg { stroke: var(--line); }
.otp-timer-ring .fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 56.55; transition: stroke-dashoffset 1s linear; }
.otp-edit { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: var(--fw-bold); color: var(--navy-700); }
.otp-edit svg { width: 16px; height: 16px; }

/* ===================================================================
 * Visual panel — the homepage hero's ground
 * ================================================================ */
.otp-visual {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	background-color: var(--brand-primary);
	background-image:
		linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
	background-size: 48px 48px;
	color: var(--on-dark);
}
/* An amber glow behind the picture, and a fade so the grid doesn't fight the copy. */
.otp-visual::before {
	content: ""; position: absolute; z-index: -1; inset: 0;
	background:
		radial-gradient(42% 38% at 50% 62%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
		linear-gradient(180deg, var(--brand-primary) 0%, transparent 34%);
}
.otp-visual-inner {
	height: 100%;
	display: flex; flex-direction: column;
	padding: 48px clamp(28px, 4vw, 64px) 40px;
	max-width: 900px;
}
.otp-badge svg { width: 15px; height: 15px; }
.otp-visual-title {
	margin: 16px 0 0;
	font-size: clamp(30px, 2.9vw, 44px); line-height: 1.4; font-weight: var(--fw-black);
	color: var(--on-dark); text-wrap: balance;
	animation: otp-rise .8s var(--otp-ease) both;
}
.otp-visual-title em { font-style: normal; color: var(--accent-on-dark, var(--brand-accent)); position: relative; white-space: nowrap; }
.otp-visual-title em::after {
	content: ""; position: absolute; inset-inline: 0; bottom: -2px; height: 3px; border-radius: 3px;
	background: var(--brand-accent); opacity: .45; transform-origin: right;
	animation: otp-line .9s .7s var(--otp-ease) both;
}
.otp-visual-sub { margin-top: 12px; max-width: 560px; font-size: 16px; line-height: 1.9; color: var(--on-dark-muted); animation: otp-rise .8s .1s var(--otp-ease) both; }
@keyframes otp-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes otp-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Scene: the picture in a frame, cards floating over its edges */
.otp-scene {
	position: relative;
	flex: 1;
	min-height: 260px;
	margin: 36px 0 8px;
	display: grid; place-items: center;
	--rx: 0deg; --ry: 0deg; --px: 0; --py: 0;
	perspective: 1400px;
}
.otp-frame {
	position: relative;
	width: min(100%, 680px);
	aspect-ratio: 16 / 10.5;
	max-height: 100%;
	border-radius: 14px;
	overflow: hidden;
	background: var(--surface-2);
	border: 6px solid rgba(255, 255, 255, .96);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
	transform: rotateY(var(--ry)) rotateX(var(--rx));
	transition: transform .6s var(--otp-ease);
	animation: otp-frame-in 1s .15s var(--otp-ease) both;
}
.otp-frame--photo { background: var(--white); }
.otp-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.otp-map { display: block; width: 100%; height: 100%; }
@keyframes otp-frame-in { from { opacity: 0; translate: 0 26px; scale: .96; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* Map motion */
.otp-pin { transform-box: fill-box; transform-origin: 50% 100%; animation: otp-drop .7s var(--otp-spring) both; }
.otp-pin--a { animation-delay: .7s; }
.otp-pin--b { animation-delay: .9s; }
.otp-pin--c { animation-delay: 1.05s; }
.otp-pin--d { animation-delay: 1.2s; }
@keyframes otp-drop { from { opacity: 0; transform: translateY(-26px); } to { opacity: 1; transform: none; } }
.otp-pin-ring { transform-box: fill-box; transform-origin: center; animation: otp-ring 2.4s 1.4s var(--otp-ease) infinite; }
@keyframes otp-ring { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.2); } }
.otp-route { animation: otp-route 1.6s linear infinite; }
@keyframes otp-route { to { stroke-dashoffset: -22; } }
.otp-me-halo { transform-box: fill-box; transform-origin: center; animation: otp-halo 2.6s ease-in-out infinite; }
@keyframes otp-halo { 50% { transform: scale(1.35); opacity: .06; } }

/* Floating cards — the base .card look, lifted */
.otp-float {
	position: absolute; z-index: 3;
	display: flex; align-items: center; gap: 10px;
	padding: 10px 14px;
	background: var(--white); color: var(--text);
	border: 1px solid var(--line); border-radius: var(--r-card);
	box-shadow: 0 18px 40px -12px rgba(3, 10, 20, .45);
	font-size: 13.5px; line-height: 1.5;
	transform: translate(calc(var(--px) * -16px), calc(var(--py) * -10px));
	transition: transform .6s var(--otp-ease);
	animation: otp-pop .7s var(--otp-spring) both, otp-float 6s ease-in-out infinite;
}
@keyframes otp-pop { from { opacity: 0; scale: .86; } to { opacity: 1; scale: 1; } }
@keyframes otp-float { 50% { translate: 0 -7px; } }
.otp-float-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r-control); background: var(--accent); color: var(--on-accent, var(--navy-800)); }
.otp-float-ic--navy { background: var(--navy-800); color: var(--accent-on-dark, var(--accent)); }
.otp-float-ic svg { width: 18px; height: 18px; }
.otp-float-body { display: flex; flex-direction: column; min-width: 0; }
.otp-float small { font-size: 11.5px; color: var(--muted); }
.otp-float b { font-weight: var(--fw-bold); }

.otp-float--search { inset-inline-end: max(0px, calc(50% - 360px)); bottom: 4%; min-width: 250px; animation-delay: 1.1s, 1.1s; }
.otp-typed { font-weight: var(--fw-bold); white-space: nowrap; }
.otp-caret { display: inline-block; width: 2px; height: 1.05em; margin-inline-start: 2px; vertical-align: -2px; background: var(--accent); animation: otp-blink 1s steps(1) infinite; }
.otp-typed-line { white-space: nowrap; }
.otp-float--count { inset-inline-start: max(0px, calc(50% - 370px)); top: 6%; animation-delay: 1.3s, 2.2s; }
.otp-float--cats {
	inset-inline-start: max(8px, calc(50% - 330px)); bottom: 12%;
	flex-wrap: wrap; gap: 6px; max-width: 260px; padding: 10px;
	animation-delay: 1.5s, 3.2s;
}
.otp-float--cats span { padding: 5px 10px; border-radius: var(--r-chip); background: var(--fill); color: var(--text-soft); font-size: 12px; font-weight: var(--fw-semibold); }
.otp-float--cats span:first-child { background: var(--accent-soft); color: var(--accent-ink); }

/* Figures — the homepage hero's stat row */
.otp-stats { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.otp-stats li { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-sm); color: #c7d3e1; }
.otp-stats li + li { padding-inline-start: 28px; border-inline-start: 1px solid rgba(255, 255, 255, .14); }
.otp-stats b { font-size: 20px; font-weight: var(--fw-black); color: var(--on-dark); font-variant-numeric: tabular-nums; }

/* ===================================================================
 * Short desktop screens
 * ================================================================ */
@media (min-width: 1024px) and (max-height: 760px) {
	.otp-visual-inner { padding-top: 32px; padding-bottom: 28px; }
	.otp-visual-sub { display: none; }
	.otp-scene { margin-top: 22px; }
	.otp-form-col { padding-block: 32px; }
}

/* ===================================================================
 * Tablet + phone: band on top, form card over its edge
 * ================================================================ */
@media (max-width: 1023px) {
	.otp-stage { grid-template-columns: minmax(0, 1fr); min-height: 0; background: var(--surface); }
	.otp-visual { order: -1; }
	.otp-visual-inner { padding: 24px var(--gutter) 64px; max-width: none; }
	.otp-visual-title { font-size: clamp(24px, 6.6vw, 34px); margin-top: 12px; }
	.otp-visual-sub { font-size: 14.5px; margin-top: 6px; }
	.otp-scene { margin: 22px auto 0; min-height: 0; width: 100%; max-width: 560px; }
	.otp-frame { border-width: 4px; border-radius: 10px; }
	.otp-stats, .otp-float--cats { display: none; }
	.otp-float { padding: 8px 12px; font-size: 12.5px; }
	.otp-float-ic { width: 30px; height: 30px; }
	.otp-float--count { inset-inline-start: -4px; top: -14px; }
	.otp-float--search { inset-inline-end: auto; left: 50%; bottom: -22px; min-width: 0; translate: -50% 0; animation: otp-pop .7s 1.1s var(--otp-spring) both; transform: none; }

	.otp-form-col {
		margin: -40px var(--gutter) 32px;
		padding: 28px 22px 24px;
		border: 1px solid var(--line); border-radius: var(--r-card);
		box-shadow: var(--shadow-card);
		align-items: stretch;
	}
	.otp-form-inner { max-width: 520px; margin-inline: auto; }
	.otp-head h1 { font-size: 24px; }
	.otp-head .muted { font-size: 14.5px; }

	/* Entering the code is the whole job on that step — the band shrinks to its headline. */
	.otp-stage--verify .otp-scene,
	.otp-stage--verify .otp-visual-sub { display: none; }
	.otp-stage--verify .otp-visual-inner { padding-bottom: 60px; }
}
@media (max-width: 760px) {
	/*
	 * Phones: the form comes first. A short navy strip under the header keeps
	 * the "card over the hero" look, the form card sits on its edge with the
	 * phone field on the first screen, and the panel — headline, map, figures —
	 * follows below as a card of its own, a reason to sign up rather than a
	 * wall in front of the form.
	 */
	.otp-stage { position: relative; }
	.otp-stage::before {
		content: ""; position: absolute; z-index: 0; inset: 0 0 auto; height: 112px;
		background-color: var(--brand-primary);
		background-image:
			radial-gradient(60% 120% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
			linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
			linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
		background-size: auto, 48px 48px, 48px 48px;
	}

	.otp-form-col { order: 0; margin: 20px 12px 16px; padding: 22px 18px 20px; }
	.otp-head { margin-bottom: 18px; }
	.otp-head h1 { font-size: 22px; margin-top: 6px; }
	.otp-head .muted { font-size: 14px; line-height: 1.8; }

	.otp-visual { order: 1; margin: 0 12px 28px; border-radius: var(--r-card); box-shadow: var(--shadow-card); }
	.otp-visual::before { background: radial-gradient(70% 45% at 50% 58%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
	.otp-visual-inner { padding: 24px 18px 22px; }
	.otp-badge { font-size: 12px; }
	.otp-visual-title { font-size: clamp(21px, 6vw, 26px); margin-top: 12px; line-height: 1.5; }
	.otp-visual-sub { display: block; font-size: 14px; line-height: 1.85; margin-top: 8px; }
	.otp-scene { margin: 26px auto 0; max-width: 420px; }
	.otp-frame { aspect-ratio: 16 / 10; }
	.otp-float--count { top: -14px; inset-inline-start: -6px; }
	.otp-float--count small { display: none; }

	/* Figures: three even tiles under the map, clear of the search card that hangs off its bottom edge. */
	.otp-stats {
		display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0;
		margin-top: 44px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12);
	}
	.otp-stats li { flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 12px; line-height: 1.6; padding-inline: 4px; }
	.otp-stats li + li { padding-inline-start: 4px; }
	.otp-stats b { font-size: 19px; }

	/* Entering the code is the whole job on that step. */
	.otp-stage--verify .otp-visual { display: none; }
}
@media (max-width: 380px) {
	.otp-perks { gap: 6px; }
	.otp-perks li { padding: 12px 4px; font-size: 11.5px; }
	.js .otp-code .otp-slots { gap: 6px; }
	.otp-slot { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.otp-stage *, .otp-stage *::before, .otp-stage *::after {
		animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
	}
	.otp-frame, .otp-float { transform: none !important; }
}
