/* TeleGate — landing / access gate.
   Deep-navy secure terminal. Zero external requests: system fonts only. */

:root {
  --bg-0: #050d1c;
  --bg-1: #0a1a34;
  --bg-2: #0f2549;

  --ink: #e9f2fd;
  --muted: #7f9cc4;
  --faint: rgba(127, 156, 196, 0.45);

  --accent: #2aabee;
  --accent-2: #66ccff;
  --accent-ink: #041524;
  --glow: rgba(42, 171, 238, 0.55);

  --danger: #ff6b6b;

  --surface: rgba(13, 32, 60, 0.55);
  --surface-line: rgba(96, 146, 214, 0.22);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 720px at 50% -10%, var(--bg-2) 0%, transparent 60%),
    radial-gradient(900px 900px at 50% 120%, #0b2044 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Signature: ambient network mesh, painted behind everything. */
.mesh {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
}

.gate {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 28px 32px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18, 40, 74, 0.62), rgba(9, 22, 44, 0.62));
  border: 1px solid var(--surface-line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 80px -30px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* Crest --------------------------------------------------------------- */
.crest {
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

.crest__halo {
  position: absolute;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  filter: blur(6px);
  animation: breathe 5.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: scale(0.94); }
  50%      { opacity: 0.9; transform: scale(1.06); }
}

.crest__mark {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 27%;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.55));
}

/* Wordmark ------------------------------------------------------------ */
.wordmark {
  margin: 0;
  font-size: clamp(2.1rem, 11vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.wordmark__a { color: var(--ink); font-weight: 600; }

.wordmark__b {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.threshold {
  width: 56px;
  height: 2px;
  margin: 20px 0 26px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 16px var(--glow);
}

/* Access form --------------------------------------------------------- */
.access {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
}

.field__glyph {
  position: absolute;
  left: 15px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: color 0.2s ease;
  pointer-events: none;
}

.field__input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 44px;
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(6, 16, 33, 0.6);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field__input::placeholder {
  color: var(--faint);
  letter-spacing: 0.02em;
}

.field__input:focus {
  border-color: var(--accent);
  background: rgba(8, 22, 44, 0.75);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.18);
}

.field__input:focus ~ .field__glyph,
.field:focus-within .field__glyph { color: var(--accent-2); }

.enter {
  position: relative;
  height: 54px;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 26px -10px var(--glow), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.enter:hover { filter: brightness(1.05); box-shadow: 0 14px 32px -10px var(--glow), 0 1px 0 rgba(255, 255, 255, 0.35) inset; }
.enter:active { transform: translateY(1px) scale(0.995); }

.enter:disabled { cursor: default; filter: none; }
.enter.is-busy { color: transparent; }
.enter.is-busy .enter__label { opacity: 0; }

.enter__spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(4, 21, 36, 0.35);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  opacity: 0;
}

.enter.is-busy .enter__spinner {
  opacity: 1;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Status line --------------------------------------------------------- */
.status {
  min-height: 1.1em;
  margin: 4px 2px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  transition: color 0.2s ease;
}

.status.is-error { color: var(--danger); }
.status.is-ok { color: var(--accent-2); }

/* Error shake on the whole panel. */
.panel.is-denied { animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* Unlock: on success the crest flares and the panel lifts away. */
.panel.is-unlocked { animation: unlock 0.5s ease forwards; }
.panel.is-unlocked .crest__halo { animation: flare 0.5s ease forwards; }

@keyframes unlock {
  to { opacity: 0; transform: translateY(-10px) scale(1.02); filter: blur(3px); }
}

@keyframes flare {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .mesh { opacity: 0.4; }
}
