/*
 * Branded wp-login.php screen.
 *
 * Loaded only on the login/lost-password/reset screens via the
 * 'login_enqueue_scripts' hook in functions.php. theme.css is deliberately
 * NOT loaded here — it carries Tailwind Preflight, which would strip the
 * styling WordPress core relies on for the login form. So the brand tokens
 * are redeclared below rather than inherited.
 *
 * Keep these values in sync with :root in src/input.css.
 */

:root {
  --brand-50:  #f4f5f0;
  --brand-100: #dde4d3;
  --brand-400: #a3b88f;
  --brand-500: #96ab80;
  --brand-600: #8ea172;
  --brand-700: #7a8d62;
  --brand-900: #3d4f34;
  --dark:      #202020;
  --offwhite:  #d5d2cd;
}

/* ── Page ──────────────────────────────────────────────────────────────── */

body.login {
  background-color: var(--brand-900);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

/* WordPress centres #login with its own margins; neutralise them so the
   flex centring above governs, then cap the width. */
body.login #login {
  width: 100%;
  max-width: 25rem;
  margin: 0;
  padding: 0;
}

/* ── Logo ──────────────────────────────────────────────────────────────── */

/* Re-Connect-Logo.png is the WHITE-on-transparent variant, which is why it
   sits on the green field rather than on the card. */
body.login h1 {
  margin: 0 0 1.75rem;
}

body.login h1 a {
  background-image: url('../images/Re-Connect-Logo.png');
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  width: 100%;
  height: 5rem;
  margin: 0;
  padding: 0;
  font-size: 0;
  text-indent: -9999px;
  outline-offset: 4px;
}

/* ── Card ──────────────────────────────────────────────────────────────── */

body.login form {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: .75rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / .18);
  padding: 1.75rem 1.75rem 1.5rem;
  margin: 0;
}

body.login form p {
  margin-bottom: 1rem;
}

body.login label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: .375rem;
}

/* ── Fields — mirrors .research-form inputs in src/input.css ───────────── */

body.login input[type="text"],
body.login input[type="password"],
body.login input[type="email"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: .375rem;
  background-color: #fff;
  padding: .625rem .75rem;
  font-size: .9375rem;
  font-family: inherit;
  color: #0f172a;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
  transition: border-color .15s, box-shadow .15s;
}

body.login input[type="text"]:focus,
body.login input[type="password"]:focus,
body.login input[type="email"]:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 1px var(--brand-500);
}

/* Show/hide password toggle sits inside the field wrapper. */
body.login .wp-pwd {
  position: relative;
}

body.login .wp-pwd input[type="password"],
body.login .wp-pwd input[type="text"] {
  padding-right: 2.75rem;
}

body.login .wp-pwd .button.wp-hide-pw {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 2.75rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #64748b;
}

body.login .wp-pwd .button.wp-hide-pw:hover {
  color: var(--brand-700);
}

body.login .wp-pwd .button.wp-hide-pw:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: -2px;
  box-shadow: none;
}

/* ── "Remember me" ─────────────────────────────────────────────────────── */

/* WordPress 7.1 renders the checkbox, its label and a help tooltip as three
   siblings inside p.forgetmenot — so the row is laid out here rather than on
   the label, and the label's global display:block is undone. */
body.login .forgetmenot {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

body.login .forgetmenot label {
  display: inline;
  font-size: .8125rem;
  font-weight: 400;
  color: #475569;
  margin-bottom: 0;
}

/* Help toggletip beside "Remember Me" (core, 7.1+). */
body.login .wp-tooltip__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  color: #94a3b8;
  cursor: pointer;
  transition: color .15s;
}

body.login .wp-tooltip__toggle:hover {
  color: var(--brand-700);
}

body.login .wp-tooltip__toggle:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: .125rem;
}

body.login .wp-tooltip__toggle .dashicons {
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
}

body.login input[type="checkbox"] {
  accent-color: var(--brand-700);
  width: 1rem;
  height: 1rem;
  margin: 0;
}

body.login input[type="checkbox"]:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ── Submit ────────────────────────────────────────────────────────────── */

body.login .button-primary,
body.login #wp-submit {
  display: block;
  width: 100%;
  float: none;
  background: var(--brand-900);
  border: 0;
  border-radius: .5rem;
  color: #fff;
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
  padding: .75rem 1.25rem;
  text-align: center;
  text-shadow: none;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .15s;
}

body.login .button-primary:hover,
body.login #wp-submit:hover {
  background: var(--brand-700);
}

body.login .button-primary:focus-visible,
body.login #wp-submit:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Links below the card ──────────────────────────────────────────────── */

body.login #nav,
body.login #backtoblog,
body.login .privacy-policy-page-link {
  text-align: center;
  padding: 0;
  margin: 1rem 0 0;
}

body.login #nav a,
body.login #backtoblog a,
body.login .privacy-policy-page-link a {
  color: var(--offwhite);
  font-size: .8125rem;
  text-decoration: none;
  transition: color .15s;
}

body.login #nav a:hover,
body.login #backtoblog a:hover,
body.login .privacy-policy-page-link a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.login #nav a:focus-visible,
body.login #backtoblog a:focus-visible,
body.login .privacy-policy-page-link a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: .125rem;
}

/* The submit paragraph carries core margins that double up on the card. */
body.login p.submit {
  margin-bottom: 0;
}

/* ── Messages & errors ─────────────────────────────────────────────────── */

body.login .message,
body.login .notice,
body.login #login_error {
  border-radius: .5rem;
  border-left-width: 4px;
  font-size: .875rem;
  padding: .75rem 1rem;
  margin: 0 0 1.25rem;
  box-shadow: 0 4px 12px rgb(0 0 0 / .12);
}

body.login .message,
body.login .notice {
  border-left-color: var(--brand-600);
  background: var(--brand-50);
  color: var(--brand-900);
}

body.login #login_error {
  border-left-color: #b91c1c;
  background: #fef2f2;
  color: #7f1d1d;
}

body.login #login_error a,
body.login .message a {
  color: var(--brand-900);
}

/* ── Small screens ─────────────────────────────────────────────────────── */

@media (max-width: 30rem) {
  body.login {
    padding: 1.5rem 1rem;
  }

  body.login form {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  body.login h1 a {
    height: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.login *,
  body.login *::before,
  body.login *::after {
    transition: none !important;
  }
}
