/* ==========================================================================
   Sign-in screen — 3D stage, aurora field and glass card.
   Everything here is motion-heavy, so every animation is disabled under
   .no-motion and prefers-reduced-motion at the bottom of the file.
   ========================================================================== */

body.auth-mode { overflow: hidden; }
body.auth-mode .app { display: none; }

.auth {
  --mx: 0; --my: 0;
  position: fixed; inset: 0; z-index: 400;
  display: grid; grid-template-columns: 1.3fr 1fr;
  background: #0a0514;
  color: #f4f0fc;
  overflow: hidden;
  animation: authIn 620ms var(--ease-out) both;
}
@keyframes authIn { from { opacity: 0; } to { opacity: 1; } }

.auth.ok { animation: authOut 740ms var(--ease) forwards; }
@keyframes authOut {
  40% { opacity: 1; }
  to { opacity: 0; transform: scale(1.06); filter: blur(8px); }
}
.auth.ok .auth-stage { transform: translateZ(360px) scale(1.5); opacity: 0; transition: all 740ms var(--ease-out); }
.auth.ok .auth-card { transform: translateY(-26px) scale(.96); opacity: 0; transition: all 500ms var(--ease); }

/* ---------- Shared backdrop (spans both halves) ---------- */
.auth-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }

/* One grid floor under the whole screen, so both halves stand in the same room. */
.auth-floor {
  position: absolute; left: -30%; right: -30%; bottom: 0; height: 46%; z-index: 1;
  background-image:
    linear-gradient(rgba(167, 139, 250, .42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, .32) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(500px) rotateX(72deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .4) 45%, transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .4) 45%, transparent 85%);
  animation: gridRun 7s linear infinite;
}
@keyframes gridRun { to { background-position: 0 58px, 0 0; } }

/* Soft light seam instead of a hard divider line. */
.auth-seam {
  position: absolute; top: 0; bottom: 0; left: 56.52%; width: 1px; z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(196, 181, 253, .35) 22%, rgba(196, 181, 253, .45) 50%, rgba(196, 181, 253, .2) 78%, transparent);
  box-shadow: 0 0 40px 10px rgba(124, 58, 237, .18);
}

/* ---------- Aurora field ---------- */
.auth-scene { position: relative; z-index: 1; display: grid; align-content: center; }
.aurora {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  mix-blend-mode: screen; pointer-events: none;
}
.a1 { width: 44vw; height: 44vw; left: -8vw; top: -14vw; background: radial-gradient(circle, #7c3aed, transparent 62%); animation: drift1 22s var(--ease) infinite alternate; }
.a2 { width: 40vw; height: 40vw; left: 18vw; bottom: -16vw; background: radial-gradient(circle, #c026d3, transparent 62%); animation: drift2 27s var(--ease) infinite alternate; }
.a3 { width: 42vw; height: 42vw; right: -8vw; top: 26%; background: radial-gradient(circle, #6d28d9, transparent 66%); opacity: .42; animation: drift3 31s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate(12vw, 10vh) scale(1.18); } }
@keyframes drift2 { to { transform: translate(10vw, -10vh) scale(1.12); } }
@keyframes drift3 { to { transform: translate(-10vw, 8vh) scale(.88); } }

/* vignette so the blur never looks flat */
.auth-bg::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(130% 95% at 38% 48%, transparent 34%, rgba(10, 5, 20, .88) 100%);
}

/* ---------- 3D stage ---------- */
.auth-stage {
  position: relative; z-index: 2;
  width: 370px; height: 370px; margin: 0 auto;
  perspective: 1100px; transform-style: preserve-3d;
  transform: rotateX(calc(var(--my) * -14deg)) rotateY(calc(var(--mx) * 18deg));
  transition: transform 500ms var(--ease-out);
}

.cube {
  position: absolute; inset: 50% auto auto 50%;
  width: 156px; height: 156px; margin: -78px 0 0 -78px;
  transform-style: preserve-3d;
  animation: spin 18s linear infinite;
}
@keyframes spin {
  from { transform: rotateX(-22deg) rotateY(0deg); }
  to { transform: rotateX(-22deg) rotateY(360deg); }
}
/* Deep aubergine core lifting into bright lilac at the lit corner — each face
   is lit from a different angle so the spin reads as dark → light → dark. */
.cube .cf {
  position: absolute; inset: 0; display: grid; place-items: center;
  border: 1px solid rgba(196, 181, 253, .5);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(10, 4, 20, .94) 0%, rgba(46, 16, 101, .88) 34%, rgba(124, 58, 237, .72) 68%, rgba(216, 180, 254, .5) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 0 50px rgba(124, 58, 237, .35),
    inset 0 -30px 50px -24px rgba(5, 2, 12, .9),
    0 0 44px rgba(124, 58, 237, .35);
  backdrop-filter: blur(3px);
}
/* Specular sweep across the top-left corner of every face. */
.cube .cf::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, .05) 22%, transparent 48%);
}
.cube .cf img { width: 46%; opacity: .95; filter: drop-shadow(0 0 16px rgba(221, 214, 254, .85)); position: relative; }

.cf-f { transform: translateZ(78px); }
.cf-b { transform: rotateY(180deg) translateZ(78px); }
.cf-l { transform: rotateY(-90deg) translateZ(78px); }
.cf-r { transform: rotateY(90deg) translateZ(78px); }
.cf-u { transform: rotateX(90deg) translateZ(78px); }
.cf-d { transform: rotateX(-90deg) translateZ(78px); }

/* Light hits the top and front hardest, the back and underside least. */
.cf-u { background: linear-gradient(145deg, rgba(167, 139, 250, .85) 0%, rgba(124, 58, 237, .7) 45%, rgba(30, 11, 58, .9) 100%); }
.cf-d { background: linear-gradient(145deg, rgba(8, 3, 16, .96) 0%, rgba(26, 10, 51, .92) 60%, rgba(76, 29, 149, .6) 100%); }
.cf-b, .cf-l { background: linear-gradient(145deg, rgba(9, 4, 18, .95) 0%, rgba(38, 13, 84, .9) 45%, rgba(109, 40, 217, .6) 100%); }
.cf-r { background: linear-gradient(145deg, rgba(14, 6, 26, .92) 0%, rgba(91, 33, 182, .8) 50%, rgba(196, 181, 253, .45) 100%); }

.cube-shadow {
  position: absolute; left: 50%; top: 78%; width: 220px; height: 42px; margin-left: -110px;
  background: radial-gradient(ellipse, rgba(124, 58, 237, .55), transparent 70%);
  filter: blur(12px); animation: breathe 18s var(--ease) infinite;
}
@keyframes breathe { 0%, 100% { transform: scaleX(1); opacity: .5; } 50% { transform: scaleX(.78); opacity: .8; } }

/* Named .orbit, not .ring — .ring is the shared progress-ring component. */
.orbit {
  position: absolute; inset: 50% auto auto 50%; border-radius: 50%;
  border: 1px solid rgba(196, 181, 253, .22);
  transform-style: preserve-3d;
}
.orbit-1 { width: 286px; height: 286px; margin: -143px 0 0 -143px; animation: orb1 14s linear infinite; border-top-color: rgba(196, 181, 253, .8); }
.orbit-2 { width: 356px; height: 356px; margin: -178px 0 0 -178px; animation: orb2 22s linear infinite reverse; border-left-color: rgba(45, 212, 191, .6); }
.orbit-3 { width: 426px; height: 426px; margin: -213px 0 0 -213px; animation: orb3 30s linear infinite; border-right-color: rgba(244, 114, 182, .45); }
@keyframes orb1 { from { transform: rotateX(72deg) rotateZ(0deg); } to { transform: rotateX(72deg) rotateZ(360deg); } }
@keyframes orb2 { from { transform: rotateX(62deg) rotateY(18deg) rotateZ(0deg); } to { transform: rotateX(62deg) rotateY(18deg) rotateZ(360deg); } }
@keyframes orb3 { from { transform: rotateX(80deg) rotateZ(0deg); } to { transform: rotateX(80deg) rotateZ(-360deg); } }

/* ---------- Floating sparks ---------- */
.sparks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.sparks i {
  position: absolute; bottom: -10px; width: var(--sz); height: var(--sz);
  border-radius: 50%; background: #ddd6fe;
  box-shadow: 0 0 10px 2px rgba(196, 181, 253, .7);
  animation: rise var(--d) linear var(--dl) infinite;
}
@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: .9; }
  80% { opacity: .5; }
  100% { transform: translateY(-105vh) translateX(28px); opacity: 0; }
}

/* ---------- Pitch copy ---------- */
.auth-pitch { position: relative; z-index: 2; text-align: center; margin-top: 52px; padding: 0 40px; }
.auth-pitch h2 { font-size: clamp(22px, 2.4vw, 32px); line-height: 1.18; letter-spacing: -.02em; font-weight: 750; }
.auth-pitch h2 span { display: block; opacity: 0; animation: lift 760ms var(--ease-out) forwards; }
.auth-pitch h2 span:nth-child(1) { animation-delay: 260ms; }
.auth-pitch h2 span:nth-child(2) { animation-delay: 380ms; background: linear-gradient(100deg, #c4b5fd, #f0abfc 60%, #5eead4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch p { margin-top: 12px; color: #b9aed3; font-size: 14px; opacity: 0; animation: lift 760ms var(--ease-out) 520ms forwards; }
@keyframes lift { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Right pane motion ---------- */
/* Transparent veil, not its own background — the shared backdrop shows through. */
.auth-pane {
  display: grid; place-items: center; padding: 32px; position: relative; z-index: 1; overflow: hidden;
  background: linear-gradient(100deg, rgba(10, 5, 20, .28), rgba(10, 5, 20, .62) 60%, rgba(10, 5, 20, .72));
  backdrop-filter: blur(2px);
}
.pane-fx { position: absolute; inset: 0; pointer-events: none; perspective: 700px; }

/* Slow conic glow orbiting behind the card */
.pane-glow {
  position: absolute; left: 50%; top: 50%; width: 660px; height: 660px; margin: -330px 0 0 -330px;
  border-radius: 50%; filter: blur(62px); opacity: 1;
  background: conic-gradient(from 0deg, rgba(124, 58, 237, .55), rgba(192, 38, 211, .3) 28%, rgba(45, 212, 191, .2) 55%, rgba(167, 139, 250, .42) 78%, rgba(124, 58, 237, .55));
  transform: translate(calc(var(--mx) * 26px), calc(var(--my) * 26px));
  animation: paneSpin 28s linear infinite;
}
@keyframes paneSpin { to { rotate: 360deg; } }

/* Drifting glass panels — the "workspace" floating in space */
.shards { position: absolute; inset: 0; transform-style: preserve-3d; }
.shards i {
  position: absolute; display: block; border-radius: 14px;
  border: 1px solid rgba(196, 181, 253, .4);
  background: linear-gradient(135deg, rgba(167, 139, 250, .34), rgba(124, 58, 237, .14) 52%, rgba(10, 5, 20, .5));
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 32px -10px rgba(139, 92, 246, .55);
  backdrop-filter: blur(4px);
}
.sh1 { width: 124px; height: 82px; left: 7%; top: 15%; animation: float1 15s var(--ease) infinite alternate; }
.sh2 { width: 86px; height: 86px; right: 6%; top: 21%; border-radius: 22px; animation: float2 19s var(--ease) infinite alternate; }
.sh3 { width: 112px; height: 56px; right: 5%; bottom: 23%; animation: float3 17s var(--ease) infinite alternate; }
.sh4 { width: 66px; height: 66px; left: 11%; bottom: 18%; border-radius: 50%; animation: float4 21s var(--ease) infinite alternate; }
@keyframes float1 { from { transform: translate3d(0, 0, 0) rotateX(16deg) rotateY(-20deg); } to { transform: translate3d(22px, -30px, 60px) rotateX(-10deg) rotateY(18deg); } }
@keyframes float2 { from { transform: translate3d(0, 0, 0) rotateX(-14deg) rotateY(24deg); } to { transform: translate3d(-26px, 34px, 40px) rotateX(18deg) rotateY(-14deg); } }
@keyframes float3 { from { transform: translate3d(0, 0, 0) rotateX(20deg) rotateY(14deg); } to { transform: translate3d(-18px, -26px, 70px) rotateX(-8deg) rotateY(-22deg); } }
@keyframes float4 { from { transform: translate3d(0, 0, 0) rotateY(0deg); } to { transform: translate3d(28px, 24px, 30px) rotateY(180deg); } }

/* Light sweeping down the pane */
.pane-beam {
  position: absolute; left: -30%; right: -30%; top: -40%; height: 46%;
  background: linear-gradient(180deg, transparent, rgba(196, 181, 253, .07) 45%, transparent);
  transform: rotate(-12deg);
  animation: beam 11s var(--ease) infinite;
}
@keyframes beam { 0% { top: -45%; opacity: 0; } 18% { opacity: 1; } 70%, 100% { top: 115%; opacity: 0; } }

/* ---------- Card ---------- */
.auth-pane.shake { animation: shake 420ms var(--ease); }
@keyframes shake { 10%, 90% { transform: translateX(-3px); } 30%, 70% { transform: translateX(5px); } 50% { transform: translateX(-7px); } }

.auth-card {
  position: relative; z-index: 2; width: 100%; max-width: 380px;
  padding: 30px 28px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(34, 23, 58, .9), rgba(21, 13, 36, .9));
  border: 1px solid rgba(196, 181, 253, .16);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
  transform: perspective(900px) rotateX(calc(var(--my) * 5deg)) rotateY(calc(var(--mx) * -6deg));
  transition: transform 400ms var(--ease-out);
  animation: cardIn 820ms var(--ease-out) 120ms both;
}
@keyframes cardIn { from { opacity: 0; transform: perspective(900px) translateY(28px) rotateX(10deg); } to { opacity: 1; } }
/* Light travelling around the card's edge. @property lets the conic angle
   animate; without it the gradient simply stays put. */
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.auth-card-glow {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent, rgba(167, 139, 250, .7) 12%, rgba(240, 171, 252, .5) 20%, transparent 34%);
  mask: linear-gradient(#000, #000) content-box exclude, linear-gradient(#000, #000);
  padding: 1px; opacity: .9;
  animation: edgeRun 7s linear infinite;
}
@keyframes edgeRun { to { --ang: 360deg; } }

.auth-brand { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.auth-brand img { height: 20px; }
.auth-brand b { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: #c4b5fd; }
.auth-card h1 { font-size: 24px; letter-spacing: -.02em; font-weight: 720; }
.auth-sub { color: #b9aed3; font-size: 13.5px; margin-top: 5px; }

.auth-form { margin-top: 22px; display: grid; gap: 14px; }
.auth-field > span { display: block; font-size: 12px; font-weight: 600; color: #b9aed3; margin-bottom: 6px; }
.auth-in {
  display: flex; align-items: center; gap: 9px;
  padding: 0 12px; height: 46px; border-radius: 13px;
  background: rgba(10, 5, 20, .6);
  border: 1px solid rgba(196, 181, 253, .16);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.auth-in:focus-within { border-color: rgba(167, 139, 250, .7); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18); background: rgba(10, 5, 20, .85); }
.auth-in svg { width: 17px; height: 17px; color: #8f82ad; flex-shrink: 0; }
.auth-in input { flex: 1; background: none; border: 0; outline: 0; color: #f4f0fc; font: 500 14.5px var(--font); min-width: 0; }
.auth-in input::placeholder { color: #6b6182; }
.auth-eye { background: none; border: 0; cursor: pointer; display: grid; place-items: center; padding: 4px; border-radius: 8px; }
.auth-eye svg { color: #6b6182; transition: color var(--t); }
.auth-eye:hover svg, .auth-eye.on svg { color: #c4b5fd; }

.auth-err { font-size: 12.5px; color: #fb7185; display: none; align-items: center; gap: 6px; }
.auth-err.on { display: flex; animation: lift 240ms var(--ease-out); }

.auth-go {
  position: relative; overflow: hidden;
  height: 48px; margin-top: 4px; border: 0; border-radius: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 650 14.5px var(--font); color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 12px 30px -10px rgba(124, 58, 237, .9);
  transition: transform var(--t) var(--spring), box-shadow var(--t), filter var(--t);
}
.auth-go:disabled { opacity: .75; cursor: progress; transform: none; filter: none; }
.auth-go.busy svg { animation: spinSlow 1s linear infinite; }
.auth-go svg { width: 17px; height: 17px; transition: transform var(--t) var(--ease-out); }
.auth-go:hover { transform: translateY(-2px); filter: brightness(1.07); }
.auth-go:hover svg { transform: translateX(4px); }
.auth-go:active { transform: translateY(0) scale(.99); }
.auth-go::after {
  content: ''; position: absolute; inset: 0 auto 0 -60%; width: 50%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
  animation: sheen 3.4s var(--ease) 1.2s infinite;
}
@keyframes sheen { 0% { left: -60%; } 55%, 100% { left: 130%; } }

.auth-quick { margin-top: 20px; }
.auth-quick .eyebrow { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #6b6182; font-weight: 700; }
.auth-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.auth-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 10px 5px 5px; border-radius: 999px;
  background: rgba(34, 23, 58, .8); border: 1px solid rgba(196, 181, 253, .14);
  color: #d8d0ea; font: 600 12px var(--font);
  transition: transform var(--t) var(--spring), border-color var(--t), background var(--t);
}
.auth-chip:hover { transform: translateY(-2px); border-color: rgba(167, 139, 250, .6); background: rgba(44, 30, 74, .9); }

.auth-foot { margin-top: 18px; font-size: 11.5px; line-height: 1.5; color: #6b6182; }

/* ---------- Narrow screens ---------- */
@media (max-width: 920px) {
  .auth { grid-template-columns: 1fr; }
  .auth-scene { position: absolute; inset: 0; }
  .auth-stage { width: 220px; height: 220px; opacity: .5; }
  .auth-pitch { display: none; }
  .auth-pane { background: none; border: 0; z-index: 3; }
  .auth-card { backdrop-filter: blur(14px); }
  .pane-fx, .auth-seam { display: none; }
}

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  .auth, .auth *, .auth *::after, .auth *::before { animation: none !important; transition: none !important; }
  .auth-pitch h2 span, .auth-pitch p { opacity: 1; }
}
.no-motion .auth, .no-motion .auth *, .no-motion .auth *::after { animation: none !important; transition: none !important; }
.no-motion .auth-pitch h2 span, .no-motion .auth-pitch p { opacity: 1; }
