/*
	Login page (WCLogin.cfm, assets/js/login.js), on ui.css tokens and components: a brand panel beside the form, which
	becomes a band above it on phones.

	Motion: elements marked data-enter rise into place in order (data-enter="1" first) when the page opens, but not when
	it comes back after a failed login (.is-retry). The airflow lines drift and the halftone ring turns slowly. Everything
	decorative stops for prefers-reduced-motion.
*/

.login-body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	background: white;
	font-family: var(--wc-font);
	font-size: 13px;
	color: var(--wc-text);
}

/* Sprite icons (assets/img/login-icons.svg), sized and colored like text */
.login-icon {
	flex: none;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.site-test-banner .login-icon { font-size: 16px; }

.login-shell {
	flex: 1;
	display: grid;
	grid-template-columns: minmax(400px, 5fr) 7fr;
}

/* ---------- Brand panel ---------- */

.login-brand {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 48px 56px 200px;   /* the airflow lines run along the bottom, under nothing */
	overflow: hidden;
	background-color: var(--wc-brand);
	background-image:
		radial-gradient(110% 70% at 0% 0%, rgba(255, 255, 255, .12), transparent 70%),
		linear-gradient(160deg, transparent 35%, rgba(16, 42, 67, .5));
	color: white;
	-webkit-font-smoothing: antialiased;
}

/* The color logo in white */
.login-logo {
	width: 196px;
	height: auto;
	filter: brightness(0) invert(1);
}

.login-pitch {
	max-width: 500px;
	margin: auto 0;
	padding: 48px 0;
}

.login-pitch-title {
	margin: 0 0 36px;
	font-size: 34px;
	font-weight: 300;
	line-height: 1.2;
	letter-spacing: -.01em;
	text-wrap: balance;
}

.login-apps {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.login-app {
	display: flex;
	align-items: center;
	gap: 14px;
}

.login-app-icon {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 8px;
	background-color: rgba(255, 255, 255, .08);
	font-size: 20px;
}

.login-app-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: rgba(255, 255, 255, .78);
}

.login-app-text strong {
	font-size: 14px;
	font-weight: 600;
	color: white;
}

/* ---------- Brand panel art (decorative) ---------- */

.login-art {
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	animation: login-fade 1.6s ease backwards;
}

/* Halftone ring, after the dots of the logo's swoosh: small dots across the ring, bigger ones along its middle */
.login-halftone,
.login-halftone::after {
	background-image: radial-gradient(circle, white 0 1.1px, transparent 1.6px);
	background-size: 14px 14px;
}

.login-halftone {
	position: absolute;
	top: -34%;
	right: -38%;
	width: 100%;
	aspect-ratio: 1;
	opacity: .2;
	-webkit-mask-image: radial-gradient(closest-side, transparent 46%, black 58%, black 72%, transparent 92%);
	mask-image: radial-gradient(closest-side, transparent 46%, black 58%, black 72%, transparent 92%);
	animation: login-turn 240s linear infinite;
}

.login-halftone::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: radial-gradient(circle, white 0 2.4px, transparent 2.9px);
	-webkit-mask-image: radial-gradient(closest-side, transparent 57%, black 63%, black 67%, transparent 75%);
	mask-image: radial-gradient(closest-side, transparent 57%, black 63%, black 67%, transparent 75%);
}

/* Airflow: two layers of the wave tile drifting at different speeds; each moves one tile width, so the loop is seamless */
.login-airflow {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 240px;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent, black 20%, black 80%, transparent);
	mask-image: linear-gradient(90deg, transparent, black 20%, black 80%, transparent);
}

.login-airflow::before,
.login-airflow::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	background: url("/assets/img/login-airflow.svg") repeat-x;
}

.login-airflow::before {
	width: calc(100% + 600px);
	background-position: 0 0;
	background-size: 600px 240px;
	opacity: .5;
	animation: login-drift 48s linear infinite;
}

.login-airflow::after {
	width: calc(100% + 900px);
	background-position: 0 -60px;
	background-size: 900px 360px;
	opacity: .22;
	animation: login-drift-far 90s linear infinite;
}

/* ---------- Form ---------- */

.login-main {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 48px 32px 24px;
	background: white;
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: 100%;
	max-width: 360px;
	margin: auto 0;
}

.login-head { margin-bottom: 4px; }

.login-title {
	margin: 0;
	font-family: var(--wc-font);
	font-size: 28px;
	font-weight: 400;
	letter-spacing: -.01em;
	color: var(--wc-text);
}

.login-subtitle {
	margin: 6px 0 0;
	font-size: 14px;
	color: var(--wc-muted);
}

.login-notice {
	align-items: flex-start;
	margin: 0;
	line-height: 1.4;
	animation: login-drop .35s cubic-bezier(.2, .8, .2, 1) backwards, login-shake .5s .3s ease-in-out;
}

.login-notice .login-icon {
	margin-top: 1px;
	font-size: 18px;
}

.login-field .wc-label { transition: color .15s ease; }
.login-field:focus-within .wc-label { color: var(--wc-brand); }
.login-field:has(.is-invalid) .wc-label { color: var(--wc-danger); }

.login-control {
	position: relative;
	display: flex;
	align-items: center;
}

/* The icon at the start of the field */
.login-control > .login-icon {
	position: absolute;
	left: 12px;
	font-size: 18px;
	color: var(--wc-muted);
	pointer-events: none;
	transition: color .15s ease;
}

.login-control:focus-within > .login-icon { color: var(--wc-brand); }
.login-control:has(.is-invalid) > .login-icon { color: var(--wc-danger); }

.login-control .wc-input {
	width: 100%;
	height: 42px;
	padding: 0 12px 0 40px;
	font-size: 14px;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.login-control .wc-input:hover:not(:focus):not(.is-invalid) { border-color: var(--wc-muted); }

.login-control .wc-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--wc-brand) 18%, transparent); }
.login-control .wc-input.is-invalid:focus { box-shadow: var(--wc-danger-ring); }

.login-control--reveal .wc-input { padding-right: 46px; }

/* Show password: the eye and the crossed-out eye swap with a quarter turn */
.login-reveal {
	position: absolute;
	right: 5px;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: none;
	font-size: 18px;
	color: var(--wc-muted);
	cursor: pointer;
	transition: color .15s ease, background-color .15s ease;
}

.login-reveal[hidden] { display: none; }

.login-reveal:hover {
	background-color: var(--wc-hover);
	color: var(--wc-brand);
}

.login-reveal:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--wc-brand);
}

.login-reveal .login-icon {
	grid-area: 1 / 1;
	transition: opacity .18s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}

.login-reveal-hide,
.login-reveal[aria-pressed="true"] .login-reveal-show {
	opacity: 0;
	transform: rotate(-90deg) scale(.6);
}

.login-reveal[aria-pressed="true"] .login-reveal-hide {
	opacity: 1;
	transform: none;
}

.login-caps {
	display: flex;
	align-items: center;
	align-self: flex-start;
	gap: 6px;
	margin: 0;
	padding: 3px 10px 3px 8px;
	border-radius: 999px;
	background-color: var(--wc-info-bg);
	font-size: 12px;
	font-weight: 600;
	color: var(--wc-info);
	animation: login-drop .2s cubic-bezier(.2, .8, .2, 1);
}

.login-caps[hidden] { display: none; }
.login-caps .login-icon { font-size: 14px; }

.login-field .wc-field-error:not([hidden]) { animation: login-drop .2s cubic-bezier(.2, .8, .2, 1); }

/* ---------- Log in button ---------- */

.login-submit {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	width: 100%;
	height: 42px;
	margin-top: 4px;
	font-size: 14px;
	transition: background-color .15s ease, box-shadow .2s ease, transform .1s ease;
}

/* ui.css dims the primary button on hover; this one darkens and lifts */
.login-submit:hover:not(:disabled) {
	opacity: 1;
	background-color: color-mix(in srgb, var(--wc-brand), black 18%);
	box-shadow: 0 6px 16px rgba(16, 42, 67, .22);
}

.login-submit:active:not(:disabled) {
	transform: translateY(1px);
	box-shadow: none;
}

.login-submit:focus-visible { box-shadow: 0 0 0 2px white, 0 0 0 4px var(--wc-brand); }

/* The arrow, and the spinner that takes its place while logging in */
.login-submit-mark {
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
}

.login-submit-mark > * { grid-area: 1 / 1; }

.login-submit-arrow {
	font-size: 18px;
	transition: opacity .15s ease, transform .2s ease;
}

.login-submit:hover .login-submit-arrow { transform: translateX(3px); }

.login-spinner {
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, .35);
	border-top-color: white;
	border-radius: 50%;
	opacity: 0;
	transition: opacity .15s ease;
}

.login-submit.is-busy:disabled {
	opacity: 1;
	cursor: progress;
}

.login-submit.is-busy .login-submit-arrow {
	opacity: 0;
	transform: translateX(8px);
}

.login-submit.is-busy .login-spinner {
	opacity: 1;
	animation: login-spin .7s linear infinite;
}

.login-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 16px;
	margin-top: 32px;
	font-size: 12px;
	color: var(--wc-muted);
}

/* ---------- Entrance ---------- */

/* backwards: hidden until its turn, and nothing held afterwards (the button's :active press still works) */
[data-enter] { animation: login-rise .7s cubic-bezier(.16, 1, .3, 1) backwards; }

[data-enter="1"] { animation-delay: .05s; }
[data-enter="2"] { animation-delay: .12s; }
[data-enter="3"] { animation-delay: .19s; }
[data-enter="4"] { animation-delay: .26s; }
[data-enter="5"] { animation-delay: .33s; }
[data-enter="6"] { animation-delay: .4s; }

.is-retry [data-enter],
.is-retry .login-art { animation: none; }

/* ---------- Keyframes ---------- */

@keyframes login-rise {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

@keyframes login-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes login-drop {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: none; }
}

@keyframes login-shake {
	0%, 100% { transform: none; }
	20% { transform: translateX(-6px); }
	40% { transform: translateX(5px); }
	60% { transform: translateX(-3px); }
	80% { transform: translateX(2px); }
}

@keyframes login-spin { to { transform: rotate(360deg); } }
@keyframes login-turn { to { transform: rotate(360deg); } }
@keyframes login-drift { to { transform: translateX(-600px); } }
@keyframes login-drift-far { to { transform: translateX(-900px); } }

@media (prefers-reduced-motion: reduce) {
	[data-enter],
	.login-art,
	.login-halftone,
	.login-airflow::before,
	.login-airflow::after,
	.login-notice,
	.login-caps,
	.login-field .wc-field-error:not([hidden]) { animation: none; }

	.login-submit:hover .login-submit-arrow { transform: none; }
}

/* Short laptop screens: a tighter brand panel, so the page doesn't scroll */
@media (min-width: 901px) and (max-height: 760px) {
	.login-brand { padding: 32px 56px 150px; }
	.login-logo { width: 168px; }
	.login-pitch { padding: 24px 0; }
	.login-pitch-title { margin-bottom: 24px; font-size: 30px; }
	.login-apps { gap: 12px; }
	.login-airflow { height: 180px; }
}

/* ---------- Phones and small tablets: the brand panel becomes a band, the form a sheet over its edge ---------- */

@media (max-width: 900px) {
	.login-shell {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.login-brand {
		align-items: center;
		padding: 28px 16px 52px;
	}

	.login-logo { width: 148px; }
	.login-pitch { display: none; }

	.login-halftone {
		top: -120%;
		right: -30%;
		width: 90%;
	}

	.login-airflow {
		bottom: -40px;
		height: 200px;
	}

	.login-main {
		margin-top: -24px;
		padding: 32px 16px 20px;
		border-radius: 16px 16px 0 0;
	}

	.login-form {
		max-width: 420px;
		margin: 0;
	}

	/* 16px text stops iOS zooming in on a field; taller tap targets */
	.login-control .wc-input,
	.login-submit {
		height: 46px;
		font-size: 16px;
	}

	.login-foot { margin-top: auto; padding-top: 32px; }
}

/* Tall tablets: the form in the middle of the sheet rather than at its top */
@media (max-width: 900px) and (min-height: 1000px) {
	.login-form { margin: auto 0; }
	.login-foot { margin-top: 0; }
}
