/* Enjambre · pantalla de entrada.
   Misma paleta que el panel: obsidiana + ámbar de colmena. El fondo es el enjambre mismo:
   hexágonos que derivan lento. Todo se apoya en una sola tarjeta de vidrio, centrada. */
:root {
  --bg: #0a0c10;
  --ink: #eef2f7;
  --ink-2: #a7b0be;
  --ink-3: #667080;
  --amber: #ffb020;
  --amber-2: #ff9500;
  --bad: #ff5c6c;
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-2: rgba(255, 255, 255, 0.18);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --display: 'Bricolage Grotesque', var(--sans);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- fondo ---------- */
.swarm { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5; }
.swarm svg { width: 100%; height: 100%; display: block; }
.bees use {
  transform-box: fill-box; transform-origin: center;
  scale: var(--s, 1);
  opacity: .22;
  animation: drift 22s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes drift {
  0%, 100% { translate: 0 0;      opacity: .14; }
  50%      { translate: 26px -34px; opacity: .34; }
}
.glow {
  position: fixed; z-index: 0; pointer-events: none;
  width: min(70vw, 620px); aspect-ratio: 1;
  top: 50%; left: 50%; translate: -50% -58%;
  background: radial-gradient(circle, rgba(255,176,32,.20), transparent 66%);
  filter: blur(28px);
  animation: breathe 9s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1);    opacity: .75; }
  50%      { transform: scale(1.14); opacity: 1; }
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .34; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- tarjeta ---------- */
.wrap { position: relative; z-index: 2; width: 100%; display: grid; place-items: center; }
.card {
  width: min(100%, 396px);
  padding: 40px 34px 30px;
  border: 1px solid var(--stroke);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.07);
  display: flex; flex-direction: column; align-items: center;
  animation: enter .7s cubic-bezier(.16,.84,.28,1) both;
}
@keyframes enter { from { opacity: 0; transform: translateY(18px) scale(.985); } }

/* cada pieza entra escalonada */
.mark, .title, .tagline, .fields, .submit, .foot { animation: rise .6s cubic-bezier(.16,.84,.28,1) both; }
.mark    { animation-delay: .10s; }
.title   { animation-delay: .16s; }
.tagline { animation-delay: .21s; }
.fields  { animation-delay: .27s; }
.submit  { animation-delay: .34s; }
.foot    { animation-delay: .42s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.mark { width: 58px; height: 58px; color: var(--amber); filter: drop-shadow(0 0 18px rgba(255,176,32,.45)); }
.mark svg { width: 100%; height: 100%; display: block; }
.mark .core { animation: pulse 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0%,100% { opacity: 1; scale: 1; } 50% { opacity: .55; scale: .9; } }

.title {
  font-family: var(--display); font-weight: 800; font-size: 33px; letter-spacing: -.035em;
  margin: 16px 0 0; line-height: 1;
}
.tagline {
  font-family: var(--mono); font-size: 10px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink-3); margin: 9px 0 0;
}

/* ---------- campos ---------- */
.fields { width: 100%; margin-top: 30px; display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
  transition: color .2s ease;
}
.field:focus-within > span { color: var(--amber); }

input {
  font-family: var(--sans); font-size: 16px; /* 16px evita el zoom automático en iOS */
  color: var(--ink); width: 100%;
  background: rgba(0,0,0,.34);
  border: 1px solid var(--stroke);
  border-radius: 13px; padding: 13px 15px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input::placeholder { color: #4c5563; }
input:focus {
  outline: none; background: rgba(0,0,0,.46);
  border-color: rgba(255,176,32,.55);
  box-shadow: 0 0 0 3.5px rgba(255,176,32,.13);
}
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 40px #0d1015 inset;
  caret-color: var(--ink);
}

.pw { position: relative; }
.pw input { padding-right: 46px; }
.peek {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: none; border-radius: 9px;
  color: var(--ink-3); cursor: pointer; transition: color .16s ease, background .16s ease;
}
.peek:hover { color: var(--ink-2); background: rgba(255,255,255,.06); }
.peek .eye-off { opacity: 0; transition: opacity .16s ease; }
.peek.on .eye-off { opacity: 1; }
.peek.on { color: var(--amber); }

/* ---------- error ---------- */
.error {
  width: 100%; margin: 13px 0 0; min-height: 17px;
  font-size: 12.5px; color: var(--bad); text-align: center;
  opacity: 0; transform: translateY(-3px); transition: opacity .2s ease, transform .2s ease;
}
.error.show { opacity: 1; transform: none; }
.card.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { translate: -1px 0; } 20%, 80% { translate: 3px 0; }
  30%, 50%, 70% { translate: -6px 0; } 40%, 60% { translate: 6px 0; }
}

/* ---------- botón ---------- */
.submit {
  position: relative; overflow: hidden;
  width: 100%; margin-top: 16px; padding: 14px 18px;
  font-family: var(--sans); font-size: 15px; font-weight: 700; color: #1a1205;
  background: linear-gradient(180deg, var(--amber), var(--amber-2));
  border: none; border-radius: 13px; cursor: pointer;
  box-shadow: 0 12px 30px -10px rgba(255,176,32,.6);
  transition: filter .16s ease, transform .12s ease, box-shadow .16s ease;
}
.submit::after { /* brillo que cruza al pasar el mouse */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.42) 50%, transparent 65%);
  translate: -110% 0; transition: translate .6s ease;
}
.submit:hover { filter: brightness(1.07); box-shadow: 0 16px 38px -10px rgba(255,176,32,.72); }
.submit:hover::after { translate: 110% 0; }
.submit:active { transform: translateY(1px) scale(.995); }
.submit:disabled { opacity: .65; cursor: progress; }
.submit:disabled::after { display: none; }

.spinner {
  position: absolute; inset: 0; margin: auto;
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(26,18,5,.28); border-top-color: #1a1205;
  opacity: 0; animation: spin .7s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }
.submit.loading .label { opacity: 0; }
.submit.loading .spinner { opacity: 1; }
.label { transition: opacity .15s ease; }

.foot { margin: 20px 0 0; font-size: 11px; color: var(--ink-3); text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 430px) {
  body { padding: 16px; align-items: center; }
  .card { padding: 32px 22px 24px; border-radius: 22px; }
  .title { font-size: 29px; }
  .mark { width: 50px; height: 50px; }
  .fields { margin-top: 24px; }
}
@media (max-height: 620px) {          /* teléfonos apaisados o teclado abierto */
  .card { padding: 24px 22px 20px; }
  .mark { width: 42px; height: 42px; }
  .title { font-size: 25px; margin-top: 11px; }
  .fields { margin-top: 18px; gap: 12px; }
  .foot { display: none; }
  .glow { display: none; }
}
@media (min-width: 1100px) { .card { width: 412px; } }

/* accesibilidad: sin movimiento si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .card, .mark, .title, .tagline, .fields, .submit, .foot { opacity: 1; transform: none; }
}
