/* ===== Suite sign-in: "Night Marquee" (de booth-ready-v2) =====
   Autocontenido y scoped a .login-stage para no chocar con los estilos del hub.
   Fuente canónica: booth-ready-v2/src/index.css + expo-booth-quoter/src/signin.css */

.login-stage {
  --muted: #a7a29a;
  --faint: #7d7870;
  --accent: #d97757;
  --accent-hover: #e8927c;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --problem: #ef5350;
  --card: #141311;
  --raised: #1b1a17;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --tracking-label: 0.14em;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --shadow-lift: 0 12px 30px -14px rgba(0, 0, 0, 0.7);
  --font-mono: 'Space Mono', ui-monospace, monospace;
  background: #0a0a0a;
  color: #edeae3;
  /* overlay: cubre el hub entero hasta que haya sesión */
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px 24px;
  isolation: isolate;
}

/* Idioms del tracker, scoped (solo los que usa la vista) */
.login-stage .label {
  font-family: var(--font-mono, ui-monospace, monospace);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: var(--tracking-label);
}
.login-stage .display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.005em;
}
.login-stage .lift {
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.login-stage .lift:hover {
  background-color: var(--raised);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.login-stage .lift:active {
  transform: translateY(0) scale(0.99);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: none;
}
.login-stage .field {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  caret-color: var(--accent);
  color: #edeae3;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.login-stage .field:hover {
  border-color: var(--line-strong);
}
.login-stage .field:focus,
.login-stage .field:focus-within {
  outline: none;
  border-color: var(--line-strong);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 85%, transparent),
    0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Utilidades de color */
.login-stage .text-faint { color: var(--faint); }
.login-stage .text-muted { color: var(--muted); }
.login-stage .text-problem { color: var(--problem); }
.login-stage .text-accent { color: var(--accent); }
.login-stage .bg-accent-soft { background-color: var(--accent-soft); }
.login-stage .border-accent { border-color: var(--accent); }

/* ——— SignIn stage: "Night Marquee" ———
   The EXPO logo hangs from a hairline truss like a lit sign over a dark show
   floor. Choreography: halos warm the room → the sign is hung → it ignites →
   its light lands on the floor → the form rises into the pool. After entry the
   only perpetual motion is the lamp's 6s breathe. */

.halo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.halo-top {
  top: -28vh;
  width: 130vw;
  height: 62vh;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--accent) 16%, transparent),
    color-mix(in srgb, var(--accent) 5%, transparent) 45%,
    transparent 72%
  );
  animation: halo-in-down 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.halo-bottom {
  bottom: -30vh;
  width: 120vw;
  height: 52vh;
  background: radial-gradient(closest-side, rgba(125, 56, 35, 0.55), transparent 70%);
  --halo-o: 0.24;
  animation: halo-in-up 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}
.light-pool {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  width: 80vw;
  height: 20vh;
  pointer-events: none;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--accent) 8%, transparent),
    transparent 70%
  );
  animation: pool-in 0.6s ease-out 0.65s both;
}
@keyframes halo-in-down {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px);
  }
  to {
    opacity: var(--halo-o, 1);
    transform: translateX(-50%);
  }
}
@keyframes halo-in-up {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(40px);
  }
  to {
    opacity: var(--halo-o, 1);
    transform: translateX(-50%);
  }
}
@keyframes pool-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Illuminated arcs */
.arcs {
  --arc-em: calc(min(min(1000px, 100svh), 100vw) * 0.022);
  position: absolute;
  inset: 0;
  margin: 0 auto;
  width: 100%;
  max-width: calc(var(--arc-em) * 44);
  pointer-events: none;
}
.arc {
  --arc-light: color-mix(in srgb, var(--accent-hover) 45%, #fff6ec);
  position: absolute;
  inset: 0;
  border-radius: calc(var(--arc-em) * 100);
  scale: 1.2;
  opacity: 0.6;
  box-shadow:
    inset 0 0 calc(var(--arc-em) * 4) calc(var(--arc-em) * 3)
      color-mix(in srgb, var(--arc-light) 20%, transparent),
    inset 0 0 calc(var(--arc-em) * 2) calc(var(--arc-em) * 0.4)
      color-mix(in srgb, var(--arc-light) 20%, transparent),
    0 0 calc(var(--arc-em) * 0.1) calc(var(--arc-em) * 0.1)
      color-mix(in srgb, var(--arc-light) 20%, transparent),
    0 0 calc(var(--arc-em) * 1) calc(var(--arc-em) * 0.4)
      color-mix(in srgb, var(--arc-light) 30%, transparent);
}
.arc-top {
  translate: 0 -74%;
  animation: arc-in-top 1s ease-in-out both;
}
.arc-bottom {
  --arc-rest: 64%;
  translate: 0 70%;
  animation: arc-in-bottom 1s ease-in-out 0.15s both;
}
@media (orientation: portrait) {
  .arc-bottom { --arc-rest: 62%; }
}
@keyframes arc-in-top {
  from { translate: 0 -74%; opacity: 0.3; }
  to   { translate: 0 -68%; opacity: 0.8; }
}
@keyframes arc-in-bottom {
  from { translate: 0 70%; opacity: 0.3; }
  to   { translate: 0 var(--arc-rest, 64%); opacity: 0.8; }
}

/* Emblem — el PNG lleva ~31% de padding transparente top/bottom */
.emblem {
  --emblem-w: clamp(220px, 34vw, 320px);
  position: relative;
  width: var(--emblem-w);
  margin-top: calc(var(--emblem-w) * -0.195);
  margin-bottom: calc(var(--emblem-w) * -0.16);
}
.emblem img {
  width: 100%;
  height: auto;
  display: block;
}
.emblem-img {
  position: relative;
  --lit: 1;
  filter: url(#emblem-glow);
}
.glow-wrap {
  position: absolute;
  inset: 0;
  --lit: 0.85;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}
.glow-under {
  filter: url(#emblem-glow);
}
.login-stage:focus-within .glow-wrap {
  opacity: 1;
}
/* iPad-Safari escape hatch */
.emblem-fallback {
  filter: drop-shadow(0 0 5px rgba(255, 246, 236, 0.5))
    drop-shadow(0 3px 14px rgba(217, 119, 87, 0.45))
    drop-shadow(0 7px 30px rgba(125, 56, 35, 0.35)) !important;
}

@media (prefers-reduced-motion: no-preference) {
  .emblem-ignite {
    animation: ignite 0.5s linear 0.25s both;
  }
  .emblem-soft {
    animation: fade-lit 0.4s ease-out 0.25s both;
  }
  .glow-under {
    animation: breathe 6s ease-in-out 1.4s infinite alternate;
  }
  [data-busy] .glow-under {
    animation-duration: 1.8s;
  }
  .lamp-dip {
    animation: lamp-dip 0.3s linear both;
  }
}
@keyframes ignite {
  0%   { opacity: 0; }
  12%  { opacity: var(--lit, 1); }
  18%  { opacity: 0.5; }
  28%  { opacity: var(--lit, 1); }
  100% { opacity: var(--lit, 1); }
}
@keyframes fade-lit {
  from { opacity: 0; }
  to   { opacity: var(--lit, 1); }
}
@keyframes breathe {
  from { opacity: 0.65; }
  to   { opacity: 1; }
}
@keyframes lamp-dip {
  0%   { opacity: var(--lit, 1); }
  40%  { opacity: 0.6; }
  100% { opacity: var(--lit, 1); }
}

/* Staggered entrance for copy + form */
.rise {
  animation: rise-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--d, 0ms);
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.err-in {
  animation: err-in 0.15s ease-out both;
}
@keyframes err-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Touch target floor */
.touch { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Layout vanilla ===== */
.login-stage .abs0 { position: absolute; }
.login-stage .ls-center {
  position: relative; z-index: 10; display: flex; width: 100%;
  max-width: 24rem; flex-direction: column; align-items: center;
}
.login-stage .ls-sub { margin: 8px 0 0; font-size: 1.125rem; font-style: italic; }
.login-stage .label { margin: 0; }
.login-stage .ls-form { margin-top: 40px; display: flex; width: 100%; flex-direction: column; }
.login-stage .ls-input {
  width: 100%; padding: 12px 16px; font-size: 1rem; font-family: inherit;
  box-sizing: border-box;
}
.login-stage .ls-input::placeholder { color: var(--faint); }
.login-stage .ls-pwwrap { position: relative; margin-top: 12px; width: 100%; }
.login-stage .ls-pw { padding-right: 48px; }
.login-stage .ls-eye {
  position: absolute; top: 0; bottom: 0; right: 0; display: flex; align-items: center;
  padding: 0 16px; background: none; border: 0; cursor: pointer;
  color: var(--faint); transition: color 0.16s ease;
}
.login-stage .ls-eye:hover { color: var(--muted); }
.login-stage .auth-msg { margin: 12px 0 0; font-size: 0.875rem; line-height: 1.6; }
.login-stage .ls-btn {
  margin-top: 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.5rem; border: 1px solid var(--accent); padding: 12px 0;
  font-weight: 600; cursor: pointer; background-color: var(--accent-soft);
  color: var(--accent); width: 100%;
}
.login-stage .ls-btn:disabled { opacity: 0.4; cursor: default; }

/* ===== Nav user chip (visible cuando hay sesión) ===== */
#user-chip {
  display: none;
  align-items: center;
  gap: 10px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--text-secondary, #a7a29a);
}
#user-chip.visible { display: flex; }
#signout-btn {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11.5px;
  color: var(--text-muted, #6e6a62);
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
  letter-spacing: 0.02em;
}
#signout-btn:hover {
  color: var(--accent, #d97757);
  border-color: rgba(217,119,87,0.35);
}
