/*!
 * Bosla sign-in screen.
 *
 * Skins the core wp-login.php screens (log in, register, lost password) with
 * the publisher's own identity. Loaded on login screens only. Logical
 * properties throughout, so the layout mirrors correctly in RTL.
 *
 * Structure: tokens -> shell -> branding -> form controls -> messages ->
 * footer -> minimal variant -> dark scheme -> reduced motion -> print.
 */

/* --- Tokens ---------------------------------------------------------------- */
body.login {
	/* Accent is provided by the inline brand vars (:root) so it always matches
	   the theme's main color; no hard-coded fallback here. */
	--bosla-auth-ink: #16181d;
	--bosla-auth-muted: #6b7280;
	--bosla-auth-line: #dcdfe5;
	--bosla-auth-surface: #ffffff;
	--bosla-auth-tint: #f4f5f8;
	--bosla-auth-ring: color-mix(in srgb, var(--bosla-auth-accent) 18%, transparent);
	--bosla-auth-radius: 20px;
	--bosla-auth-field-radius: 12px;
	--bosla-auth-shadow: 0 26px 60px -34px rgba(15, 18, 25, 0.42), 0 2px 6px -2px rgba(15, 18, 25, 0.08);

	background-color: var(--bosla-auth-tint);
	background-image:
		radial-gradient(1100px 520px at 12% -8%, color-mix(in srgb, var(--bosla-auth-accent) 13%, transparent), transparent 62%),
		radial-gradient(760px 420px at 108% 8%, rgba(15, 18, 25, 0.07), transparent 58%);
	color: var(--bosla-auth-ink);
	font-family: var(--bosla-font-body, "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, sans-serif);
	font-size: 15px;
	line-height: 1.55;
	min-height: 100vh;
	padding-block: clamp(1.5rem, 6vh, 4rem) 2rem;
}

/* --- Shell ----------------------------------------------------------------- */
body.login #login {
	width: min(100% - 2rem, 27rem);
	margin: 0 auto;
	padding: 0;
}

body.login h1 {
	margin: 0 0 1.15rem;
	text-align: center;
	font-size: 1.5rem;
	line-height: 1.2;
}

body.login h1 a {
	background-image: none;
	display: inline-block;
	width: auto;
	height: auto;
	max-width: 100%;
	text-indent: 0;
	overflow-wrap: anywhere;
	color: var(--bosla-auth-ink);
	font-family: var(--bosla-font-heading, inherit);
	font-size: 1.5rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	text-decoration: none;
	padding: 0.15rem 0.4rem;
	border-radius: 10px;
}

body.login h1 a:focus-visible {
	outline: 2px solid var(--bosla-auth-accent);
	outline-offset: 3px;
}

/* Publishers with a logo get the image; everyone else gets the wordmark. */
body.login:has(.bosla-auth-logo) h1 a {
	width: 168px;
	height: 56px;
	background-image: var(--bosla-auth-logo);
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	text-indent: -9999px;
	overflow: hidden;
}

body.login form {
	background: var(--bosla-auth-surface);
	border: 1px solid rgba(15, 18, 25, 0.07);
	border-radius: var(--bosla-auth-radius);
	box-shadow: var(--bosla-auth-shadow);
	margin: 0;
	padding: clamp(1.35rem, 4vw, 1.9rem);
}

body.login form p {
	margin: 0 0 1.05rem;
}

body.login form p:last-child {
	margin-bottom: 0;
}

/* --- Form controls --------------------------------------------------------- */
body.login label {
	display: block;
	color: var(--bosla-auth-muted);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	margin-bottom: 0.4rem;
}

body.login form .input,
body.login form input[type="text"],
body.login form input[type="password"],
body.login form input[type="email"] {
	box-sizing: border-box;
	width: 100%;
	min-height: 2.9rem;
	margin: 0;
	padding: 0.6rem 0.9rem;
	background: var(--bosla-auth-surface);
	border: 1px solid var(--bosla-auth-line);
	border-radius: var(--bosla-auth-field-radius);
	color: var(--bosla-auth-ink);
	font-family: inherit;
	font-size: 0.97rem;
	line-height: 1.4;
	transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

body.login form .input:hover,
body.login form input[type="text"]:hover,
body.login form input[type="password"]:hover,
body.login form input[type="email"]:hover {
	border-color: #c3c7cf;
	border-color: color-mix(in srgb, var(--bosla-auth-accent) 45%, var(--bosla-auth-line));
}

body.login form .input:focus,
body.login form input[type="text"]:focus,
body.login form input[type="password"]:focus,
body.login form input[type="email"]:focus {
	border-color: var(--bosla-auth-accent);
	box-shadow: 0 0 0 3px var(--bosla-auth-ring);
	color: var(--bosla-auth-ink);
	outline: none;
}

body.login form .input::placeholder {
	color: #9aa1ac;
	color: color-mix(in srgb, var(--bosla-auth-muted) 78%, transparent);
}

body.login .button-primary {
	width: 100%;
	min-height: 2.9rem;
	margin: 0.35rem 0 0;
	padding: 0.7rem 1rem;
	background: var(--bosla-auth-accent);
	border: 0;
	border-radius: var(--bosla-auth-field-radius);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.98rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	text-shadow: none;
	box-shadow: 0 10px 22px -14px var(--bosla-auth-accent);
	transition: transform 0.14s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

body.login .button-primary:hover {
	background: var(--bosla-auth-accent);
	filter: brightness(1.06);
	transform: translateY(-1px);
}

body.login .button-primary:active {
	transform: translateY(0);
	filter: brightness(0.96);
}

body.login .button-primary:focus-visible {
	outline: 2px solid var(--bosla-auth-ink);
	outline-offset: 2px;
}

body.login p.forgetmenot {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0 0 1.15rem;
}

body.login p.forgetmenot input[type="checkbox"] {
	width: 1.05rem;
	height: 1.05rem;
	margin: 0;
	accent-color: var(--bosla-auth-accent);
}

body.login p.forgetmenot label {
	margin: 0;
	color: var(--bosla-auth-muted);
	font-size: 0.86rem;
	font-weight: 600;
	letter-spacing: 0;
}

/* --- Messages -------------------------------------------------------------- */
body.login .message,
body.login #login_error,
body.login .success {
	border: 1px solid var(--bosla-auth-line);
	border-inline-start: 4px solid var(--bosla-auth-accent);
	border-radius: 12px;
	box-shadow: none;
	background: var(--bosla-auth-surface);
	color: var(--bosla-auth-ink);
	font-size: 0.88rem;
	margin: 0 0 1rem;
	padding: 0.8rem 1rem;
}

body.login #login_error {
	border-inline-start-color: #c0392b;
	background: #fff6f5;
	background: color-mix(in srgb, #c0392b 6%, var(--bosla-auth-surface));
}

body.login .message a,
body.login #login_error a {
	color: var(--bosla-auth-accent);
	font-weight: 600;
}

/* --- Footer ---------------------------------------------------------------- */
body.login #nav,
body.login #backtoblog {
	padding: 0;
	margin: 0;
	text-align: center;
	font-size: 0.86rem;
}

body.login #nav {
	margin-top: 1.1rem;
}

body.login #backtoblog {
	margin-top: 0.35rem;
}

body.login #nav a,
body.login #backtoblog a,
body.login .bosla-auth-links a {
	color: var(--bosla-auth-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	padding: 0.15rem 0.1rem;
	transition: color 0.16s ease, border-color 0.16s ease;
}

body.login #nav a:hover,
body.login #backtoblog a:hover,
body.login .bosla-auth-links a:hover {
	color: var(--bosla-auth-accent);
	border-bottom-color: currentColor;
}

body.login .bosla-auth-links {
	margin: 1.4rem 0 0;
	text-align: center;
}

body.login .bosla-auth-links a {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: var(--bosla-auth-ink);
	font-weight: 700;
}

body.login .bosla-auth-links a::before {
	content: "\2190";
	font-size: 0.95em;
	color: var(--bosla-auth-muted);
}

body.login .bosla-auth-blurb {
	margin: 0.55rem 0 0;
	text-align: center;
	color: var(--bosla-auth-muted);
	font-size: 0.8rem;
}

/* --- Minimal variant ------------------------------------------------------- */
body.login.bosla-auth-minimal {
	background: var(--bosla-auth-tint);
}

body.login.bosla-auth-minimal form {
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
}

body.login.bosla-auth-minimal #nav,
body.login.bosla-auth-minimal #backtoblog,
body.login.bosla-auth-minimal .bosla-auth-links {
	margin-inline: auto;
	max-width: 27rem;
}

/* --- Dark scheme ----------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
	body.login {
		--bosla-auth-ink: #e9ebef;
		--bosla-auth-muted: #9aa2ae;
		--bosla-auth-line: #34383f;
		--bosla-auth-surface: #15171c;
		--bosla-auth-tint: #0f1115;
		--bosla-auth-shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.8);

		background-color: var(--bosla-auth-tint);
		background-image: radial-gradient(1000px 480px at 12% -8%, color-mix(in srgb, var(--bosla-auth-accent) 16%, transparent), transparent 60%);
	}

	body.login form,
	body.login .message,
	body.login #login_error {
		border-color: rgba(255, 255, 255, 0.08);
	}

	body.login #login_error {
		background: color-mix(in srgb, #c0392b 14%, var(--bosla-auth-surface));
	}

	body.login .button-primary {
		color: #ffffff;
	}
}

/* --- Reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	body.login .button-primary,
	body.login form .input,
	body.login #nav a,
	body.login #backtoblog a {
		transition: none;
	}

	body.login .button-primary:hover {
		transform: none;
	}
}

/* --- Narrow screens -------------------------------------------------------- */
@media (max-width: 400px) {
	body.login #login {
		width: 100%;
		padding-inline: 0.25rem;
	}

	body.login form {
		border-radius: 16px;
		padding: 1.2rem 1rem;
	}
}
