/* Sign-in dialog. Tokens come from the theme, with plain fallbacks. */

.mea-auth {
	position: fixed;
	inset: 0;
	margin: auto;
	height: fit-content;
	inline-size: min(27rem, calc(100vw - 1.5rem));
	max-block-size: calc(100dvh - 1.5rem);
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: var(--ai-bg, #fff);
	color: var(--ai-text, #14182b);
	box-shadow: 0 24px 64px rgba(6, 12, 70, 0.35);
	overflow: auto;
}

.mea-auth::backdrop {
	background: rgba(6, 12, 70, 0.6);
	backdrop-filter: blur(4px);
}

.mea-auth[open] {
	animation: mea-auth-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes mea-auth-in {
	from { opacity: 0; transform: translateY(16px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mea-auth[open] {
		animation: none;
	}
}

.mea-auth-open {
	overflow: hidden;
}

.mea-auth__panel {
	position: relative;
}

.mea-auth__close {
	position: absolute;
	z-index: 1;
	inset-block-start: 0.6rem;
	inset-inline-end: 0.6rem;
	inline-size: 2.5rem;
	block-size: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.mea-auth__close:hover,
.mea-auth__close:focus-visible {
	background: rgba(255, 255, 255, 0.24);
}

/* ---- Welcome band ---- */

.mea-auth__hero {
	position: relative;
	padding: 2rem 1.75rem 1.6rem;
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(38, 130, 255, 0.35) 0%, transparent 60%),
		linear-gradient(160deg, var(--ai-band-navy, #060c46) 0%, var(--ai-band-navy-2, #0a1250) 100%);
	color: #fff;
	text-align: center;
	overflow: hidden;
}

.mea-auth__hero::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	block-size: 3px;
	background: linear-gradient(90deg, transparent, var(--ai-gold-on-navy, #e6c98a), transparent);
}

.mea-auth__logo {
	display: flex;
	justify-content: center;
	margin-block-end: 1rem;
}

.mea-auth__logo svg {
	block-size: 1.9rem;
	inline-size: auto;
	max-inline-size: 100%;
}

.mea-auth__title {
	margin: 0 0 0.4rem;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1.35;
}

.mea-auth__lede {
	margin: 0 auto;
	max-inline-size: 22rem;
	color: rgba(255, 255, 255, 0.78);
	font-size: 0.95rem;
	line-height: 1.6;
}

/* ---- Body ---- */

.mea-auth__body {
	padding: 1.4rem 1.75rem 1.5rem;
}

.mea-auth__body:focus {
	outline: none;
}

.mea-auth .mea-identity {
	max-inline-size: none;
	margin: 0;
}

.mea-auth .mea-identity__or {
	display: none;
}

.mea-auth .mea-identity__list {
	display: grid;
	gap: 0.5rem;
}

.mea-auth .mea-identity__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	min-block-size: 3rem;
	padding: 0.5rem 1rem;
	border: 1px solid var(--ai-border-strong, #d0d5dd);
	border-radius: 12px;
	background: var(--ai-bg, #fff);
	color: var(--ai-text, #14182b);
	font-size: 1rem;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
	transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.mea-auth .mea-identity__btn:hover,
.mea-auth .mea-identity__btn:focus-visible {
	border-color: var(--ai-text-muted, #475467);
	box-shadow: 0 4px 12px rgba(16, 24, 40, 0.1);
	text-decoration: none;
}

.mea-auth__or {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 1.1rem 0;
	color: var(--ai-text-muted, #475467);
	font-size: 0.8125rem;
}

.mea-auth__or::before,
.mea-auth__or::after {
	content: "";
	flex: 1;
	border-top: 1px solid var(--ai-border, #e4e7ec);
}

.mea-auth__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.25rem;
	margin-block-end: 1rem;
	padding: 0.25rem;
	border-radius: 12px;
	background: var(--ai-bg-sunken, #f2f4f7);
}

[data-theme="dark"] .mea-auth__tabs {
	background: var(--ai-bg-raised, #181b2a);
}

.mea-auth__tabs button {
	min-block-size: 2.5rem;
	padding: 0.35rem;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var(--ai-text-muted, #475467);
	font: inherit;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
}

.mea-auth__tabs button[aria-selected="true"] {
	background: var(--ai-bg, #fff);
	color: var(--ai-text, #14182b);
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.mea-auth__tabs button:focus-visible {
	outline: none;
	box-shadow: var(--ai-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #086af5);
}

.mea-auth__form {
	display: grid;
	gap: 0.85rem;
}

.mea-auth__form[hidden] {
	display: none;
}

.mea-auth__field {
	display: grid;
	gap: 0.35rem;
	font-size: 0.875rem;
	font-weight: 600;
}

.mea-auth__label-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}

.mea-auth__lost {
	color: var(--ai-brand-text, #005be8);
	font-size: 0.8125rem;
	font-weight: 600;
}

.mea-auth__field input {
	inline-size: 100%;
	min-block-size: 3rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--ai-border-strong, #d0d5dd);
	border-radius: 12px;
	background: var(--ai-bg, #fff);
	color: var(--ai-text, #14182b);
	font: inherit;
	font-size: 1rem;
	font-weight: 400;
	text-align: left;
	transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.mea-auth__field input[name="display_name"] {
	text-align: start;
}

.mea-auth__field input:focus {
	border-color: var(--ai-brand, #086af5);
	outline: none;
	box-shadow: 0 0 0 3px rgba(8, 106, 245, 0.18);
}

.mea-auth__pass {
	position: relative;
	display: block;
}

.mea-auth__eye {
	position: absolute;
	inset-block: 0;
	right: 0.25rem;
	inline-size: 2.75rem;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ai-text-muted, #475467);
	cursor: pointer;
}

/* The field is left-to-right, so the eye sits on its right edge. */
.mea-auth__pass input {
	padding-right: 3rem;
	padding-left: 0.9rem;
}

.mea-auth__eye[aria-pressed="true"] {
	color: var(--ai-brand, #086af5);
}

.mea-auth__error {
	margin: 0;
	padding: 0.6rem 0.8rem;
	border-radius: 10px;
	background: rgba(212, 38, 69, 0.08);
	color: var(--ai-urgent-text, #b01e38);
	font-size: 0.9rem;
}

.mea-auth__submit {
	inline-size: 100%;
	min-block-size: 3rem;
	border-radius: 12px;
	font-size: 1rem;
}

.mea-auth__terms {
	margin: 1.1rem 0 0;
	color: var(--ai-text-muted, #475467);
	font-size: 0.75rem;
	text-align: center;
}

.mea-auth__terms a {
	color: inherit;
	text-decoration: underline;
}

/* ---- After sign-up ---- */

.mea-auth__done {
	text-align: center;
}

.mea-auth__done-icon {
	display: inline-grid;
	place-items: center;
	inline-size: 4.5rem;
	block-size: 4.5rem;
	margin-block-end: 0.75rem;
	border-radius: 50%;
	background: var(--ai-bg-sunken, #f2f4f7);
	color: var(--ai-brand, #086af5);
}

.mea-auth__done-title {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
}

.mea-auth__done p {
	margin: 0 0 1.25rem;
	color: var(--ai-text-muted, #475467);
}

@media (max-width: 480px) {
	.mea-auth {
		margin-block-end: 0;
		margin-inline: 0;
		inline-size: 100vw;
		max-inline-size: 100vw;
		border-end-start-radius: 0;
		border-end-end-radius: 0;
	}

	.mea-auth__hero {
		padding: 1.6rem 1.25rem 1.3rem;
	}

	.mea-auth__body {
		padding: 1.2rem 1.25rem 1.4rem;
	}
}
