/* ============================================================================
   ScopeTrail — authentication pages (login, forgot / reset password)
   Depends on ./base.css for tokens, reset and primitives (.btn, .badge …).
   Same visual identity as the landing page and dashboard: ivory ground,
   Newsreader headings, coral accent, restrained borders + shadows.
   ============================================================================ */

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-topbar {
  padding: 22px clamp(18px, 5vw, 40px) 0;
}
.auth-topbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.auth-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 7vw, 72px) clamp(18px, 5vw, 40px);
}

.auth-card {
  width: 100%;
  max-width: 27rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(24px, 5vw, 40px);
}

.auth-card__eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.auth-card__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  font-size: clamp(1.6rem, 4.5vw, 2.05rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.auth-card__lead {
  margin: 10px 0 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.auth-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.auth-field__control {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  min-height: 46px;
  width: 100%;
}
.auth-field__control::placeholder {
  color: var(--ink-faint);
}
.auth-field__control:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-color: var(--accent-strong);
}
.auth-field__control[aria-invalid="true"] {
  border-color: var(--coral-deep);
  background: var(--coral-tint-soft);
}

/* Password field with an inline show/hide control */
.auth-field__password {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-field__password .auth-field__control {
  padding-right: 4.6rem;
}
.auth-reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  min-height: 34px;
  cursor: pointer;
}
.auth-reveal:hover {
  background: var(--accent-tint);
}
.auth-reveal:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

.auth-field__hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
  line-height: 1.45;
}
.auth-field__error {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--coral-deep);
  line-height: 1.45;
}
:root[data-theme="dark"] .auth-field__error,
:root:not([data-theme="light"]) .auth-field__error {
  color: var(--accent-ink);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.auth-actions .btn {
  width: 100%;
}

/* Page-level status / error banner above the form */
.auth-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 20px;
}
.auth-alert[data-tone="error"] {
  background: var(--warn-tint);
  border: 1px solid rgba(198, 136, 27, 0.32);
  color: var(--warn-ink);
}
.auth-alert[data-tone="success"] {
  background: var(--good-tint);
  border: 1px solid var(--coral-tint);
  color: var(--good-ink);
}
.auth-alert[data-tone="info"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
}
.auth-alert__icon {
  flex: 0 0 auto;
  font-weight: 700;
  font-family: var(--font-display);
}

.auth-links {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.88rem;
}
.auth-links a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 3px;
}
.auth-links a:hover {
  color: var(--ink);
}

.auth-note {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-faint);
  line-height: 1.55;
}

.auth-footer {
  padding: 20px clamp(18px, 5vw, 40px) 36px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.is-busy {
  cursor: progress;
}

@media (prefers-reduced-motion: no-preference) {
  .spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    vertical-align: -1px;
    margin-right: 6px;
  }
  @keyframes auth-spin {
    to {
      transform: rotate(360deg);
    }
  }
}
