/* Login / signup / bootstrap page. Reuses dashboard.css's :root tokens
   (--accent, --card-bg, --border, --radius, --font-sans, ...) — this file
   only adds the centered-card layout those tokens don't already cover. */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  padding: 24px;
}

.login-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Centered, not left-aligned: the logo is the card's masthead, so it sits
   on the card's own centre line rather than hanging off the left edge. */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* .preview-badge lives in dashboard.css — /legal uses it too and loads
   dashboard.css but not this file. */

.login-tagline {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.login-loading {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
}

.login-form input {
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--fg);
}

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

.btn-primary {
  margin-top: 4px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-link {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
}
.btn-link:hover { text-decoration: underline; }

.login-error {
  margin: 0;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.login-notice {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* The one-time code: wide tracking so six digits are easy to check against
   the email before submitting. */
#verify-code-form input[name="code"] {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
}

#code-restart {
  align-self: center;
  text-align: center;
}

.login-invite {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

/* nowrap so the address breaks onto its own line rather than mid-word */
.login-invite a { color: var(--accent); white-space: nowrap; }

.login-disclaimer {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ---------- small print under the card ----------
   Deliberately outside .login-card and deliberately tiny: copyright plus
   the four company-level documents, mirroring dlyog.com's own footer
   without competing with the sign-in form. */

.site-footer {
  width: 100%;
  max-width: 620px;
  text-align: center;
  padding: 0 4px;
}

.site-footer p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer-copy { font-size: 11px; }

.site-footer-links {
  font-size: 11.5px;
}

.site-footer-links a {
  color: var(--accent);
  margin: 0 2px;
  white-space: nowrap;
}

.site-footer-links a:hover { text-decoration: underline; }


/* ---------- colour-grid challenge ----------
   Shown before a sign-in code is emailed, so a script can't hammer the mail
   server. The answer is verified server-side; this is only the interface. */

.challenge-prompt {
  margin: 4px 0 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.challenge-cell {
  aspect-ratio: 1 / 1;
  /* Every cell keeps a border: the white squares would otherwise be
     invisible against the modal's white card. */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  /* Large enough to be an easy tap target on a phone. */
  min-height: 44px;
}

/* An accent ring *outside* the cell, so focus reads the same on a black
   square as on a white one. */
.challenge-cell:hover,
.challenge-cell:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#challenge-refresh {
  align-self: flex-start;
  font-size: 12px;
}

/* The challenge modal reuses dashboard.css's .modal-overlay / .modal-card. */
.challenge-card {
  max-width: 360px;
}

.challenge-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.challenge-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.challenge-actions .btn-link { padding: 0; }

/* ---------- responsive: phone, short screens, tablet ----------
   Measured problem this fixes: at 375x667 (iPhone SE and anything smaller)
   the card alone was taller than the viewport, pushing the disclaimer and
   footer 190px below the fold. Nothing was broken — it scrolled — but a
   sign-in form should fit on the screen it's being used on. */

@media (max-width: 560px) {
  .login-body {
    padding: 16px 12px;
    /* flex-start, not center: a card taller than the viewport centred in a
       flex container has its top clipped and cannot be scrolled back to.
       `auto` margins keep it centred whenever it does fit. */
    align-items: flex-start;
  }

  .login-shell { margin: auto 0; gap: 14px; }

  .login-card {
    max-width: 100%;
    padding: 22px 18px;
    gap: 12px;
  }

  .brand-logo-lg { height: 38px; }

  .login-tagline { font-size: 12.5px; }
  .login-form-note { font-size: 12px; padding: 7px 9px; }
  .login-disclaimer { font-size: 11px; padding-top: 10px; }
  .site-footer-links a { display: inline-block; }
}

/* Short screens (landscape phones, small laptops) — trim vertical rhythm
   rather than width, since height is what's scarce. */
@media (max-height: 700px) {
  .login-body { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
  .login-shell { margin: auto 0; }
  .login-card { padding: 18px; gap: 10px; }
  .brand-logo-lg { height: 34px; }
  .login-tagline { display: none; }  /* the note below already explains the flow */
}

/* Tablet: the card was pinned to 400px on an 820px screen, leaving a wide
   empty band. A little more width reads as deliberate rather than stranded. */
@media (min-width: 561px) and (max-width: 1024px) {
  .login-card { max-width: 460px; }
  .site-footer { max-width: 560px; }
}

/* The challenge modal has to fit a phone too — 4 columns of 44px plus gaps
   and card padding is right at the edge of a 320px screen. */
@media (max-width: 400px) {
  .challenge-card { padding: 18px 14px; }
  .challenge-grid { gap: 5px; }
  .challenge-cell { min-height: 38px; }
}

/* Pilot-access link: the primary way in for someone who isn't invited yet,
   so it reads as an action rather than another line of small print. The
   email stays as a quieter fallback beneath it. */
.pilot-link {
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.pilot-link:hover { color: var(--accent-hover); }

.login-invite-alt {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
}
