/* ==========================================================================
   WPInterface — sign-in dialog + Login/Register page panels
   Loaded non-blocking for the modal (inc/modules/ui-auth.php) and enqueued
   by the wpi/auth block on the Login/Register pages.
   ========================================================================== */

.wpi-auth,
.wpi-auth-page {
	--a-paper: #F7F7FB;
	--a-err: #B42318;
	--a-err-bg: #FFF1F1;
	--a-ok: #067647;
	--a-ok-bg: #ECFDF3;
	--a-spring: cubic-bezier(.34, 1.56, .64, 1);
	color: var(--ink);
	font-family: var(--wp--preset--font-family--montreal);
}

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

/* ---------- Dialog shell ---------- */
.wpi-auth {
	width: min(940px, calc(100% - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 28px;
	background: transparent;
	overflow: visible;
}

.wpi-auth::backdrop {
	background: rgba(8, 8, 14, .55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity .3s var(--ease);
}

.wpi-auth.is-open::backdrop { opacity: 1; }
.wpi-auth.is-closing::backdrop { opacity: 0; }

.wpi-auth__panel {
	display: grid;
	grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
	border-radius: 28px;
	background: var(--white);
	box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(11, 11, 18, .06);
	overflow: hidden;
}

.wpi-auth .wpi-auth__panel {
	max-height: calc(100dvh - 2rem);
	opacity: 0;
	transform: translateY(24px) scale(.97);
	transition: opacity .3s var(--ease), transform .5s var(--ease);
}

.wpi-auth.is-open .wpi-auth__panel {
	opacity: 1;
	transform: none;
}

.wpi-auth.is-closing .wpi-auth__panel {
	opacity: 0;
	transform: translateY(12px) scale(.98);
	transition-duration: .22s;
}

/* ---------- Art side ---------- */
.wpi-auth__art {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 1.25rem;
	padding: 2.5rem;
	background: var(--ink) radial-gradient(90% 70% at 30% 20%, rgba(76, 91, 255, .45), transparent 65%);
	color: #fff;
	overflow: hidden;
	isolation: isolate;
}

.wpi-auth__art::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .12) 1px, transparent 0);
	background-size: 22px 22px;
	-webkit-mask-image: radial-gradient(80% 60% at 40% 30%, #000, transparent);
	mask-image: radial-gradient(80% 60% at 40% 30%, #000, transparent);
}

.wpi-auth__orbit {
	position: relative;
	display: grid;
	place-items: center;
	width: 100%;
	max-width: 320px;
	aspect-ratio: 1;
	margin: auto;
}

.wpi-auth__rings {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	stroke: rgba(255, 255, 255, .12);
	stroke-width: 1;
	stroke-dasharray: 2 6;
	animation: wpi-auth-spin 60s linear infinite;
}

.wpi-auth-mark { display: block; overflow: visible; color: #fff; }
.wpi-auth-mark__a,
.wpi-auth-mark__b { transform-box: view-box; }

.wpi-auth__mark {
	position: relative;
	width: 150px;
	height: auto;
	filter: drop-shadow(0 10px 30px rgba(76, 91, 255, .55));
}

/* The two circles drift apart and click back together as the dialog opens. */

.wpi-auth__node {
	position: absolute;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border: 1px solid rgba(255, 255, 255, .14);
	border-radius: 12px;
	background: rgba(255, 255, 255, .06);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--lav);
	animation: wpi-auth-float 6s ease-in-out infinite;
}

.wpi-auth__node--1 { top: 12%; left: 14%; }
.wpi-auth__node--2 { top: 22%; right: 6%; animation-delay: -2s; }
.wpi-auth__node--3 { bottom: 14%; left: 30%; animation-delay: -4s; }

@keyframes wpi-auth-float { 50% { transform: translateY(-10px); } }
@keyframes wpi-auth-spin { to { transform: rotate(360deg); } }

.wpi-auth__art-title {
	margin: 0;
	font-size: 1.6rem;
	font-weight: 400;
	line-height: 1.1;
	color: #fff;
}

.wpi-auth__perks {
	display: grid;
	gap: .55rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 14px;
	color: rgba(255, 255, 255, .78);
}

.wpi-auth__perks li { display: flex; align-items: center; gap: .6rem; }
.wpi-auth__perks svg { flex: none; color: var(--lav); }

/* ---------- Form side ---------- */
.wpi-auth__main {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 2.25rem clamp(1.5rem, 4vw, 3rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--white);
}

.wpi-auth__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--white);
	color: var(--ink);
	cursor: pointer;
	transition: transform .4s var(--ease), background-color .2s, border-color .2s, color .2s;
}

.wpi-auth__close:hover,
.wpi-auth__close:focus-visible {
	background: var(--ink);
	border-color: var(--ink);
	color: #fff;
	transform: rotate(90deg);
}

.wpi-auth__home { align-self: flex-start; display: block; line-height: 0; color: var(--ink); }

.wpi-auth__logo {
	display: block;
	align-self: flex-start;
	width: 112px;
	height: auto;
	margin-bottom: 2rem;
	color: var(--ink);
}

.wpi-auth__views {
	position: relative;
	margin: -4px -24px -32px;
	padding: 4px 24px 32px;
	overflow: hidden;
}

.wpi-auth__view.is-entering { animation: wpi-auth-view-in .5s var(--ease) both; }

@keyframes wpi-auth-view-in {
	from { opacity: 0; transform: translateX(18px); }
	to { opacity: 1; transform: none; }
}

.wpi-auth__title {
	margin: 0 0 .85rem;
	font-size: clamp(1.75rem, 3vw, 2.25rem);
	font-weight: 400;
	line-height: 1.05;
	color: var(--ink);
}

.wpi-auth__lead {
	margin: 0 0 1.5rem;
	font-size: 15px;
	line-height: 1.5;
	color: var(--muted);
}

.wpi-auth__form { display: grid; gap: 1rem; }

.wpi-auth__alert {
	padding: .8rem 1rem;
	border-radius: 12px;
	background: var(--a-err-bg);
	color: var(--a-err);
	font-size: 14px;
	line-height: 1.45;
}

.wpi-auth__alert.is-success { background: var(--a-ok-bg); color: var(--a-ok); }
.wpi-auth__alert[hidden] { display: none; }

.wpi-auth__field { display: grid; gap: .4rem; }

.wpi-auth__field > label:not(.wpi-auth__check) {
	font-size: 13.5px;
	font-weight: 500;
	color: var(--ink);
}

.wpi-auth__opt { font-weight: 400; color: var(--muted); }

.wpi-auth__field input[type="text"],
.wpi-auth__field input[type="email"],
.wpi-auth__field input[type="password"],
.wpi-auth-page__form input[type="text"],
.wpi-auth-page__form input[type="email"],
.wpi-auth-page__form input[type="password"] {
	width: 100%;
	min-height: 50px;
	padding: .75rem 1rem;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--a-paper);
	color: var(--ink);
	font: 400 15px/1.3 var(--wp--preset--font-family--montreal);
	box-shadow: none;
	transition: border-color .2s, background-color .2s, box-shadow .25s var(--ease);
}

.wpi-auth__field input:hover,
.wpi-auth-page__form input:hover { border-color: rgba(11, 11, 18, .22); }

.wpi-auth__field input:not([type="checkbox"]):focus,
.wpi-auth-page__form input:not([type="checkbox"]):not([type="submit"]):focus {
	outline: none;
	border-color: var(--indigo);
	background: var(--white);
	box-shadow: 0 0 0 4px rgba(76, 91, 255, .16);
}

.wpi-auth__field.is-invalid input:not([type="checkbox"]) {
	border-color: #D92D20;
	box-shadow: 0 0 0 4px rgba(217, 45, 32, .1);
}

.wpi-auth__error { margin: 0; font-size: 13px; color: var(--a-err); }
.wpi-auth__error[hidden] { display: none; }

.wpi-auth__pass { position: relative; }
.wpi-auth__pass input { padding-right: 3.25rem !important; }

.wpi-auth__reveal {
	position: absolute;
	top: 50%;
	right: .5rem;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--muted);
	transform: translateY(-50%);
	cursor: pointer;
	transition: color .2s, background-color .2s;
}

.wpi-auth__reveal:hover,
.wpi-auth__reveal[aria-pressed="true"] { color: var(--indigo); background: var(--lav-2); }
.wpi-auth__reveal .is-hide,
.wpi-auth__reveal[aria-pressed="true"] .is-show { display: none; }
.wpi-auth__reveal[aria-pressed="true"] .is-hide { display: block; }

.wpi-auth__strength {
	display: flex;
	align-items: center;
	gap: .75rem;
	font-size: 12.5px;
	color: var(--muted);
}

.wpi-auth__strength-bar {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	width: 120px;
}

.wpi-auth__strength-bar i {
	height: 4px;
	border-radius: 4px;
	background: var(--line);
	transition: background-color .3s;
}

.wpi-auth__strength[data-score="1"] i:nth-child(-n+1) { background: #F04438; }
.wpi-auth__strength[data-score="2"] i:nth-child(-n+2) { background: #F79009; }
.wpi-auth__strength[data-score="3"] i:nth-child(-n+3) { background: var(--indigo); }
.wpi-auth__strength[data-score="4"] i { background: #12B76A; }

.wpi-auth__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .5rem 1rem;
	font-size: 14px;
}

.wpi-auth__row a,
.wpi-auth__switch a,
.wpi-auth__check a,
.wpi-auth-page__form a {
	color: var(--indigo-2);
	font-weight: 500;
	text-decoration: none;
}

.wpi-auth__row a:hover,
.wpi-auth__switch a:hover,
.wpi-auth__check a:hover,
.wpi-auth-page__form a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wpi-auth__check {
	display: inline-flex;
	align-items: flex-start;
	gap: .55rem;
	font-size: 14px;
	font-weight: 400;
	color: var(--ink);
	cursor: pointer;
}

.wpi-auth__check input,
.wpi-auth-page__form input[type="checkbox"] {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: var(--indigo);
}

/* Big indigo button */
.wpi-auth__submit,
.wpi-auth-page__form :is(input[type="submit"], .edd-submit) {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 54px;
	margin-top: .35rem;
	padding: 1rem 1.7rem;
	border: 0;
	border-radius: 999px;
	background: radial-gradient(120% 120% at 50% 120%, rgba(169, 177, 255, .6), transparent 55%), var(--indigo) !important;
	box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 30px -12px rgba(76, 91, 255, .8);
	color: #fff !important;
	font: 500 1rem/1.1 var(--wp--preset--font-family--montreal);
	text-decoration: none;
	cursor: pointer;
	overflow: hidden;
	transition: background-color .35s var(--ease), box-shadow .35s var(--ease), transform .35s var(--ease);
}

.wpi-auth__submit:hover,
.wpi-auth-page__form :is(input[type="submit"], .edd-submit):hover {
	background: radial-gradient(120% 120% at 50% 120%, rgba(169, 177, 255, .6), transparent 55%), var(--indigo-2) !important;
	box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 16px 40px -12px rgba(76, 91, 255, .9);
	transform: translateY(-1px);
}

.wpi-auth__submit:focus-visible,
.wpi-auth-page__form :is(input[type="submit"], .edd-submit):focus-visible { outline: 0; box-shadow: var(--focus); }
.wpi-auth__submit:disabled { cursor: progress; transform: none; }

.wpi-auth__submit-label { transition: opacity .2s; }

.wpi-auth__dots {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.wpi-auth__dots i {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	animation: wpi-auth-dot 1s ease-in-out infinite;
}

.wpi-auth__dots i:nth-child(2) { background: var(--lav); animation-delay: .15s; }
.wpi-auth__dots i:nth-child(3) { animation-delay: .3s; }

@keyframes wpi-auth-dot {
	0%, 100% { transform: translateY(0); opacity: .55; }
	50% { transform: translateY(-5px); opacity: 1; }
}

.is-busy .wpi-auth__dots { display: inline-flex; }
.is-busy .wpi-auth__submit-label { opacity: 0; }

.wpi-auth__switch {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: .35rem;
	margin: 1.5rem 0 0;
	font-size: 14px;
	color: var(--muted);
}

.wpi-auth__switch a { display: inline-flex; align-items: center; gap: .35rem; }
.wpi-auth__switch[hidden] { display: none; }

:is(.wpi-auth, .wpi-auth-page) a:focus-visible,
:is(.wpi-auth, .wpi-auth-page) input[type="checkbox"]:focus-visible,
.wpi-auth__reveal:focus-visible {
	outline: 2px solid var(--indigo);
	outline-offset: 2px;
	border-radius: 6px;
}

/* ---------- Success ---------- */
.wpi-auth__view--done {
	display: grid;
	justify-items: center;
	padding: 2rem 0 1rem;
	text-align: center;
	outline: none;
}

.wpi-auth__view--done[hidden] { display: none; }

.wpi-auth__done-mark {
	position: relative;
	display: grid;
	place-items: center;
	width: 120px;
	height: 120px;
	margin-bottom: 1.5rem;
	border-radius: 50%;
	background: var(--lav-2);
}

.wpi-auth__done-mark .wpi-auth-mark { opacity: 0; color: var(--ink); }

.wpi-auth__tick {
	position: absolute;
	width: 52px;
	height: 52px;
	stroke: var(--indigo);
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 24;
	stroke-dashoffset: 24;
}

.wpi-auth.is-done .wpi-auth__done-mark { animation: wpi-auth-pop .7s var(--a-spring) both; }
.wpi-auth.is-done .wpi-auth__tick { animation: wpi-auth-draw .6s .25s var(--ease) forwards; }

@keyframes wpi-auth-pop { from { transform: scale(.6); opacity: 0; } }
@keyframes wpi-auth-draw { to { stroke-dashoffset: 0; } }

/* ---------- Full-page Login / Register panel (EDD forms) ---------- */
.wpi-auth-inline { display: grid; place-items: center; }

.wpi-auth-page { width: min(940px, 100%); margin-inline: auto; }

.wpi-auth-page .wpi-auth__panel { box-shadow: 0 40px 100px -40px rgba(36, 44, 140, .45), 0 0 0 1px rgba(11, 11, 18, .06); }
.wpi-auth-page .wpi-auth__main { overflow: visible; padding-block: 2.5rem; }
.wpi-auth-page .wpi-auth__logo { margin-bottom: 2rem; }
.wpi-auth-page.is-signed-in .wpi-auth__submit { margin-top: .5rem; }

.wpi-auth-page__form fieldset {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.wpi-auth-page__form legend {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.wpi-auth-page__form fieldset > p { flex: 1 1 100%; display: grid; gap: .4rem; margin: 0; }
.wpi-auth-page__form fieldset > input[type="hidden"] { display: none; }

.wpi-auth-page__form label {
	margin: 0;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--ink);
}

.wpi-auth-page__form .edd-login-remember { flex: 1 1 auto; order: 5; }
.wpi-auth-page__form .edd-login-remember label { display: inline-flex; align-items: center; gap: .55rem; font-size: 14px; font-weight: 400; cursor: pointer; }
.wpi-auth-page__form .edd-login-remember input { margin: 0; }
.wpi-auth-page__form .edd-lost-password { flex: 0 0 auto; order: 6; font-size: 14px; }
.wpi-auth-page__form .edd-login-submit { order: 7; }
.wpi-auth-page__form .edd-login-submit ~ p:not(.edd-lost-password) { order: 8; }
.wpi-auth-page__form .edd-lost-password a { text-decoration: none; }

.wpi-auth-page__form .edd-alert { flex: 1 1 100%; margin: 0 0 .25rem; padding: .8rem 1rem; border: 0; border-radius: 12px; font-size: 14px; }
.wpi-auth-page__form .edd-alert-error { background: var(--a-err-bg); color: var(--a-err); }
.wpi-auth-page__form .edd-alert-success { background: var(--a-ok-bg); color: var(--a-ok); }

/* ---------- Mobile: single column, bottom sheet ---------- */
@media (max-width: 760px) {
	.wpi-auth {
		width: 100%;
		max-height: 100dvh;
		margin: auto 0 0;
		border-radius: 24px 24px 0 0;
	}

	.wpi-auth__panel { grid-template-columns: 1fr; }

	.wpi-auth .wpi-auth__panel {
		max-height: 94dvh;
		border-radius: 24px 24px 0 0;
		transform: translateY(100%);
	}

	.wpi-auth.is-closing .wpi-auth__panel { transform: translateY(100%); }

	.wpi-auth .wpi-auth__art { display: none; }

	.wpi-auth__main { padding: 1.75rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom)); }

	.wpi-auth .wpi-auth__main::before {
		content: "";
		flex: none;
		width: 40px;
		height: 4px;
		margin: -.75rem auto 1.25rem;
		border-radius: 4px;
		background: var(--line);
	}

	.wpi-auth__close { top: .75rem; right: .75rem; }

	/* Pages keep a compact art header above the form. */
	.wpi-auth-page .wpi-auth__art { padding: 1.75rem 1.5rem; gap: .75rem; }
	.wpi-auth-page .wpi-auth__orbit { max-width: 180px; }
	.wpi-auth-page .wpi-auth__mark { width: 96px; }
	.wpi-auth-page .wpi-auth__perks { display: none; }
	.wpi-auth-page .wpi-auth__art-title { font-size: 1.3rem; text-align: center; }
	.wpi-auth-page .wpi-auth__main { padding: 1.75rem 1.25rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
	.wpi-auth *,
	.wpi-auth::backdrop,
	.wpi-auth-page * {
		animation: none !important;
		transition: none !important;
	}

	.wpi-auth__tick { stroke-dashoffset: 0; }
	.wpi-auth__done-mark .wpi-auth-mark { opacity: 0; }
}
