/**
 * AMCHP login skin — built from the portal design prototype.
 *
 * Palette and metrics are lifted from the prototype's :root, not invented.
 * The markup is core wp-login.php; everything below either styles what
 * WordPress already outputs or positions the two blocks injected via the
 * login_form hook. #loginform is the card, so it survives an error notice
 * appearing above it.
 */

.amchp-login {
	--navy: #192F59;
	--navy-deep: #11213F;
	--teal: #008BAE;
	--teal-dark: #00647E;
	--red: #AB0535;
	--gold: #EBAC20;
	--ink: #22262B;
	--ink-2: #4A515C;
	--ink-3: #6E747C;
	--page: #EDF0F1;
	--card: #FFFFFF;
	--line: #DCE1E1;
	--line-2: #EDF0F0;
	--field: #D5DBDB;
	--r: 8px;
	--r-lg: 12px;

	background: var(--page);
	color: var(--ink);
	/* The prototype centres the card in the viewport; WordPress top-aligns it.
	   Auto margins rather than justify-content:center, because auto margins
	   never clip the top of the content when it outgrows a short window. */
	/* Core's login stylesheet pins body to height:100%, so anything taller than the window
	   overflows the page instead of growing it, and the strip at the foot of the page
	   would then sit on top of the last lines. */
	height: auto;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	/* The silhouette strip lives at the foot of the page, not the window, so it can
	   never sit on top of the links above it. The padding reserves its room. */
	position: relative;
	box-sizing: border-box;
	padding-bottom: 100px;
	font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* Tri-colour rule across the top. */
.amchp-login::before {
	content: '';
	position: fixed;
	inset: 0 0 auto 0;
	height: 12px;
	background: linear-gradient(90deg, var(--navy) 0 66%, var(--red) 66% 83%, var(--gold) 83% 100%);
	z-index: 3;
}

/* Silhouette strip along the bottom, from the prototype. */
.amchp-login::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 78px;
	opacity: .16;
	pointer-events: none;
	background-image: var(--amchp-silhouette);
	background-repeat: repeat-x;
	background-position: left bottom;
	background-size: auto 78px;
	z-index: 0;
}

.amchp-login #login {
	position: relative;
	z-index: 1;
	width: 396px;
	max-width: calc(100vw - 40px);
	padding: 34px 0 0;
	/* Core sets `#login { margin: auto }` on all four sides. Overriding only
	   margin-top left core's auto bottom margin absorbing a share of the free
	   space, which pushed the help text away from the card. */
	margin: auto auto 0;
}

/* The password screens have no help text under the card, so there is nothing for
   the bottom margin to share the free space with: centre the card instead of
   leaving it at the foot of the window. */
.amchp-login:not(.login-action-login) #login { margin: auto; }

/* --- Logo, above the card ---------------------------------------------- */

.amchp-login h1 a {
	width: 100%;
	/* Sized so the mark fills the 396px column: 751x209 source at 3.593:1
	   needs 110px of height. Still a downscale on a 2x display (792 device px
	   against 751 of source), so it stays sharp. */
	height: 110px;
	margin: 0 auto 20px;
	background-size: contain;
	background-position: center center;
	background-repeat: no-repeat;
}

/* --- The card ----------------------------------------------------------- */

.amchp-login #loginform,
.amchp-login #lostpasswordform,
.amchp-login #resetpassform {
	display: flex;
	flex-direction: column;
	background: var(--card);
	border: 1px solid var(--line);
	border-top: 3px solid var(--gold);
	border-radius: var(--r-lg);
	padding: 24px;
	box-shadow: none;
}

/* Injected heading block sits first regardless of DOM position. */
.amchp-login .amchp-head {
	order: 0;
	/* Padding, not margin: core's `.login form p { margin-bottom: 0 }` wins the
	   cascade against a margin on the subtitle. */
	padding-bottom: 22px;
}
.amchp-login #loginform > p:not(.submit):not(.forgetmenot),
.amchp-login #lostpasswordform > p,
.amchp-login #resetpassform > p { order: 1; }
.amchp-login .user-pass-wrap,
.amchp-login #resetpassform .user-pass { order: 2; }
.amchp-login .forgetmenot { order: 3; }
.amchp-login .submit { order: 4; }
.amchp-login .amchp-first { order: 10; }

.amchp-login .amchp-head h2 {
	font-family: inherit;
	font-size: 22px;
	/* 600 rather than the prototype's 400: a sans needs the extra weight to
	   hold the same presence the serif had at this size. */
	font-weight: 600;
	letter-spacing: -0.01em;
	text-align: center;
	color: var(--navy);
	margin: 0;
	padding: 0;
}

.amchp-login .amchp-head p {
	font-size: 12.5px;
	color: var(--ink-3);
	text-align: center;
	margin: 5px 0 0;
}

/* Core sets `box-shadow: 0 1px 3px rgba(0,0,0,.04)` on `.login form`. The
   card rules above already clear it for the three known form IDs; this covers
   any other form the login screen might render, so no pure black leaks in. */
.amchp-login form { box-shadow: none; }

/* --- Fields -------------------------------------------------------------- */

.amchp-login form label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 5px;
	color: var(--navy);
}

.amchp-login input[type='text'],
.amchp-login input[type='email'],
.amchp-login input[type='password'] {
	width: 100%;
	font: inherit;
	font-size: 14px;
	border: 1px solid var(--field);
	border-radius: var(--r);
	padding: 10px 12px;
	background: var(--card);
	color: var(--ink);
	box-shadow: none;
	margin: 0;
}

.amchp-login input[type='text']:focus,
.amchp-login input[type='email']:focus,
.amchp-login input[type='password']:focus {
	outline: 2px solid var(--teal);
	outline-offset: 1px;
	border-color: transparent;
	box-shadow: none;
}

.amchp-login #loginform > p,
.amchp-login .user-pass-wrap { margin-bottom: 13px; }

/* Core's show/hide-password button, kept usable inside the rounded field. */
.amchp-login .wp-pwd { position: relative; }
.amchp-login .wp-pwd input[type='password'],
.amchp-login .wp-pwd input[type='text'] { padding-right: 42px; }
/* top/bottom:0 with height:auto centres it whatever height core assigns. */
.amchp-login button.wp-hide-pw {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 4px;
	height: auto;
	min-height: 0;
	width: auto;
	transform: none;
	display: flex;
	align-items: center;
	padding: 0 8px;
	color: var(--ink-3);
	background: transparent;
	border: 0;
	box-shadow: none;
}
.amchp-login button.wp-hide-pw:hover { color: var(--teal-dark); }
.amchp-login button.wp-hide-pw:focus-visible { outline: 2px solid var(--teal); }

/* --- Primary action ------------------------------------------------------ */

.amchp-login .button-primary {
	width: 100%;
	float: none;
	display: block;
	background: var(--teal);
	border: 1px solid var(--teal);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	padding: 11px;
	height: auto;
	border-radius: var(--r);
	margin-top: 6px;
	text-shadow: none;
	box-shadow: none;
	transition: filter .12s ease;
}

.amchp-login .button-primary:hover { filter: brightness(1.08); }
.amchp-login .button-primary:active { filter: brightness(.96); }

.amchp-login .button-primary:focus-visible,
.amchp-login a:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 2px;
}

.amchp-login .forgetmenot label {
	display: inline;
	font-size: 12px;
	font-weight: 400;
	color: var(--ink-2);
}

/* Core ships a help toggletip beside Remember Me; size and colour it so it
   reads as part of the form rather than a stray glyph. */
.amchp-login .forgetmenot { display: flex; align-items: center; gap: 6px; }
.amchp-login .forgetmenot input[type='checkbox'] { margin: 0; }
.amchp-login .wp-tooltip__toggle {
	display: inline-flex;
	align-items: center;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ink-3);
	cursor: pointer;
}
.amchp-login .wp-tooltip__toggle:hover { color: var(--teal-dark); }
.amchp-login .wp-tooltip__toggle .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* --- "First time here?" -------------------------------------------------- */

.amchp-login .amchp-first {
	border-top: 1px solid var(--line-2);
	margin-top: 18px;
	padding-top: 16px;
}

.amchp-login .amchp-first b {
	display: block;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--navy);
	margin-bottom: 4px;
}

.amchp-login .amchp-first p {
	font-size: 11.5px;
	color: var(--ink-2);
	line-height: 1.5;
	margin: 0 0 9px;
}

.amchp-login .amchp-first a {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	color: var(--teal-dark);
	text-decoration: none;
	border: 1px solid var(--field);
	border-radius: var(--r);
	padding: 7px 14px;
}

.amchp-login .amchp-first a:hover {
	border-color: var(--teal);
	color: var(--teal);
}

/* --- Links and footer ---------------------------------------------------- */

.amchp-login #nav,
.amchp-login #backtoblog {
	text-align: center;
	padding: 0;
	margin: 14px 0 0;
}

.amchp-login #nav a,
.amchp-login #backtoblog a,
.amchp-login .amchp-alt a {
	color: var(--teal-dark);
	font-size: 11.5px;
	text-decoration: none;
}

.amchp-login #nav a:hover,
.amchp-login #backtoblog a:hover,
.amchp-login .amchp-alt a:hover { text-decoration: underline; }

.amchp-login .amchp-alt {
	position: relative;
	z-index: 1;
	width: 396px;
	max-width: calc(100vw - 40px);
	margin: 16px auto auto;
	padding-bottom: 8px;
	text-align: center;
	font-size: 11.5px;
	color: var(--ink-3);
	line-height: 1.6;
}

/* --- Messages ------------------------------------------------------------ */

.amchp-login #login .notice,
.amchp-login #login_error,
.amchp-login .message {
	border-radius: var(--r);
	border-left-width: 4px;
	font-size: 12.5px;
	padding: 11px 13px;
	box-shadow: none;
	margin-bottom: 16px;
}

.amchp-login #login_error { border-left-color: var(--red); }
.amchp-login .message { border-left-color: var(--teal); }

/* --- Small screens ------------------------------------------------------- */

@media screen and (max-width: 420px) {
	.amchp-login #login { padding: 26px 0 0; }
	.amchp-login { padding-bottom: 76px; }
	.amchp-login::after { height: 60px; background-size: auto 60px; }
}

@media (prefers-reduced-motion: reduce) {
	.amchp-login .button-primary { transition: none; }
}
