/*
 * The login screen of WordPress, wearing the brand.
 *
 * Three journeys land here and none of them is a WordPress journey: a professional discovering
 * their trial site, a customer signing in, an operator taking up an invitation. The screen where
 * somebody chooses their own password is the most exposed of the three, and it used to show the
 * WordPress logo at the exact moment somebody discovered their own site.
 *
 * It reads the tokens, which bring the fonts with them, and nothing else. Bootstrap is not loaded:
 * this page belongs to WordPress and the sheet repaints it rather than rebuilding it, so a rule
 * that reached beyond the few elements named below would fight the core on its own screen.
 *
 * Every rule is anchored on a class of OURS, added to the body by login_body_class. The screen
 * belongs to WordPress and its class names are shared with the core, a theme and every plugin that
 * ever touched a login form: a rule written on .login alone would win or lose against theirs
 * depending on the order the sheets happened to load in.
 */

body.ssf-login-page {
	background: var(--ssf-surface-raised);
	color: var(--ssf-text);
	font-family: var(--ssf-font-body);

	/*
	 * The core paints this whole screen from one variable of its own, and every element the rules
	 * below do not name reads it: the show-password eye inside the field, the focus ring of every
	 * link, the outline of the secondary button. Repainting the primary button alone left a green
	 * button with a blue ring around it. The variable belongs to the core and is redefined HERE,
	 * inside our own scope, rather than declared as a token of ours.
	 */
	--wp-admin-theme-color: var(--ssf-primary);
	--wp-admin-theme-color-darker-10: var(--ssf-primary-strong);
	--wp-admin-theme-color-darker-20: var(--ssf-primary-strong);

	/* The foot of the screen reserves the bar an in-app browser lays over it and the home
	   indicator of a telephone, so the lost password link never ends up under either. */
	padding-block-end: calc(var(--ssf-space-6) + env(safe-area-inset-bottom, 0px));
}

/*
 * Never under sixteen pixels of text, and never under the size the person asked their system for:
 * below sixteen, Safari on iOS zooms the page on focus and never zooms back out. The core draws
 * these fields large on a telephone today, and has for years, but a floor that depends on a choice
 * of the core is a floor that moves without us.
 */
body.ssf-login-page #login > form .input,
body.ssf-login-page input[type="text"],
body.ssf-login-page input[type="password"],
body.ssf-login-page input[type="email"] {
	font-size: max(16px, 1rem);
}

/* Under the thumb: the button that signs in, the box that remembers, and the links at the foot. */
body.ssf-login-page .button-primary {
	min-height: var(--ssf-tap);
}

body.ssf-login-page .forgetmenot label,
body.ssf-login-page #nav a,
body.ssf-login-page #backtoblog a,
body.ssf-login-page .privacy-policy-link {
	display: inline-flex;
	align-items: center;
	min-height: var(--ssf-tap);
}

/*
 * The heading of the login screen is a link carrying the WordPress logo as a background image,
 * sized in the core sheet. Everything the core sets there is set again, or the two would show
 * one over the other.
 */
body.ssf-login-page h1 a {
	background-image: url("../img/soklae-login.svg");

	/*
	 * The whole lockup and no longer the monogram alone: the mark and the name together, which is
	 * what somebody discovering their own site should read at the top of the screen where they
	 * choose their password.
	 *
	 * It is a wide drawing, so the box follows its ratio instead of being a square with the
	 * drawing lost inside it, and contain is what keeps it undistorted when the form narrows on a
	 * telephone. The width is capped rather than fixed: the core form is three hundred and twenty
	 * pixels wide, and a mark wider than the card it sits above reads as a mistake.
	 */
	width: min(260px, 100%);
	aspect-ratio: 1036 / 320;
	height: auto;
	background-size: contain;
	background-position: center center;
	background-repeat: no-repeat;
	margin-bottom: var(--ssf-space-4);
	text-indent: -9999em;
	overflow: hidden;
}

body.ssf-login-page h1,
body.ssf-login-page h2 {
	font-family: var(--ssf-font-display);
}

/*
 * The form is a card and has to keep reading as one. The core gave white on grey plus a shadow
 * plus a border; painting both the page and the card in near neighbours and dropping the shadow
 * left a boundary at 1.4 to 1, under the floor a limit that identifies something has to clear.
 * The page takes the ivory, the card takes the white, and the border takes the brand.
 *
 * The child selector matters: the language switcher at the foot of the screen is a form too, and
 * it lives OUTSIDE the login block. Given a border, a radius and a shadow it became a second card
 * under the first, which the core never draws.
 */
body.ssf-login-page #login > form {
	background: var(--ssf-surface);
	border: 1px solid var(--ssf-primary);
	border-radius: var(--ssf-radius);
	box-shadow: 0 1px 3px var(--ssf-primary-wash);
}

body.ssf-login-page label,
body.ssf-login-page #login > form .input,
body.ssf-login-page input[type="text"],
body.ssf-login-page input[type="password"],
body.ssf-login-page input[type="email"] {
	color: var(--ssf-text);
	font-family: var(--ssf-font-body);
}

body.ssf-login-page #login > form .input:focus,
body.ssf-login-page input[type="text"]:focus,
body.ssf-login-page input[type="password"]:focus,
body.ssf-login-page input[type="email"]:focus {
	border-color: var(--ssf-primary);
	box-shadow: 0 0 0 1px var(--ssf-primary);
	outline: 2px solid transparent;
}

/*
 * The submit button. The brand green carries the ivory of the palette rather than the blue of the
 * core, and the pressed state falls to the declared deep green instead of a computed filter.
 */
body.ssf-login-page .button-primary,
body.ssf-login-page .button-primary:visited {
	background: var(--ssf-primary);
	border-color: var(--ssf-primary);
	color: var(--ssf-on-primary);
	text-shadow: none;
	box-shadow: none;
}

body.ssf-login-page .button-primary:hover,
body.ssf-login-page .button-primary:focus,
body.ssf-login-page .button-primary:active {
	background: var(--ssf-primary-strong);
	border-color: var(--ssf-primary-strong);
	color: var(--ssf-on-primary);
}

body.ssf-login-page .button-primary:focus-visible {
	outline: 2px solid var(--ssf-primary-strong);
	outline-offset: 2px;
}

body.ssf-login-page #nav a,
body.ssf-login-page #backtoblog a,
body.ssf-login-page .privacy-policy-link {
	color: var(--ssf-brand-text);
}

body.ssf-login-page #nav a:hover,
body.ssf-login-page #backtoblog a:hover,
body.ssf-login-page .privacy-policy-link:hover {
	color: var(--ssf-primary-strong);
}

body.ssf-login-page .message,
body.ssf-login-page .notice {
	border-left-color: var(--ssf-primary);
	background: var(--ssf-surface);
	color: var(--ssf-text);
}

/*
 * A refusal keeps TWO channels, and both are measured. The core prints this box BEFORE the form,
 * so its fill composes on the ivory of the page and not on the white of the card: a light tint
 * there lands at 1.1 to 1 and identifies nothing at all. The rule goes right round instead, at
 * 5 to 1 against the page, and the tint stays as the second, softer signal rather than the only
 * one.
 */
body.ssf-login-page #login_error,
body.ssf-login-page .notice-error {
	border: 1px solid var(--ssf-error);
	border-left-width: 4px;
	background: rgba(var(--ssf-error-rgb), 0.10);
	color: var(--ssf-text);
}

/* The control that reveals the password, inside the field, on the most exposed screen of three. */
body.ssf-login-page .button.wp-hide-pw {
	color: var(--ssf-brand-text);
}

body.ssf-login-page .button.wp-hide-pw:focus-visible {
	outline: 2px solid var(--ssf-primary);
	outline-offset: 0;
	box-shadow: none;
}

/*
 * The consent block of a demonstration trial, drawn inside the form of the core, under the two
 * password fields.
 *
 * It exists on this screen and on no other: a trial opened over the telephone has no journey
 * behind it, so the texts are read and accepted at the one moment its holder is alone in front of
 * us. Every rule below is anchored on the class of OURS that the brand already puts on the body,
 * for the same reason as the rules above it, and the block borrows the sixteen pixel floor and the
 * touch target token declared there rather than restating either.
 */

body.ssf-login-page .ssf-consent-login {
	margin-block-start: var(--ssf-space-5);
	padding-block-start: var(--ssf-space-4);
	border-block-start: 1px solid var(--ssf-border);
	font-size: var(--ssf-size-body);
	line-height: var(--ssf-leading-body);
	color: var(--ssf-text);
}

body.ssf-login-page .ssf-consent-login-title,
body.ssf-login-page .ssf-consent-login-subtitle {
	margin: 0 0 var(--ssf-space-2);
	font-family: var(--ssf-font-display);
	font-size: var(--ssf-size-h3);
	line-height: var(--ssf-leading-h3);
	color: var(--ssf-text);
}

body.ssf-login-page .ssf-consent-login-lead,
body.ssf-login-page .ssf-consent-login-note,
body.ssf-login-page .ssf-consent-login-help {
	margin: 0 0 var(--ssf-space-3);
	color: var(--ssf-text-muted);
}

body.ssf-login-page .ssf-consent-login-docs {
	margin: 0 0 var(--ssf-space-4);
	padding: 0;
	list-style: none;
}

/*
 * One line per text, and it wraps rather than truncates. A legal label runs long in five of the
 * six languages, and the card of this screen is three hundred and twenty pixels wide.
 */
body.ssf-login-page .ssf-consent-login-docs li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ssf-space-2);
}

/* The whole of the touch target, because this link is how a text is opened at all. */
body.ssf-login-page .ssf-consent-login-docs a {
	display: inline-flex;
	align-items: center;
	min-height: var(--ssf-tap);
	color: var(--ssf-brand-text);
}

body.ssf-login-page .ssf-consent-login-docs a:hover,
body.ssf-login-page .ssf-consent-login-docs a:focus {
	color: var(--ssf-primary-strong);
}

body.ssf-login-page .ssf-consent-login-version,
body.ssf-login-page .ssf-consent-login-served {
	font-size: var(--ssf-size-caption);
	color: var(--ssf-text-subtle);
}

/*
 * The box and its sentence stay side by side, and the sentence carries the target: a tick alone is
 * twenty pixels wide, which is under the thumb of nobody.
 */
body.ssf-login-page .ssf-consent-login-box {
	display: flex;
	align-items: flex-start;
	gap: var(--ssf-space-2);
	margin: 0 0 var(--ssf-space-3);
}

body.ssf-login-page .ssf-consent-login-tick {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-block-start: calc((var(--ssf-tap) - 20px) / 2);
}

body.ssf-login-page .ssf-consent-login-box label {
	display: flex;
	align-items: center;
	min-height: var(--ssf-tap);
	margin: 0;
	color: var(--ssf-text);
}

body.ssf-login-page .ssf-consent-login-field {
	margin: 0 0 var(--ssf-space-3);
}

body.ssf-login-page .ssf-consent-login-field label {
	display: block;
	margin-block-end: var(--ssf-space-1);
	color: var(--ssf-text);
}

/*
 * The same floor as the fields of the core above, written again here because a select is not one
 * of them: under sixteen pixels Safari on iOS zooms the page on focus and never zooms back out.
 */
body.ssf-login-page .ssf-consent-login-field select {
	width: 100%;
	min-height: var(--ssf-tap);
	font-size: max(16px, 1rem);
}

body.ssf-login-page .ssf-consent-login-pad {
	margin: 0 0 var(--ssf-space-3);
}

/*
 * The drawing surface. Its height is declared HERE and not on the element, because the script
 * measures the box and sizes the bitmap against it in device pixels: an attribute would fix the
 * bitmap and leave the box to be guessed at. touch-action is what makes a finger draw instead of
 * scrolling the screen away under it.
 */
body.ssf-login-page .ssf-consent-login-canvas {
	display: block;
	width: 100%;
	height: 160px;
	border: 1px solid var(--ssf-border-strong);
	border-radius: var(--ssf-radius-sm);
	background: var(--ssf-surface);
	touch-action: none;
}

body.ssf-login-page .ssf-consent-login-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ssf-space-2);
	margin: var(--ssf-space-2) 0 0;
}

body.ssf-login-page .ssf-consent-login-clear {
	min-height: var(--ssf-tap);
}

body.ssf-login-page .ssf-consent-login-state {
	color: var(--ssf-success-text);
}

/*
 * Two sentences that only ever appear when something is missing: the one the server prints for a
 * page with no script, and the one the browser gate writes while the button is held. Neither is a
 * refusal, so neither wears the red of one.
 */
body.ssf-login-page .ssf-consent-login-nopad,
body.ssf-login-page .ssf-consent-login-gate {
	margin: var(--ssf-space-2) 0 0;
	color: var(--ssf-text-muted);
}

/*
 * Two things WordPress 7.1 added to this screen and that no rule above names: the help button next
 * to "Remember me", with the bubble it opens, and the visible label of the language switcher at the
 * foot. The core draws both in its own greys and blue, a twenty four pixel button and a thirteen
 * pixel bubble, so they read as the only pieces of WordPress left on a branded screen. Nothing is
 * removed: the help text is the core's, and so is the way the bubble opens and closes.
 *
 * The core sheet of the tooltip loads before this one and its rules weigh the same or less, so the
 * selectors below win by order and specificity without any !important.
 */
body.ssf-login-page .wp-tooltip .wp-tooltip__toggle {
	min-width: var(--ssf-tap);
	min-height: var(--ssf-tap);
	color: var(--ssf-text-muted);
}

body.ssf-login-page .wp-tooltip .wp-tooltip__toggle:hover,
body.ssf-login-page .wp-tooltip .wp-tooltip__toggle:focus,
body.ssf-login-page .wp-tooltip .wp-tooltip__close:hover,
body.ssf-login-page .wp-tooltip .wp-tooltip__close:focus {
	color: var(--ssf-brand-text);
}

body.ssf-login-page .wp-tooltip .wp-tooltip__bubble {
	padding: var(--ssf-space-3) var(--ssf-space-4);
	border: 1px solid var(--ssf-border-strong);
	border-radius: var(--ssf-radius-sm);
	background: var(--ssf-surface);
	color: var(--ssf-text);
	font-family: var(--ssf-font-body);
	font-size: var(--ssf-size-small);
	line-height: var(--ssf-leading-small);
	box-shadow: var(--ssf-shadow-float);
}

/* The arrow under the bubble is two borders, one for the rule and one for the fill. */
body.ssf-login-page .wp-tooltip:not(.wp-is-tooltip) .wp-tooltip__bubble::before {
	border-top-color: var(--ssf-border-strong);
}

body.ssf-login-page .wp-tooltip:not(.wp-is-tooltip) .wp-tooltip__bubble::after {
	border-top-color: var(--ssf-surface);
}

/*
 * The close button sits in the corner of the bubble. It takes the whole touch target, flush with
 * the corner, and the text keeps clear of it by the same amount, less the padding of the bubble.
 */
body.ssf-login-page .wp-tooltip .wp-tooltip__close {
	top: 0;
	inset-inline-end: 0;
	width: var(--ssf-tap);
	height: var(--ssf-tap);
	color: var(--ssf-text-muted);
}

body.ssf-login-page .wp-tooltip:not(.wp-is-tooltip) .wp-tooltip__text {
	padding-inline-end: calc(var(--ssf-tap) - var(--ssf-space-4));
}

/*
 * The language switcher, outside the card. Its label is visible since 7.1, with an icon after it;
 * its list is a field like the others and takes the same sixteen pixel floor, for the same reason.
 */
body.ssf-login-page .language-switcher label {
	color: var(--ssf-text);
	font-size: var(--ssf-size-small);
}

body.ssf-login-page .language-switcher label .dashicons {
	color: var(--ssf-text-muted);
}

body.ssf-login-page #language-switcher-locales {
	min-height: var(--ssf-tap);
	border-color: var(--ssf-border-strong);
	background-color: var(--ssf-surface);
	color: var(--ssf-text);
	font-family: var(--ssf-font-body);
	font-size: max(16px, 1rem);
}

body.ssf-login-page .language-switcher .button {
	min-height: var(--ssf-tap);
}
