/* ============================================================================
   Pro UI — LOCKSCREEN surface (restyle of the existing #auth-gate PIN gate).
   Scope: EVERY selector is under `body.pro-lock` so nothing applies until the
   flag adds that class (window.proFlag('lockscreen') → body.classList.add).
   Uses ONLY var(--pro-*) tokens from pro-tokens.css. No external assets.
   Canon: A.I Vault/J-Bot/J-Bot Pro Surface Blueprint.md + lockscreen.html mock.
   ============================================================================ */

/* Default-HIDE the injected enrichment whenever the Pro lockscreen is NOT active,
   so the legacy gate stays byte-identical with the flag OFF. The scoped rules
   below re-show + style them only under body.pro-lock. (This is the one rule not
   scoped under body.pro-lock, by necessity.) */
body:not(.pro-lock) .pro-lock-head,
body:not(.pro-lock) .pro-lock-wordmark,
body:not(.pro-lock) .pro-lock-rule,
body:not(.pro-lock) .pro-lock-foot { display: none !important; }

/* ---- stage: full-bleed grid + radial cyan glow over the gate overlay ---- */
body.pro-lock #auth-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 620px at 50% -8%, rgba(34, 211, 238, 0.20), transparent 60%),
    radial-gradient(760px 520px at 84% 110%, rgba(18, 182, 207, 0.08), transparent 60%),
    radial-gradient(900px 700px at 10% 90%, rgba(45, 140, 220, 0.06), transparent 60%),
    var(--pro-base);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  overflow: hidden;
  z-index: 1000;
}

/* faint scanning grid, masked to fade toward the edges */
body.pro-lock #auth-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 220, 235, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 220, 235, 0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
}

/* ---- glass card ---- */
body.pro-lock #auth-gate .auth-card {
  position: relative;
  z-index: 1;
  width: min(452px, 100%);
  max-width: 452px;
  padding: 40px 44px 30px;
  background: var(--pro-panel-soft);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 22px;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
  font-family: var(--pro-font-body);
  color: var(--pro-text);
  animation: pro-lock-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pro-lock-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---- head: glowing disc + ring holding the J-Bot sprite ---- */
body.pro-lock .pro-lock-head {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 20px;
}
body.pro-lock .pro-lock-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 211, 238, 0.45);
  box-shadow:
    0 0 40px rgba(34, 211, 238, 0.38),
    inset 0 0 20px rgba(34, 211, 238, 0.12);
  animation: pro-lock-pulse 3.2s ease-in-out infinite;
}
@keyframes pro-lock-pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(34, 211, 238, 0.38), inset 0 0 20px rgba(34, 211, 238, 0.12); }
  50%      { box-shadow: 0 0 56px rgba(34, 211, 238, 0.55), inset 0 0 24px rgba(34, 211, 238, 0.18); }
}
body.pro-lock .pro-lock-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #0f2436 0%, #060d17 80%);
  border: 1px solid rgba(34, 211, 238, 0.5);
  box-shadow:
    0 0 26px rgba(34, 211, 238, 0.35),
    inset 0 0 22px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body.pro-lock .pro-lock-sprite {
  width: 88px;
  height: 88px;
  margin-top: 6px;
}

/* ---- wordmark ---- */
body.pro-lock .pro-lock-wordmark {
  font-family: var(--pro-font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.34em;
  margin: 0 0 0 0.34em;
  color: var(--pro-glow-cyan);
  line-height: 1;
}

/* eyebrow ("Secure access") → mono spine label */
body.pro-lock #auth-gate .welcome-eyebrow {
  font-family: var(--pro-font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pro-text-faint);
  margin: 14px 0 0;
}

/* divider rule */
body.pro-lock .pro-lock-rule {
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.30), transparent);
}

/* ---- greeting (repurposed #auth-title + .auth-copy) ---- */
body.pro-lock #auth-gate #auth-title {
  font-family: var(--pro-font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--pro-text);
  margin: 0;
}
body.pro-lock #auth-gate .auth-copy {
  font-size: 13px;
  line-height: 1.5;
  color: var(--pro-text-muted);
  margin: 6px 0 0;
}

/* ---- PIN field (#auth-input stays fully usable) ---- */
body.pro-lock #auth-gate #auth-input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 22px 0 0;
  padding: 0 16px;
  box-sizing: border-box;
  background: rgba(6, 10, 16, 0.7);
  border: 1px solid rgba(34, 211, 238, 0.7);
  border-radius: 13px;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.10);
  font-family: var(--pro-font-mono);
  font-size: 22px;
  letter-spacing: 0.5em;
  text-align: center;
  color: var(--pro-text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
body.pro-lock #auth-gate #auth-input::placeholder {
  color: var(--pro-text-faint);
  letter-spacing: 0.28em;
  opacity: 1;
}
body.pro-lock #auth-gate #auth-input:focus {
  border-color: var(--pro-glow-cyan);
  box-shadow: 0 0 0 4px rgba(92, 240, 255, 0.16);
}

/* ---- error line ---- */
body.pro-lock #auth-gate #auth-error {
  min-height: 16px;
  margin: 12px 0 0;
  font-family: var(--pro-font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--pro-danger);
}
/* empty error → no reserved gap jump */
body.pro-lock #auth-gate #auth-error:empty {
  margin-top: 0;
  min-height: 0;
}

/* ---- Unlock button (#auth-submit) ---- */
body.pro-lock #auth-gate #auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 52px;
  margin: 14px 0 0;
  border: none;
  border-radius: 13px;
  font-family: var(--pro-font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: #04141a;
  background: linear-gradient(180deg, var(--pro-glow-cyan), var(--pro-deep-cyan));
  box-shadow:
    0 12px 34px rgba(18, 182, 207, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
body.pro-lock #auth-gate #auth-submit:hover {
  filter: brightness(1.05);
  box-shadow:
    0 16px 42px rgba(18, 182, 207, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
body.pro-lock #auth-gate #auth-submit:active {
  transform: translateY(1px);
}
body.pro-lock #auth-gate #auth-submit:disabled {
  filter: saturate(0.6) brightness(0.85);
  cursor: default;
  transform: none;
}

/* ---- Fingerprint unlock (#auth-passkey) — secondary/ghost under the PIN ---- */
body.pro-lock #auth-gate #auth-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  margin: 10px 0 0;
  border: 1px solid rgba(120, 210, 235, 0.28);
  border-radius: 12px;
  font-family: var(--pro-font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--pro-glow-cyan, #5cf0ff);
  background: rgba(20, 40, 54, 0.5);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
body.pro-lock #auth-gate #auth-passkey[hidden] { display: none; }
body.pro-lock #auth-gate #auth-passkey:hover {
  border-color: rgba(120, 210, 235, 0.5);
  background: rgba(24, 48, 64, 0.62);
}
body.pro-lock #auth-gate #auth-passkey:active { transform: translateY(1px); }
body.pro-lock #auth-gate #auth-passkey:disabled { filter: brightness(0.8); cursor: default; transform: none; }

/* ---- footer: mono session-secured line ---- */
body.pro-lock .pro-lock-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 24px;
  font-family: var(--pro-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--pro-text-faint);
}
body.pro-lock .pro-lock-foot .pro-lock-foot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pro-success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  body.pro-lock #auth-gate .auth-card,
  body.pro-lock .pro-lock-ring {
    animation: none;
  }
}
