/**
 * Valhalla for Vikinger — Access & Registration (front end + wp-login.php).
 *
 * Styles the fields added to the BuddyPress register page (Vikinger template), the activation
 * notices and the extra fields of wp-login.php. Colors come from the Vikinger CSS variables with
 * neutral fallbacks for other themes.
 */

/* Honeypot: never visible, never focusable (inline styles repeat this in case CSS fails). */
.vhl-access-hp {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* ---------------------------------------------------------------------------------------------
 * BuddyPress register page (Vikinger: body.buddypress.registration #buddypress .page form)
 * ------------------------------------------------------------------------------------------- */

.vhl-access-guard {
	margin-top: 28px;
}

.vhl-access-guard:empty {
	display: none;
}

.vhl-access-field + .vhl-access-field {
	margin-top: 20px;
}

.vhl-access-guard > .error,
.vhl-access-field > .error {
	margin-bottom: 10px;
}

body.buddypress.registration #buddypress .page form label.vhl-access-terms-label,
.vhl-access-terms-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	color: var(--color-text, #3e3f5e);
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 500;
	line-height: 1.5em;
	cursor: pointer;
}

body.buddypress.registration #buddypress .page form label.vhl-access-terms-label input[type="checkbox"],
.vhl-access-terms-label input[type="checkbox"] {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	position: static;
	accent-color: var(--color-secondary, #615dfa);
	cursor: pointer;
}

.vhl-access-terms-label a {
	color: var(--color-primary-dark, #00c7d9);
	font-weight: 700;
	text-decoration: none;
}

.vhl-access-terms-label a:hover,
.vhl-access-terms-label a:focus {
	text-decoration: underline;
}

.vhl-access-turnstile {
	min-height: 65px;
}

.vhl-access-captcha .vhl-access-turnstile {
	width: 100%;
}

/* Notices on the activation / registration-complete screens. */
#buddypress .vhl-access-notice,
.vhl-access-notice {
	width: 356px;
	max-width: 100%;
	margin: 24px auto 0;
	text-align: left;
}

/* ---------------------------------------------------------------------------------------------
 * wp-login.php (Vikinger restyles it with floating labels on every <p> of the form)
 * ------------------------------------------------------------------------------------------- */

/*
 * Vikinger 2.0's login stylesheet (vklogin-style.css) reads --font-primary / --font-secondary, but
 * the theme only prints --vikinger-font-family-primary / -secondary on wp-login.php, so the branded
 * login screen (also the members-only gate) fell back to the browser's serif font. Map the names to
 * the theme's own font settings; other themes do not use these variables.
 */
body.login {
	--font-primary: var(--vikinger-font-family-primary, "Rajdhani", sans-serif);
	--font-secondary: var(--vikinger-font-family-secondary, "Titillium Web", sans-serif);
}

body.login #login form p.vhl-access-terms.vhl-access-wp-terms {
	position: static;
	margin: 0 0 20px;
}

body.login #login form p.vhl-access-terms.vhl-access-wp-terms label.vhl-access-terms-label {
	position: static;
	top: auto;
	left: auto;
	padding: 0;
	background: transparent;
	pointer-events: auto;
	color: var(--color-text-alt, #50575e);
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.5em;
}

/* Keep the theme's own checkbox look (size, colors, check mark); only fix the layout. */
body.login #login form p.vhl-access-terms.vhl-access-wp-terms label.vhl-access-terms-label input[type="checkbox"] {
	flex: 0 0 auto;
	margin: 0;
	accent-color: var(--color-secondary, #2271b1);
}

body.login .vhl-access-login-captcha {
	margin: 0 0 20px;
}

body.login .vhl-access-login-captcha .vhl-access-turnstile {
	display: flex;
	justify-content: center;
}

body.login #login .vhl-access-message {
	word-wrap: break-word;
}

/* Front-end login widgets (bbPress etc.) using the login_form hook. */
.vhl-access-login-captcha {
	margin: 12px 0;
}

@media screen and (max-width: 480px) {
	#buddypress .vhl-access-notice,
	.vhl-access-notice {
		width: auto;
	}
}
