:root {
  color-scheme: light;
  --ink:        #0c1222;
  --ink-soft:   #525866;
  --paper:      #f4f6f9;
  --card:       #ffffff;
  --line:       #edf0f4;
  --accent:     #670117;
  --accent-light: #cf110c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #eef1f7 0%, var(--paper) 70%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Brand mark ── */
.brand-mark {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: contain;
}

/* ── Card ── */
.login-stage {
  width: 100%;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(12,18,34,0.06);
}

.login-brand {
  margin-bottom: 28px;
}

.login-page .brand-mark {
  margin-inline: auto;
}

.login-header {
  margin-bottom: 28px;
}

.login-page .login-header,
.intro-page .login-header {
  text-align: center;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
  line-height: 1.2;
}

.login-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ── Form ── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field[hidden] { display: none; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--ink);
  background: var(--card);
}

.form-input.invalid {
  border-color: #dc2626;
}

/* ── Error ── */
.login-error {
  font-size: 13px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.4;
}

/* ── Submit button ── */
.login-btn {
  height: 40px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}

.login-btn:hover:not(:disabled) { opacity: 0.85; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Login and invite page: the logo builds big in the centre, then settles above the card ── */
.intro-page {
  align-items: flex-start;
  background: radial-gradient(ellipse at 15% 5%, #f00919, transparent 65%),
              radial-gradient(ellipse at 90% 90%, #f00018, transparent 65%),
              #a40010;
}

/* Top-aligned, so the logo's resting spot doesn't move when the card's height
   changes mid-intro (form shown, error shown). */
.intro-page .login-stage {
  flex-direction: column;
  gap: 24px;
  padding-top: clamp(32px, 10vh, 96px);
}

/* The login card never changes height, so it can stay centred. */
.intro-page.login-page { align-items: center; }
.intro-page.login-page .login-stage { padding-top: 24px; }
/* Centre the card alone: the logo (112px wide, 910:636) plus the gap take no height. */
.intro-page.login-page .intro-logo { margin-top: calc(-112px * 636 / 910 - 24px); }

.intro-logo {
  width: 112px;
  opacity: 0;
}

.intro-logo svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 14px #51000b35);
}

/* intro.js sets --dx/--dy/--s from the screen centre to the resting spot. */
.intro-page.is-intro .intro-logo {
  opacity: 1;
  animation: intro-logo-settle 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.85s backwards;
}

.intro-page .login-card {
  border: none;
  box-shadow: 0 24px 48px #51000b40;
  opacity: 0;
  /* Not just transparent: Safari would anchor its saved-login popup to the
     email field while the intro still plays. */
  visibility: hidden;
}

/* Keyed to the same class as the logo, so both start on the same clock. */
.intro-page.is-intro .login-card {
  animation: intro-card-in 0.35s ease 1.1s forwards;
}

.intro-page .login-btn { background: var(--accent-light); }

/* Onboarding: the invite page's red and logo spot, without replaying the intro. */
.intro-page.intro-static .intro-logo,
.intro-page.intro-static .login-card { opacity: 1; visibility: visible; }
.intro-page.intro-static .build { animation: none; stroke-dashoffset: 0; }

@keyframes intro-logo-settle { from { transform: translate(var(--dx), var(--dy)) scale(var(--s)); } }
@keyframes intro-card-in {
  from { visibility: visible; transform: translateY(12px); }
  to { visibility: visible; opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-logo { opacity: 1; animation: none !important; }
  .intro-page .login-card { opacity: 1; visibility: visible; animation: none !important; }
}
