/* The login page's own surface.
 *
 * Deliberately separate from `shell.css`: the login document does not load the app bundle or its
 * layout, and pulling the whole shell in for one card would couple a page that must keep working
 * to every future change in the workspace grammar.
 *
 * Every value here is a token from `tokens.css`. Nothing is hard-coded — a brand change has to
 * reach this page too, and the way that stays true is by never writing a literal.
 *
 * Note that `tokens.css` is not only tokens: it also styles `body` with the app shell's layout
 * (`display: grid`, `height: 100svh`, `overflow: hidden`). Any second document that loads it
 * inherits that, so `.auth-body` below undoes it explicitly rather than fighting it with
 * specificity. The font comes from the same block and is deliberately not restated here.
 */

.auth-body {
  /* Undo the app-shell layout `tokens.css` applies to every `body`. A login card is one column
     that may scroll on a short viewport; the app is a fixed two-row grid that never does. */
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow: auto;
  margin: 0;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--mat-document);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 32px 28px;
  box-sizing: border-box;
}

.auth-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-mark {
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-eyebrow {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.375rem;
  line-height: 1.35;
}

.auth-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.auth-step {
  display: grid;
  gap: 16px;
}

/* `display: grid` above beats the user agent's `[hidden] { display: none }`, so without this every
   step renders at once and the page shows the email, code and password fields together. Caught by
   looking at the page in a browser; no unit test on this file would have seen it. */
.auth-step[hidden] {
  display: none;
}

.auth-field {
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-field input {
  font: inherit;
  color: var(--text);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--mat-sheet);
  /* 16px stops iOS Safari zooming the viewport when the field takes focus. */
  font-size: 1rem;
}

.auth-field input:focus-visible,
.auth-primary:focus-visible,
.auth-ghost:focus-visible {
  outline: 2px solid var(--color-brand-500);
  outline-offset: 2px;
}

.auth-field input[aria-invalid="true"] {
  border-color: var(--red);
}

.auth-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-primary {
  font: inherit;
  font-weight: 600;
  /* 44px min target: this is the one control on the page and it is used on a phone. */
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-cta);
  background: var(--cta-fill);
  color: var(--text-on-brand);
  cursor: pointer;
}

.auth-primary:disabled {
  opacity: 0.55;
  cursor: progress;
}

.auth-ghost {
  font: inherit;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.auth-status {
  margin: 16px 0 0;
  font-size: 0.875rem;
}

.auth-status[data-kind="error"] {
  color: var(--red);
}

.auth-status[data-kind="pending"] {
  color: var(--muted);
}

/* The disclosure the person is agreeing to by signing in. It says the same thing the consent
 * sheet says, because decision D3 made the old "only you can read this" false and a login page
 * that stays quiet about it is the same misstatement one screen earlier. */
.auth-boundary {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
