/* Diario Fondeo - the login and first-account pages.
   Loaded after styles.css, which owns the tokens (--surface, --accent, ...)
   and the shared parts (.card, .field, .btn, .hint, .form-error, .env-badge).
   Nothing here names a colour: both themes come from the tokens.

   There is no header or nav before a session exists, so the card carries the
   header's own chrome: a band on --surface-2 with the name, the environment
   badge and the one-line description, then the form below it. */

.login-body {
  min-height: 100vh;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  /* A touch above centre reads as centred; true centre looks low. */
  padding: 1.5rem 1rem 3.5rem;
}

.login-card {
  width: min(100%, 25rem);
  padding: 0;
  overflow: clip;
  box-shadow: var(--shadow-md);
}

/* --- brand band ------------------------------------------------------------ */

.login-card .brand {
  padding: 1.2rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* The environment badge is injected after the title; it sits under it. */
.login-card .env-badge {
  margin-top: 0.35rem;
  margin-right: 0.5rem;
}

/* In dev the band at the top of the page already says DESARROLLO; the card
   does not repeat it. Prod has no band, so there the badge is the marker. */
body[data-environment="dev"] .login-card .env-badge {
  display: none;
}

.login-card .brand-sub {
  margin-top: 0.15rem;
}

/* --- body ------------------------------------------------------------------ */

.login-main {
  display: grid;
  gap: 1.15rem;
  padding: 1.5rem 1.5rem 1.7rem;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.login-hint {
  margin-top: 0.4rem;
  max-width: 44ch;
  color: var(--text-2);
  font-size: 0.88rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-form input {
  width: 100%;
}

.login-form input[aria-invalid="true"] {
  border-color: var(--negative);
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 0.15rem;
}

/* --- messages -------------------------------------------------------------- */

/* Session ended: information, not failure. Calm warm tint, no alarm. */
.login-notice {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.86rem;
  font-weight: 560;
}

.login-notice[hidden],
.login-form .form-error[hidden] {
  display: none;
}

/* Too many attempts: the account is fine, the person only has to wait, so it
   reads as a pause (warn) and not as a wrong answer (negative). */
.login-form .form-error[data-tone="warn"] {
  background: var(--warn-soft);
  color: var(--warn);
}

/* --- submitting ------------------------------------------------------------ */

.login-submit[aria-busy="true"]::before {
  content: "";
  width: 0.95em;
  height: 0.95em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit[aria-busy="true"]::before {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.55;
  }
}

/* --- phone ------------------------------------------------------------------ */

@media (max-width: 480px) {
  .login-page {
    place-items: start center;
    padding: 1rem 0.75rem 2rem;
  }

  .login-main {
    padding: 1.25rem 1.15rem 1.4rem;
  }

  .login-card .brand {
    padding: 1rem 1.15rem;
  }

  /* 16px keeps iOS from zooming the page when a field takes focus. */
  .login-form input {
    font-size: 16px;
  }
}

/* The invitation page: a link that does not work says one thing, whatever the reason. */
.invite-invalid {
  display: grid;
  gap: 1rem;
}

.invite-invalid p {
  color: var(--text);
  text-wrap: pretty;
}
