/* ============================================================
   AeriTek · Portales — biblioteca de animaciones (v1)
   Regla: TODA pantalla nueva lleva movimiento. Elige de aquí; agrega
   nuevas al final con comentario de origen. Solo transform/opacity.
   Todo se apaga con prefers-reduced-motion (bloque al final).
   Requiere at-portal-tokens.css.
   ============================================================ */

/* ---------- Keyframes ---------- */

/* Giro continuo: anillos del escudo/candado (18s), copo gigante de fondo (160s) */
@keyframes at-spin { to { transform: rotate(360deg); } }

/* Línea de escaneo que sube/baja dentro del escudo (3.2s) */
@keyframes at-scan {
  0%, 100% { transform: translateY(-70px); opacity: 0; }
  15%, 85% { opacity: .9; }
  50%      { transform: translateY(70px); }
}

/* Entrada de tarjetas/bloques: sube 12px y aparece. Escalonar con --i */
@keyframes at-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Brillo de escarcha que cruza una tarjeta en hover */
@keyframes at-sheen {
  from { left: -60%; }
  to   { left: 120%; }
}

/* Nieve cayendo (usar con .at-snow__flake; --drift = deriva lateral) */
@keyframes at-fall {
  from { transform: translate3d(0, -10px, 0); }
  to   { transform: translate3d(var(--drift, 0), 110vh, 0); }
}

/* Candado + llave (6s, un solo ciclo): la llave entra, gira, el gancho sube y brilla */
@keyframes at-key {
  0%        { transform: translateX(-120px); opacity: 0; }
  22%, 78%  { transform: translateX(0); opacity: 1; }
  92%, 100% { transform: translateX(-120px); opacity: 0; }
}
@keyframes at-key-bow {
  0%, 26%   { transform: scaleY(1); }
  34%       { transform: scaleY(.12); }
  42%, 100% { transform: scaleY(1); }
}
@keyframes at-key-bit {
  0%, 24%   { opacity: 1; }
  30%, 82%  { opacity: 0; }
  88%, 100% { opacity: 1; }
}
@keyframes at-shackle {
  0%, 40%   { transform: translateY(0); }
  52%, 74%  { transform: translateY(-22px); }
  86%, 100% { transform: translateY(0); }
}
@keyframes at-glow {
  0%, 40%   { opacity: 0; transform: scale(.6); }
  55%       { opacity: .9; transform: scale(1.15); }
  74%       { opacity: .5; transform: scale(1); }
  86%, 100% { opacity: 0; transform: scale(.6); }
}

/* Flotación suave (iconos hero, ilustraciones): 6px de recorrido */
@keyframes at-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* Pulso de halo (estado "en vivo", CTA principal) */
@keyframes at-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 171, 226, .45); }
  100% { box-shadow: 0 0 0 14px rgba(61, 171, 226, 0); }
}

/* ---------- Clases utilitarias ---------- */

.at-rise {
  animation: at-rise var(--at-dur-slow) var(--at-ease-spring) backwards;
  animation-delay: calc(var(--i, 0) * 50ms + 60ms);
}

.at-spin-slow { animation: at-spin 18s linear infinite; transform-origin: center; }
.at-float     { animation: at-float 6s ease-in-out infinite; }
.at-pulse     { animation: at-pulse 1.8s var(--at-ease-out) infinite; }

/* Copo gigante girando al fondo (esquina inferior derecha del hero) */
.at-hero-flake {
  position: absolute; right: -90px; bottom: -120px;
  width: 460px; height: 460px; opacity: .07; pointer-events: none;
  transform-origin: 50% 50%;
  animation: at-spin 160s linear infinite;
}

/* Nieve (generada por Snow.react.js o por JS equivalente) */
.at-snow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.at-snow__flake {
  position: absolute; top: -10px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, .8);
  animation-name: at-fall; animation-timing-function: linear; animation-iteration-count: infinite;
}

/* Tarjeta con elevación + brillo de escarcha en hover */
.at-card-lift {
  position: relative; overflow: hidden;
  transition: transform var(--at-dur-base) var(--at-ease-spring), box-shadow var(--at-dur-base) var(--at-ease-out);
}
.at-card-lift::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(142, 195, 234, .22), transparent);
  transform: skewX(-18deg); pointer-events: none; opacity: 0;
}
@media (hover: hover) {
  .at-card-lift:hover { transform: translateY(-6px); box-shadow: var(--at-shadow-lift); }
  .at-card-lift:hover::after { opacity: 1; animation: at-sheen 900ms var(--at-ease-out) forwards; }
}

/* Fondo de panel oscuro: rejilla tenue + (canvas de red se pone con at-network.js) */
.at-grid-bg {
  position: absolute; inset: 0; opacity: .07; pointer-events: none;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(80% 70% at 50% 45%, #000, transparent);
          mask-image: radial-gradient(80% 70% at 50% 45%, #000, transparent);
}

/* Barra de pasos (login en 2 pasos): la activa se llena con transición */
.at-steps { display: flex; gap: 8px; }
.at-steps i { flex: 1; height: 3px; background: var(--at-line); border-radius: 2px; transition: background .3s; }
.at-steps i.on { background: var(--at-cyan); }

/* ---------- Escudo (login) y candado + llave (reset / logout / home del Identity) ----------
   Marcado SVG en assets/svg/shield-lock.svg y padlock-key.svg: pegar inline y poner
   la clase indicada a cada grupo. */
.at-shield .scan   { animation: at-scan 3.2s ease-in-out infinite; }
.at-shield .ring,
.at-lock   .ring   { transform-origin: 150px 160px; animation: at-spin 18s linear infinite; }
.at-lock .shackle  { transform-box: fill-box; transform-origin: 50% 100%; animation: at-shackle 6s ease-in-out infinite; }
.at-lock .key      { animation: at-key 6s ease-in-out infinite; }
.at-lock .key-bow  { transform-box: fill-box; transform-origin: 50% 50%; animation: at-key-bow 6s ease-in-out infinite; }
.at-lock .key-bit  { transform-box: fill-box; transform-origin: 50% 0;   animation: at-key-bit 6s ease-in-out infinite; }
.at-lock .glow     { transform-box: fill-box; transform-origin: 50% 50%; animation: at-glow 6s ease-in-out infinite; }

/* ---------- Accesibilidad: movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  .at-rise, .at-spin-slow, .at-float, .at-pulse, .at-hero-flake,
  .at-card-lift::after,
  .at-shield .scan, .at-shield .ring, .at-lock .ring, .at-lock .shackle,
  .at-lock .key, .at-lock .key-bow, .at-lock .key-bit, .at-lock .glow {
    animation: none !important;
  }
  .at-snow { display: none; }
  .at-lock .key { opacity: 1; transform: none; }
  .at-lock .glow { opacity: 0; }
  .at-card-lift, .at-steps i { transition: none; }
}
