/* ============================================================
   LUMA Auth Entry Shell — v2 reference implementation
   Contract: docs/PREMIUM_AUTH_ENTRY_SHELL_STANDARD.md
   Layout:   two-panel (brand / form), single panel on mobile
   Motion:   brand-mark intro pass-through + shell rise + outro
   Branding: token-only. Swap the variables, logo slots, and copy.
   ============================================================ */

:root {
  --auth-page-bg: #08090f;
  --auth-page-ink: #f4f4f6;
  --auth-card-bg: rgba(16, 17, 24, 0.92);
  --auth-card-border: rgba(255, 255, 255, 0.13);
  --auth-brand-panel: #101018;
  --auth-accent: #c9b8ff;
  --auth-accent-strong: #a98bff;
  --auth-muted: rgba(244, 244, 246, 0.55);
  --auth-shadow: 0 34px 90px rgba(0, 0, 0, 0.5);

  /* shell-internal tokens (derived, overridable) */
  --auth-input-bg: rgba(255, 255, 255, 0.04);
  --auth-input-border: rgba(255, 255, 255, 0.14);
  --auth-button-ink: #0b0b12;
  --auth-intro-bg:
    radial-gradient(circle at 50% 44%, rgba(122, 92, 255, 0.20), transparent 34%),
    radial-gradient(circle at 18% 18%, rgba(201, 184, 255, 0.10), transparent 30%),
    #07080e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", "SF Pro Text", -apple-system, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 82% -10%, rgba(122, 92, 255, 0.14), transparent 40%),
    radial-gradient(circle at 8% 110%, rgba(122, 92, 255, 0.10), transparent 40%),
    var(--auth-page-bg);
  color: var(--auth-page-ink);
  -webkit-font-smoothing: antialiased;
}

.auth-entry {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

/* ---------------- intro loader ---------------- */

[data-auth-intro] {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--auth-intro-bg);
  pointer-events: none;
  animation: authIntroFade 2850ms ease forwards;
}

.auth-intro-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  transform-origin: 50% 50%;
  animation: authLockupPass 2700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

[data-auth-intro-check] {
  width: min(74px, 16vw);
  height: auto;
  opacity: 0;
  transform: scale(0.92);
  filter: blur(12px);
  animation: authMarkResolve 1400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

[data-auth-intro-logo] {
  height: min(40px, 9vw);
  width: auto;
  opacity: 0;
  transform: translateX(-14px);
  filter: blur(8px);
  animation: authWordmarkResolve 900ms cubic-bezier(0.22, 1, 0.36, 1) 950ms forwards;
}

/* mark: blur in, settle, blip */
@keyframes authMarkResolve {
  0%   { opacity: 0; transform: scale(0.92); filter: blur(14px); }
  55%  { opacity: 1; transform: scale(1);    filter: blur(0); }
  78%  { opacity: 1; transform: scale(1.06); filter: blur(0); }
  100% { opacity: 1; transform: scale(1);    filter: blur(0); }
}

/* wordmark: resolves out of the mark after the blip */
@keyframes authWordmarkResolve {
  0%   { opacity: 0; transform: translateX(-14px); filter: blur(8px); }
  100% { opacity: 1; transform: translateX(0);     filter: blur(0); }
}

/* whole lockup: hold, then zoom through the screen */
@keyframes authLockupPass {
  0%, 68% { opacity: 1;    transform: scale(1);    filter: blur(0); }
  86%     { opacity: 0.82; transform: scale(8.5);  filter: blur(16px); }
  100%    { opacity: 0;    transform: scale(18);   filter: blur(42px); }
}

@keyframes authIntroFade {
  0%, 66% { opacity: 1; }
  100%    { opacity: 0; visibility: hidden; }
}

/* ---------------- shell ---------------- */

.auth-shell {
  width: min(100%, 1180px);
  min-height: min(700px, calc(100vh - 96px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.86fr);
  overflow: hidden;
  border: 1px solid var(--auth-card-border);
  border-radius: 32px;
  background: var(--auth-card-bg);
  box-shadow: var(--auth-shadow);
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: opacity 520ms ease, transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-shell-ready {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* outro: shell recedes on successful submit */
.auth-shell-leave {
  opacity: 0;
  transform: translateY(-10px) scale(0.982);
  transition: opacity 440ms ease, transform 520ms cubic-bezier(0.5, 0, 0.75, 0.4);
}

/* ---------------- brand panel (left) ---------------- */

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  background:
    radial-gradient(circle at 24% 22%, rgba(122, 92, 255, 0.26), transparent 34%),
    radial-gradient(circle at 82% 84%, rgba(201, 184, 255, 0.12), transparent 30%),
    linear-gradient(150deg, #14141d 0%, #0e0f1a 58%, #090a12 100%);
  color: #fff;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 30%),
    radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.3) 82%);
  pointer-events: none;
}

.auth-brand > * { position: relative; z-index: 1; }

.auth-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-brand-lockup svg { display: block; }

.auth-brand-quote {
  max-width: 400px;
  display: grid;
  gap: 14px;
}

.auth-brand-quote blockquote {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.88);
}

.auth-brand-quote cite {
  font-style: normal;
  font-size: 14px;
  font-weight: 500;
  color: var(--auth-muted);
}

/* ---------------- form panel (right) ---------------- */

.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px;
}

.auth-mode-switch {
  position: absolute;
  top: 26px;
  right: 30px;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--auth-page-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease;
}

.auth-mode-switch:hover { background: rgba(255, 255, 255, 0.07); }

.auth-card {
  width: 100%;
  max-width: 350px;
  display: grid;
  gap: 22px;
}

.auth-heading {
  display: grid;
  gap: 8px;
  text-align: center;
}

.auth-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.auth-heading p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--auth-muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-muted);
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--auth-input-border);
  border-radius: 12px;
  background: var(--auth-input-bg);
  color: var(--auth-page-ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.auth-input::placeholder { color: rgba(244, 244, 246, 0.35); }

.auth-input:focus-visible {
  outline: none;
  border-color: var(--auth-accent-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent-strong) 28%, transparent);
}

.auth-button {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--auth-accent), var(--auth-accent-strong));
  color: var(--auth-button-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), filter 180ms ease, opacity 180ms ease;
}

.auth-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.auth-button:active { transform: translateY(0) scale(0.99); }
.auth-button[disabled] { opacity: 0.65; cursor: default; transform: none; }

.auth-button:focus-visible,
.auth-button-ghost:focus-visible,
.auth-mode-switch:focus-visible {
  outline: 2px solid var(--auth-accent-strong);
  outline-offset: 2px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--auth-muted);
}

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

.auth-providers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-button-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  border: 1px solid var(--auth-input-border);
  border-radius: 12px;
  background: transparent;
  color: var(--auth-page-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-button-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.auth-status {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  color: var(--auth-muted);
}

.auth-status[data-tone="success"] { color: var(--auth-accent); }
.auth-status[data-tone="error"] { color: #ff8f8f; }

.auth-terms {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  text-align: center;
  color: var(--auth-muted);
}

.auth-terms a {
  color: var(--auth-page-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--auth-accent-strong);
}

/* staggered reveal of card children once the shell is ready */
.auth-card > * {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 480ms ease, transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-shell-ready .auth-card > * { opacity: 1; transform: translateY(0); }
.auth-shell-ready .auth-card > *:nth-child(1) { transition-delay: 60ms; }
.auth-shell-ready .auth-card > *:nth-child(2) { transition-delay: 140ms; }
.auth-shell-ready .auth-card > *:nth-child(3) { transition-delay: 200ms; }
.auth-shell-ready .auth-card > *:nth-child(4) { transition-delay: 250ms; }
.auth-shell-ready .auth-card > *:nth-child(5) { transition-delay: 290ms; }
.auth-shell-ready .auth-card > *:nth-child(6) { transition-delay: 320ms; }

/* mode crossfade: brief settle when copy swaps */
.auth-mode-swap .auth-card > * {
  opacity: 0;
  transform: translateY(6px);
  transition-delay: 0ms !important;
}

/* ---------------- outro overlay ---------------- */

.auth-outro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--auth-intro-bg);
  pointer-events: none;
  opacity: 0;
  animation: authOutroFadeIn 1500ms ease forwards;
}

.auth-outro .auth-intro-lockup {
  animation: authOutroPass 1500ms cubic-bezier(0.55, 0, 0.6, 0.2) forwards;
}

.auth-outro [data-auth-intro-check],
.auth-outro [data-auth-intro-logo] {
  opacity: 1;
  transform: none;
  filter: none;
  animation: none;
}

@keyframes authOutroFadeIn {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes authOutroPass {
  0%   { opacity: 0;    transform: scale(0.6);  filter: blur(10px); }
  38%  { opacity: 1;    transform: scale(1);    filter: blur(0); }
  55%  { opacity: 1;    transform: scale(1.05); filter: blur(0); }
  85%  { opacity: 0.85; transform: scale(9);    filter: blur(18px); }
  100% { opacity: 0;    transform: scale(19);   filter: blur(44px); }
}

.auth-post[hidden] { display: none; }

.auth-post {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  background: var(--auth-page-bg);
  opacity: 0;
  transition: opacity 600ms ease 150ms;
}

.auth-post-visible { opacity: 1; }

.auth-post-inner {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.auth-post-inner p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--auth-muted);
}

.auth-post-replay {
  padding: 10px 18px;
  border: 1px solid var(--auth-input-border);
  border-radius: 12px;
  background: transparent;
  color: var(--auth-page-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease;
}

.auth-post-replay:hover { background: rgba(255, 255, 255, 0.07); }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .auth-entry { padding: 20px; }

  .auth-shell {
    display: block;
    width: min(100%, 430px);
    min-height: auto;
    border-radius: 26px;
  }

  .auth-brand { display: none; }

  .auth-panel { padding: 72px 26px 30px; }
}

@media (max-width: 420px) {
  .auth-entry { padding: 12px; }
  .auth-panel { padding: 66px 20px 24px; }
  .auth-providers { grid-template-columns: 1fr; }
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  [data-auth-intro],
  .auth-intro-lockup,
  [data-auth-intro-check],
  [data-auth-intro-logo],
  .auth-outro,
  .auth-outro .auth-intro-lockup,
  .auth-shell,
  .auth-card > * {
    animation: none !important;
    transition: none !important;
  }

  [data-auth-intro] { display: none; }
  .auth-shell { opacity: 1; transform: none; }
  .auth-card > * { opacity: 1; transform: none; }
}
