/* ============================================================
   In Your Face — login page (index.html)
   Extends shared.css. Tokens only — no new raw hex colors.
   ============================================================ */

/* Reveal gate: login.js adds .ready once the auth check decides
   we're staying here (signed-in users get routed away first, so
   the form never flashes for them). */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  /* failsafe: if login.js never runs, reveal anyway after ~1.2s so
     the page is never permanently blank (.ready still wins instantly) */
  animation: reveal-failsafe 0.3s ease 1.2s forwards;
}

body.ready { opacity: 1; }

@keyframes reveal-failsafe { to { opacity: 1; } }

/* ------------------------------------------------------------
   Layout shell — split hero on desktop, single column on phones
   ------------------------------------------------------------ */
.login-shell {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(1.6rem + var(--safe-top)) 1.25rem 2rem;
  display: grid;
  gap: 2.5rem;
  align-content: start;
}

@media (min-width: 900px) {
  .login-shell {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    align-content: center;
    gap: clamp(3rem, 6vw, 5.5rem);
    padding: calc(2rem + var(--safe-top)) 3rem 2rem;
  }
}

/* ------------------------------------------------------------
   Hero / brand panel
   ------------------------------------------------------------ */
.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.4rem;
  min-width: 0;
}

.logo img { box-shadow: var(--glow-violet); }

.hero-title {
  font-size: var(--fs-hero);
  line-height: 1.04;
  max-width: 13ch;
  text-wrap: balance;
}

.hero-sub {
  font-size: var(--fs-md);
  line-height: 1.6;
  max-width: 46ch;
}

.trust-line {
  gap: 0.6em;
  padding: 0.5em 1.1em;
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.06);
}

/* ------------------------------------------------------------
   Mirror stage — CSS-only mirrored orbs, seam, floating chips
   ------------------------------------------------------------ */
.mirror-stage {
  position: relative;
  width: 100%;
  max-width: 580px;
  aspect-ratio: 16 / 10;
  margin-top: 0.4rem;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
}

.orb-l {
  left: 4%;
  top: 8%;
  width: 46%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 35% 35%, rgba(139, 92, 246, 0.75), rgba(139, 92, 246, 0) 70%);
  filter: blur(38px);
  animation: orbL 11s ease-in-out infinite alternate;
}

.orb-r {
  right: 4%;
  top: 8%;
  width: 46%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 65% 35%, rgba(34, 211, 238, 0.6), rgba(34, 211, 238, 0) 70%);
  filter: blur(38px);
  animation: orbR 11s ease-in-out infinite alternate;
}

.orb-m {
  left: 50%;
  bottom: -8%;
  width: 34%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(232, 121, 249, 0.4), rgba(232, 121, 249, 0) 70%);
  filter: blur(44px);
  animation: orbM 9s ease-in-out infinite alternate;
}

@keyframes orbL { to { transform: translate(9%, -7%) scale(1.07); } }
@keyframes orbR { to { transform: translate(-9%, -7%) scale(1.07); } }
@keyframes orbM { to { transform: translateX(-50%) translateY(-8%) scale(1.12); } }

/* the mirror line itself */
.seam {
  position: absolute;
  left: 50%;
  top: 5%;
  bottom: 5%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.55) 28%,
    rgba(255, 255, 255, 0.55) 72%,
    rgba(255, 255, 255, 0));
  box-shadow: 0 0 22px rgba(139, 92, 246, 0.55), 0 0 44px rgba(34, 211, 238, 0.3);
}

/* floating variation chips: wrapper = position + entrance,
   inner .chip = perpetual drift */
.fp { position: absolute; }

.fp .chip {
  background: rgba(12, 14, 21, 0.72);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  animation: chipFloat 6.4s ease-in-out infinite alternate;
}

@keyframes chipFloat {
  from { transform: translateY(5px); }
  to   { transform: translateY(-7px); }
}

.fp1 { left: 2%;  top: 6%;  }
.fp2 { left: 60%; top: 3%;  }
.fp3 { left: 12%; top: 38%; }
.fp4 { left: 64%; top: 42%; }
.fp5 { left: 37%; top: 18%; }
.fp6 { left: 5%;  top: 72%; }
.fp7 { left: 41%; top: 64%; }
.fp8 { left: 63%; top: 80%; }

/* desynchronize the drift so the cloud feels alive */
.fp1 .chip { animation-delay: -0.6s; }
.fp2 .chip { animation-delay: -2.1s; animation-duration: 7.6s; }
.fp3 .chip { animation-delay: -3.4s; animation-duration: 7s;   }
.fp4 .chip { animation-delay: -1.2s; }
.fp5 .chip { animation-delay: -4.6s; animation-duration: 8.2s; }
.fp6 .chip { animation-delay: -2.8s; animation-duration: 7.2s; }
.fp7 .chip { animation-delay: -5.3s; }
.fp8 .chip { animation-delay: -3.9s; animation-duration: 8s;   }

/* mirror-coded dots: violet = left side, magenta = center blends,
   cyan = right side */
.fp .dot { width: 6px; height: 6px; }

.fp1 .dot, .fp3 .dot, .fp6 .dot {
  background: rgba(139, 92, 246, 0.95);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.7);
}

.fp5 .dot, .fp7 .dot {
  background: rgba(232, 121, 249, 0.9);
  box-shadow: 0 0 8px rgba(232, 121, 249, 0.6);
}

.fp2 .dot, .fp4 .dot, .fp8 .dot {
  background: rgba(34, 211, 238, 0.95);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

/* ------------------------------------------------------------
   Sign-in card
   ------------------------------------------------------------ */
.form-panel {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2.4rem 2.1rem 2rem;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* gradient hairline across the card's top edge */
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(139, 92, 246, 0),
    rgba(139, 92, 246, 0.7) 30%,
    rgba(34, 211, 238, 0.7) 70%,
    rgba(34, 211, 238, 0));
}

.card-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.card-title { font-size: var(--fs-lg); }

.card-sub { font-size: var(--fs-sm); }

.form-group {
  display: flex;
  flex-direction: column;
}

/* ≥16px input text stops iOS from zooming the page on focus */
.field input { font-size: max(1rem, var(--fs-base)); }

/* dark, token-derived autofill (Chrome/Safari would paint it light) */
.field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 44px var(--bg-elev) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 999999s;
}

.field input:-webkit-autofill + label {
  top: 0.85em;
  transform: none;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* password show/hide */
.pw-field input { padding-right: 3.6em; }

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.pw-toggle:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.pw-toggle[aria-pressed="true"] { color: var(--cyan); }

/* submit + loading swap */
.login-submit {
  width: 100%;
  margin-top: 0.4rem;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}

.login-submit .spinner {
  width: 18px;
  height: 18px;
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.95);
}

/* divider */
.divider {
  display: flex;
  align-items: center;
  gap: 1em;
  margin: 0.2rem 0;
  color: var(--text-faint);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* dev bypass */
.login-dev { width: 100%; }

.dev-note {
  text-align: center;
  margin-top: -0.2rem;
}

/* ------------------------------------------------------------
   Footer strip
   ------------------------------------------------------------ */
.page-foot {
  padding: 1rem 1.5rem calc(1.1rem + var(--safe-bottom));
  text-align: center;
}

.foot-note { font-size: var(--fs-xs); }

/* ------------------------------------------------------------
   Condensed single-column (phones + narrow windows)
   ------------------------------------------------------------ */
@media (max-width: 899.98px) {
  .hero-panel {
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding-top: 0.8rem;
  }

  .hero-title { max-width: 15ch; }

  .hero-sub {
    font-size: var(--fs-base);
    max-width: 40ch;
  }

  .mirror-stage { display: none; }

  .login-card {
    max-width: 480px;
    padding: 1.9rem 1.4rem 1.6rem;
  }
}

@media (max-width: 380px) {
  .login-shell { padding-left: 1rem; padding-right: 1rem; }
  .login-card { padding: 1.7rem 1.15rem 1.5rem; }
}
