/* usaIA — capa de animaciones (se carga después de Tailwind) */

:root {
  --ua-cobalt: #002868;
  --ua-blue: #0a3d91;
  --ua-cyan: #15d5e8;
  --ua-ease: cubic-bezier(0.2, 0, 0, 1);
}

html { scroll-behavior: smooth; }

/* ---------- Barra de progreso de lectura ---------- */
.ua-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--ua-blue), var(--ua-cyan));
  z-index: 60; pointer-events: none;
  box-shadow: 0 0 12px rgba(21, 213, 232, 0.6);
}

/* ---------- Entrada de página ---------- */
body.ua-ready main { animation: ua-page-in 0.6s var(--ua-ease) both; }
body.ua-leaving main { opacity: 0; transform: translateY(8px); transition: opacity 0.22s ease, transform 0.22s ease; }
@keyframes ua-page-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Header con vidrio al hacer scroll ---------- */
header.sticky { transition: box-shadow 0.3s ease, background-color 0.3s ease, backdrop-filter 0.3s ease; }
header.sticky.ua-scrolled {
  background-color: rgba(255, 255, 255, 0.78) !important;
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 8px 24px -12px rgba(0, 40, 104, 0.25);
}

/* Enlace activo / subrayado animado en la navegación */
nav[aria-label="Navegación principal"] a { position: relative; }
nav[aria-label="Navegación principal"] a::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; height: 2px; width: 0;
  background: var(--ua-cyan); border-radius: 2px; transform: translateX(-50%);
  transition: width 0.25s var(--ua-ease);
}
nav[aria-label="Navegación principal"] a:hover::after { width: 60%; }

/* ---------- Revelado al hacer scroll ---------- */
.ua-reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  transition: opacity 0.75s var(--ua-ease), transform 0.75s var(--ua-ease);
  transition-delay: var(--ua-delay, 0ms);
  will-change: opacity, transform;
}
.ua-reveal.ua-in { opacity: 1; transform: none; }

/* ---------- Hero: entrada en cascada ---------- */
@keyframes ua-rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
main > section:first-child h1,
main > section:first-child h2,
main > section:first-child p,
main > section:first-child a,
main > section:first-child button,
main > section:first-child [class*="rounded-full"] {
  animation: ua-rise 0.8s var(--ua-ease) both;
}
main > section:first-child h1, main > section:first-child h2 { animation-delay: 0.08s; }
main > section:first-child p { animation-delay: 0.18s; }
main > section:first-child a, main > section:first-child button { animation-delay: 0.28s; }

/* Blobs de luz decorativos que flotan detrás del hero */
@keyframes ua-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -22px) scale(1.08); }
}
.ua-blob {
  position: absolute; border-radius: 9999px; filter: blur(60px);
  pointer-events: none; z-index: 0; opacity: 0.45;
  animation: ua-float 14s ease-in-out infinite;
}
.ua-blob.b1 { width: 340px; height: 340px; background: rgba(21, 213, 232, 0.45); top: -40px; right: 4%; }
.ua-blob.b2 { width: 280px; height: 280px; background: rgba(10, 61, 145, 0.35); bottom: -60px; left: 2%; animation-duration: 18s; animation-delay: -4s; }

/* ---------- Tarjetas: elevación y brillo ---------- */
article[data-component-type="card"],
main article.rounded-xl,
main article.rounded-xl {
  transition: transform 0.35s var(--ua-ease), box-shadow 0.35s var(--ua-ease), border-color 0.35s ease;
  position: relative; overflow: hidden;
}
article[data-component-type="card"]:hover,
main article.rounded-xl:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px -18px rgba(0, 40, 104, 0.35), 0 0 0 1px rgba(21, 213, 232, 0.35);
}
article[data-component-type="card"]::before,
main article.rounded-xl::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform 0.9s var(--ua-ease);
}
article[data-component-type="card"]:hover::before,
main article.rounded-xl:hover::before { transform: translateX(120%); }

/* ---------- Botones: elevación, brillo y pulsación ---------- */
button, a[class*="rounded-full"] {
  transition: transform 0.2s var(--ua-ease), box-shadow 0.25s ease, background-color 0.2s ease, color 0.2s ease;
}
button:hover:not(:disabled), a[class*="rounded-full"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(0, 40, 104, 0.45);
}
button:active:not(:disabled), a[class*="rounded-full"]:active { transform: translateY(0) scale(0.97); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--ua-cyan); outline-offset: 3px;
}

/* Brillo que cruza los botones primarios */
button.bg-light-primary, a.bg-light-primary { position: relative; overflow: hidden; isolation: isolate; }
button.bg-light-primary::after, a.bg-light-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg); transition: left 0.7s var(--ua-ease); z-index: -1;
}
button.bg-light-primary:hover::after, a.bg-light-primary:hover::after { left: 130%; }

/* ---------- Chips y pestañas ---------- */
[role="tab"], .filter-chip, .period-chip, .usecase-tab {
  transition: transform 0.2s var(--ua-ease), background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
[role="tab"][aria-selected="true"], .filter-chip[aria-pressed="true"], .period-chip[aria-pressed="true"] {
  box-shadow: 0 8px 18px -10px rgba(21, 213, 232, 0.9);
}
.ua-swap { animation: ua-swap 0.5s var(--ua-ease) both; }
@keyframes ua-swap {
  from { opacity: 0; transform: translateX(14px) scale(0.98); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

/* Pulso de acento en badges y etiquetas técnicas */
@keyframes ua-pulse {
  0% { box-shadow: 0 0 0 0 rgba(21, 213, 232, 0.55); }
  100% { box-shadow: 0 0 0 12px rgba(21, 213, 232, 0); }
}
#usecase-badge, [id^="usecase-label"] { animation: ua-pulse 2.4s ease-out infinite; }

/* ---------- Cursor de escritura (bloque Flujo activo) ---------- */
.ua-caret {
  display: inline-block; width: 0.55em; height: 1.05em;
  margin-left: 2px; vertical-align: -0.15em;
  background: var(--ua-cyan); border-radius: 2px;
  box-shadow: 0 0 8px rgba(21, 213, 232, 0.8);
  animation: ua-caret-blink 0.9s steps(1) infinite;
}
@keyframes ua-caret-blink { 50% { opacity: 0; } }

/* ---------- Métricas ---------- */
.ua-count { font-variant-numeric: tabular-nums; }

/* ---------- Campos de formulario ---------- */
input[type="text"], input[type="search"] {
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ua-ease);
}
input[type="text"]:focus, input[type="search"]:focus {
  box-shadow: 0 0 0 4px rgba(21, 213, 232, 0.25);
  transform: translateY(-1px);
}

/* ---------- Respeto a quien prefiere menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ua-reveal { opacity: 1; transform: none; }
}
