/* ============================================================
   auth.css — shared shell for the CADABRA auth card pages
   (login, signup, verify, forgot). Loaded after theme.css.

   Genuinely page-specific bits live in each page's small local
   <style> AFTER this file: the iOS-zoom guard, body text-rendering,
   .mobile-brand positioning, and the --auth-* knobs below (code-input
   size, focus fill, blob colour assignment). Rules for elements a page
   doesn't have (steps, select, pw-rules) are inert there, so they can
   live here safely.
   ============================================================ */
@import url("../theme.css?v=3");

:root {
  /* Local aliases the auth pages map onto the theme ink/line ladder. */
  --ink-dim: var(--ink-strong);
  --ink-mute: var(--ink-faint);
  --line: var(--line-soft);
  --bg: var(--surface-deep);
  --dur: var(--dur-ui);
  --ease: var(--ease-out);

  /* Per-page knobs (a page overrides these in its local <style>). */
  --auth-focus-fill: rgba(255, 255, 255, 0.055); /* forgot: 0.06 */
  --auth-code-size: 18px;                         /* login: 20px */
  --auth-code-height: 48px;                       /* login: 52px */
  --auth-blob-after: var(--accent-light);         /* verify/forgot: var(--accent) */
  --auth-blob-orb: var(--accent);                 /* verify/forgot: var(--accent-light) */
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  min-height: 100vh; overflow-x: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.ambient::before {
  content: ''; position: absolute;
  left: 50%; top: 32%; transform: translate(-50%, -50%);
  width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(72px);
}

.card {
  position: relative; z-index: 1;
  display: flex; align-items: stretch;
  width: 100%; max-width: 820px;
  overflow: hidden; border-radius: 20px;
  background: rgba(10, 10, 12, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(34px) saturate(160%);
  -webkit-backdrop-filter: blur(34px) saturate(160%);
  box-shadow: 0 30px 90px -20px rgba(0,0,0,0.8);
}

.form-col {
  width: 100%; padding: 36px 36px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
@media (min-width: 768px) { .form-col { width: 50%; } }

/* Multi-step crossfade (login/signup/forgot). Inert on single-step verify. */
.step { display: flex; flex-direction: column; }
.step > .title { margin-bottom: 2px; }
.step > .sub   { margin-bottom: 16px; }
.step > form   { margin-bottom: 10px; }
.step { transition: opacity 240ms var(--ease), transform 240ms var(--ease); }
.step.leaving  { opacity: 0; transform: translateY(-6px); pointer-events: none; position: absolute; left: 36px; right: 36px; }
.step.entering { opacity: 0; transform: translateY(8px); }
.step.active   { opacity: 1; transform: none; }
.alt-group { display: flex; flex-direction: column; gap: 6px; align-items: center; }

.mobile-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--ink);
}
.mobile-brand img { width: 22px; height: 22px; }
@media (min-width: 768px) { .mobile-brand { display: none; } }

h1.title {
  font-size: 22px; font-weight: 600; letter-spacing: -0.025em;
  line-height: 1.2; color: var(--ink);
}
.sub { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.sub strong { color: var(--ink-dim); font-weight: 500; }

form { display: flex; flex-direction: column; gap: 8px; }

.input, input.code {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 42px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line); border-radius: 999px;  /* pill */
  padding: 0 18px; color: var(--ink);
  font: 400 14px 'Inter', sans-serif;
  letter-spacing: -0.005em;
  transition: border-color var(--dur), background-color var(--dur), box-shadow var(--dur);
}
.input::placeholder { color: var(--ink-mute); }
.input:hover { border-color: var(--line-strong); }
.input:focus {
  outline: none;
  background: var(--auth-focus-fill);
  border-color: rgba(255,255,255,0.45);
  box-shadow: 0 0 0 3px var(--accent);
}

/* Select variant (signup plan picker). Inert where no <select> exists. */
select.input {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.35)' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select.input option { background: #0f1c3a; color: #fff; }
select.input:invalid, select.input option[value=""] { color: var(--ink-mute); }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  background: transparent; border: 0; cursor: pointer;
  display: grid; place-items: center; border-radius: 999px;
  color: var(--ink-soft);
  transition: color var(--dur), background-color var(--dur);
}
.pw-toggle:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.pw-toggle svg { width: 16px; height: 16px; }

/* Inline password-rule chips (signup). Inert where absent. */
.pw-rules {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  padding: 0 4px; margin-top: -2px;
  max-height: 0; opacity: 0;
  transition: max-height 260ms var(--ease), opacity 200ms var(--ease);
  overflow: hidden;
}
.pw-rules.show { max-height: 60px; opacity: 1; }
.pw-rule {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--ink-mute);
  transition: color var(--dur);
}
.pw-rule svg { width: 10px; height: 10px; flex-shrink: 0; }
.pw-rule.met { color: var(--success); }

.submit {
  margin-top: 4px;
  appearance: none; border: 0; cursor: pointer;
  width: 100%; height: 42px; border-radius: 999px;
  background: #fff; color: #000;
  font: 500 14.5px 'Inter', sans-serif;
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color var(--dur), transform var(--dur);
}
.submit:hover { background: #ececec; }
.submit:active { transform: scale(0.98); }
.submit:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.spinner { width: 14px; height: 14px; border: 2px solid rgba(0,0,0,0.18); border-top-color: #000; border-radius: 50%; animation: spin 0.85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 6-digit code input (login MFA, signup/verify OTP, forgot reset). */
input.code {
  text-align: center;
  font-weight: 500;
  font-size: var(--auth-code-size);
  font-family: 'SF Mono', 'Inter', monospace;
  letter-spacing: 0.55em; padding-left: 0.55em;
  height: var(--auth-code-height);
  border-radius: 999px;
}
input.code::placeholder { letter-spacing: 0.25em; color: var(--ink-mute); }

.resend {
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-soft); font: 500 12.5px 'Inter', sans-serif;
  margin-top: 2px; text-align: center;
  transition: color var(--dur);
}
.resend:hover { color: var(--ink); }
.resend:disabled { color: var(--ink-mute); cursor: default; }

.alt { font-size: 13px; color: var(--ink-soft); text-align: center; line-height: 1.5; }
.alt a { color: var(--ink); text-decoration: none; font-weight: 500; transition: color var(--dur); }
.alt a:hover { color: var(--ink-dim); }

.terms { font-size: 11.5px; color: var(--ink-mute); line-height: 1.5; text-align: center; }
.terms a { color: var(--ink-soft); text-decoration: none; }
.terms a:hover { color: var(--ink-dim); }

.msg {
  font-size: 12.5px;
  padding: 9px 12px; border-radius: 9px;
  display: none; text-align: center;
}
.msg.error   { display: block; background: rgba(255,69,58,0.10); color: var(--danger);  border: 1px solid rgba(255,69,58,0.22); }
.msg.success { display: block; background: rgba(52,199,89,0.10); color: var(--success); border: 1px solid rgba(52,199,89,0.22); }
.msg a { color: #fff; border-bottom: 1px solid rgba(255,255,255,0.4); text-decoration: none; }

/* ─── Visual column (right side, desktop only) ─── */
.visual-col { display: none; position: relative; width: 50%; padding: 12px; }
@media (min-width: 768px) { .visual-col { display: block; } }
@keyframes blob-a {
  0%   { transform: translate(0%, 0%)    scale(1);    }
  25%  { transform: translate(28%, -18%) scale(1.12); }
  50%  { transform: translate(-12%, 26%) scale(0.94); }
  75%  { transform: translate(18%, 10%)  scale(1.06); }
  100% { transform: translate(0%, 0%)    scale(1);    }
}
@keyframes blob-b {
  0%   { transform: translate(0%, 0%)     scale(1);    }
  25%  { transform: translate(-24%, 24%)  scale(1.16); }
  50%  { transform: translate(20%, -14%)  scale(0.9);  }
  75%  { transform: translate(-14%, -24%) scale(1.1);  }
  100% { transform: translate(0%, 0%)     scale(1);    }
}
@keyframes blob-c {
  0%   { transform: translate(0%, 0%)     scale(1.05); }
  25%  { transform: translate(14%, 28%)   scale(0.9);  }
  50%  { transform: translate(-28%, -10%) scale(1.16); }
  75%  { transform: translate(10%, -18%)  scale(1);    }
  100% { transform: translate(0%, 0%)     scale(1.05); }
}
@keyframes auth-hue {
  0%, 100% { filter: hue-rotate(-10deg); }
  50%      { filter: hue-rotate(16deg);  }
}
.visual {
  position: relative; height: 100%; width: 100%;
  border-radius: 14px; overflow: hidden;
  background: radial-gradient(125% 95% at 50% 112%, var(--surface-0) 0%, var(--surface-deep) 72%);
  animation: auth-hue 24s ease-in-out infinite;
}
.visual::before, .visual::after, .visual > .blob {
  content: ""; position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  pointer-events: none;
}
.visual::before {
  width: 130%; height: 130%; top: -28%; left: -18%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 62%);
  animation: blob-a 19s ease-in-out infinite;
}
.visual::after {
  width: 120%; height: 120%; bottom: -22%; right: -20%;
  background: radial-gradient(circle, var(--auth-blob-after) 0%, transparent 62%);
  animation: blob-b 23s ease-in-out infinite;
}
.visual > .blob {
  width: 110%; height: 110%; top: 8%; left: 2%;
  background: radial-gradient(circle, var(--auth-blob-orb) 0%, transparent 64%);
  animation: blob-c 21s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .visual, .visual::before, .visual::after, .visual > .blob { animation-duration: 0.01ms !important; }
}

.visual-content { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; padding: 32px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.015em;
  color: rgba(255,255,255,0.92);
}
.wordmark img { width: 22px; height: 22px; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.4)); }
.visual-tag { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.visual-tag h2 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.025em;
  line-height: 1.2; color: rgba(255,255,255,0.96);
  text-shadow: 0 2px 18px rgba(0,0,0,0.35);
}
.visual-tag p {
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
}

.page-footer {
  position: fixed; left: 0; right: 0; bottom: 16px;
  text-align: center; font-size: 11px; color: var(--ink-mute);
  line-height: 1.7;
  z-index: 0;
}
.page-footer a { color: var(--ink-soft); text-decoration: none; }
.page-footer a:hover { color: var(--ink-dim); }
.back-home {
  position: fixed; top: 22px; left: 22px; z-index: 2;
  color: var(--ink-soft); text-decoration: none;
  font-size: 12.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 999px;
  transition: color var(--dur), background-color var(--dur);
}
.back-home:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
