/**
 * Ananda styling for every wp-login.php screen.
 *
 * Loaded by functions/login-screens.php on login_enqueue_scripts, for the whole
 * network. Companion file: js/login.js, which does the structural moves CSS
 * cannot (see that file's header).
 *
 * WHY THE SELECTORS LOOK LIKE THIS
 *
 * The form id changes per screen — #loginform, #magicloginform,
 * #lostpasswordform, #resetpassform — so nothing here keys off a form id.
 * Everything hangs off `#login` and the shared control classes, or three of the
 * five screens would silently go unstyled.
 *
 * Likewise the submit button is `button-hero` on the sign-in and magic-link
 * screens but `button-large` on lost-password and reset-password, so the button
 * rules target `.button-primary` and let the size classes fall where they may.
 *
 * RIGHT-TO-LEFT
 *
 * wp-login.php serves the whole network and eleven of its sites run non-English
 * locales, one of them Hebrew — so anything side-specific uses LOGICAL
 * properties (padding-inline-end, inset-inline-end, text-align: start) rather
 * than left/right. Get this wrong and the password reveal button sits on top of
 * the text on the RTL sites. Symmetric values (padding: 0 14px) are fine as they
 * are; only the asymmetric ones matter.
 *
 * WHAT IS DELIBERATELY LEFT ALONE
 *
 * #pass-strength-result keeps core's colours. It is the only element on any of
 * these screens whose colour carries meaning (red weak → green strong); a navy
 * strength meter would tell the member nothing. Only its box is adjusted.
 *
 * @since 2026-Sep-08
 */

/* ---------------------------------------------------------------------------
 * Tokens
 * ------------------------------------------------------------------------- */

body.login {
	--ananda-navy: #2b388f;
	--ananda-navy-hover: #1e2867;
	--ananda-ink: #2c3e50;
	--ananda-muted: #64748b;
	--ananda-border: #c9ccd1;
	--ananda-hairline: #e2e5ea;
	--ananda-danger: #b02a20;
	--ananda-danger-bg: #fdeeed;
	--ananda-danger-ink: #8a2119;
	--ananda-info-bg: #f2f5fa;
	--ananda-radius: 10px;
}

/* ---------------------------------------------------------------------------
 * Page
 * ------------------------------------------------------------------------- */

/* The parent theme sets `background-size: 100% auto`, which scales the sky to the
 * viewport WIDTH: on a tall phone it stops partway down and leaves a white band,
 * and on a wide monitor it crops to a strip. `cover` plus a sky-toned fallback
 * behind it fixes both. The image itself still comes from the parent theme. */
body.login {
	background-color: #7cc0e4;
	background-size: cover;
	background-position: center center;
	background-attachment: fixed;
	font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
	color: var(--ananda-ink);
	-webkit-font-smoothing: antialiased;
}

#login {
	width: 400px;
	max-width: calc(100vw - 32px);
	padding: 6% 0 24px;
	box-sizing: border-box;
}

/* Core sizes the logo box at 84px; the parent theme paints the joy mark into it
 * at its natural 74x73 with an 8px top offset. Keep the parent's image, give it
 * a little more room and centre it properly. */
#login h1 a,
#login .wp-login-logo a {
	width: 88px;
	height: 88px;
	background-size: 88px auto !important;
	background-position: center center !important;
	margin: 0 auto 22px;
}

/* ---------------------------------------------------------------------------
 * The card — every screen
 * ------------------------------------------------------------------------- */

#login form {
	margin-top: 0;
	padding: 30px 28px;
	background: #fff;
	border: 0;
	border-radius: 20px;
	box-shadow: 0 14px 40px rgba(20, 32, 84, 0.18);
	overflow: visible;
}

/* The parent theme sets `#login #loginform { border-radius: 16px }` — two ids,
 * which outranks the single-id rule above no matter which stylesheet loads
 * later. Restate it at matching specificity rather than reaching for
 * !important, so the sign-in card matches the other four. */
#login #loginform {
	border-radius: 20px;
}

#login form p {
	margin-bottom: 0;
}

#login label,
#login form label {
	display: block;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--ananda-ink);
	margin-bottom: 6px;
}

/* ---------------------------------------------------------------------------
 * Fields
 * ------------------------------------------------------------------------- */

/* 16px is deliberate: below that, iOS Safari zooms the page on focus. Core uses
 * 24px here, which is larger than anything else on the page. */
#login input[type="text"],
#login input[type="password"],
#login input[type="email"],
#login .input {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	margin: 0 0 18px;
	padding: 0 14px;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
	color: var(--ananda-ink);
	background: #fff;
	border: 1.5px solid var(--ananda-border);
	border-radius: var(--ananda-radius);
	box-shadow: none;
}

#login input[type="text"]:focus,
#login input[type="password"]:focus,
#login input[type="email"]:focus,
#login .input:focus {
	border-color: var(--ananda-navy);
	box-shadow: 0 0 0 3px rgba(43, 56, 143, 0.18);
	outline: 2px solid transparent; /* keeps a ring in forced-colors mode */
}

/* Password field + reveal toggle. Shared by the sign-in and reset screens. */
#login .wp-pwd {
	position: relative;
	margin-bottom: 18px;
}

#login .wp-pwd input[type="text"],
#login .wp-pwd input[type="password"] {
	padding-inline-end: 52px;
	margin-bottom: 0;
}

#login .wp-pwd .wp-hide-pw {
	position: absolute;
	top: 0;
	inset-inline-end: 0;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ananda-navy);
	box-shadow: none;
}

#login .wp-pwd .wp-hide-pw:hover {
	color: var(--ananda-navy-hover);
}

#login .wp-pwd .wp-hide-pw:focus {
	border-radius: 8px;
	box-shadow: 0 0 0 3px rgba(43, 56, 143, 0.18);
}

/* Remember me */
#login .forgetmenot {
	display: flex;
	align-items: center;
	gap: 10px;
	float: none;
	margin: 0 0 20px;
}

#login .forgetmenot input[type="checkbox"],
#login .pw-weak input[type="checkbox"] {
	width: 20px;
	height: 20px;
	margin: 0;
	border: 1.5px solid var(--ananda-border);
	border-radius: 6px;
}

#login .forgetmenot label,
#login .pw-weak label {
	display: inline;
	margin: 0;
	font-weight: 400;
}

/* ---------------------------------------------------------------------------
 * Buttons
 *
 * One filled primary per screen. The magic-link button becomes an outlined
 * secondary so the ordinary path is unambiguous.
 * ------------------------------------------------------------------------- */

#login .submit,
#login p.submit {
	margin: 0;
}

#login .button-primary,
#login input[type="submit"].button-primary {
	box-sizing: border-box;
	float: none;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 0 20px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	text-shadow: none;
	color: #fff;
	background: var(--ananda-navy);
	border: 1.5px solid var(--ananda-navy);
	border-radius: var(--ananda-radius);
	box-shadow: none;
}

#login .button-primary:hover,
#login .button-primary:focus {
	color: #fff;
	background: var(--ananda-navy-hover);
	border-color: var(--ananda-navy-hover);
}

#login .button-primary:focus {
	box-shadow: 0 0 0 3px rgba(43, 56, 143, 0.28);
}

/* The magic-login plugin hides core's own submit and injects a duplicate.
 * js/login.js removes the duplicate; this brings core's button back. The
 * plugin prints its rule in an inline <style> AFTER our stylesheet, so equal
 * specificity loses — hence the !important. */
body.login #loginform #wp-submit {
	display: inline-block !important;
}

/* Secondary: "Send me a login link". Also covers the plugin's own inline
 * width/float on the magic-link screen's submit, which a plain rule cannot beat. */
#login #magic-login-button,
#login .magic-login-normal-login .button {
	box-sizing: border-box;
	float: none !important;
	width: 100% !important;
	min-height: 50px;
	padding: 0 20px !important;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	text-shadow: none;
	color: var(--ananda-navy);
	background: #fff;
	border: 1.5px solid var(--ananda-navy);
	border-radius: var(--ananda-radius);
	box-shadow: none;
}

#login #magic-login-button:hover,
#login #magic-login-button:focus {
	color: #fff;
	background: var(--ananda-navy);
}

/* The magic-link REQUEST screen's own submit is the primary there, and carries
 * inline float/width that a normal rule cannot override. */
#login #magicloginform input[type="submit"] {
	float: none !important;
	width: 100% !important;
}

/* "or" divider between the two paths.
 *
 * Keeps the plugin's own construction — a full-width rule behind, and the word
 * punched over it on an opaque background — because there are only two
 * pseudo-elements to work with and a flex version cannot draw both halves of
 * the line. Only the colours and type change. */
#login .magic-login-or-separator {
	display: block;
	position: relative;
	width: 100%;
	margin: 16px 0;
	line-height: 1;
	text-align: center;
}

#login .magic-login-or-separator::before {
	content: "or";
	position: relative;
	z-index: 1;
	display: inline-block;
	width: auto;
	padding: 0 12px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #94a3b8;
	background-color: #fff;
}

#login .magic-login-or-separator::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	z-index: 0;
	width: 100%;
	height: 1px;
	background: var(--ananda-hairline);
}

/* Help text under a control, added by js/login.js. */
#login .ananda-help {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--ananda-muted);
}

/* A field's own bottom margin would otherwise fall BETWEEN an input and any help
 * text under it, leaving the hint nearer the next label than the field it
 * describes. js/login.js adds this class whenever it inserts help below a field,
 * so the space lands below the hint instead. Nothing uses it today — the
 * username hint was removed — but the pairing is what makes any future
 * under-field hint sit correctly. */
#login input.ananda-has-help {
	margin-bottom: 0;
}

#login .ananda-help--center {
	text-align: center;
}

/* ---------------------------------------------------------------------------
 * Notices
 *
 * Three markup shapes across the screens, so all three are named here:
 *   p.message                                    (magic_login)
 *   div.notice.notice-info.message               (lostpassword)
 *   div.notice.notice-info.message.reset-pass    (rp)
 * ------------------------------------------------------------------------- */

#login .message,
#login .notice,
#login #login_error {
	box-sizing: border-box;
	margin: 0 0 20px;
	padding: 12px 14px;
	font-size: 13.5px;
	line-height: 1.5;
	background: var(--ananda-info-bg);
	border: 0;
	border-left: 0;
	border-radius: var(--ananda-radius);
	box-shadow: none;
	color: #445566;
}

#login .message p,
#login .notice p {
	margin: 0;
	padding: 0;
	font-size: inherit;
	line-height: inherit;
}

/* Failures read differently from introductions. #login_error is core's; the
 * ananda-link-notice modifiers come from functions/plugins/magic-login.php,
 * which routes expired and already-used links through the plugin's info-message
 * slot — the same p.message element as the neutral intro. */
#login #login_error,
#login .ananda-link-notice.is-expired,
#login .ananda-link-notice.is-used {
	background: var(--ananda-danger-bg);
	color: var(--ananda-danger-ink);
}

/* Signed in as someone else is not a failure — the link simply is not theirs.
 * Amber rather than red: nothing went wrong, but they should notice before
 * requesting a fresh link. */
#login .ananda-link-notice.is-other-account {
	background: #fff8e5;
	color: #6f5100;
}

#login #login_error a,
#login .ananda-link-notice a {
	color: var(--ananda-danger-ink);
	text-decoration: underline;
}

/* js/login.js moves the error inside the card; until it runs (or if it cannot),
 * this keeps a legible box floating over the photo. */
#login #login_error {
	background: var(--ananda-danger-bg);
}

/* Field the error is about. */
#login .ananda-field-error input[type="text"],
#login .ananda-field-error input[type="password"],
#login .ananda-field-error .input {
	border-color: var(--ananda-danger);
	box-shadow: 0 0 0 3px rgba(176, 42, 32, 0.16);
}

/* The pasted-value notice from functions/login-username-normalize.php. That file
 * sets its own inline styles, so these need !important until it is changed to
 * lean on this stylesheet instead. */
#login #ananda-login-username-notice {
	margin: -8px 0 18px !important;
	padding: 11px 13px !important;
	font-family: inherit !important;
	font-size: 12.5px !important;
	line-height: 1.5 !important;
	color: #6f5100 !important;
	background: #fff8e5 !important;
	border: 0 !important;
	border-left: 0 !important;
	border-radius: var(--ananda-radius) !important;
}

/* ---------------------------------------------------------------------------
 * Reset-password screen (action=rp)
 * ------------------------------------------------------------------------- */

/* Core's strength meter. Colours are core's on purpose — see the file header.
 * Only the box changes. */
#login #pass-strength-result {
	box-sizing: border-box;
	width: 100%;
	margin: 10px 0 0;
	padding: 8px 12px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 700;
	text-align: start;
	border-radius: 8px;
}

#login .pw-weak {
	margin: 14px 0 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

#login .user-pass2-wrap {
	margin-top: 18px;
}

#login .indicator-hint {
	margin: 10px 0 0;
	padding: 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--ananda-muted);
}

/* "Generate Password" shares the submit row with "Save Password" in core markup,
 * which gives the screen two competing buttons. js/login.js moves it up onto the
 * password label; this styles it as the quiet action it should be. */
#login .wp-generate-pw {
	min-height: 0;
	padding: 0;
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	color: var(--ananda-navy);
	background: none;
	border: 0;
	box-shadow: none;
	text-decoration: none;
}

#login .wp-generate-pw:hover {
	color: var(--ananda-navy-hover);
	text-decoration: underline;
	background: none;
}

/* Label row that carries a secondary action on the right ("Forgot password?",
 * "Generate one for me"). Built by js/login.js. */
#login .ananda-label-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

#login .ananda-label-row label {
	margin-bottom: 0;
}

#login .ananda-label-row a,
#login .ananda-label-row .wp-generate-pw {
	flex: 0 0 auto;
	font-size: 13px;
	font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * Edwiser SSO container
 *
 * Edwiser prints this list with two empty <li> even when no providers are
 * configured, adding unexplained space between Password and Remember Me. It is
 * NOT dead markup — it is where the Google and Facebook buttons will land — so
 * this collapses it only while it has nothing to show. :empty will not match
 * (the empty <li> are still children), hence the explicit shape.
 * ------------------------------------------------------------------------- */

#login .eb-sso-cont-login-btns {
	margin: 0;
	padding: 0;
	list-style: none;
}

#login .eb-sso-cont-login-btns:not(.has-buttons) {
	display: none;
}

#login .eb-sso-cont-login-btns.has-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0 0 18px;
}

#login .eb-sso-cont-login-btns li {
	margin: 0;
}

/* ---------------------------------------------------------------------------
 * Below the card
 * ------------------------------------------------------------------------- */

#login #nav,
#login #backtoblog {
	margin: 18px 0 0;
	padding: 0;
	font-size: 14px;
	text-align: center;
}

#login #nav a,
#login #backtoblog a {
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 3px rgba(16, 32, 72, 0.55);
	text-decoration: none;
}

#login #nav a:hover,
#login #backtoblog a:hover {
	color: #fff;
	text-decoration: underline;
}

/* "Lost your password?" is moved into the card by js/login.js; hide the leftover
 * only once that has happened, so it stays reachable if the script does not run. */
#login #nav a.ananda-moved {
	display: none;
}

.login .language-switcher {
	margin: 18px auto 0;
}

.login .language-switcher form {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.login .language-switcher select {
	min-height: 36px;
	border-radius: 8px;
	border: 1.5px solid rgba(255, 255, 255, 0.7);
	background-color: rgba(255, 255, 255, 0.9);
	font-family: inherit;
	font-size: 13px;
}

.login .language-switcher .button {
	min-height: 36px;
	border-radius: 8px;
	font-family: inherit;
	font-size: 13px;
}

.login .language-switcher .dashicons-translation {
	color: #fff;
}

/* ---------------------------------------------------------------------------
 * Narrow screens
 * ------------------------------------------------------------------------- */

@media screen and (max-width: 480px) {
	#login {
		width: 100%;
		padding: 40px 16px 24px;
	}

	#login form {
		padding: 26px 20px;
	}

	/* Bigger hit targets on touch. */
	#login input[type="text"],
	#login input[type="password"],
	#login input[type="email"],
	#login .input {
		min-height: 52px;
	}

	#login .wp-pwd .wp-hide-pw {
		width: 52px;
		height: 52px;
	}

	#login .button-primary,
	#login #magic-login-button {
		min-height: 52px;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.login {
		animation: none;
	}
}
