/*
 * WordPress's own login screens (wp-login.php), dressed like the theme's
 * /logga-in/ page: the blue top bar with the logo, a white page, the blue
 * heading and the blue button. The fields follow the join page instead
 * (ra-stripe-subs join.css): white, bordered, rounded, from the same --rj-*
 * palette, because /logga-in/'s flat grey fields are not the brand's.
 *
 * Loaded by ra_login_enqueue_style() after core's login.css. Every rule is
 * scoped to body.ra-login, which ra_login_body_class() adds on every screen
 * except the interim login (wp-admin's "session expired" modal), so that
 * screen keeps core's look. Values are copied from /logga-in/ as rendered.
 */

body.ra-login {
	/* The subset of join.css's tokens these screens use, with its values. */
	--rj-blue: #007ac1;
	--rj-blue-tint: #e8f4fb;
	--rj-green-dark: #2f7a62;
	--rj-green-tint: #eaf5f1;
	--rj-grey: #f4f3f4;
	--rj-text: #222222;
	--rj-muted: #5c5c5c;
	--rj-white: #ffffff;
	--rj-danger: #b3261e;
	--rj-radius-sm: 10px;
	/* join.css draws its search field with --rj-line (#dedcde), which is 1.4:1
	   on white: too faint to show where a field is. This grey from the same
	   family is 3.8:1. */
	--rj-field-line: #858385;

	/* Light only, like the rest of the site: /logga-in/ and every page a
	   member passes through on the way here are light, and the reset flow
	   should not change character halfway. "only" also stops browsers that
	   darken light pages on their own (Chrome's auto dark mode). */
	color-scheme: only light;
	min-width: 0;
	background: #fff;
	color: #222;
	font-family: Roboto, Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

html:has(> body.ra-login) {
	color-scheme: only light;
}

/* The top bar: core's logo heading, widened to the full page. */
body.ra-login #login h1.wp-login-logo {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 54px;
	margin: 0;
	padding: 0 20px;
	background: #007ac1;
}

body.ra-login #login h1.wp-login-logo a {
	width: 140px;
	height: 44px;
	margin: 5px 0 0;
	background: url("../img/logo.png") no-repeat left center / 140px 25px;
}

@media (min-width: 1024px) {
	body.ra-login #login h1.wp-login-logo {
		padding: 0 23px;
	}

	body.ra-login #login h1.wp-login-logo a {
		width: 170px;
		background-size: 170px 31px;
	}
}

/* The page heading: core prints each screen's title in a visually hidden h1
   before #login. Shown here as /logga-in/ shows "Logga in". */
body.ra-login > h1.screen-reader-text {
	position: static;
	width: auto;
	height: auto;
	max-width: 944px;
	margin: 102px auto 10px;
	padding: 0 16px;
	overflow: visible;
	clip: auto;
	clip-path: none;
	box-sizing: border-box;
	color: #007ac1;
	font-size: 26px;
	font-weight: 500;
	line-height: 1.2;
	text-align: left;
}

/* Without a title (core passes none on a few screens) the content still has
   to clear the bar. */
body.ra-login #login {
	width: auto;
	max-width: 944px;
	margin: 0 auto;
	padding: 102px 16px 48px;
	box-sizing: border-box;
}

body.ra-login > h1.screen-reader-text + #login {
	padding-top: 0;
}

body.ra-login #login > * {
	max-width: 591px;
	box-sizing: border-box;
}

body.ra-login #login > h1.wp-login-logo {
	max-width: none;
}

/* The form sits on the page, not in a box. */
body.ra-login #loginform,
body.ra-login #lostpasswordform,
body.ra-login #resetpassform,
body.ra-login #registerform {
	margin: 0;
	padding: 0;
	overflow: visible;
	background: none;
	border: 0;
	box-shadow: none;
}

body.ra-login #login form p,
body.ra-login #login .user-pass-wrap,
body.ra-login #login .user-pass1-wrap {
	margin: 0 0 16px;
}

body.ra-login label {
	display: block;
	margin: 0 0 10px;
	color: #222;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.7;
}

/* Fields: the join page's field (white, 1.5px border, 10px radius, 16px
   text). #login outranks core's own field rules, including the ones that
   recolour the password field's border by strength. */
body.ra-login #login .input,
body.ra-login #login input[type="text"],
body.ra-login #login input[type="email"],
body.ra-login #login input[type="password"] {
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 11px 14px;
	border: 1.5px solid var(--rj-field-line);
	border-radius: var(--rj-radius-sm);
	background: var(--rj-white);
	box-shadow: none;
	color: var(--rj-text);
	caret-color: var(--rj-blue);
	/* 16px: below that iOS zooms the page when the field is tapped. */
	font-size: 16px;
	line-height: 22px;
}

@media (hover: hover) {
	body.ra-login #login .input:hover {
		border-color: var(--rj-muted);
	}
}

/* Focus: the join page's ring (3px --rj-blue, 2px out), 4.6:1 on white,
   with the border turning blue as well. */
body.ra-login #login .input:focus,
body.ra-login #login .input:focus-visible {
	border-color: var(--rj-blue);
	outline: 3px solid var(--rj-blue);
	outline-offset: 2px;
	box-shadow: none;
}

/* Errors: core points the login fields at #login_error with
   aria-describedby when the log-in failed; aria-invalid is honoured too.
   The lost-password field is left alone: there core's errors are about the
   link, not about what was typed. */
body.ra-login #login .input[aria-describedby~="login_error"],
body.ra-login #login .input[aria-invalid="true"] {
	border-color: var(--rj-danger);
}

body.ra-login #login .input[aria-describedby~="login_error"]:focus,
body.ra-login #login .input[aria-invalid="true"]:focus {
	border-color: var(--rj-danger);
}

/* Password field with core's show/hide button, a 44px target inside the
   field's right edge. */
body.ra-login .wp-pwd {
	position: relative;
}

body.ra-login #login .wp-pwd .input {
	padding-right: 52px;
}

body.ra-login #login .button.wp-hide-pw {
	top: 2px;
	right: 2px;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: var(--rj-blue);
	line-height: 1;
}

@media (hover: hover) {
	body.ra-login #login .button.wp-hide-pw:hover {
		background: var(--rj-blue-tint);
	}
}

body.ra-login #login .button.wp-hide-pw:active {
	background: var(--rj-blue-tint);
}

body.ra-login #login .button.wp-hide-pw:focus {
	outline: none;
	box-shadow: none;
}

body.ra-login #login .button.wp-hide-pw:focus-visible {
	outline: 3px solid var(--rj-blue);
	outline-offset: -3px;
}

/* Strength meter under the new-password field. Core sets the state class;
   each state keeps its text at 4.5:1 or more on its tint. */
body.ra-login #login #pass-strength-result {
	width: 100%;
	margin: 8px 0 0;
	padding: 8px 14px;
	border: 0;
	border-radius: var(--rj-radius-sm);
	box-sizing: border-box;
	background: var(--rj-grey);
	color: var(--rj-muted);
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	opacity: 1;
}

body.ra-login #login #pass-strength-result.short,
body.ra-login #login #pass-strength-result.bad {
	background: #fdecea;
	color: var(--rj-danger);
}

body.ra-login #login #pass-strength-result.good {
	background: #fff4d6;
	color: #6b4e00;
}

body.ra-login #login #pass-strength-result.strong {
	background: var(--rj-green-tint);
	color: var(--rj-green-dark);
}

body.ra-login ::selection {
	background: var(--rj-blue-tint);
	color: var(--rj-text);
}

body.ra-login #login .indicator-hint,
body.ra-login #login p.description {
	margin: 0 0 16px;
	color: #222;
	font-size: 14px;
}

/* "Bekräfta användning av svagt lösenord": checkbox and label on one line. */
body.ra-login #login .pw-weak {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0 0 16px;
}

body.ra-login #login .pw-weak label {
	display: inline;
	margin: 0;
}

body.ra-login #login .forgetmenot {
	float: none;
	margin: 0 0 16px;
}

body.ra-login .forgetmenot label {
	display: inline;
	margin: 0;
}

body.ra-login #login input[type="checkbox"] {
	margin: 0 6px 0 0;
	border-color: var(--rj-field-line);
}

body.ra-login #login input[type="checkbox"]:focus-visible {
	outline: 3px solid var(--rj-blue);
	outline-offset: 2px;
	box-shadow: none;
}

/* Buttons: the theme's .a-button. */
body.ra-login #login .submit,
body.ra-login #login .reset-pass-submit {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: 12px;
	margin: 0;
	padding: 0;
}

/* #login outranks core's mobile rule (.wp-core-ui .button.button-large),
   which would shrink the text to 14px below 782px. */
body.ra-login #login .button {
	float: none;
	min-height: 44px;
	margin: 0;
	padding: 0 24px;
	border-radius: 5px;
	font-family: Roboto, Arial, Helvetica, sans-serif;
	font-size: 16px;
	font-weight: 500;
	line-height: 44px;
	text-shadow: none;
}

/* #login lets the resting colour outrank core's own, ungated
   .wp-core-ui .button-primary:hover, so a tap leaves no hover colour. */
body.ra-login #login .button-primary,
body.ra-login #wp-submit {
	width: 100%;
	border: 0;
	background: #007ac1;
	box-shadow: none;
	color: #fff;
}

/* Hover only where a pointer really hovers: a phone keeps :hover on the
   last thing tapped, which would leave the button in its hover colour. */
@media (hover: hover) {
	body.ra-login #login .button-primary:hover,
	body.ra-login #wp-submit:hover {
		background: #006eae;
		color: #fff;
	}
}

body.ra-login #login .button-primary:focus,
body.ra-login #wp-submit:focus {
	background: #006eae;
	color: #fff;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #007ac1;
}

/* Pressed: a step darker than hover, so a tap shows on touch screens too. */
body.ra-login #login .button-primary:active,
body.ra-login #wp-submit:active {
	background: #005f96;
	color: #fff;
}

/* Core disables "Spara lösenordet" until a weak password is confirmed. Its
   disabled colours (buttons.css) are !important and win over every state
   above, so only the cursor is added here. */
body.ra-login #login .button:disabled {
	cursor: not-allowed;
}

/* "Generera lösenord" and core's other secondary buttons: white, with the
   field's border weight in brand blue. */
body.ra-login #login .wp-generate-pw,
body.ra-login #login .button-secondary:not(.wp-hide-pw) {
	width: 100%;
	border: 1.5px solid var(--rj-blue);
	background: var(--rj-white);
	box-shadow: none;
	color: var(--rj-blue);
}

@media (hover: hover) {
	body.ra-login #login .wp-generate-pw:hover,
	body.ra-login #login .button-secondary:not(.wp-hide-pw):hover {
		background: var(--rj-blue-tint);
		color: var(--rj-blue);
	}
}

body.ra-login #login .wp-generate-pw:active,
body.ra-login #login .button-secondary:not(.wp-hide-pw):active {
	background: var(--rj-blue-tint);
	color: var(--rj-blue);
}

body.ra-login #login .wp-generate-pw:focus,
body.ra-login #login .button-secondary:not(.wp-hide-pw):focus {
	box-shadow: none;
	outline: none;
}

body.ra-login #login .wp-generate-pw:focus-visible,
body.ra-login #login .button-secondary:not(.wp-hide-pw):focus-visible {
	outline: 3px solid var(--rj-blue);
	outline-offset: 2px;
}

@media (min-width: 768px) {
	body.ra-login #login .button-primary,
	body.ra-login #wp-submit,
	body.ra-login #login .wp-generate-pw,
	body.ra-login #login .button-secondary:not(.wp-hide-pw) {
		width: auto;
		min-width: 192px;
	}
}

/* Messages and errors: the theme's .error-message, and a quiet info box. */
body.ra-login .message,
body.ra-login .notice,
body.ra-login .success,
body.ra-login #login_error {
	margin: 0 0 20px;
	padding: 16px 20px;
	border: 0;
	border-radius: 10px;
	background: #f4f3f4;
	box-shadow: none;
	color: #222;
	font-size: 16px;
	text-align: left;
}

body.ra-login .notice-error,
body.ra-login #login_error {
	background: #ffdfe0;
	color: #790057;
}

body.ra-login .notice p,
body.ra-login .message p,
body.ra-login #login_error p {
	margin: 0;
	font-size: 16px;
}

body.ra-login a,
body.ra-login #nav a,
body.ra-login #backtoblog a,
body.ra-login .privacy-policy-page-link a {
	color: #007ac1;
}

body.ra-login a:hover,
body.ra-login a:focus,
body.ra-login #nav a:hover,
body.ra-login #backtoblog a:hover {
	color: #006eae;
}

body.ra-login #login_error a {
	color: #790057;
}

/* Links under the form. */
body.ra-login #nav,
body.ra-login #backtoblog {
	margin: 24px 0 0;
	padding: 0;
	font-size: 16px;
}

body.ra-login #backtoblog {
	margin-top: 12px;
}

body.ra-login .privacy-policy-page-link {
	margin: 32px 0 0;
	text-align: left;
	font-size: 14px;
}
