/** 
 * Auth styles
 * @file auth.css
 * @author SFPD Panel Team
 * @description Styles for the authentication pages, including the login and registration forms.
 */

.login {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 40px 20px;
	background-color: var(--neutral-50);
	overflow: hidden;
	isolation: isolate;
}

/* === the living background ============================================== */
/* A faint grid gives the light something to move against; without it the
   drifting orbs read as a flat wash instead of depth. */
.login::before {
	content: '';
	position: absolute;
	inset: -2px;
	background-image:
		linear-gradient(to right, var(--border-color) 1px, transparent 1px),
		linear-gradient(to bottom, var(--border-color) 1px, transparent 1px);
	background-size: 56px 56px;
	opacity: 0.5;
	mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
	-webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
	z-index: -2;
}

.login__orbs {
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	overflow: hidden;
}

.login__orb {
	position: absolute;
	border-radius: 50%;
	filter: blur(70px);
	opacity: 0.55;
	will-change: transform;
}

.login__orb--one {
	top: -14%;
	left: -8%;
	width: 46vmax;
	height: 46vmax;
	background: radial-gradient(circle, var(--primary-600) 0%, transparent 68%);
	animation: login-drift-a 26s ease-in-out infinite alternate;
}

.login__orb--two {
	right: -12%;
	bottom: -18%;
	width: 40vmax;
	height: 40vmax;
	background: radial-gradient(circle, var(--info-main) 0%, transparent 68%);
	animation: login-drift-b 32s ease-in-out infinite alternate;
	opacity: 0.4;
}

.login__orb--three {
	top: 42%;
	left: 58%;
	width: 26vmax;
	height: 26vmax;
	background: radial-gradient(circle, var(--lilac-600, #8b5cf6) 0%, transparent 68%);
	animation: login-drift-a 38s ease-in-out infinite alternate-reverse;
	opacity: 0.28;
}

@keyframes login-drift-a {
	from {
		transform: translate3d(0, 0, 0) scale(1);
	}

	to {
		transform: translate3d(7vw, 6vh, 0) scale(1.14);
	}
}

@keyframes login-drift-b {
	from {
		transform: translate3d(0, 0, 0) scale(1.08);
	}

	to {
		transform: translate3d(-8vw, -5vh, 0) scale(1);
	}
}

/* === the card =========================================================== */
.login-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	width: 100%;
	max-width: 440px;
	margin-top: 46px;
	padding: 66px 34px 32px;
	border: 1px solid var(--border-color);
	border-radius: 24px;
	/* Glass: the drifting light stays visible through the surface */
	background-color: color-mix(in srgb, var(--white) 78%, transparent);
	backdrop-filter: blur(22px) saturate(140%);
	-webkit-backdrop-filter: blur(22px) saturate(140%);
	box-shadow:
		0 32px 64px -28px rgba(17, 24, 39, 0.55),
		inset 0 1px 0 rgba(255, 255, 255, 0.14);
	text-align: center;
	animation: login-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* A hairline of light along the top edge, the way glass catches it */
.login-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 12%;
	width: 76%;
	height: 1px;
	background: linear-gradient(to right, transparent, var(--primary-600), transparent);
	opacity: 0.65;
}

@keyframes login-rise {
	from {
		opacity: 0;
		transform: translateY(22px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* === the crest ========================================================== */
/* The logo breaks the card's top edge so the composition has a focal point
   above the text rather than another row inside it. */
.login-crest {
	position: absolute;
	top: -46px;
	left: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 96px;
	height: 96px;
	margin-left: -48px;
	border: 1px solid var(--border-color);
	border-radius: 50%;
	background-color: var(--white);
	box-shadow:
		0 18px 36px -18px rgba(17, 24, 39, 0.5),
		0 0 0 8px color-mix(in srgb, var(--primary-50) 60%, transparent);
	animation: login-float 7s ease-in-out infinite;
}

.login-crest img {
	width: 68px;
	height: 68px;
	object-fit: contain;
}

@keyframes login-float {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-6px);
	}
}

/* === contents, arriving in order ======================================== */
.login-card > *:not(.login-crest) {
	animation: login-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card > *:nth-child(2) {
	animation-delay: 0.12s;
}

.login-card > *:nth-child(3) {
	animation-delay: 0.19s;
}

.login-card > *:nth-child(4) {
	animation-delay: 0.26s;
}

.login-card > *:nth-child(5) {
	animation-delay: 0.33s;
}

.login-card > *:nth-child(6) {
	animation-delay: 0.4s;
}

@keyframes login-fade-up {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.login-head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

/* white-space keeps the label a single line: the text is an anonymous flex item
   and would otherwise shrink and wrap under a narrow card, leaving the icon
   beside a two-line block. line-height 1 makes both boxes the height of their
   glyphs, so align-items: center lines them up exactly and the pill's height
   comes from its padding. */
.login-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 14px;
	border-radius: 100px;
	background-color: color-mix(in srgb, var(--primary-50) 85%, transparent);
	color: var(--primary-600);
	font-size: 0.625rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
}

.login-eyebrow > i {
	display: inline-flex;
	align-items: center;
	font-size: 0.8125rem;
	line-height: 1;
	flex-shrink: 0;
}

.login-title {
	margin: 0;
	color: var(--text-primary-light);
	font-size: 1.625rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.login-title span {
	color: var(--primary-600);
}

.login-domain {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 8px;
	border-radius: 100px;
	background-color: var(--primary-50);
	color: var(--primary-600);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.5;
}

.login-domain > i {
	display: inline-flex;
	align-items: center;
	font-size: 0.875rem;
	line-height: 1;
	opacity: 0.8;
	flex-shrink: 0;
}

/* === the bilingual instructions ========================================= */
.login-notes {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	padding: 16px;
	border: 1px solid var(--border-color);
	border-radius: 16px;
	background-color: color-mix(in srgb, var(--neutral-50) 70%, transparent);
	text-align: left;
}

.login-note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	min-width: 0;
	margin: 0;
	color: var(--text-primary-light);
	font-size: 0.8125rem;
	line-height: 1.6;
}

.login-note img {
	width: 20px;
	height: 20px;
	margin-top: 1px;
	border-radius: 4px;
	flex-shrink: 0;
}

/* === the button ========================================================= */
/* Discord's own colour: an OAuth button is easier to trust when it looks like
   the service it hands you to. */
.login-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 54px;
	padding: 0 22px;
	border: 0;
	border-radius: 16px;
	background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
	color: #fff;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	box-shadow: 0 14px 30px -16px rgba(88, 101, 242, 0.9);
	overflow: hidden;
	transition:
		transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow 0.2s ease;
}

/* A sheen crosses the button on hover, so the primary action feels alive */
.login-button::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: -60%;
	width: 40%;
	background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.38), transparent);
	transform: skewX(-18deg);
	transition: left 0.55s ease;
}

.login-button:hover {
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 20px 38px -16px rgba(88, 101, 242, 1);
}

.login-button:hover::after {
	left: 120%;
}

.login-button:active {
	transform: translateY(0);
}

.login-button:focus-visible {
	outline: 2px solid var(--primary-600);
	outline-offset: 3px;
}

.login-button > iconify-icon {
	display: inline-flex;
	align-items: center;
	font-size: 1.375rem;
	line-height: 1;
	flex-shrink: 0;
}

.login-foot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	color: var(--text-secondary-light);
	font-size: 0.6875rem;
	font-weight: 500;
	line-height: 1.5;
}

.login-foot > i {
	display: inline-flex;
	align-items: center;
	font-size: 0.875rem;
	line-height: 1;
	color: var(--success-main);
	flex-shrink: 0;
}

/* === small screens ====================================================== */
@media (max-width: 575.98px) {
	.login {
		padding: 32px 16px;
	}

	.login::before {
		background-size: 40px 40px;
	}

	.login-card {
		margin-top: 38px;
		padding: 56px 20px 26px;
		border-radius: 20px;
		gap: 16px;
	}

	.login-crest {
		top: -38px;
		width: 80px;
		height: 80px;
		margin-left: -40px;
	}

	.login-crest img {
		width: 54px;
		height: 54px;
	}

	.login-title {
		font-size: 1.375rem;
	}

	/* Blur is the most expensive thing here and the least visible on a phone */
	.login-card {
		backdrop-filter: blur(14px);
		-webkit-backdrop-filter: blur(14px);
	}
}

/* === motion off ========================================================= */
@media (prefers-reduced-motion: reduce) {
	.login__orb,
	.login-crest,
	.login-card,
	.login-card > * {
		animation: none !important;
	}

	.login-button,
	.login-button::after {
		transition: none;
	}

	.login-button:hover {
		transform: none;
	}
}
