@import "../shared/auth-motion.css";

:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0d0f18;
  color: #f0f1fb;
  --muted: #a5acc5;
  --accent: #c9bfff;
  --line: #d3ceff20;
  --ease: cubic-bezier(.22, .72, .23, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html:not([data-login-js]) [data-wizard-title],
html[data-login-js] [data-fallback-title],
html[data-login-js] .login-card[data-step="method"] [data-login-form],
html[data-login-js] .login-card:not([data-step="method"]) :is([data-view="method"], .login-footer),
html[data-login-js] .login-card:not([data-step="account"]) [data-view="account"],
html[data-login-js] .login-card:not([data-step="password"]) [data-view="password"] { display: none; }
.sr-only,
html[data-login-js] .field label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  margin: 0;
  padding: clamp(16px, 4vw, 54px);
  background:
    radial-gradient(ellipse at 20% 20%, #33406555, transparent 55%),
    radial-gradient(ellipse at 88% 75%, #422c6055, transparent 54%),
    #0d0f18;
}
body::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("../shared/grain.png");
  opacity: .27;
  pointer-events: none;
}
.login-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  width: min(100%, 1020px);
  min-height: 550px;
  overflow: hidden;
  border: 1px solid #d5ccff30;
  border-radius: 26px;
  background: linear-gradient(144deg, #25283d, #171a28 62%);
  box-shadow: 0 35px 110px #03040ab0, inset 0 1px #fff1;
}
.art {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  border-inline-end: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 54% 54%, #8173e044, transparent 61%),
    linear-gradient(140deg, #36416489, #25203e82 65%, #171a29);
}
.art::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(to right, #dedbff19 1px, transparent 1px),
    linear-gradient(to bottom, #dedbff19 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(ellipse at center, #000, transparent 77%);
}
.art-stage { position: relative; display: grid; place-items: center; width: min(37vw, 420px); aspect-ratio: 1; }
.art-orbit, .art-orbit::before, .art-orbit::after {
  position: absolute;
  border: 1px solid #c7bdff38;
  border-radius: 50%;
  pointer-events: none;
}
.art-orbit {
  inset: 4%;
  box-shadow: 0 0 74px #9b91ff28, inset 0 0 54px #9b91ff17;
  background: radial-gradient(circle, #ad9bff21, transparent 70%);
}
.art-orbit::before, .art-orbit::after { content: ""; }
.art-orbit::before { inset: 9%; border-color: #d2c6ff25; }
.art-orbit::after { inset: -7%; border-color: #bcbbff1b; }
.lion-figure {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
}
.lion-figure img { width: 77%; height: auto; filter: drop-shadow(0 22px 21px #09071dc9); }
.lion-figure canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 22px 21px #09071da0);
}
.lion-figure.has-model img { opacity: 0; }
.lion-figure.has-model canvas { opacity: 1; }
.login-content {
  display: grid;
  align-self: center;
  min-width: 0;
  padding: clamp(26px, 4.2vw, 55px);
}
.wordmark { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 16px; font-weight: 650; }
.wordmark strong { color: #f0f1fb; }
.login-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 23px 0 24px;
  padding: 0;
  list-style: none;
}
.login-progress li {
  height: 3px;
  border-radius: 10px;
  background-color: var(--line);
  font-size: 0;
}
.login-progress [data-complete="true"] { background-color: #978bc878; }
.login-progress [aria-current="step"] { background-color: var(--accent); }
html:not([data-login-js]) .login-flow { margin-top: 25px; }
.step-heading { margin-bottom: 22px; }
.step-heading h1 {
  margin: 0;
  font-size: clamp(27px, 3.2vw, 42px);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: 1.08;
}
.step-heading h1:focus { outline: none; }
.login-methods, form, .field { display: grid; gap: 9px; }
form { gap: 14px; }
button, input { min-width: 0; border-radius: 11px; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.login-method {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #2b2d42;
  color: inherit;
  text-align: start;
}
.login-method:first-child { border-color: #d0c2ff52; background-color: #38334e; }
.login-method:enabled:hover, .emergency-method:hover { border-color: #d0c2ff7a; background-color: #423956; }
.emergency-method { border-radius: 11px; text-decoration: none; }
.method-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #c9baff36;
  border-radius: 10px;
  background: #b6a3ff17;
  color: #d9ceff;
}
.method-icon svg { width: 19px; height: 19px; }
.method-label { font-size: 14px; font-weight: 650; line-height: 1.25; }
.action-arrow { flex: none; width: 17px; height: 17px; }
.login-method > .action-arrow { color: #c4b9ed; }
.passkey-login[aria-busy] > .action-arrow { display: none; }
.passkey-login[aria-busy]::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid #c9bfff40;
  border-top-color: var(--accent);
  border-radius: 50%;
}
.field { gap: 7px; }
.field label { color: #c8cee1; font-size: 13px; font-weight: 600; }
.field input {
  width: 100%;
  min-height: 49px;
  padding: 10px 13px;
  border: 1px solid #ccc6ff39;
  background: #121522b3;
  color: inherit;
  font-size: 16px;
}
.field input:focus-visible { border-color: #ccc2ff; outline-offset: 2px; }
.step-actions { display: flex; gap: 9px; margin-top: 15px; }
.step-actions button { min-height: 46px; padding: 10px 15px; font-size: 14px; font-weight: 650; }
.primary-action {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #e4dcff8c;
  background-color: #c9bdf9;
  color: #221a39;
}
.primary-action:enabled:hover { background-color: #ded3ff; }
.secondary-action { border: 1px solid var(--line); background: #282a3d; color: #dad9ed; }
.secondary-action:hover { background-color: #37364d; }
.account-tag { display: inline-flex; max-width: 100%; margin: 7px 0 0; }
.account-tag strong { min-width: 0; overflow: hidden; color: #e1d7ff; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.login-footer { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.emergency-entry { margin: 10px 0 0; }
html[data-login-js] .login-card[data-step="method"] .emergency-alternate { display: none; }
.register-link { display: inline-block; padding: 4px 0; border-radius: 4px; color: #ded3ff; font-size: 13px; text-decoration: none; }
.register-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.login-error, .passkey-feedback {
  margin: 0 0 12px;
  padding: 8px 11px;
  border: 1px solid #f0ab8247;
  border-radius: 9px;
  background: #a95b391e;
  color: #f6cdb6;
  font-size: 13px;
  line-height: 1.45;
}
.passkey-feedback { margin: 9px 0 0; }
.passkey-feedback:empty { display: none; }
.login-spinner { width: 16px; height: 16px; border: 2px solid #221a3940; border-top-color: #221a39; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .login-card { animation: card-enter 570ms var(--ease) both; transition: grid-template-columns 420ms var(--ease); }
  .login-card[data-direction] [data-view] { animation: step-in 300ms var(--ease) both; --step-offset: 9px; }
  .login-card[data-direction="back"] [data-view] { --step-offset: -9px; }
  .art-stage { transition: transform 600ms var(--ease); }
  [data-step="account"] .art-stage { transform: translate(-2%, 1%) rotate(-5deg) scale(.94); }
  [data-step="password"] .art-stage { transform: translate(2%, -2%) rotate(4deg) scale(1.04); }
  .art-orbit, .lion-figure img, .lion-figure canvas { transition: opacity 350ms ease-in-out; }
  [data-step="password"] .art-orbit { opacity: .82; }
  button, input, .login-progress li { transition: background-color 180ms ease-in-out, border-color 180ms ease-in-out, color 180ms ease-in-out; }
  .login-method > .action-arrow { transition: transform 220ms var(--ease); }
  .login-method:hover > .action-arrow { transform: translateX(3px); }
  .login-spinner, .passkey-login[aria-busy]::after { animation: spin 740ms linear infinite; }
}
@keyframes step-in {
  from { transform: translateX(var(--step-offset)); }
  to { transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 691px) {
  .login-card[data-step="account"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .login-card[data-step="password"] { grid-template-columns: minmax(0, .94fr) minmax(0, 1.11fr); }
}
@media (max-width: 690px) {
  .login-card { grid-template-columns: minmax(0, 1fr); min-height: 0; max-width: 460px; border-radius: 20px; }
  .art { min-height: 185px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .art-stage { width: min(52%, 186px); }
  .login-content { padding: 21px 20px 23px; }
  .login-progress { margin: 20px 0 19px; }
  .step-heading { margin-bottom: 16px; }
}
