/* =============================================================================
   The auth card.

   Built on the platform's tokens (--mena-*) so it follows the light/dark switch
   without knowing anything about it, and every var() carries a fallback because
   this is the one screen that has to render correctly on a site where something
   else has gone wrong.
   ========================================================================== */

.mena-auth {
	--ma-bg: var(--mena-bg, #fff);
	--ma-card: var(--mena-elevated, #fff);
	--ma-soft: var(--mena-surface, #f7f7f9);
	--ma-line: var(--mena-border, #e6e6ec);
	--ma-line-soft: var(--mena-border-soft, #f0f0f4);
	--ma-text: var(--mena-text, #1a1a1a);
	--ma-text-2: var(--mena-text-2, #3f4650);
	--ma-muted: var(--mena-muted, #8898aa);
	--ma-gold: var(--mena-gold, #ffd014);
	--ma-on-gold: var(--mena-on-gold, #1a1a1a);
	--ma-rose: var(--mena-rose, #f5365c);
	--ma-green: var(--mena-green, #17bf63);

	box-sizing: border-box;
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
	color: var(--ma-text);
	font-family: inherit;
	text-align: start;
}

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

/*
 * `hidden` means hidden.
 *
 * The browser hides a [hidden] element with `display: none` from its own
 * stylesheet, and *any* author rule that sets display beats it — no !important
 * or clever specificity required, because the page's own styles always outrank
 * the browser's defaults. So `.mena-auth__field { display: block }` quietly
 * un-hid every field the script had just switched off, and the password reset
 * pane showed the whole form: username, email, password, repeat, remember me.
 *
 * The panes are switched by toggling the property, so this is the rule that
 * makes that mean something. It carries !important because it has to win
 * against every display rule in this file, present and future — the whole
 * point is that no later rule can accidentally reveal a hidden pane again.
 */
.mena-auth [hidden],
.mena-auth-modal [hidden] { display: none !important; }
/* ------------------------------------------------------------------ header */

.mena-auth__home {
	display: block;
	margin: 0 0 18px;
	text-align: center;
	text-decoration: none !important;
}

.mena-auth__logo { display: inline-block; height: 34px; width: auto; }
/* The theme owns which of the two wordmarks is visible; these only stop both
   being laid out at once before that rule has had a chance to apply. */
.mena-auth__logo.mena-logo--dark { display: none; }
:root[data-mena-theme="dark"] .mena-auth__logo.mena-logo--light { display: none; }
:root[data-mena-theme="dark"] .mena-auth__logo.mena-logo--dark { display: inline-block; }

.mena-auth__title {
	margin: 0 0 6px !important;
	font-size: 22px !important;
	font-weight: 800 !important;
	line-height: 1.4 !important;
	color: var(--ma-text) !important;
	text-align: center;
}

.mena-auth__lead {
	margin: 0 0 20px;
	font-size: 13.5px;
	line-height: 1.8;
	color: var(--ma-muted);
	text-align: center;
}
/* ----------------------------------------------------------------- message */

/*
 * One box for every outcome, coloured by tone rather than replaced per pane —
 * a person who has just been told something is wrong should not have to look
 * for it somewhere new the next time.
 */
.mena-auth .mena-auth__say {
	margin: 0 0 14px;
	padding: 11px 14px;
	border: 1px solid var(--ma-line);
	border-radius: 12px;
	background: var(--ma-soft);
	font-size: 13px;
	line-height: 1.8;
	color: var(--ma-text);
}

.mena-auth .mena-auth__say.is-bad {
	border-color: rgba(245, 54, 92, .35);
	background: rgba(245, 54, 92, .08);
}

.mena-auth .mena-auth__say.is-good {
	border-color: rgba(23, 191, 99, .35);
	background: rgba(23, 191, 99, .08);
}
/* ------------------------------------------------------------------ fields */

.mena-auth .mena-auth__form { margin: 0; }

.mena-auth .mena-auth__field { display: block; margin: 0 0 14px; }

.mena-auth .mena-auth__label {
	display: block;
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ma-text-2);
}

.mena-auth .mena-auth__wrap { display: block; position: relative; }

.mena-auth .mena-auth__input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--ma-line);
	border-radius: 12px;
	background: var(--ma-card);
	color: var(--ma-text);
	font-family: inherit;
	font-size: 15px;
	line-height: 46px;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.mena-auth .mena-auth__input::placeholder { color: var(--ma-muted); }

.mena-auth .mena-auth__input:focus {
	border-color: var(--mena-gold-text, var(--ma-gold));
	box-shadow: 0 0 0 3px rgba(255, 208, 20, .18);
}
/* Room for the eye, on whichever side the page reads from. */
.mena-auth__wrap .mena-auth__input { padding-inline-end: 46px; }

.mena-auth .mena-auth__eye {
	position: absolute;
	inset-inline-end: 4px;
	top: 4px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 10px;
	background: none;
	color: var(--ma-muted);
	font-size: 16px;
	cursor: pointer;
	padding: 0;
}

.mena-auth .mena-auth__eye:hover { color: var(--ma-text); background: var(--ma-soft); }

.mena-auth .mena-auth__hint {
	display: block;
	margin: 6px 2px 0;
	font-size: 11.5px;
	font-style: normal;
	line-height: 1.7;
	color: var(--ma-muted);
}
/* --------------------------------------------------------- remember/forgot */

.mena-auth .mena-auth__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0 0 18px;
	font-size: 13px;
}

.mena-auth .mena-auth__check {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	color: var(--ma-text-2);
	cursor: pointer;
}

.mena-auth .mena-auth__check input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--mena-gold-text, var(--ma-gold));
}
/* A link that is a button, because it changes the pane rather than the page. */
.mena-auth .mena-auth__plain {
	padding: 0;
	border: 0;
	background: none;
	color: var(--mena-gold-text, #c68f00);
	font-family: inherit;
	font-size: inherit;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
}

.mena-auth .mena-auth__plain:hover { text-decoration: underline; }
/* ------------------------------------------------------------------ submit */

.mena-auth .mena-auth__go {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	height: 50px;
	border: 0;
	border-radius: 999px;
	background: var(--ma-gold);
	color: var(--ma-on-gold);
	font-family: inherit;
	font-size: 15px;
	font-weight: 800;
	cursor: pointer;
	transition: filter .15s ease, opacity .15s ease;
}

.mena-auth .mena-auth__go:hover { filter: brightness(.96); }
.mena-auth .mena-auth__go:disabled { opacity: .7; cursor: default; }

.mena-auth__spin {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(0, 0, 0, .25);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: mena-auth-spin .7s linear infinite;
}

.mena-auth.is-sending .mena-auth__spin { display: block; }
@keyframes mena-auth-spin { to { transform: rotate(360deg); } }
/* The spinner is the only motion here, and it is the one thing a visitor with
   reduced motion still benefits from knowing about — so it slows rather than
   stops, and the button's disabled state carries the message either way. */
@media (prefers-reduced-motion: reduce) {
	.mena-auth__spin { animation-duration: 2.4s; }
}
/* ------------------------------------------------------------------ social */

.mena-auth__or {
	position: relative;
	margin: 22px 0 16px;
	text-align: center;
}

.mena-auth__or::before {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: 50%;
	height: 1px;
	background: var(--ma-line);
}

.mena-auth__or span {
	position: relative;
	padding: 0 12px;
	background: var(--ma-bg);
	color: var(--ma-muted);
	font-size: 12px;
}
/* Inside the dialog the strip sits on the card, not on the page. */
.mena-auth-modal__box .mena-auth__or span { background: var(--ma-card); }
/*
 * Nextend's buttons, wearing this site's clothes.
 *
 * The plugin ships each provider as a brand-coloured pill: Google on white, X
 * on black. Stacked under a form on a dark page one of them disappears
 * completely — black on black — so the row goes neutral and the brand stays on
 * the mark, in a chip that keeps each logo on the background it was drawn for.
 * The inline background-color the provider writes onto the element is an
 * attribute, which is why every one of these has to be forced.
 */
.mena-auth__social .nsl-container { text-align: inherit !important; }

.mena-auth__social .nsl-container.nsl-container-block .nsl-container-buttons, .mena-auth__social .nsl-container .nsl-container-buttons {
	display: grid !important;
	gap: 10px !important;
	width: 100% !important;
}

.mena-auth__social .nsl-container-buttons > a {
	display: block !important;
	width: 100% !important;
	margin: 0 !important;
	box-shadow: none !important;
	text-decoration: none !important;
}

.mena-auth__social .nsl-button {
	display: grid !important;
	grid-template-columns: 34px minmax(0, 1fr) 34px;
	align-items: center;
	gap: 10px;
	width: 100% !important;
	min-height: 50px;
	padding: 8px 12px !important;
	border: 1px solid var(--ma-line) !important;
	border-radius: 999px !important;
	background: var(--ma-card) !important;
	box-shadow: none !important;
	transition: border-color .15s ease, background-color .15s ease;
}

.mena-auth__social .nsl-container-buttons > a:hover .nsl-button {
	border-color: var(--mena-gold-text, var(--ma-gold)) !important;
	background: var(--ma-soft) !important;
}

.mena-auth__social .nsl-button-svg-container {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 34px !important;
	height: 34px !important;
	margin: 0 !important;
	padding: 0 !important;
	border-radius: 50%;
	overflow: hidden;
}

.mena-auth__social .nsl-button-svg-container svg {
	width: 19px !important;
	height: 19px !important;
	display: block;
}

.mena-auth__social .nsl-button-google .nsl-button-svg-container {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, .10);
}

.mena-auth__social .nsl-button-twitter .nsl-button-svg-container, .mena-auth__social .nsl-button-x .nsl-button-svg-container {
	background: #000;
	border: 1px solid rgba(255, 255, 255, .14);
}

.mena-auth__social .nsl-button-facebook .nsl-button-svg-container { background: #1877f2; }
.mena-auth__social .nsl-button-apple .nsl-button-svg-container { background: #000; }

.mena-auth__social .nsl-button-label-container {
	margin: 0 !important;
	padding: 0 !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	line-height: 1.5 !important;
	color: var(--ma-text) !important;
	text-align: center !important;
	white-space: normal !important;
}
/* ------------------------------------------------------------------- swap */

/*
 * The consent line.
 *
 * Small and quiet, but not hidden: 12px at the muted colour is legible without
 * competing with the button above it, and the two links carry the accent so
 * they read as links rather than as emphasis. Wider line-height than the rest
 * of the card because this is the one paragraph here that wraps to three lines
 * in Arabic, and set flush-centre to sit under the button it qualifies.
 */
.mena-auth__legal {
	margin: 18px 0 0;
	text-align: center;
	font-size: 12px;
	line-height: 1.8;
	color: var(--ma-muted);
}

.mena-auth__legal a {
	color: var(--mena-gold-text, #c68f00);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mena-auth__legal a:hover { text-decoration: none; }

.mena-auth__swap {
	margin: 14px 0 0;
	text-align: center;
	font-size: 13.5px;
	color: var(--ma-muted);
}

.mena-auth__back {
	margin: 14px 0 0;
	text-align: center;
	font-size: 12.5px;
}

.mena-auth__back a { color: var(--ma-muted); text-decoration: none; }
.mena-auth__back a:hover { text-decoration: underline; }
/* ============================================================== the dialog */

/* The dialog wraps the card rather than living inside it, so the card's own
   border-box reset does not reach it — and 452px of max-width plus 26px of
   padding either side is a 506px dialog. */
.mena-auth-modal, .mena-auth-modal *, .mena-auth-modal *::before, .mena-auth-modal *::after {
	box-sizing: border-box;
}

.mena-auth-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	overflow-y: auto;
}

.mena-auth-modal[hidden] { display: none; }

/*
 * Opening and closing.
 *
 * Two things move: the backdrop fades, and the dialog comes up a little and
 * settles. Both are driven by one class, and the class is the only state — the
 * script hides the dialog on a timer rather than waiting for transitionend, so
 * nothing here can leave it stuck half-open if the animation never runs.
 *
 * The easing is asymmetric on purpose. Opening overshoots slightly into place,
 * which reads as the dialog arriving; closing is a plain ease-in, because an
 * element on its way out should get out of the way rather than perform.
 */
.mena-auth-modal__veil {
	position: fixed;
	inset: 0;
	background: rgba(9, 10, 12, .62);
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity .18s ease-in;
}

.mena-auth-modal.is-open .mena-auth-modal__veil {
	opacity: 1;
	transition: opacity .22s ease-out;
}

.mena-auth-modal__box {
	position: relative;
	width: 100%;
	max-width: 452px;
	margin: auto;
	padding: 30px 26px 26px;
	border: 1px solid var(--mena-border, #e6e6ec);
	border-radius: 20px;
	background: var(--mena-elevated, #fff);
	box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
	outline: none;

	opacity: 0;
	transform: translateY(10px) scale(.97);
	transform-origin: center;
	transition: opacity .16s ease-in, transform .16s ease-in;
	will-change: transform, opacity;
}

.mena-auth-modal.is-open .mena-auth-modal__box {
	opacity: 1;
	transform: none;
	transition: opacity .2s ease-out, transform .26s cubic-bezier(.2, .9, .3, 1.08);
}

/*
 * Motion off, dialog still.
 *
 * The fade stays — it is what tells you something appeared — but the movement
 * goes, and it goes by having no transform to animate rather than by turning
 * the transition off, so the dialog never lands anywhere but its final place.
 */
@media (prefers-reduced-motion: reduce) {
	.mena-auth-modal__box,
	.mena-auth-modal.is-open .mena-auth-modal__box {
		transform: none;
		transition: opacity .12s linear;
	}
}

.mena-auth-modal .mena-auth-modal__x {
	position: absolute;
	inset-inline-end: 12px;
	top: 12px;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--mena-muted, #8898aa);
	font-size: 15px;
	cursor: pointer;
	padding: 0;
}

.mena-auth-modal .mena-auth-modal__x:hover { background: var(--mena-surface, #f7f7f9); color: var(--mena-text, #1a1a1a); }
/* The page behind the dialog stays where it is. */
.mena-auth-open, .mena-auth-open body { overflow: hidden; }
/* ================================================================ the page */

body.mena-auth-page {
	margin: 0;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px 18px;
	background: var(--mena-bg, #fff);
	color: var(--mena-text, #1a1a1a);
	font-family: "Alexandria", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
}

.mena-auth-page__main { width: 100%; }
/*
 * On its own page the card is the page: no border and no shadow, because a
 * boxed card floating on an empty screen is a dialog that has lost its site.
 */
.mena-auth--page { max-width: 400px; }
@media (max-width: 480px) {
	.mena-auth-modal { padding: 0; }

	.mena-auth-modal__box {
		max-width: none;
		min-height: 100%;
		margin: 0;
		border: 0;
		border-radius: 0;
		padding: 56px 20px 32px;

		/* A full-height sheet grows out of nothing if it scales; it belongs to
		   the bottom edge, so that is where it comes from and goes back to. */
		transform: translateY(3%);
	}

	.mena-auth-modal.is-open .mena-auth-modal__box { transform: none; }

	@media (prefers-reduced-motion: reduce) {
		.mena-auth-modal__box { transform: none; }
	}

	body.mena-auth-page { align-items: flex-start; padding: 24px 18px 40px; }
}
