/* Login page (/login): the home hero's dark slate and floating dots around a white form card.
   Loads after home.css. */

.auth-body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  color: var(--white);
}

/* The dots (particles.js) sit on a layer fixed to the screen, so they stay put while the page
   scrolls. 100vh is the tallest the screen gets, so a phone's browser bars sliding away do not
   resize the layer and scatter the dots. */
.auth-backdrop { position: fixed; inset: 0 0 auto; height: 100vh; z-index: 0; pointer-events: none; }
.auth-header, .auth, .auth-footer { position: relative; z-index: 1; }

.auth-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.auth-header .link-arrow { flex: none; white-space: nowrap; color: var(--on-dark-muted); }
.auth-header .link-arrow:hover { color: var(--white); }

.auth { flex: 1; display: grid; align-items: center; padding: 24px 0 48px; }
.auth-grid { display: grid; gap: 48px; align-items: center; }

.auth-intro { display: grid; gap: 14px; max-width: 560px; }
.auth-intro-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.3;
  color: var(--white);
}
.auth-intro .hero-lead { color: var(--on-dark-muted); }
.auth-points { display: grid; gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; }
.auth-points li { display: flex; align-items: center; gap: 14px; color: var(--white); }
.auth-point-icon {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--line-dark);
  color: var(--on-dark-accent);
}

.auth-card { color: var(--ink); position: relative; width: 100%; max-width: 440px; padding: 36px 32px 28px; box-shadow: inset 0 0 0 1px var(--line), 0 30px 60px -36px rgba(11, 22, 51, 0.4); }
/* Accent rule across the top of the card, in the brand indigo. */
.auth-card::before {
  content: "";
  position: absolute; inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-2) 60%, var(--on-dark-accent));
}
.auth-card-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.9rem; line-height: 1.35; color: var(--ink); }
.auth-card-lead { margin: 4px 0 24px; }

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field-label { font-size: 0.92rem; font-weight: 500; color: var(--ink); transition: color 160ms; }
.field:focus-within .field-label { color: var(--indigo); }
.field-control { position: relative; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid rgba(11, 22, 51, 0.2); border-radius: 6px;
  background: var(--white); color: var(--ink);
  font: inherit;
  transition: border-color 160ms, box-shadow 160ms;
}
.input:hover { border-color: rgba(11, 22, 51, 0.35); }
.input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(86, 84, 196, 0.2); }
.input-password { padding-right: 52px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer;
  transition: color 160ms;
}
.password-toggle:hover { color: var(--indigo); }
.password-toggle [hidden] { display: none; }

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; margin-bottom: 14px; border-radius: 6px;
  font-size: 0.92rem; line-height: 1.55;
}
.alert[hidden] { display: none; }
.alert .icon { margin-top: 0.15em; }
.alert-error { background: #fbeef0; color: #9b1c2c; box-shadow: inset 0 0 0 1px rgba(180, 35, 53, 0.22); }
.alert-warn { background: #fdf5e1; color: #6f4b00; box-shadow: inset 0 0 0 1px rgba(176, 124, 0, 0.28); }
.field-note { margin: 4px 0 0; }

.btn-block {
  width: 100%; margin-top: 8px;
  background-image: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  box-shadow: 0 10px 22px -14px rgba(59, 58, 143, 0.9);
  transition: transform 180ms var(--ease-out), box-shadow 180ms, filter 180ms;
}
/* .btn-primary:hover sets the background shorthand, which would drop the gradient. */
.auth-card .btn-block:hover {
  background-image: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  filter: brightness(1.1);
  box-shadow: 0 14px 26px -14px rgba(59, 58, 143, 0.95);
}
.auth-help { margin-top: 18px; font-size: 0.875rem; color: var(--muted); text-align: center; }

/* Card shown after signing in (/login/welcome): who signed in and as what, then on to /dashboard.
   The bar under the button fills over the same --welcome-ms the page waits before moving on. */
.auth-welcome { text-align: center; }
.auth-welcome-check {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: #eceefb; color: var(--indigo);
}
.auth-welcome-check .icon { width: 28px; height: 28px; stroke-width: 2.2; }
.auth-welcome-name {
  margin-top: 6px;
  font-family: var(--font-serif); font-weight: 600; font-size: 1.5rem; line-height: 1.4;
  color: var(--ink); overflow-wrap: anywhere;
}
.auth-welcome-role {
  display: inline-block; margin: 10px 0 26px; padding: 4px 14px; border-radius: 999px;
  background: #eceefb; color: var(--indigo); font-size: 0.95rem; font-weight: 600;
}
.auth-welcome-timer { height: 3px; margin-top: 16px; border-radius: 3px; background: rgba(11, 22, 51, 0.08); overflow: hidden; }
.auth-welcome-timer span {
  display: block; height: 100%; background: var(--indigo-2);
  transform-origin: left; animation: welcome-timer var(--welcome-ms) linear both;
}
@keyframes welcome-timer { from { transform: scaleX(0); } }

.auth-footer { padding: 20px var(--gutter) 28px; font-size: 0.85rem; color: var(--on-dark-muted); text-align: center; }

/* Entrance; CSS only, so the form never depends on a script to become visible. */
.auth-in { animation: auth-in 800ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes auth-in { from { opacity: 0; transform: translateY(16px); } }

@media (min-width: 900px) {
  .auth-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 72px; }
  .auth-card { justify-self: end; }
}
@media (max-width: 899px) {
  /* Surveyors sign in on phones: the form stands alone in the middle of the screen. */
  .auth-intro { display: none; }
  .auth { padding: 16px 0; }
  .auth-card { margin: 0 auto; }
}
@media (max-width: 419px) {
  .auth-card { padding: 28px 20px 22px; }
}
