/**
 * Registration and sign-in form.
 *
 * Structural only. Colour, radius and typography come from the variables at the
 * top, so a designer restyles the form by overriding four custom properties on
 * the Bricks element rather than by fighting these rules.
 *
 * Logical properties throughout: this form is used right-to-left, and a
 * physical `margin-left` would have to be mirrored by hand.
 */

.lpf-auth-w {
	--lpf-auth-accent: var(--lpf-accent, #1d7bff);
	--lpf-auth-border: var(--lpf-border, rgba(0, 0, 0, 0.14));
	--lpf-auth-radius: var(--lpf-radius, 8px);
	--lpf-auth-gap: 0.85rem;
	--lpf-auth-control-size: 48px;

	inline-size: 100%;
	max-inline-size: 26rem;
	margin-inline: auto;
	line-height: 1.9;
}

.lpf-auth-box {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--lpf-auth-gap);
}

/* Every flex child that can hold unbreakable text needs this, or a long email
   address widens the whole popup instead of wrapping. */
.lpf-auth-box > * {
	min-inline-size: 0;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */

.lpf-auth-step {
	display: none;
	flex-direction: column;
	gap: var(--lpf-auth-gap);
}

.lpf-auth-step.is-active {
	display: flex;
}

.lpf-auth-title {
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.7;
	text-align: start;
}

.lpf-auth-hint,
.lpf-auth-sent-to {
	font-size: 0.85rem;
	opacity: 0.75;
	text-align: start;
}

.lpf-auth-sent-to {
	unicode-bidi: plaintext;
}

/* ── Visually hidden labels ─────────────────────────────────────────────── */

/* Hidden, but still focusable and still read aloud. Never display:none on a
   form label — it removes it from the accessibility tree entirely. */
.lpf-auth-w .screen-reader-text {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.lpf-auth-secondary.is-hidden {
	display: none;
}

.lpf-auth-intro {
	font-size: 0.92rem;
	opacity: 0.85;
	text-align: start;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */

.lpf-auth-label {
	display: block;
	margin-block-end: 0.35rem;
	font-size: 0.9rem;
	font-weight: 600;
	text-align: start;
}

.lpf-auth-input {
	inline-size: 100%;
	min-block-size: var(--lpf-auth-control-size);
	padding-inline: 0.85rem;
	border: 1px solid var(--lpf-auth-border);
	border-radius: var(--lpf-auth-radius);
	background: #fff;
	color: inherit;
	/* Never the `font` shorthand here. In the browser's own stylesheet it
	   resets font-variation-settings and font-feature-settings on form
	   controls, so a variable Persian font loses its axis settings and the
	   inputs stop matching the rest of the page. */
	font-family: inherit;
	font-size: 1rem;
}

.lpf-auth-input:focus-visible {
	outline: 2px solid var(--lpf-auth-accent);
	outline-offset: 2px;
}

.lpf-auth-code {
	letter-spacing: 0.5em;
	text-align: center;
	font-size: 1.4rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.lpf-auth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-block-size: var(--lpf-auth-control-size);
	padding-inline: 1.25rem;
	border: 0;
	border-radius: var(--lpf-auth-radius);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.lpf-auth-btn-primary {
	background: var(--lpf-auth-accent);
	color: #fff;
}

.lpf-auth-link {
	border: 0;
	background: transparent;
	color: var(--lpf-auth-accent);
	font: inherit;
	/* A link-styled control still needs a real touch target. */
	min-block-size: 44px;
	padding-inline: 0.25rem;
	cursor: pointer;
}

.lpf-auth-link[disabled] {
	color: inherit;
	opacity: 0.6;
	cursor: default;
}

.lpf-auth-sub {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

/* ── Divider and social ──────────────────────────────────────────────────── */

.lpf-auth-or {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.85rem;
	opacity: 0.7;
}

.lpf-auth-or::before,
.lpf-auth-or::after {
	content: "";
	flex: 1 1 0;
	min-inline-size: 0;
	block-size: 1px;
	background: var(--lpf-auth-border);
}

/* ── Messages and busy state ─────────────────────────────────────────────── */

.lpf-auth-message {
	display: none;
	padding: 0.7rem 0.9rem;
	border-radius: var(--lpf-auth-radius);
	background: rgba(220, 38, 38, 0.1);
	color: #b91c1c;
	font-size: 0.9rem;
	text-align: start;
}

.lpf-auth-message.is-visible {
	display: block;
}

.lpf-auth-loading {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 2;
	background: rgba(255, 255, 255, 0.6);
	border-radius: var(--lpf-auth-radius);
}

.lpf-auth-w.is-busy .lpf-auth-loading {
	display: block;
}

.lpf-auth-w.is-busy .lpf-auth-btn {
	opacity: 0.6;
	pointer-events: none;
}

.lpf-auth-unavailable {
	padding: 1rem;
	border: 1px solid var(--lpf-border, rgba(0, 0, 0, 0.14));
	border-radius: 8px;
	text-align: start;
}

@media (prefers-reduced-motion: reduce) {
	.lpf-auth-w * {
		transition: none !important;
	}
}
