/**
 * Lafoura Auth — login form.
 *
 * Faithful to the Lafoura Login artboard: a single 420px card sitting near
 * the top of an empty field, square corners, hairline borders, one near-black
 * accent, and Vazirmatn served from the plugin so the page never waits on a
 * font CDN.
 *
 * Every component rule is scoped under .lf-auth. Themes routinely style
 * `input[type="tel"]`, which outweighs a lone class, and this form has to
 * render at the artboard's exact metrics inside whatever theme is running.
 */

@font-face {
	font-family: "Vazirmatn LF";
	src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Vazirmatn LF";
	src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Vazirmatn LF";
	src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

.lf-auth {
	--lf-ink: #111110;
	--lf-ink-strong: #000;
	--lf-muted: #78756f;
	--lf-faint: #8d8983;
	--lf-placeholder: #b3afa9;
	--lf-page: #e9e7e4;
	--lf-surface: #fff;
	--lf-card-line: #dcd9d5;
	--lf-line: #e5e3e0;
	--lf-line-soft: #eceae7;
	--lf-line-field: #d9d5d0;
	--lf-line-link: #c9c5c0;
	--lf-danger: #a3352b;
	--lf-disabled: #dcd9d5;
	--lf-expired-bg: #faf9f8;
	--lf-font: "Vazirmatn LF", Vazirmatn, Vazir, "IRANSans", Tahoma, sans-serif;

	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 60vh;
	padding: 40px 20px;
	direction: rtl;
	font-family: var(--lf-font);
	color: var(--lf-ink);
	background: var(--lf-page);
}

.lf-auth--standalone {
	min-height: 100vh;
}

body.lf-auth-standalone {
	margin: 0 !important;
	/* The theme reserves room for a sticky toolbar this page never draws. */
	padding: 0 !important;
	background: #e9e7e4;
}

/*
 * The standalone page shows the form and nothing else. Themes and plugins
 * still drop sprite sheets, live regions and toolbars into the body through
 * enqueued scripts; none of them belong on a page that takes a phone number,
 * and left visible they add stray scroll height.
 */
body.lf-auth-standalone > *:not(.lf-auth) {
	display: none !important;
}

.lf-auth *,
.lf-auth *::before,
.lf-auth *::after {
	box-sizing: border-box;
}

.lf-auth .lf-auth__card {
	width: 420px;
	max-width: 100%;
	background: var(--lf-surface);
	border: 1px solid var(--lf-card-line);
}

.lf-auth .lf-auth__panel {
	display: flex;
	flex-direction: column;
	padding: 26px 32px 34px;
}

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

.lf-auth .lf-auth__header {
	display: grid;
	grid-template-columns: 26px 1fr 26px;
	align-items: center;
	gap: 12px;
	padding-bottom: 38px;
}

.lf-auth .lf-auth__back {
	/*
	 * Placed explicitly: when the arrow is hidden the other two items must
	 * stay in their own columns, or the logo drops into the 26px gutter.
	 */
	grid-column: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	color: var(--lf-ink);
	background: none;
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.lf-auth .lf-auth__back:hover,
.lf-auth .lf-auth__back:focus-visible {
	opacity: 0.55;
	background: none;
	color: var(--lf-ink);
}

.lf-auth .lf-auth__back[hidden] {
	display: none;
}

.lf-auth .lf-auth__back svg {
	display: block;
	width: 24px;
	height: 24px;
}

.lf-auth .lf-auth__brand {
	grid-column: 2;
	text-align: center;
}

.lf-auth .lf-auth__header-spacer {
	grid-column: 3;
}

.lf-auth .lf-auth__logo {
	display: block;
	width: 196px;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}

.lf-auth .lf-auth__wordmark {
	display: block;
	font-size: 26px;
	font-weight: 700;
	letter-spacing: 0.14em;
	color: var(--lf-ink);
}

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

.lf-auth .lf-auth__step {
	display: none;
	flex-direction: column;
}

.lf-auth .lf-auth__step.is-active {
	display: flex;
}

.lf-auth .lf-auth__group {
	display: flex;
	flex-direction: column;
}

.lf-auth .lf-auth__group--intro {
	gap: 10px;
}

.lf-auth .lf-auth__group--code {
	gap: 18px;
}

.lf-auth .lf-auth__group--actions {
	gap: 14px;
}

.lf-auth .lf-auth__group--verify {
	gap: 16px;
}

.lf-auth .lf-auth__step--done.is-active {
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 30px 0 40px;
}

.lf-auth .lf-auth__title {
	margin: 0;
	padding: 0;
	font-family: var(--lf-font);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.7;
	color: var(--lf-ink);
	text-align: right;
}

.lf-auth .lf-auth__lead {
	margin: 0;
	font-size: 13px;
	line-height: 1.9;
	color: var(--lf-faint);
}

.lf-auth .lf-auth__lead--tight {
	margin-top: -8px;
}

.lf-auth .lf-auth__phone-echo {
	font-weight: 500;
	color: var(--lf-ink);
	unicode-bidi: plaintext;
}

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

.lf-auth .lf-auth__input {
	width: 100%;
	max-width: 100%;
	height: 52px;
	padding: 0 16px;
	font-family: var(--lf-font);
	font-size: 15px;
	line-height: normal;
	letter-spacing: 0.06em;
	color: var(--lf-ink);
	text-align: right;
	background: var(--lf-surface);
	border: 1px solid var(--lf-line-field);
	border-radius: 0;
	box-shadow: none;
	transition: border-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.lf-auth .lf-auth__input::placeholder {
	color: var(--lf-placeholder);
	letter-spacing: 0.06em;
}

.lf-auth .lf-auth__input:focus {
	outline: none;
	border-color: var(--lf-ink);
	box-shadow: none;
}

.lf-auth .lf-auth__input--code {
	font-size: 18px;
	letter-spacing: 0.5em;
	text-align: center;
	text-indent: 0.5em;
}

.lf-auth .lf-auth__slots {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.lf-auth .lf-auth__slot {
	flex: 0 0 auto;
	width: 54px;
	height: 58px;
	padding: 0;
	font-family: var(--lf-font);
	font-size: 20px;
	color: var(--lf-ink);
	text-align: center;
	background: var(--lf-surface);
	border: 1px solid var(--lf-line-field);
	border-radius: 0;
	box-shadow: none;
	transition: border-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.lf-auth .lf-auth__slot:focus {
	outline: none;
	border-color: var(--lf-ink);
}

/* Invalid and expired states, driven by the script. */

.lf-auth.is-invalid .lf-auth__slot,
.lf-auth.is-invalid .lf-auth__input--code {
	color: var(--lf-danger);
	border-color: var(--lf-danger);
}

.lf-auth.is-phone-invalid .lf-auth__input--phone {
	color: var(--lf-danger);
	border-color: var(--lf-danger);
}

.lf-auth.is-expired .lf-auth__slot,
.lf-auth.is-expired .lf-auth__input--code {
	color: var(--lf-placeholder);
	background: var(--lf-expired-bg);
	border-color: var(--lf-line);
}

/* Buttons ---------------------------------------------------------------- */

.lf-auth .lf-auth__button {
	width: 100%;
	height: 52px;
	padding: 0;
	font-family: var(--lf-font);
	font-size: 14.5px;
	font-weight: 500;
	letter-spacing: 0.02em;
	color: #fff;
	background: var(--lf-ink);
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.lf-auth .lf-auth__button:hover,
.lf-auth .lf-auth__button:focus-visible {
	background: var(--lf-ink-strong);
	color: #fff;
}

.lf-auth .lf-auth__button[disabled],
.lf-auth .lf-auth__button.is-busy {
	background: var(--lf-disabled);
	color: #fff;
	cursor: default;
	pointer-events: none;
}

.lf-auth .lf-auth__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 12.5px;
}

.lf-auth .lf-auth__link {
	padding: 0;
	font-family: var(--lf-font);
	font-size: 12.5px;
	color: var(--lf-ink);
	background: none;
	border: none;
	border-bottom: 1px solid var(--lf-line-link);
	border-radius: 0;
	cursor: pointer;
}

.lf-auth .lf-auth__link:hover {
	color: var(--lf-ink-strong);
	border-bottom-color: var(--lf-ink);
	background: none;
}

.lf-auth .lf-auth__link[disabled] {
	color: var(--lf-faint);
	border-bottom-color: transparent;
	cursor: default;
}

.lf-auth .lf-auth__link--resend {
	unicode-bidi: plaintext;
}

/* Messages --------------------------------------------------------------- */

.lf-auth .lf-auth__error {
	min-height: 16px;
	font-size: 12px;
	line-height: 1.7;
	color: var(--lf-danger);
}

.lf-auth .lf-auth__terms {
	margin: 0;
	font-size: 11.5px;
	line-height: 2;
	color: var(--lf-faint);
	text-align: center;
}

.lf-auth .lf-auth__terms a {
	color: var(--lf-ink);
	text-decoration: none;
	border-bottom: 1px solid var(--lf-line-link);
}

.lf-auth .lf-auth__terms a:hover {
	color: var(--lf-ink-strong);
	border-bottom-color: var(--lf-ink);
}

.lf-auth .lf-auth__note {
	margin: 0;
	padding-top: 16px;
	font-size: 11.5px;
	line-height: 2;
	color: var(--lf-muted);
	text-align: center;
	border-top: 1px solid var(--lf-line-soft);
}

/* Handover --------------------------------------------------------------- */

.lf-auth .lf-auth__spinner {
	width: 26px;
	height: 26px;
	border: 2px solid var(--lf-line-soft);
	border-top-color: var(--lf-ink);
	border-radius: 50%;
	animation: lf-auth-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.lf-auth .lf-auth__spinner {
		animation-duration: 3s;
	}
}

/*
 * Phones: the card goes edge to edge and fills the screen, while the header
 * grid keeps the back button in the same top-right corner it holds on
 * desktop.
 */

@media (max-width: 480px) {
	.lf-auth {
		align-items: stretch;
		padding: 0;
	}

	.lf-auth .lf-auth__card {
		display: flex;
		flex-direction: column;
		width: 100%;
		border: none;
	}

	.lf-auth .lf-auth__panel {
		flex: 1 1 auto;
		padding: 22px 20px 28px;
	}

	.lf-auth .lf-auth__header {
		padding-bottom: 32px;
	}

	.lf-auth .lf-auth__slots {
		gap: 10px;
	}

	.lf-auth .lf-auth__slot {
		flex: 1 1 0;
		width: auto;
		max-width: 68px;
		height: 56px;
	}
}
