/* =====================================================================
   Lava Stream — password gate page
   Visual system lifted from the "Lava Stream Mot de passe" prototype
   (LOCKED + UNLOCKING phases). Shares the viewer's palette and fonts.
   ===================================================================== */

:root {
  /* Palette (same values as the viewer) */
  --lv-accent:       #7F77DD;
  --lv-accent-deep:  #534AB7;
  --lv-accent-soft:  #8079e0;
  --lv-text:         #ECEBE7;
  --lv-muted:        #9C9B94;
  --lv-violet-dim:   #b9b5e8;
  --lv-error:        #e0584f;
  --lv-error-soft:   #f0a59f;

  /* Fonts */
  --lv-font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --lv-font-body:    'Space Grotesk', system-ui, sans-serif;
  --lv-font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Same radial background as offline/connecting */
  --lv-radial-bg: radial-gradient(80% 90% at 50% 38%, #34324d 0%, #1d1d1a 64%);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--lv-bg-page, #1b1b19);
  color: var(--lv-text);
  font-family: var(--lv-font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* ---------- Keyframes (same names/values as the prototype) ---------- */
@keyframes lvFade   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lvShake  { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes lvSpin   { to { transform: rotate(360deg); } }
@keyframes lvHalo   { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.7); opacity: 0; } }

/* ---------- Stage ---------- */
.auth-stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--lv-radial-bg);
  padding: 48px 24px;
}

.phase[hidden] { display: none; }

/* =====================================================================
   LOCKED
   ===================================================================== */
.phase--locked { animation: lvFade .35s ease forwards; }

.locked__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 330px;
  max-width: 100%;
}

/* Lock ring + pulsing halo + padlock */
.lockring {
  position: relative;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}
.lockring__halo {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1.5px solid rgba(127,119,221,.7);
  animation: lvHalo 2.4s ease-out infinite;
}
.lockring__circle {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1.5px solid rgba(127,119,221,.55);
  display: grid;
  place-items: center;
  box-shadow: 0 0 44px rgba(127,119,221,.28);
}
.padlock {
  position: relative;
  width: 30px;
  height: 26px;
  border-radius: 7px;
  background: rgba(127,119,221,.16);
  border: 1.5px solid var(--lv-accent-soft);
  display: grid;
  place-items: center;
}
.padlock__shackle {
  position: absolute;
  top: -11px;
  width: 17px;
  height: 16px;
  border: 2.4px solid var(--lv-accent-soft);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
}
.padlock__keyhole {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lv-violet-dim);
}

.locked__title {
  margin: 0 0 8px;
  font-family: var(--lv-font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--lv-text);
}
.locked__subtitle {
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--lv-muted);
}

/* ---------- Form ---------- */
.form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 14px 12px 14px 16px;
  border: 1px solid rgba(127,119,221,.4);
  box-shadow: 0 0 22px rgba(127,119,221,.12);
  transition: border-color .18s, box-shadow .18s;
}
.field__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--lv-text);
  font-family: var(--lv-font-body);
  font-size: 15px;
  letter-spacing: .02em;
  padding: 0;
}
.field__input::placeholder { color: var(--lv-muted); }
.field__eye {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--lv-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.field__eye:hover { color: #cfcdd9; background: rgba(255,255,255,.05); }
.eye--closed { width: 9px; height: 9px; border-radius: 50%; border: 1.7px solid currentColor; }
.eye--open   { width: 16px; height: 1.7px; background: currentColor; transform: rotate(-20deg); }

/* Error message (hidden until a wrong password is submitted). The explicit
   [hidden] rule is needed because `.error { display:flex }` (author) would
   otherwise override the UA's default `[hidden] { display:none }`. */
.error[hidden] { display: none; }

/* Error state on the field */
.field.is-error {
  border-color: rgba(224,88,79,.6);
  box-shadow: 0 0 0 3px rgba(224,88,79,.12);
  animation: lvShake .4s ease;
}
.error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  color: var(--lv-error-soft);
  font-size: 12.5px;
}
.error__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lv-error);
  flex: none;
}

/* Submit button */
.btn {
  width: 100%;
  margin-top: 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #6157c9, var(--lv-accent-deep));
  color: #fff;
  font-family: var(--lv-font-display);
  font-size: 15.5px;
  font-weight: 600;
  padding: 15px;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(83,74,183,.65);
  transition: transform .12s, background .15s;
}
.btn:hover { background: linear-gradient(180deg, #6c62d6, #5a51c4); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .7; cursor: default; }

/* =====================================================================
   UNLOCKING (access animation)
   ===================================================================== */
.phase--unlocking { animation: lvFade .3s ease forwards; }
.unlocking__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2.5px solid rgba(127,119,221,.2);
  border-top-color: var(--lv-accent);
  animation: lvSpin .9s linear infinite;
  margin-bottom: 22px;
}
.unlocking__label {
  font-family: var(--lv-font-mono);
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--lv-violet-dim);
}

/* =====================================================================
   Brand wordmark, bottom-left
   ===================================================================== */
.wordmark {
  position: absolute;
  left: 22px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: .65;
}
.wordmark__ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.3px solid var(--lv-accent);
  display: grid;
  place-items: center;
}
.wordmark__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lv-accent);
}
.wordmark__text {
  font-family: var(--lv-font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--lv-text);
}
.wordmark__accent { color: var(--lv-accent); }

/* =====================================================================
   Responsiveness
   ===================================================================== */
@media (max-width: 540px) {
  .auth-stage { padding: 32px 20px; }
  .wordmark { left: 16px; bottom: 14px; }
}

/* Honor reduced-motion: keep the fade, stop the loops. */
@media (prefers-reduced-motion: reduce) {
  .lockring__halo,
  .spinner { animation: none; }
  .field.is-error { animation: none; }
}
