/* ============================================================
   AUTH PAGES
   All selectors scoped to .auth-page so styles cannot leak.
   Depends on tokens.css being loaded first.
   ============================================================ */

/* --- Page shell -------------------------------------------- */

.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  /* Warm paper — matches the rest of the site; the card reads as raised via
     its border, green bottom edge, and shadow. */
  background-color: var(--page);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Main centered area ------------------------------------ */

.auth-page .auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  padding: 48px 20px 32px;
  width: 100%;
  box-sizing: border-box;
}

/* --- Wordmark ---------------------------------------------- */

.auth-page .auth-wordmark {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 30px;
  text-align: center;
}

.auth-page .auth-wordmark a {
  color: inherit;
  text-decoration: none;
}

.auth-page .auth-wordmark a:hover {
  color: var(--accent);
}

/* --- Card -------------------------------------------------- */

.auth-page .auth-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  /* Green bottom edge — matches the home page masthead card */
  border-bottom: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

/* --- Heading & descriptive text ---------------------------- */

.auth-page .auth-title {
  font-family: var(--body);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.auth-page .auth-subtitle {
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.auth-page .auth-fineprint {
  font-family: var(--body);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-faint);
  margin: 10px 0 0;
}

.auth-page .auth-fineprint a.auth-link {
  font-size: inherit;
}

/* --- Form layout ------------------------------------------- */

.auth-page .auth-form {
  margin: 0;
}

.auth-page .auth-field {
  margin-bottom: 16px;
}

/* --- Labels ------------------------------------------------ */

.auth-page .auth-label {
  display: block;
  font-family: var(--body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

/* --- Inputs & select --------------------------------------- */

.auth-page .auth-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 12px;
  /* Transition border + shadow for focus ring */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.auth-page .auth-input::placeholder {
  color: var(--ink-faint);
}

.auth-page .auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.auth-page .auth-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-page .auth-input:focus:not(:focus-visible) {
  outline: none;
}

/* Select gets a small disclosure chevron via background-image */
.auth-page select.auth-input {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

/* --- Primary button ---------------------------------------- */
/*
   Must render identically on <button>, <input type="submit">, and <a>.
   Green by default, darker green on hover — matches the editorial home
   page CTA (.ed-btn).
*/

.auth-page .auth-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 13px 24px;
  background: var(--accent);
  color: #fff;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  /* Reset browser defaults that affect <button> / <input type="submit"> */
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.auth-page .auth-btn:hover,
.auth-page .auth-btn:focus {
  background: var(--accent-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.28);
}

.auth-page .auth-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-page .auth-btn:focus:not(:focus-visible) {
  outline: none;
}

/* --- Links ------------------------------------------------- */

.auth-page .auth-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-page .auth-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* "Forgot password?" — sits between the last field and the button */
.auth-page .auth-forgot {
  display: block;
  text-align: right;
  font-family: var(--body);
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: -4px;   /* intentionally coupled to .auth-field's 16px bottom margin — pulls the link flush below the last field */
  margin-bottom: 4px; /* breathing room before the button */
}

.auth-page .auth-forgot:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* "No account? …" — centered secondary line */
.auth-page .auth-alt {
  font-family: var(--body);
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 20px 0 0;
}

.auth-page .auth-alt .auth-link {
  font-size: inherit;
}

/* --- Error container --------------------------------------- */

.auth-page .auth-error {
  display: block;
  background: rgba(var(--danger-rgb), 0.08);
  border-left: 3px solid var(--danger);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.auth-page .auth-error p {
  font-family: var(--body);
  font-size: 0.875rem;
  color: var(--danger);
  line-height: 1.45;
  margin: 0;
}

.auth-page .auth-error p + p {
  margin-top: 4px;
}

.auth-page .auth-error .auth-link {
  color: var(--danger);
  font-weight: 700;
}

.auth-page .auth-error .auth-link:hover {
  color: var(--danger);
}

/* --- Responsive -------------------------------------------- */

/* Narrow screens: tighten card padding */
@media (max-width: 480px) {
  .auth-page .auth-main {
    padding: 32px 16px 24px;
    justify-content: flex-start;
  }

  .auth-page .auth-card {
    padding: 28px 20px 22px;
    border-radius: 8px;
  }

  .auth-page .auth-title {
    font-size: 1.45rem;
  }
}

/* Very narrow: minimal chrome, still readable */
@media (max-width: 360px) {
  .auth-page .auth-card {
    padding: 22px 16px 18px;
  }

  .auth-page .auth-wordmark {
    font-size: 1.6rem;
  }
}

/* --- Reduced motion ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .auth-page .auth-btn,
  .auth-page .auth-input,
  .auth-page .auth-wordmark a,
  .auth-page .auth-link {
    transition: none;
  }

  .auth-page .auth-btn:hover,
  .auth-page .auth-btn:focus {
    transform: none;
  }
}
