/*
 * auth.css — the sign-in pages: login, the six auth views, the routing error
 * (dashboards/partials/auth-shell.php). Loaded after foundation.css, so it uses
 * the contract's tokens and @lb-ui's .lb-btn / .lb-field / .lb-input classes.
 *
 * Tokens only, with two exceptions defined once below, both
 * v1.3:B22 (the sign-in carve-out): the court photo's navy treatment
 * and Microsoft's own sign-in button colours (its brand guidelines).
 */

/* v1.3:B22 — the photo's navy treatment (Option C, chosen by the team
   2026-10-27): the same in light and dark. Only the card follows the theme. */
.lb-auth {
  --lb-auth-page:    #0B1222;   /* behind the photo while it loads */
  --lb-auth-tint:    #1B2B4A;   /* colour blend over the grayscale photo */
  --lb-auth-scrim-1: rgba(11, 18, 34, .30);
  --lb-auth-scrim-2: rgba(11, 18, 34, .55);
  --lb-auth-scrim-3: rgba(11, 18, 34, .90);
  --lb-auth-on-photo:  #FFFFFF;
  --lb-auth-card:      var(--lb-surface);
  --lb-auth-card-line: var(--lb-line);
}
/* Dark: the card a step lighter than the dark surface, so it stands off the
   navy scrim (the team's review of Option C, 2026-10-27). */
html[data-theme="dark"] .lb-auth {
  --lb-auth-card:      #283548;
  --lb-auth-card-line: rgba(255, 255, 255, .12);
}

/* v1.3:B22 — Microsoft's "Sign in with Microsoft" button, light and dark. */
.lb-auth {
  --lb-ms-fill:   #FFFFFF;
  --lb-ms-hover:  #F3F3F3;
  --lb-ms-border: #8C8C8C;
  --lb-ms-text:   #5E5E5E;
}
html[data-theme="dark"] .lb-auth {
  --lb-ms-fill:   #2F2F2F;
  --lb-ms-hover:  #3B3B3B;
  --lb-ms-border: #5E5E5E;
  --lb-ms-text:   #FFFFFF;
}

/* ── Page: the court photo, grayscale under a navy tint and scrim ─────────── */
.lb-auth {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-wrap: wrap;
  background: var(--lb-auth-page);
  color: var(--lb-ink);
  font: var(--lb-text-body);
  -webkit-font-smoothing: antialiased;
}
.lb-auth *, .lb-auth *::before, .lb-auth *::after { box-sizing: border-box; }
.lb-auth a { color: var(--lb-link); }

/* The photo: full bleed, the building left of centre so the card never covers it. */
.lb-auth__photo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 38% 45%;
  filter: grayscale(1) contrast(1.08) brightness(.7);
  pointer-events: none;
}

/* The navy colour blend that turns the grayscale photo into a duotone. */
.lb-auth__wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--lb-auth-tint);
  mix-blend-mode: color;
}

/* The scrim: see-through on the left, nearly solid navy behind the card. */
.lb-auth__fade {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,
    var(--lb-auth-scrim-1) 0%,
    var(--lb-auth-scrim-2) 50%,
    var(--lb-auth-scrim-3) 100%);
}

/* ── Left: the logo over the photo ────────────────────────────────────────── */
.lb-auth__side {
  position: relative;
  flex: 1 1 560px;
  padding: var(--lb-space-12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--lb-space-12);
}
.lb-auth__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--lb-space-3);
  border-radius: var(--lb-radius-button);
  color: var(--lb-auth-on-photo) !important;
  text-decoration: none;
  font: var(--lb-text-page-title);
  letter-spacing: var(--lb-tracking-page-title);
}
.lb-auth__brand img { border-radius: var(--lb-radius-button); }
.lb-auth__brand:focus-visible { outline: none; box-shadow: var(--lb-focus-ring); }

/* ── Right: the card ──────────────────────────────────────────────────────── */
.lb-auth__main {
  position: relative;
  flex: 1 1 440px;
  padding: var(--lb-space-12) var(--lb-space-8);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-auth__card {
  width: 100%;
  max-width: 400px;
  padding: var(--lb-space-10);
  display: flex;
  flex-direction: column;
  gap: var(--lb-space-6);
  background: var(--lb-auth-card);
  border: 1px solid var(--lb-auth-card-line);
  border-radius: var(--lb-radius-widget);
  box-shadow: var(--lb-e2);
}
.lb-auth__head { display: flex; flex-direction: column; gap: var(--lb-space-1); }
.lb-auth__greeting { min-height: 18px; font: var(--lb-text-small); color: var(--lb-muted); }
.lb-auth__title {
  margin: 0;
  font: var(--lb-text-case-name);
  letter-spacing: var(--lb-tracking-case-name);
  color: var(--lb-ink);
}
.lb-auth__lede { margin: 0; color: var(--lb-muted); }
.lb-auth__stack { display: flex; flex-direction: column; gap: var(--lb-space-4); }

/* Full-width buttons in the card. */
.lb-auth .lb-btn.lb-auth__wide { width: 100%; height: 44px; font-size: 14px; }

/* Microsoft's button (v1.3:B22): its colours, mark and wording. */
.lb-auth__ms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--lb-space-3);
  width: 100%;
  height: 44px;
  padding: 0 var(--lb-space-3);
  background: var(--lb-ms-fill);
  border: 1px solid var(--lb-ms-border);
  border-radius: var(--lb-radius-button);
  color: var(--lb-ms-text) !important;
  font: 600 15px/20px 'Segoe UI', var(--lb-font);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--lb-dur-press) var(--lb-ease-out);
}
.lb-auth__ms:hover { background: var(--lb-ms-hover); }
.lb-auth__ms:focus-visible { outline: none; box-shadow: var(--lb-focus-ring); }
.lb-auth__ms[aria-busy="true"] { opacity: .75; cursor: progress; pointer-events: none; }

.lb-auth__or {
  display: flex;
  align-items: center;
  gap: var(--lb-space-3);
  font: var(--lb-text-caption);
  color: var(--lb-muted);
}
.lb-auth__or::before,
.lb-auth__or::after { content: ''; flex: 1; height: 1px; background: var(--lb-line); }

/* The email form folds open under its button (no layout jump, no fixed height). */
.lb-auth__email {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--lb-dur-collapse) var(--lb-ease-collapse);
}
.lb-auth__email > div { overflow: hidden; min-height: 0; }
.lb-auth__email:not(.is-open) > div { visibility: hidden; }
.lb-auth__email.is-open { grid-template-rows: 1fr; }
.lb-auth__email form { display: flex; flex-direction: column; gap: var(--lb-space-4); padding: 2px; }
.lb-auth__email-toggle[aria-expanded="true"] { display: none; }

.lb-auth .lb-input { height: 40px; font: var(--lb-text-body); }
.lb-auth__label-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--lb-space-3); }
.lb-auth__label-row a { font: var(--lb-text-small); }
.lb-auth__code {
  height: 48px !important;
  text-align: center;
  font: 500 20px/28px var(--lb-font-mono) !important;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.lb-auth__check {
  display: flex;
  align-items: center;
  gap: var(--lb-gap-control);
  color: var(--lb-ink-2);
  cursor: pointer;
}
.lb-auth__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--lb-accent); }

.lb-auth__links {
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--lb-space-2) var(--lb-space-4);
  font: var(--lb-text-small);
}

/* A message at the top of the card. */
.lb-auth__alert {
  display: flex;
  gap: var(--lb-gap-control);
  padding: var(--lb-space-3) var(--lb-space-4);
  border-radius: var(--lb-radius-card);
  font: var(--lb-text-small);
}
.lb-auth__alert svg { flex: none; margin-top: 1px; }
.lb-auth__alert a { color: inherit; text-decoration: underline; }
.lb-auth__alert--error {
  background: var(--lb-danger-soft);
  color: var(--lb-danger);
  border: 1px solid color-mix(in srgb, var(--lb-danger) 25%, transparent);
}
.lb-auth__alert--info {
  background: var(--lb-surface-2);
  color: var(--lb-ink-2);
  border: 1px solid var(--lb-line);
}

/* The new password after a reset: shown once. */
.lb-auth__secret {
  margin: 0;
  padding: var(--lb-space-4);
  background: var(--lb-sunken);
  border: 1px solid var(--lb-line);
  border-radius: var(--lb-radius-card);
  font: 600 20px/28px var(--lb-font-mono);
  letter-spacing: .05em;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}

/* The error page's line bot (components/feedback-states.md). */
.lb-auth__bot { color: var(--lb-muted); }

.lb-auth__help {
  margin: 0;
  padding-top: var(--lb-space-4);
  border-top: 1px solid var(--lb-line);
  font: var(--lb-text-small);
  color: var(--lb-muted);
}

/* ── Narrow windows: logo row on top, the card below ──────────────────────── */
@media (max-width: 1000px) {
  .lb-auth { align-content: flex-start; }
  .lb-auth__side {
    flex-basis: 100%;
    flex-direction: row;
    align-items: center;
    padding: var(--lb-space-6) var(--lb-space-4);
  }
  .lb-auth__fade { background: var(--lb-auth-scrim-3); }
  .lb-auth__main { align-items: flex-start; padding: var(--lb-space-2) var(--lb-space-4) var(--lb-space-10); }
}
@media (max-width: 480px) {
  .lb-auth__card { padding: var(--lb-space-6); }
}
@media (prefers-reduced-motion: reduce) {
  .lb-auth__email, .lb-auth__ms { transition: none; }
}
