/* ============================================================
   NEXRA CAPITAL - authentication
   - Join (sign up): full split-screen page in /auth
   - Log in: global modal popup (.lm-*) injected on every page
   Sign in: Continue with Google, or email, or mobile phone
   → one-time code. Builds on tokens/components in styles.css.
   ============================================================ */

body.auth {
  background: var(--bg-warm);
}

/* ---------- Shell (Join + Verify pages) ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
}

/* ---------- Brand aside ---------- */
.auth-aside {
  position: relative;
  isolation: isolate;
  background: var(--navy-900);
  color: #c9d4e2;
  padding: clamp(40px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auth-aside__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    165deg,
    rgba(8, 17, 32, 0.82) 0%,
    rgba(8, 17, 32, 0.7) 46%,
    rgba(8, 17, 32, 0.92) 100%
  );
}

.auth-aside__glow {
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 164, 92, 0.22), transparent 65%);
  top: -160px;
  right: -120px;
  z-index: -1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.auth-brand__logo {
  display: block;
  width: min(230px, 80%);
  height: 56px;
  object-fit: contain;
  object-position: left center;
}

.auth-brand .brand__mark {
  width: 42px;
  height: 42px;
}

.auth-brand b {
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: #f4f6f9;
  display: block;
  line-height: 1;
}

.auth-brand span > span {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.52em;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-top: 5px;
}

.auth-aside__body {
  margin-top: auto;
  margin-bottom: auto;
  padding: 48px 0;
  max-width: 30ch;
}

.auth-aside__body .eyebrow {
  color: var(--gold);
}

.auth-aside h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 2.6vw, 2.5rem);
  line-height: 1.16;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 30px;
}

.auth-aside h2 em {
  font-style: italic;
  color: var(--gold);
}

.auth-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-points li {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  font-size: 0.95rem;
  color: #cdd8e6;
  line-height: 1.5;
}

.auth-points svg {
  flex: none;
  margin-top: 2px;
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(201, 164, 92, 0.16);
  color: var(--gold);
}

.auth-aside__foot {
  font-size: 0.8rem;
  color: #7e8da4;
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-aside__foot svg {
  color: var(--gold);
  flex: none;
}

/* ---------- Form side ---------- */
.auth-main {
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 3vw, 30px) clamp(20px, 5vw, 64px) clamp(28px, 4vw, 48px);
  overflow-y: auto;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(18px, 4vw, 40px);
}

.auth-topbar__home {
  display: none;
  align-items: center;
  gap: 0;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.auth-topbar__logo {
  display: block;
  width: 166px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.auth-topbar__home .brand__mark {
  width: 34px;
  height: 34px;
}

.auth-topbar__home b {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--ink);
}

.auth-back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s;
}

.auth-back:hover {
  color: var(--gold-deep);
}

.auth-back svg {
  transition: transform 0.25s var(--ease);
}

.auth-back:hover svg {
  transform: translateX(-3px);
}

/* ---------- Card ---------- */
.auth-card {
  width: 100%;
  max-width: 408px;
  margin: auto;
  padding: clamp(8px, 2vw, 16px) 0;
}

.auth-card__head {
  margin-bottom: 26px;
}

.auth-card__head .eyebrow {
  margin-bottom: 14px;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.2vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 10px;
}

.auth-card h1 em {
  font-style: italic;
  color: var(--gold);
}

.auth-card__sub {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.auth-card__sub a,
.auth-foot a {
  color: var(--gold-deep);
  font-weight: 700;
}

.auth-card__sub a:hover,
.auth-foot a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Social buttons (Google) ---------- */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line);
  background: #fff;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}

.sbtn:hover {
  border-color: rgba(201, 164, 92, 0.6);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.sbtn:active {
  transform: translateY(0);
}

.sbtn svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.sbtn.is-busy {
  color: var(--muted);
  pointer-events: none;
}

.sbtn.is-busy .sbtn__label::after {
  content: "…";
}

/* ---------- Divider ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Segmented email / phone ---------- */
.auth-seg {
  margin-bottom: 16px;
}

.auth-pane {
  display: none;
}

.auth-pane.on {
  display: block;
  animation: authFade 0.3s var(--ease);
}

@keyframes authFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Phone field with dial code ---------- */
.tel-wrap {
  display: flex;
  align-items: stretch;
  background: var(--bg-warm);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  transition: 0.25s;
}

.tel-wrap:focus-within {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 164, 92, 0.15);
}

.tel-wrap__code {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 14px;
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--ink);
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.tel-wrap__code .flag {
  font-size: 1.05rem;
  line-height: 1;
}

.tel-wrap input {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 12px 15px;
  font-size: 0.93rem;
  font-weight: 500;
}

.field.invalid .tel-wrap {
  border-color: #b03a2e;
}

/* ---------- Submit ---------- */
.auth-hint {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  margin: -2px 0 6px;
}

.auth-submit {
  margin-top: 4px;
}

.auth-submit .spin,
.btn .spin {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(12, 27, 46, 0.25);
  border-top-color: var(--navy-900);
  animation: authSpin 0.7s linear infinite;
  display: none;
}

.btn.is-loading .spin {
  display: inline-block;
}

.btn.is-loading .auth-submit__label,
.btn.is-loading .arr {
  display: none;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Foot switch link ---------- */
.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.auth-fine {
  margin-top: 16px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--faint);
  text-align: center;
}

.auth-fine a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-fine a:hover {
  color: var(--gold-deep);
}

/* ---------- OTP ---------- */
.otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  margin: 6px 0 4px;
}

.otp input {
  aspect-ratio: 1;
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-warm);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  transition: 0.2s;
}

.otp input:focus {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 164, 92, 0.18);
}

.otp input.filled {
  border-color: var(--gold);
}

.otp.shake {
  animation: authShake 0.4s;
}

@keyframes authShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.otp-resend {
  margin-top: 18px;
  font-size: 0.88rem;
  color: var(--muted);
}

.otp-resend button {
  color: var(--gold-deep);
  font-weight: 700;
}

.otp-resend button:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.otp-resend button:disabled {
  color: var(--faint);
  cursor: default;
  font-weight: 600;
}

/* ---------- Inline form error ---------- */
.auth-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: rgba(176, 58, 46, 0.07);
  border: 1px solid rgba(176, 58, 46, 0.28);
  color: #8f2d23;
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.auth-alert.show {
  display: flex;
}

.auth-alert svg {
  flex: none;
  margin-top: 1px;
}

/* ---------- Success panel (verify page) ---------- */
.auth-done {
  display: none;
  text-align: center;
  animation: authFade 0.4s var(--ease);
}

.auth-done.show {
  display: block;
}

.auth-form.hide {
  display: none;
}

.auth-done__ico {
  width: 66px;
  height: 66px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  display: grid;
  place-items: center;
}

.auth-done h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--ink);
  margin-bottom: 12px;
}

.auth-done p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ============================================================
   LOG IN MODAL (injected globally as .lm-overlay)
   ============================================================ */
.lm-overlay {
  position: fixed;
  inset: 0;
  z-index: 340;
  background: rgba(8, 17, 32, 0.62);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 40px);
  opacity: 0;
  visibility: hidden;
  transition: 0.28s;
}

.lm-overlay.open {
  opacity: 1;
  visibility: visible;
}

.lm {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(26px, 4vw, 40px);
  transform: translateY(14px) scale(0.985);
  transition: 0.28s var(--ease);
}

.lm-overlay.open .lm {
  transform: none;
}

.lm__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fff;
  transition: 0.2s;
}

.lm__close:hover {
  background: var(--bg-soft);
  color: var(--ink);
  transform: rotate(90deg);
}

.lm__brand {
  display: flex;
  align-items: center;
  gap: 0;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
  margin-bottom: 20px;
}

.lm__brand-logo {
  display: block;
  width: 170px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.lm__brand .brand__mark {
  width: 34px;
  height: 34px;
}

.lm__brand b {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--ink);
}

.lm__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 6px;
}

.lm__sub {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 22px;
}

.lm__sub strong {
  color: var(--ink);
  font-weight: 600;
}

.lm-step {
  display: none;
}

.lm-step.on {
  display: block;
  animation: authFade 0.3s var(--ease);
}

.lm__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

.lm__back:hover {
  color: var(--gold-deep);
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    display: none;
  }
  .auth-topbar__home {
    display: flex;
  }
  .auth-main {
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  .otp {
    gap: 6px;
  }
  .otp input {
    font-size: 1.25rem;
  }
  .auth-main {
    padding-left: 18px;
    padding-right: 18px;
  }
  .lm {
    padding: 24px 20px 28px;
  }
}
