/* ============================================================
   Auth Gate — fullscreen login overlay shown until the user
   enters the shared password. Same brand language as the deck.
   ============================================================ */
:root{
  /* duplicated from styles.css so the gate renders BEFORE main styles
     in case styles.css is still parsing (CSS evaluation order) */
  --auth-brand:#2997ff;
  --auth-brand-2:#7eb8ff;
}

.auth-gate{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(41,151,255,.18), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(41,151,255,.14), transparent 55%),
    radial-gradient(circle at center, #0a1628 0%, #050a14 60%, #02060c 100%);
  font-family:'Montserrat', system-ui, -apple-system, Helvetica, Arial, sans-serif;
  color:#ffffff;
  opacity:1;
  transition:opacity .6s ease, visibility .6s ease;
}
body.is-authed .auth-gate{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

/* Background — drifting grid + soft orbs (mirrors the deck's atmosphere) */
.auth-gate__bg{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
}
.auth-gate__orb{
  position:absolute;
  border-radius:50%;
  filter:blur(80px);
  opacity:.55;
}
.auth-gate__orb--a{
  width:600px; height:600px;
  top:-180px; left:-160px;
  background:radial-gradient(circle, rgba(41,151,255,.45), transparent 70%);
  animation:authOrbA 18s ease-in-out infinite;
}
.auth-gate__orb--b{
  width:520px; height:520px;
  bottom:-140px; right:-120px;
  background:radial-gradient(circle, rgba(120,180,255,.4), transparent 70%);
  animation:authOrbB 22s ease-in-out infinite;
}
@keyframes authOrbA{
  0%,100%{ transform:translate(0,0) scale(1); }
  50%    { transform:translate(80px,40px) scale(1.1); }
}
@keyframes authOrbB{
  0%,100%{ transform:translate(0,0) scale(1); }
  50%    { transform:translate(-60px,-30px) scale(1.08); }
}
.auth-gate__grid{
  position:absolute;
  inset:-40%;
  background-image:
    linear-gradient(rgba(41,151,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41,151,255,.06) 1px, transparent 1px);
  background-size:48px 48px, 48px 48px;
  mask-image:radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image:radial-gradient(ellipse at center, #000 30%, transparent 75%);
  animation:authGrid 30s linear infinite;
}
@keyframes authGrid{
  from{ transform:translate(0,0); }
  to  { transform:translate(48px,48px); }
}

/* Card */
.auth-gate__card{
  position:relative;
  z-index:1;
  width:min(440px, 100%);
  padding:44px 36px 32px;
  border-radius:24px;
  background:
    radial-gradient(800px circle at 50% 0%, rgba(41,151,255,.14), transparent 65%),
    linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid rgba(41,151,255,.3);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,.65),
    0 0 60px -10px rgba(41,151,255,.25);
  text-align:center;
  animation:authCardIn .9s cubic-bezier(.16,1,.3,1) both;
}
@keyframes authCardIn{
  from{ opacity:0; transform:translateY(20px) scale(.96); }
  to  { opacity:1; transform:translateY(0)   scale(1); }
}
.auth-gate.is-shake .auth-gate__card{
  animation:authShake .55s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes authShake{
  10%,90%{ transform:translateX(-2px); }
  20%,80%{ transform:translateX(4px); }
  30%,50%,70%{ transform:translateX(-8px); }
  40%,60%{ transform:translateX(8px); }
}

.auth-gate__logo{
  display:block;
  width:100%;
  max-width:200px;
  height:auto;
  margin:0 auto 24px;
  filter:drop-shadow(0 14px 36px rgba(41,151,255,.5));
  animation:authLogo 1.2s cubic-bezier(.16,1,.3,1) .15s both;
}
@keyframes authLogo{
  from{ opacity:0; transform:translateY(-8px) scale(.96); }
  to  { opacity:1; transform:translateY(0)   scale(1); }
}

.auth-gate__kicker{
  display:inline-block;
  font-size:11px;
  font-weight:700;
  letter-spacing:.32em;
  text-transform:uppercase;
  color:var(--auth-brand-2);
  padding:5px 14px;
  border-radius:999px;
  background:rgba(41,151,255,.14);
  border:1px solid rgba(41,151,255,.4);
  margin-bottom:18px;
  opacity:0;
  animation:authFadeUp .7s cubic-bezier(.16,1,.3,1) .4s forwards;
}

.auth-gate__title{
  font-size:clamp(28px, 4vw, 36px);
  font-weight:800;
  letter-spacing:-.02em;
  line-height:1.05;
  margin:0 0 10px;
  color:#ffffff;
  opacity:0;
  animation:authFadeUp .8s cubic-bezier(.16,1,.3,1) .5s forwards;
}
.auth-gate__title span{
  background:linear-gradient(135deg, #ffffff, #b3d6ff);
  -webkit-background-clip:text; background-clip:text;
  color:transparent;
}

.auth-gate__sub{
  margin:0 0 26px;
  font-size:14px;
  color:rgba(255,255,255,.65);
  opacity:0;
  animation:authFadeUp .8s cubic-bezier(.16,1,.3,1) .6s forwards;
}
@keyframes authFadeUp{
  from{ opacity:0; transform:translateY(8px); }
  to  { opacity:1; transform:translateY(0); }
}

/* Field */
.auth-gate__form{
  margin:0 0 24px;
  opacity:0;
  animation:authFadeUp .8s cubic-bezier(.16,1,.3,1) .75s forwards;
}
.auth-gate__field{
  position:relative;
  display:flex;
  align-items:center;
  gap:0;
  padding:0;
  border-radius:14px;
  background:rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.12);
  transition:border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.auth-gate__field:focus-within{
  border-color:rgba(41,151,255,.7);
  background:rgba(0,0,0,.5);
  box-shadow:0 0 0 4px rgba(41,151,255,.18), 0 12px 30px -10px rgba(41,151,255,.5);
}
.auth-gate__field input{
  flex:1;
  width:100%;
  padding:16px 18px;
  background:transparent;
  border:none;
  outline:none;
  color:#ffffff;
  font-family:inherit;
  font-size:15px;
  letter-spacing:.04em;
}
.auth-gate__field input::placeholder{
  color:rgba(255,255,255,.4);
  letter-spacing:.06em;
}
.auth-gate__submit{
  flex:0 0 auto;
  width:48px; height:48px;
  margin:3px;
  border-radius:11px;
  border:none;
  background:linear-gradient(135deg, var(--auth-brand), var(--auth-brand-2));
  color:#0a0c10;
  display:grid; place-items:center;
  cursor:pointer;
  padding:0;
  transition:transform .25s cubic-bezier(.34,1.56,.64,1), filter .2s ease;
  box-shadow:0 8px 22px -6px rgba(41,151,255,.6);
}
.auth-gate__submit svg{ width:20px; height:20px; }
.auth-gate__submit:hover{ transform:scale(1.05); filter:brightness(1.05); }
.auth-gate__submit:active{ transform:scale(.96); }
.auth-gate__submit:disabled{ opacity:.5; cursor:wait; }

.auth-gate__error{
  margin:14px 0 0;
  min-height:18px;
  font-size:13px;
  color:#ff6b8e;
  font-weight:500;
  opacity:0;
  transform:translateY(-4px);
  transition:opacity .25s ease, transform .25s ease;
}
.auth-gate.is-shake .auth-gate__error{
  opacity:1;
  transform:translateY(0);
}

.auth-gate__foot{
  margin:0;
  font-size:11px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:rgba(255,255,255,.3);
  opacity:0;
  animation:authFadeUp .8s cubic-bezier(.16,1,.3,1) .9s forwards;
}

/* Hide all page content while the gate is up — prevents accidental
   exposure if the JS hasn't yet flipped the body class. */
body:not(.is-authed) > *:not(.auth-gate):not(script):not(noscript){
  visibility:hidden;
}

@media (prefers-reduced-motion: reduce){
  .auth-gate *{ animation:none !important; }
}
