﻿/* AUTH PAGES
   Scoped to .auth-page so nothing here can leak into the main site layout. */

.auth-page {
	position: relative;
	min-height: 100dvh;
	height: auto;
	overflow-x: hidden;
	overflow-y: auto;
	background:
		radial-gradient(60rem 30rem at 50% -8rem, color-mix(in oklab, var(--primary) 7%, transparent), transparent 70%),
		var(--background);
}

/* Ambient background motion. Two slow drifting glows plus a faint grid that
   breathes - all behind the content, none of it interactive. Transform/opacity
   only, so it stays off the layout path. */
.auth-page:before,
.auth-page:after {
	content: "";
	position: fixed;
	z-index: 0;
	pointer-events: none;
	border-radius: 50%;
	filter: blur(60px);
	will-change: transform;
}

.auth-page:before {
	top: -18vh;
	left: 50%;
	width: 46rem;
	height: 46rem;
	margin-left: -23rem;
	background: radial-gradient(circle, color-mix(in oklab, var(--primary) 18%, transparent), transparent 62%);
	animation: auth-drift-a 26s ease-in-out infinite;
}

.auth-page:after {
	bottom: -26vh;
	left: 50%;
	width: 38rem;
	height: 38rem;
	margin-left: -19rem;
	background: radial-gradient(circle, color-mix(in oklab, var(--color-info) 14%, transparent), transparent 64%);
	animation: auth-drift-b 34s ease-in-out infinite;
}

.auth-grid {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background-image:
		linear-gradient(to right, color-mix(in oklab, var(--foreground) 4%, transparent) 1px, transparent 1px),
		linear-gradient(to bottom, color-mix(in oklab, var(--foreground) 4%, transparent) 1px, transparent 1px);
	background-size: 64px 64px;
	-webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 70%);
	mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 70%);
	animation: auth-grid-breathe 18s ease-in-out infinite;
}

@keyframes auth-drift-a {
	0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
	50%      { transform: translate3d(-3rem, 2.5rem, 0) scale(1.08); opacity: 1; }
}

@keyframes auth-drift-b {
	0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); opacity: 0.7; }
	50%      { transform: translate3d(3.5rem, -2rem, 0) scale(1); opacity: 0.95; }
}

@keyframes auth-grid-breathe {
	0%, 100% { opacity: 0.5; transform: scale(1); }
	50%      { opacity: 0.9; transform: scale(1.03); }
}

@keyframes auth-rise {
	from { opacity: 0; transform: translate3d(0, 10px, 0); }
	to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

.auth-shell {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 27rem;
	margin: 0 auto;
	padding: 2.5rem 1rem 3rem;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	-ms-flex-direction: column;
	flex-direction: column;
	gap: 1.25rem;
}

@media (max-width: 768px) {
	.auth-shell {
		padding: 1.5rem 1rem 2.5rem;
	}
}

.auth-brand {
	display: block;
	text-align: center;
	animation: auth-rise 500ms ease-out both;
}

.auth-brand img {
	width: 190px;
	max-width: 60%;
	height: auto;
}

@media (max-width: 768px) {
	.auth-brand img { width: 150px; }
}

/* CARD */

.auth-card {
	animation: auth-rise 500ms ease-out 80ms both;
	background-color: color-mix(in oklab, var(--card) 55%, transparent);
	border: 1px solid color-mix(in oklab, var(--foreground) 9%, transparent);
	border-radius: 0.875rem;
	padding: 1.5rem;
	box-shadow: 0 1px 0 color-mix(in oklab, var(--foreground) 6%, transparent) inset;
}

@media (max-width: 480px) {
	.auth-card { padding: 1.25rem 1rem; }
}

.auth-card-header {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	-ms-flex-direction: column;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.auth-title {
	font-size: 1.25rem;
	line-height: 1.3;
	letter-spacing: 0.5px;
}

.auth-subtitle {
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--muted-foreground);
	letter-spacing: 0.3px;
}

.auth-subtitle strong {
	color: var(--foreground);
	font-weight: inherit;
	word-break: break-word;
}

/* FORM */

.auth-form {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	-ms-flex-direction: column;
	flex-direction: column;
	gap: 0.875rem;
}

.auth-field {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	-ms-flex-direction: column;
	flex-direction: column;
	gap: 0.375rem;
}

.auth-label {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	letter-spacing: 0.6px;
	color: var(--muted-foreground);
	text-transform: uppercase;
}

.auth-label-optional {
	margin-left: auto;
	font-size: 0.625rem;
	letter-spacing: 0.8px;
	padding: 2px 6px;
	border-radius: 999px;
	color: var(--muted-foreground);
	background: color-mix(in oklab, var(--foreground) 8%, transparent);
	text-transform: uppercase;
}

/* The shared .input_field component, restyled for the auth card only.
   Hooks (.input_field, .field_element_input, .field_bottom) are untouched. */
.auth-field .input_field {
	margin: 0 !important;
	padding: 0;
	width: 100%;
	background-color: color-mix(in oklab, var(--background) 60%, transparent);
	border: 1px solid color-mix(in oklab, var(--foreground) 12%, transparent) !important;
	border-radius: 0.625rem;
	transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field .field_container {
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	padding: 0 0.625rem;
	min-height: 2.875rem;
}

.auth-field .field_element_input {
	padding: 0.75rem 0.5rem !important;
	font-size: 0.875rem;
	letter-spacing: 0.5px;
	min-width: 0;
}

.auth-field .field_element_input::placeholder {
	color: color-mix(in oklab, var(--muted-foreground) 70%, transparent);
	letter-spacing: 0.3px;
}

/* leading icon slot */
.field_leading {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	color: var(--muted-foreground);
	padding-left: 0.25rem;
	-ms-flex-negative: 0;
	flex-shrink: 0;
}

.auth-field .input_field:focus-within .field_leading {
	color: var(--primary);
}

/* focus ring - the global stylesheet clears outlines, so this restores a
   visible keyboard focus indicator inside the auth pages */
.auth-field .input_field:focus-within {
	border-color: color-mix(in oklab, var(--primary) 55%, transparent) !important;
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
}

.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page input:focus-visible,
.auth-page [tabindex]:focus-visible {
	outline: 2px solid var(--primary) !important;
	outline-offset: 2px;
	border-radius: 0.375rem;
}

/* a focused text input is already indicated by the wrapper's ring, so the
   input's own outline would draw a second, nested one */
.auth-field .field_element_input:focus-visible {
	outline: none !important;
}

/* validation text - the shared component absolutely positions .field_bottom,
   which overlaps neighbouring fields. Inside the card it flows inline instead. */
.auth-field .field_bottom {
	position: static;
	height: auto;
	padding: 0;
	line-height: 1.45;
	font-size: 0.6875rem;
	color: var(--color-danger) !important;
	word-break: break-word;
}

.auth-field .field_bottom:not(:has(.field_error.active:not([data-error="default"]))) {
	display: none;
}

.auth-field .field_error.active {
	display: block;
	padding-top: 0.375rem;
	letter-spacing: 0.3px;
}

/* The shared validator writes an inline border/color onto .input_field. The
   card's own border rule is !important, so the invalid state is driven off the
   error class the validator toggles instead of its inline style. */
.auth-field .input_field:has(.field_error.active:not([data-error="default"])) {
	border-color: color-mix(in oklab, var(--color-danger) 70%, transparent) !important;
}

.auth-field .input_field:has(.field_error.active:not([data-error="default"])):focus-within {
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-danger) 18%, transparent);
}

.auth-field .input_field:has(.field_error.active:not([data-error="default"])) .field_leading {
	color: var(--color-danger);
}

/* keep typed text readable - the validator also sets an inline color */
.auth-field .field_element_input {
	color: var(--foreground) !important;
}

/* password visibility toggle */
.auth_password_toggle {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	background: transparent;
	border-radius: 0.375rem;
	color: var(--muted-foreground);
	cursor: pointer;
	padding: 0.5rem;
	line-height: 0;
}

.auth_password_toggle:hover { color: var(--foreground); }

/* BUTTONS */

/* Scoped under .auth-page so these win over styles.css, which is concatenated
   after this file and resets .button's background to transparent. */
.auth-page .auth-submit {
	width: 100%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.875rem;
	margin-top: 0.25rem;
	border-radius: 0.625rem;
	background-color: var(--primary);
	color: var(--background);
	letter-spacing: 0.6px;
	transition: filter 160ms ease;
}

.auth-page .auth-submit:hover:not([disabled]) { filter: brightness(1.08); }
.auth-page .auth-submit[disabled] { opacity: 0.7; cursor: progress; }

.auth-page .auth-submit .auth-spinner { display: none; }

/* the icon gives way to the spinner while a request is in flight */
.auth-page .auth-submit .auth-submit-icon {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	line-height: 0;
}

.auth-page .auth-submit.is-loading .auth-submit-icon { display: none; }
.auth-page .auth-submit.is-loading .auth-submit-label { opacity: 0.85; }
.auth-page .auth-submit.is-loading .auth-spinner { display: block; }

.auth-spinner {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid color-mix(in oklab, var(--background) 35%, transparent);
	border-top-color: var(--background);
	animation: auth-spin 650ms linear infinite;
}

@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.auth-spinner { animation-duration: 2s; }
	.auth-field .input_field { transition: none; }

	/* ambient motion and entrances are decorative - drop them entirely */
	.auth-page:before,
	.auth-page:after,
	.auth-grid,
	.auth-brand,
	.auth-card {
		animation: none !important;
	}

	.auth-page .auth-social-button,
	.auth-page .auth-social-button:hover,
	.auth-page .auth-social-button:active {
		transition: none;
		transform: none;
	}
}

/* LINKS + FOOTER ROWS */

.auth-row {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-webkit-flex-wrap: wrap;
	-ms-flex-wrap: wrap;
	flex-wrap: wrap;
	gap: 0.375rem;
	font-size: 0.8125rem;
	letter-spacing: 0.4px;
	color: var(--muted-foreground);
}

.auth-row.between {
	-webkit-box-pack: justify;
	-ms-flex-pack: justify;
	justify-content: space-between;
}

.auth-link {
	color: var(--primary);
	display: -webkit-inline-box;
	display: -ms-inline-flexbox;
	display: inline-flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	gap: 0.3rem;
}

.auth-link:hover { text-decoration: underline; }

.auth-divider {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	gap: 0.75rem;
	margin: 1.25rem 0;
	font-size: 0.6875rem;
	letter-spacing: 1px;
	color: var(--muted-foreground);
	text-transform: uppercase;
}

.auth-divider:empty {
	margin: 1rem 0;
	height: 1px;
	background: color-mix(in oklab, var(--foreground) 12%, transparent);
}

.auth-divider:empty:before,
.auth-divider:empty:after { content: none; }

.auth-divider:before,
.auth-divider:after {
	content: "";
	-webkit-box-flex: 1;
	-ms-flex: 1;
	flex: 1;
	height: 1px;
	background: color-mix(in oklab, var(--foreground) 12%, transparent);
}

/* SOCIAL - official provider marks, kept as the shipped image assets */

/* icon-only providers, laid out in one centred row at every width */
.auth-social {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: horizontal;
	-webkit-box-direction: normal;
	-ms-flex-direction: row;
	flex-direction: row;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-flex-wrap: wrap;
	-ms-flex-wrap: wrap;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* visually hidden but still read out - the buttons show only a logo */
.auth-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.auth-page .auth-social-button {
	position: relative;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	width: 3.25rem;
	height: 3.25rem;
	padding: 0;
	border-radius: 0.875rem;
	background-color: color-mix(in oklab, var(--background) 55%, transparent);
	border: 1px solid color-mix(in oklab, var(--foreground) 12%, transparent);
	color: var(--foreground);
	transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.auth-page .auth-social-button:hover {
	background-color: color-mix(in oklab, var(--accent) 55%, transparent);
	border-color: color-mix(in oklab, var(--primary) 45%, transparent);
	transform: translateY(-2px);
}

.auth-page .auth-social-button:active { transform: translateY(0); }

.auth-social-mark {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-ms-flex-negative: 0;
	flex-shrink: 0;
	background: var(--color-white);
}

.auth-social-mark img {
	width: 18px;
	height: 18px;
	object-fit: contain;
}

.auth-social-mark.steam { background: var(--color-steam); }
.auth-social-mark.discord { background: var(--color-discord); }

.auth-page .auth-social-button[aria-disabled="true"] {
	opacity: 0.45;
	pointer-events: none;
}

/* NOTES + STATUS */

.auth-note {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem;
	border-radius: 0.625rem;
	font-size: 0.75rem;
	line-height: 1.5;
	letter-spacing: 0.3px;
	background: color-mix(in oklab, var(--foreground) 6%, transparent);
	border: 1px solid color-mix(in oklab, var(--foreground) 10%, transparent);
	color: var(--muted-foreground);
}

.auth-note .auth-icon { -ms-flex-negative: 0; flex-shrink: 0; margin-top: 1px; }

.auth-note.success {
	background: var(--color-success-10);
	border-color: var(--color-success-50);
	color: var(--color-success);
}

.auth-note.warning {
	background: var(--color-warning-10);
	border-color: var(--color-warning-50);
	color: var(--color-warning);
}

.auth-note.info {
	background: var(--color-info-10);
	border-color: var(--color-info-50);
	color: var(--color-info);
}

/* status icon shown above a title on outcome pages */
.auth-status-icon {
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	background: color-mix(in oklab, var(--primary) 14%, transparent);
	color: var(--primary);
}

.auth-status-icon.success { background: var(--color-success-10); color: var(--color-success); }
.auth-status-icon.warning { background: var(--color-warning-10); color: var(--color-warning); }

/* METHOD LIST (2FA chooser) */

.auth-page .auth-method {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding: 0.875rem;
	border-radius: 0.625rem;
	background: color-mix(in oklab, var(--background) 55%, transparent);
	border: 1px solid color-mix(in oklab, var(--foreground) 12%, transparent);
	color: var(--foreground);
	text-align: left;
	transition: background-color 160ms ease, border-color 160ms ease;
}

.auth-page .auth-method:hover {
	background: color-mix(in oklab, var(--accent) 55%, transparent);
	border-color: color-mix(in oklab, var(--primary) 40%, transparent);
}

.auth-method-icon {
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 0.5rem;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-ms-flex-negative: 0;
	flex-shrink: 0;
	background: color-mix(in oklab, var(--primary) 12%, transparent);
	color: var(--primary);
}

.auth-method-body { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; min-width: 0; }

.auth-method-title {
	display: block;
	font-size: 0.875rem;
	letter-spacing: 0.4px;
	margin-bottom: 0.25rem;
}

.auth-method-hint {
	display: block;
	font-size: 0.6875rem;
	line-height: 1.4;
	color: var(--muted-foreground);
	letter-spacing: 0.3px;
}

.auth-method-chevron { color: var(--muted-foreground); -ms-flex-negative: 0; flex-shrink: 0; }

/* one-time code inputs read better with wide tracking */
.auth-field .field_element_input.auth-code {
	letter-spacing: 3px;
	font-size: 1rem;
}

/* skip link */
.auth-skip {
	position: absolute;
	left: -9999px;
	top: 0;
}

.auth-skip:focus {
	left: 0.5rem;
	top: 0.5rem;
	z-index: 10;
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	background: var(--card);
	color: var(--foreground);
}

/* COMPACT RHYTHM
   Opted into by a view wrapping its content in .auth-compact. Signup carries
   five fields and overflowed the viewport on a 360x740 phone, so the vertical
   spacing tightens rather than the form being split up. Selected with :has()
   so the view keeps control without the layout needing a flag. */

.auth-page:has(.auth-compact) .auth-shell {
	padding-top: 1.25rem;
	padding-bottom: 1.5rem;
	gap: 0.875rem;
}

.auth-page:has(.auth-compact) .auth-brand img {
	width: 150px;
}

.auth-card:has(.auth-compact) {
	padding: 1.125rem;
}

.auth-compact .auth-card-header {
	gap: 0.3125rem;
	margin-bottom: 0.875rem;
}

.auth-compact .auth-form {
	gap: 0.5rem;
}

.auth-compact .auth-field {
	gap: 0.25rem;
}

.auth-compact .auth-label {
	font-size: 0.6875rem;
	letter-spacing: 0.5px;
}

.auth-compact .auth-field .field_container {
	min-height: 2.5rem;
}

.auth-compact .auth-field .field_element_input {
	padding: 0.5625rem 0.5rem !important;
}

.auth-compact .auth-divider {
	margin: 0.875rem 0;
}

.auth-compact .auth-divider:empty {
	margin: 0.75rem 0;
}

.auth-compact .auth-page .auth-submit,
.auth-page .auth-compact .auth-submit {
	min-height: 2.625rem;
	margin-top: 0.125rem;
}

@media (max-width: 480px) {
	.auth-card:has(.auth-compact) {
		padding: 1rem 0.875rem;
	}

	.auth-page:has(.auth-compact) .auth-brand img {
		width: 128px;
	}

	.auth-page:has(.auth-compact) .auth-shell {
		padding-top: 1rem;
		padding-bottom: 1.25rem;
		gap: 0.75rem;
	}

	.auth-compact .auth-divider {
		margin: 0.625rem 0;
	}

	/* still a 48px touch target */
	.auth-compact .auth-social { gap: 0.625rem; }

	.auth-page .auth-compact .auth-social-button {
		width: 3rem;
		height: 3rem;
	}
}

/* END COMPACT RHYTHM */

/* END AUTH PAGES */

/* Keep the validation message outside the visible input surface. The shared
   validator still finds errors inside .input_field, so its hooks stay intact. */
.auth-page .auth-field .input_field,
.auth-page .auth-field .input_field:focus-within,
.auth-page .auth-field .input_field:has(.field_error.active) {
	border: 0 !important;
	background: transparent;
	box-shadow: none;
	overflow: visible;
}
.auth-page .auth-field .field_container {
	border: 1px solid color-mix(in oklab, var(--foreground) 12%, transparent);
	border-radius: 0.625rem;
	background: color-mix(in oklab, var(--background) 60%, transparent);
}
.auth-page .auth-field .input_field:focus-within .field_container {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 15%, transparent);
}
.auth-page .auth-field .input_field:has(.field_error.active:not([data-error="default"])) .field_container {
	border-color: var(--color-danger);
}
.auth-page .auth-field .field_bottom {
	position: static;
	margin: 0.25rem 0 0;
	padding: 0 0.125rem;
}


