/*
 * Login page styling.
 *
 * Tokens copied from demo-portal/css/style.css (not linked — the portal is a
 * separate container, and it going down must not unstyle the login page) so
 * the two look like one product. Update both places if the palette changes.
 */

:root {
  color-scheme: light;

  --brand-700: #0d47a1;
  --brand-600: #1565c0;
  --brand-500: #1e88e5;
  --brand-light: #e3f2fd;
  --accent-text: #0d47a1;

  --page: #f0f4f8;
  --surface: #ffffff;
  --field: #ffffff;
  --field-line: #cfd8e3;
  --line: #e0e0e0;
  --text: #333333;
  --text-soft: #555555;
  --text-faint: #666666;

  --danger: #c62828;
  --danger-bg: #fdecea;
  --danger-line: #f5c6c2;

  --card-line: rgba(15, 40, 80, 0.1);
  --shadow-card: 0 1px 2px rgba(15, 40, 80, 0.04), 0 4px 16px rgba(15, 40, 80, 0.06);
  --focus-ring: rgba(30, 136, 229, 0.25);
  --hero: linear-gradient(120deg, #0d47a1, #1565c0 60%, #1e88e5); /* the modal's top edge */

  --font: "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --radius-s: 10px;
}

/*
 * Dark twice over. Standalone, the page follows the OS like the portal does.
 * Framed in a demo, theme.js copies the app's data-theme in, because the apps
 * have their own picker and the visitor's pick there beats the OS.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-light: #24344b;
    --accent-text: #8ec5ff;
    --page: #0f172a;
    --surface: #1b2637;
    --field: #142033;
    --field-line: #334155;
    --line: #334155;
    --text: #e5edf5;
    --text-soft: #c3cfdd;
    --text-faint: #9aa8ba;
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.12);
    --danger-line: rgba(255, 107, 107, 0.3);
    --card-line: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
    --focus-ring: rgba(142, 197, 255, 0.25);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-light: #24344b;
  --accent-text: #8ec5ff;
  --page: #0f172a;
  --surface: #1b2637;
  --field: #142033;
  --field-line: #334155;
  --line: #334155;
  --text: #e5edf5;
  --text-soft: #c3cfdd;
  --text-faint: #9aa8ba;
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.12);
  --danger-line: rgba(255, 107, 107, 0.3);
  --card-line: rgba(255, 255, 255, 0.1);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
  --focus-ring: rgba(142, 197, 255, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* --- card ---------------------------------------------------------------- */

.shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 100vh;
  justify-content: center;
  padding: clamp(20px, 5vw, 48px);
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 36px);
  box-shadow: var(--shadow-card);
}

.card-head { margin-bottom: 24px; }

/* The X mark, tinted via its alpha: the asset is white-on-transparent. */
.eyebrow {
  margin: 0 0 12px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("banner_mark.png") center / contain no-repeat;
  mask: url("banner_mark.png") center / contain no-repeat;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.lede { margin: 10px 0 0; color: var(--text-soft); font-size: .95rem; }
.pending-email { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* --- fields ------------------------------------------------------------- */

.field { margin-bottom: 18px; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-s);
  background: var(--field);
  color: var(--text);
  font-family: inherit; /* else Safari/Firefox substitute their own control font */
  font-size: 16px; /* below 16px, iOS zooms the viewport on focus */
  transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder { color: var(--text-faint); opacity: .8; }

input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }

.hint { margin: 6px 0 0; font-size: .8rem; color: var(--text-faint); }

/* text-soft, not text-faint: this is the notice the visitor consents under,
   so it has to be legible, not fine print. */
.consent { margin: 12px 0 0; font-size: .82rem; line-height: 1.5; color: var(--text-soft); }

/* The six-digit field: tabular figures + wide tracking so digits are
   countable at a glance. Qualified with input[type="text"] to out-specify the
   plain input[type="text"] rule above, which would otherwise win on font-size. */
input[type="text"].code-input {
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .35em;
  text-align: center;
  text-indent: .35em; /* offsets the trailing letter-spacing so it stays centred */
  padding: 14px;
}

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

.alert, .notice {
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: var(--radius-s);
  font-size: .88rem;
  border: 1px solid;
}
.alert { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.notice { background: var(--brand-light); border-color: var(--card-line); color: var(--accent-text); }

/* --- buttons ------------------------------------------------------------- */

/* Same shape as the portal's and the apps' buttons: 10px corners, brand fill. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 22px;
  border: 0;
  border-radius: var(--radius-s);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}

.btn-primary { background: var(--brand-600); color: #ffffff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:disabled { background: var(--text-faint); cursor: not-allowed; }

/* The X mark as the "go" arrow, as on the portal's Start demo buttons. */
.btn-mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("banner_mark.png") center / contain no-repeat;
  mask: url("banner_mark.png") center / contain no-repeat;
  transition: transform .15s ease;
}
.btn-primary:hover .btn-mark { transform: translateX(2px); }

.alt-actions {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--card-line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.inline { margin: 0; }

/* A button that reads as a link: resend has to be a POST (it sends mail and is
   rate-limited, so it must not be reachable by a prefetch or a page refresh),
   but it should not compete with the primary action. */
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: .85rem;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--text); }

.legal {
  max-width: 440px;
  margin: 0;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--text-faint);
  text-align: center;
}
.legal a { color: var(--text-soft); }

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