/*
 * The login screen (inc/login.php): the clothes of the site over
 * wp-login.php. Colours and shapes are those of the theme (theme.json);
 * the logo and the fonts come as inline style, their addresses belonging to
 * the site rather than to this file.
 *
 * 1. The page
 * 2. The logo
 * 3. The order of the blocks
 * 4. The SAC account (the way in)
 * 5. The identifier and password form, folded away
 * 6. What WordPress says (logged out, session expired, refusal)
 */

:root {
	--cj-primary: #1b7a43;
	--cj-ink: #14181b;
	--cj-muted: #565e63;
	--cj-paper: #f6f5f1;
	--cj-line: #dcd8cf;
	--cj-body: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--cj-heading: Archivo, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* 1. The page */

body.login {
	background: var(--cj-paper);
	color: var(--cj-ink);
	font-family: var(--cj-body);
	font-size: 16px;
	line-height: 1.65;
}

body.login #login {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 27rem;
	padding: 6vh 1.25rem 3rem;
}

/* 2. The logo, in place of the WordPress one */

.login h1.wp-login-logo {
	order: 0;
	margin: 0;
}

.login h1.wp-login-logo a {
	width: 13rem;
	height: 5.75rem;
	margin: 0 auto 1.5rem;
	background-image: var(--cj-logo, none);
	background-size: contain;
	background-position: center;
}

/* 3. The order: what was said, the SAC account, then the rest */

#login .notice,
#login .message,
#login #login_error {
	order: 1;
}

#login .casjaman-login-intro {
	order: 2;
}

#login .openid-connect-login-button {
	order: 3;
}

/* With the script: the form moves into the folded block (assets/login.js);
   without it, the form simply stays where WordPress put it. */
#login .casjaman-login-other,
#login #loginform {
	order: 4;
}

#login #nav {
	order: 5;
}

#login #backtoblog {
	order: 6;
}

/* The site is in French; the choice only puzzles (outside #login). */
body.login .language-switcher {
	display: none;
}

#login .casjaman-login-intro {
	margin: 0 0 1rem;
	color: var(--cj-muted);
	text-align: center;
}

#login #nav,
#login #backtoblog {
	margin: 1rem 0 0;
	padding: 0;
	text-align: center;
}

.login a,
#login #nav a,
#login #backtoblog a {
	color: var(--cj-primary);
	text-decoration: underline;
}

.login a:hover,
.login a:focus {
	color: #b3541e; /* Terre, as on the site. */
}

/* 4. The SAC account: the way in, as a button of the site */

#login .openid-connect-login-button {
	margin: 0 !important; /* The plugin writes its own margin inline. */
}

#login .openid-connect-login-button a.button {
	display: block;
	width: 100%;
	height: auto;
	padding: 0.85em 1.6em;
	border: 0;
	border-radius: 4px;
	background: var(--cj-primary);
	box-shadow: none;
	color: #fff;
	font-family: var(--cj-heading);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	text-shadow: none;
}

#login .openid-connect-login-button a.button:hover,
#login .openid-connect-login-button a.button:focus {
	background: var(--cj-ink);
	color: #fff;
}

#login .openid-connect-login-button a.button:focus-visible {
	outline: 2px solid var(--cj-primary);
	outline-offset: 2px;
}

/* 5. Identifier and password: the site's team, and the hut keepers */

#login .casjaman-login-other {
	margin: 1.25rem 0 0;
}

#login .casjaman-login-other > summary {
	color: var(--cj-muted);
	font-size: 0.95rem;
	text-align: center;
	text-decoration: underline;
	cursor: pointer;
	list-style: none;
}

#login .casjaman-login-other > summary::-webkit-details-marker {
	display: none;
}

#login .casjaman-login-other > summary::after {
	content: " ▾";
	text-decoration: none;
}

#login .casjaman-login-other[open] > summary::after {
	content: " ▴";
}

#login .casjaman-login-other__note {
	margin: 0.75rem 0 0;
	color: var(--cj-muted);
	font-size: 0.9rem;
	text-align: center;
}

.login form {
	margin-top: 1rem;
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--cj-line);
	border-radius: 8px;
	box-shadow: none;
	font-size: 1rem;
}

.login form .input,
.login input[type="text"],
.login input[type="password"] {
	border-radius: 4px;
	font-size: 1rem;
}

.login form .input:focus,
.login input[type="text"]:focus,
.login input[type="password"]:focus {
	border-color: var(--cj-primary);
	box-shadow: 0 0 0 1px var(--cj-primary);
}

.login .button-primary {
	border-radius: 4px;
	background: var(--cj-primary);
	border-color: var(--cj-primary);
	font-family: var(--cj-heading);
	font-weight: 600;
}

.login .button-primary:hover,
.login .button-primary:focus {
	background: var(--cj-ink);
	border-color: var(--cj-ink);
}

/* 6. What WordPress says: logged out, session expired, login refused */

#login .notice,
#login .message,
#login #login_error {
	margin: 0 0 1.25rem;
	border-radius: 6px;
	border-left-color: var(--cj-primary);
	box-shadow: none;
	font-size: 0.95rem;
}

#login #login_error {
	border-left-color: #b3541e;
}
