/* ============================================================
   Access gate — invitation-only entry screen
   ============================================================ */

.gate-scene{
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: var(--sp-6);
}

.gate-card{
  padding: var(--sp-7) var(--sp-5) var(--sp-6);
  text-align: center;
}
@media (min-width: 400px){
  .gate-card{ padding: 40px 32px 32px; }
}

.gate-card > * { opacity: 0; transform: translateY(10px); animation: rise var(--dur-slow) var(--ease-out) forwards; }
.gate-card > *:nth-child(1){ animation-delay: 0.02s; }
.gate-card > *:nth-child(2){ animation-delay: 0.08s; }
.gate-card > *:nth-child(3){ animation-delay: 0.14s; }
.gate-card > *:nth-child(4){ animation-delay: 0.2s; }
.gate-card > *:nth-child(5){ animation-delay: 0.26s; }
.gate-card > *:nth-child(6){ animation-delay: 0.32s; }
@keyframes rise{ to{ opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){
  .gate-card > *{ animation: none !important; opacity: 1; transform: none; }
}

.gate-icon{
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-5);
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-strong);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 8px rgba(91,124,250,0.06);
}
.gate-icon svg{ width: 26px; height: 26px; stroke: var(--accent-2); }

.gate-title{
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-2);
}
.gate-lede{
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
  max-width: 32ch;
  margin: 0 auto var(--sp-6);
}

/* ---------- Segmented code input ---------- */
.otp{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3.5vw, 16px);
  margin-bottom: var(--sp-2);
}
/* All border/background/transform/animation styling lives on this wrapper,
   never on the <input> itself. Transforming a focused native text input is
   a known WebKit/iOS Safari trap: the box moves but the internal text-render
   layer can desync from it, so typed characters appear to float outside the
   box instead of sitting inside it. Keeping the input transform-free and
   putting all motion on this plain wrapper span avoids that entirely. */
.otp-box-wrap{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 170px;
  height: clamp(54px, 15vw, 64px);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0) 40%), var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.3);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-fast), transform var(--dur-touch) var(--ease-out);
}
.otp-box-wrap.is-filled{ background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0) 40%), var(--surface-3); border-color: var(--border-strong); }
.otp-box-wrap:focus-within{
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 0 0 1px var(--accent),
    0 0 20px -4px rgba(91,124,250,0.55),
    0 6px 16px -8px rgba(0,0,0,0.4);
}
.otp-box-wrap.pop{ animation: otp-pop 0.24s var(--ease-spring); }
@keyframes otp-pop{ 0%{ transform: scale(1); } 45%{ transform: scale(1.06); } 100%{ transform: scale(1); } }
@media (prefers-reduced-motion: reduce){ .otp-box-wrap.pop{ animation: none; } .otp-box-wrap:focus-within{ transform: none; } }

/* The <input>'s own text is made fully transparent (but keeps a real,
   natively-positioned caret via caret-color) instead of trying to make its
   internal text rendering look right — every bug so far has come from a
   browser's native <input> text layout doing something unexpected under
   this combination of letter-spacing/uppercase/height. The digits people
   actually see are rendered separately, in .otp-box-display below: plain
   flex-centered text, nothing to do with form-control rendering at all. */
.otp-box{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: clamp(19px, 5.6vw, 25px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  background: transparent;
  border: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  outline: none;
  caret-color: var(--accent-2);
  -webkit-appearance: none;
  z-index: 2;
}
.otp-box-display{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(19px, 5.6vw, 25px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  color: var(--text);
  pointer-events: none;
  z-index: 1;
}
.otp-box-wrap.has-value .otp-box,
.otp-box-wrap.has-value .otp-box-display{ padding-left: 0.14em; } /* recentre glyphs against the trailing letter-spacing gap; only once there's a glyph to offset, else the empty caret sits off-centre */
.otp-sep{
  width: 12px;
  height: 1.5px;
  background: var(--border-strong);
  border-radius: 1px;
  flex-shrink: 0;
  align-self: center;
}

.otp.is-error .otp-box-wrap{ border-color: var(--danger); animation: shake 0.32s var(--ease-out); }
.otp.is-error .otp-box-wrap:focus-within{ box-shadow: 0 0 0 1px var(--danger), 0 0 16px -4px rgba(251,113,133,0.5); }
@keyframes shake{
  20%{ transform: translateX(-2px); }
  40%{ transform: translateX(2px); }
  60%{ transform: translateX(-1.5px); }
  80%{ transform: translateX(1.5px); }
  100%{ transform: translateX(0); }
}
.otp.is-success .otp-box-wrap{
  border-color: var(--success);
  background: var(--success-soft);
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out), transform var(--dur-fast);
}
@media (prefers-reduced-motion: reduce){
  .otp.is-error .otp-box-wrap{ animation: none; }
}

.gate-status{ min-height: 0; }

.gate-actions{ margin-top: var(--sp-4); }

.fine-print{
  display: flex; align-items: flex-start; justify-content: center; gap: 7px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.5;
  margin-top: var(--sp-5);
  padding: 0 var(--sp-2);
}
.fine-print svg{ width: 13px; height: 13px; flex-shrink: 0; margin-top: 3px; }

.help-row{
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-top: var(--sp-6);
  padding-bottom: max(var(--sp-4), var(--safe-bottom));
}

/* ---------- Scene transition — a quiet scale + fade, not a slide ---------- */
.scene{ transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.scene-leaving{ opacity: 0; transform: scale(0.97); }
.scene-entering{ opacity: 0; transform: scale(1.015); }
.scene-entered{ opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce){
  .scene{ transition: opacity var(--dur-fast) linear; }
  .scene-leaving, .scene-entering{ transform: none; }
}
