/**
 * animations.css - Animaciones CSS3 puras aceleradas por GPU (0 JS Overhead)
 * Inspirado en REF-009 (tailwind-animations)
 * Plan "Nuestros Futuros Olímpicos" Anzoátegui 2026
 */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scrollTape {
  0% {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
    -webkit-transform: translate3d(-50%, 0, 0);
  }
}

@-webkit-keyframes scrollTape {
  0% {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
  100% {
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translate3d(24px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translate3d(-24px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale3d(0.85, 0.85, 1);
  }
  70% {
    transform: scale3d(1.05, 1.05, 1);
  }
  100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes pulseTalent {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(245, 158, 11, 0);
  }
}

@keyframes pulseSuccess {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
  }
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  20% { transform: scale(1.15); }
  40% { transform: scale(1); }
  60% { transform: scale(1.1); }
  80% { transform: scale(1); }
  100% { transform: scale(1); }
}

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

/* Clases de utilidad */
.anim-fade-in {
  animation: fadeIn 0.3s ease forwards;
  will-change: opacity;
}

.anim-fade-in-up {
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

.anim-slide-in-right {
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

.anim-slide-in-left {
  animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

.anim-pop {
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: opacity, transform;
}

.anim-talent-highlight {
  animation: popIn 0.4s ease forwards, pulseTalent 2s infinite ease-in-out;
}

.anim-success-badge {
  animation: pulseSuccess 2s infinite ease-in-out;
}

.anim-pulse-heart {
  animation: heartbeat 2s infinite ease-in-out;
}

.anim-spin {
  animation: spin 1s linear infinite;
}

.anim-scroll-tape {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  width: max-content !important;
  min-width: 200% !important;
  animation: scrollTape 25s linear infinite !important;
  -webkit-animation: scrollTape 25s linear infinite !important;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
  will-change: transform;
}

.anim-scroll-tape:hover,
.anim-scroll-tape:active {
  animation-play-state: paused;
  -webkit-animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  *:not(.anim-scroll-tape):not(.anim-scroll-tape *) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================================================== */
/* PATRONES DE ANIMACIÓN SCROLL Y UI MODERNA ACCELERADOS POR GPU              */
/* Plan "Nuestros Futuros Olímpicos" Anzoátegui 2026                         */
/* ========================================================================== */

/* 12. Smooth Scrolling Global sin Recarga de Página */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* 7. Sticky Section Layout (Encabezados Fijos Flotantes con Desenfoque) */
.sticky-section-header {
  position: sticky;
  top: 64px;
  z-index: 25;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

/* 8. Sticky Stacking on Scroll (Apilamiento Sutil de Tarjetas por Capas) */
.sticky-stack-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.sticky-stack-card {
  position: sticky;
  top: 80px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: 0 10px 30px -10px rgba(0, 43, 127, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 15. Slice Slider (Carrusel Táctil Fluido con Scroll-Snap) */
.slice-slider {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.5rem 0.25rem 1rem 0.25rem;
}

.slice-slider::-webkit-scrollbar {
  display: none;
}

.slice-slide {
  scroll-snap-align: center;
  flex: 0 0 85%;
  max-width: 320px;
}

@media (min-width: 768px) {
  .slice-slide {
    flex: 0 0 300px;
    scroll-snap-align: start;
  }
}

/* 20. Scroll-Driven Fade-In (CSS Nativo acelerado por GPU con Fallback) */
@keyframes scrollFadeIn {
  from {
    opacity: 0.15;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@supports (animation-timeline: view()) {
  .scroll-driven-view {
    animation: scrollFadeIn linear both;
    animation-timeline: view();
    animation-range: entry 10% cover 30%;
  }
}

/* 29. CSS Grid con Subgrid para Alineación Perfecta de Tarjetas */
@supports (grid-template-rows: subgrid) {
  .subgrid-card-group {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
  }
}

/* 39. Curved SVG Background Animation (Ondas Orgánicas en Hero) */
@keyframes waveFloat {
  0% { transform: translate3d(0, 0, 0) scaleY(1); }
  50% { transform: translate3d(-25px, 6px, 0) scaleY(1.05); }
  100% { transform: translate3d(0, 0, 0) scaleY(1); }
}

.curved-svg-wave {
  position: absolute;
  bottom: 0;
  left: -5%;
  width: 110%;
  height: 60px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
  animation: waveFloat 12s ease-in-out infinite;
  transform-origin: center bottom;
}
