/**
 * LiquidBook threshold — the login page, dressed as the door.
 *
 * Styles AROUND WordPress's native login markup (#login, #loginform,
 * #user_login, #user_pass, #wp-submit, #login_error, #nav). Never replaces the
 * form; auth stays native. Loaded ONLY on wp-login via login_enqueue_scripts,
 * after WordPress's own login styles, and overrides them.
 *
 * COMPOSITION (rev-3 geometry correction): ONE centred vertical column, the
 * sphere as the anchor at the TOP of the column in every state —
 *   sphere stage  ->  (gap)  ->  Hermes's line  ->  (gap)  ->  ONE element
 * The element is the door (greeting) or the native card (sign-in). Nothing sits
 * beside or on top of the sphere. The sphere is a CONTAINED, cell-sized stage —
 * NOT a full-bleed background — and its diameter is cell-derived in sphere.js
 * (0.68 x R(mode) x cell); this CSS only sizes the cell and lets it transition.
 *
 * DARK-ROOM PALETTE — PROVISIONAL LOCAL EXTENSION (dark-surface token set still
 * owed to the CD). Anchored to tokens where they exist: accent = the LOCKED teal
 * (#2D7D78) rendered emissive as #4FA6A3 on near-black (one hue); voice =
 * color-text-inverse (#F5F2ED); shadows warm near-black, never cool/pure. NO
 * WEBFONT — token stacks verbatim; Georgia carries the serif.
 */

/* ---- Source Serif 4 — self-hosted, login-only ------------------------ *
 * The token serif, self-hosted (NO external CDN — the privacy/no-external-
 * emission rule only ever barred CDN fetches; a woff2 from our own wp-content
 * fetches nothing external). 36pt optical size (the display cut, right for the
 * large voice line), weight 400, roman + italic. Georgia remains the swap
 * fallback via --lb-serif. Licensed SIL OFL 1.1 — see fonts/OFL.txt. The
 * browser only downloads a face when rendered text actually uses it, so italic
 * stays unfetched until italic copy appears. */
@font-face {
	font-family: "Source Serif 4";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("fonts/source-serif-4-36pt-regular.woff2") format("woff2");
}
@font-face {
	font-family: "Source Serif 4";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("fonts/source-serif-4-36pt-italic.woff2") format("woff2");
}

:root {
	--lb-ground:      #080b0b;
	--lb-ground-2:    #0c1110;

	--lb-teal:        #4fa6a3; /* emissive dark-room rendering of locked #2D7D78 */
	--lb-teal-lift:   #5cb6b3;
	--lb-teal-deep:   #2d7d78;

	--lb-voice:       #f5f2ed; /* token color-text-inverse */
	--lb-voice-dim:   #9fb2ad;
	--lb-micro:       #5f736f;

	--lb-error:       #e1917e; /* emissive dark rendering of token color-error */

	--lb-serif: "Source Serif 4", Georgia, Cambria, serif;
	--lb-sans:  "Inter", system-ui, -apple-system, sans-serif;

	--lb-radius-input: 8px;  /* token radius-md */
	--lb-radius-card:  12px; /* token radius-lg */

	/* Stage cell caps (desktop). The sign-in cell shrinks; the column gaps and
	   the line band collapse with it so the card rides close under the prompt. */
	--lb-cell:  min(360px, 74vw);
	--lb-gap:   34px;
	--lb-band:  2.84em; /* reserves a two-line cold greeting so the door won't jump */
}

/* ---- the room -------------------------------------------------------- */

body.login {
	min-height: 100vh;
	margin: 0;
	background:
		radial-gradient(120% 90% at 50% 46%, rgba(79,166,163,0.06), transparent 60%),
		var(--lb-ground);
	color: var(--lb-voice);
	font-family: var(--lb-serif);
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-font-smoothing: antialiased;
}

/* The single centred column. */
#login {
	position: relative;
	z-index: 1;
	width: min(360px, 92vw);
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--lb-gap);
	transition: gap 0.6s cubic-bezier(0.4,0,0.2,1);
	text-align: center;
}

/* The wordmark: the sphere is the identity, so the native h1 is kept for
   assistive tech only (sr-only), not shown. */
.login h1 {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---- the stage: a contained, cell-sized sphere ----------------------- */

#lb-stage {
	position: relative;
	width: var(--lb-cell);
	height: var(--lb-cell);
	flex: 0 0 auto;
	display: block;
	transition: width 0.6s cubic-bezier(0.4,0,0.2,1), height 0.6s cubic-bezier(0.4,0,0.2,1);
}
#lb-stage[role="button"] {
	cursor: pointer;
}
#lb-stage:focus-visible {
	outline: 2px solid var(--lb-teal);
	outline-offset: 6px;
	border-radius: 50%;
}
#lb-sphere {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	z-index: 1;
}

/* Halo — a feathered radial glow tied to the sphere (bright behind it, fading
   ~30% beyond the cell). Opacity/scale are driven by sphere.js per state.
   Never a hard ring. */
#lb-halo {
	position: absolute;
	inset: -30%;
	border-radius: 50%;
	background: radial-gradient(circle at 50% 50%, rgba(79,166,163,0.34), transparent 62%);
	filter: blur(8px);
	opacity: 0.28;
	z-index: 0;
	pointer-events: none;
}

/* Knock-ripple — ONLY at arrival, from the sphere centre; gone the instant the
   knock lands. Diameter ~44% -> ~94% of the cell (scale 1 -> 2.15). */
#lb-ripple {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 44%;
	height: 44%;
	margin: -22% 0 0 -22%;
	z-index: 2;
	pointer-events: none;
	display: none;
}
#lb-ripple span {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1px solid rgba(79,166,163,0.5);
	opacity: 0;
}
body.lb-armed:not(.lb-knocked) #lb-ripple {
	display: block;
}
body.lb-armed:not(.lb-knocked) #lb-ripple span {
	animation: lb-knock 3.4s ease-out infinite;
}
body.lb-armed:not(.lb-knocked) #lb-ripple span:last-child {
	animation-delay: 1.7s;
}
@keyframes lb-knock {
	0%   { transform: scale(1);    opacity: 0; }
	12%  { opacity: 0.42; }
	100% { transform: scale(2.15); opacity: 0; }
}

/* ---- Hermes's line --------------------------------------------------- */

#lb-voice {
	font-family: var(--lb-serif);
	font-weight: 400;
	font-size: clamp(21px, 3.4vw, 30px);
	line-height: 1.42;
	letter-spacing: -0.01em;
	max-width: 22ch;
	min-height: var(--lb-band);
	margin: 0;
	color: var(--lb-voice);
	text-shadow: 0 2px 16px rgba(0,0,0,0.65);
	transition: min-height 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ---- the reveal door (greeting state only) --------------------------- */

#lb-signin {
	display: none;
	width: min(300px, 78vw);
	height: 47px;
	font-family: var(--lb-sans);
	font-size: 15px;
	font-weight: 500;
	color: #06100f;
	background: var(--lb-teal);
	border: 1px solid transparent;
	border-radius: var(--lb-radius-card);
	cursor: pointer;
	transition: background-color 120ms cubic-bezier(0.4,0,0.2,1);
}
#lb-signin:hover {
	background: var(--lb-teal-lift);
}
#lb-signin:focus-visible {
	outline: 2px solid var(--lb-teal);
	outline-offset: 2px;
}
/* Shown only once the knock has landed and before the card opens. */
body.lb-armed.lb-knocked:not(.lb-signing) #lb-signin {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ---- the native form, restyled as the card -------------------------- */

.login form#loginform {
	box-sizing: border-box; /* so width is the true outer card width (WP defaults to content-box) */
	width: min(340px, 84vw);
	background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
	border: 1px solid rgba(79,166,163,0.18);
	border-radius: 16px; /* card = radius-xl feel; hairline teal edge above */
	box-shadow: 0 24px 64px -34px rgba(0,0,0,0.85), 0 0 46px -22px rgba(79,166,163,0.28);
	padding: 26px 24px 22px;
	margin: 0;
	overflow: hidden;
}

/* Armed but not yet in the card state → the form is held out of the room. It
   NEVER leaves the DOM; opacity/visibility only, driven by the JS-added class.
   With JS off, `lb-armed` is never added and the form is fully present. */
body.lb-armed #loginform,
body.lb-armed #nav {
	position: absolute;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	pointer-events: none;
}
body.lb-armed.lb-signing #loginform,
body.lb-armed.lb-signing #nav {
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
	transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ---- sign-in geometry: the cell shrinks, the gaps + band collapse ----- */

body.lb-signing {
	--lb-cell: min(252px, 56vw);
	--lb-gap:  16px;
	--lb-band: 1.42em;
}

.login form#loginform label {
	font-family: var(--lb-sans);
	font-size: 10.5px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--lb-micro);
}

.login input[type="text"],
.login input[type="password"],
.login input[type="email"],
.login input.input,
.login .wp-pwd input[type="text"] {
	background: rgba(0,0,0,0.25);
	border: 1px solid rgba(159,178,173,0.16);
	border-radius: var(--lb-radius-input);
	color: var(--lb-voice);
	font-family: var(--lb-sans);
	font-size: 15px;
	padding: 12px 13px;
	box-shadow: none;
	transition: border-color 120ms ease, box-shadow 120ms ease;
}
.login input[type="text"]:focus,
.login input[type="password"]:focus,
.login input[type="email"]:focus,
.login input.input:focus {
	border-color: var(--lb-teal);
	box-shadow: 0 0 0 3px rgba(79,166,163,0.15);
	outline: none;
}
.login input::placeholder {
	color: #4a5a57;
}

.login .wp-pwd {
	position: relative;
}
.login .wp-pwd .button.wp-hide-pw {
	background: transparent;
	border: 0;
	color: var(--lb-micro);
	box-shadow: none;
}
.login .wp-pwd .button.wp-hide-pw:hover {
	color: var(--lb-voice-dim);
}
.login .wp-pwd .button.wp-hide-pw .dashicons {
	top: 0;
}

.login .forgetmenot label {
	font-size: 12px;
	letter-spacing: 0.04em;
	text-transform: none;
	color: var(--lb-voice-dim);
}

.login .button-primary,
.login #wp-submit {
	background: var(--lb-teal) !important;
	border: 1px solid transparent !important;
	border-radius: var(--lb-radius-input) !important;
	color: #06100f !important;
	font-family: var(--lb-sans);
	font-size: 15px;
	font-weight: 500;
	text-shadow: none !important;
	box-shadow: none !important;
	padding: 6px 22px;
	transition: background-color 120ms cubic-bezier(0.4,0,0.2,1);
}
.login .button-primary:hover,
.login #wp-submit:hover {
	background: var(--lb-teal-lift) !important;
}
.login .button-primary:focus,
.login #wp-submit:focus {
	outline: 2px solid var(--lb-teal);
	outline-offset: 2px;
}

/* ---- messages -------------------------------------------------------- */

/* A real auth error (State C) — warm brick, never cool/pure. */
.login #login_error {
	width: min(340px, 84vw);
	margin: 0 auto;
	background: rgba(184,60,43,0.10);
	border: 1px solid rgba(225,145,126,0.35);
	border-left: 3px solid var(--lb-error);
	border-radius: 8px;
	color: var(--lb-error);
	font-family: var(--lb-sans);
	font-size: 13px;
	box-shadow: none;
}
.login #login_error a {
	color: var(--lb-voice-dim);
}

/* Benign notices ("You are now logged out.") — calm teal, NOT an error. */
.login .message,
.login .notice {
	width: min(340px, 84vw);
	margin: 0 auto;
	background: rgba(79,166,163,0.08);
	border: 1px solid rgba(79,166,163,0.22);
	border-left: 3px solid var(--lb-teal);
	border-radius: 8px;
	color: var(--lb-voice-dim);
	font-family: var(--lb-sans);
	font-size: 13px;
	box-shadow: none;
}
.login .message a,
.login .notice a {
	color: var(--lb-teal);
}

/* ---- footer links ---------------------------------------------------- */

.login #nav {
	text-align: center;
	margin: 0;
	text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.login #nav a,
.login #backtoblog a {
	color: var(--lb-micro);
	font-family: var(--lb-sans);
	font-size: 12px;
}
.login #nav a:hover {
	color: var(--lb-teal);
}
/* The "Go to LiquidBook" link points at the front root, which redirects right
   back to this login. Remove the loop. */
.login #backtoblog {
	display: none;
}

.login .language-switcher {
	display: none;
}

/* ---- reduced motion: a static lit frame; fields reachable ------------ */
@media (prefers-reduced-motion: reduce) {
	#lb-ripple span {
		animation: none !important;
	}
	#lb-stage,
	#login,
	#lb-voice,
	.login #loginform {
		transition: none !important;
	}
}
