/* ============================================================
   RIT Enterprise — Animaciones (100% CSS, sin JS)
   - Marquee / pulse / drift / sweep
   - Reveal al scroll (scroll-driven animations)
   - Contadores animados (@property + view())
   - prefers-reduced-motion
   ============================================================ */

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes marquee-rev {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(8px); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.25); }
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-60px, -40px, 0); }
}

/* ------------------------------------------------------------
   Reveal al hacer scroll (scroll-driven, sin IntersectionObserver)
   Solo en navegadores compatibles; el resto ve el contenido normal.
   ------------------------------------------------------------ */
@supports (animation-timeline: view()) {
  .rit-rv {
    animation: rit-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 70%;
  }
  .rit-rv:nth-child(2) { animation-range: entry 5% entry 78%; }
  .rit-rv:nth-child(3) { animation-range: entry 8% entry 84%; }
  .rit-rv:nth-child(4) { animation-range: entry 10% entry 88%; }
}
@keyframes rit-reveal {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------
   Contadores animados (count-up al entrar en viewport)
   Trick: @property + counter() + animation-timeline: view()
   Fallback: el número estático del <span> se muestra.
   ------------------------------------------------------------ */
@property --rit-num {
  syntax: "<integer>";
  initial-value: 0;
  inherits: false;
}

@supports (animation-timeline: view()) {
  .stat-num {
    counter-reset: rit-num var(--rit-num);
    animation: rit-count linear both;
    animation-timeline: view();
    animation-range: entry 10% entry 55%;
  }
  .stat-num::after {
    content: attr(data-pre) counter(rit-num) attr(data-post);
  }
  .stat-num > span { display: none; }

  .stat-num.c-7 { animation-name: rit-count-7; }
  .stat-num.c-24 { animation-name: rit-count-24; }
  .stat-num.c-47 { animation-name: rit-count-47; }
  .stat-num.c-120 { animation-name: rit-count-120; }

  @keyframes rit-count-7 { from { --rit-num: 0; } to { --rit-num: 7; } }
  @keyframes rit-count-24 { from { --rit-num: 0; } to { --rit-num: 24; } }
  @keyframes rit-count-47 { from { --rit-num: 0; } to { --rit-num: 47; } }
  @keyframes rit-count-120 { from { --rit-num: 0; } to { --rit-num: 120; } }
  /* Genérico: cualquier valor de count (lee --target del elemento) */
  @keyframes rit-count { from { --rit-num: 0; } to { --rit-num: var(--target, 0); } }
}

/* ------------------------------------------------------------
   prefers-reduced-motion: todo quieto
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .rit-rv { opacity: 1; transform: none; }
  .stat-num > span { display: inline; }
  .stat-num::after { content: none; }
  .preloader { display: none; }
}

/* Contadores — página Nosotros (600 · 60 · 11 · 18) */
.stat-num.c-600 { animation-name: rit-count-600; }
.stat-num.c-60 { animation-name: rit-count-60; }
.stat-num.c-11 { animation-name: rit-count-11; }
.stat-num.c-18 { animation-name: rit-count-18; }
@keyframes rit-count-600 { from { --rit-num: 0; } to { --rit-num: 600; } }
@keyframes rit-count-60 { from { --rit-num: 0; } to { --rit-num: 60; } }
@keyframes rit-count-11 { from { --rit-num: 0; } to { --rit-num: 11; } }
@keyframes rit-count-18 { from { --rit-num: 0; } to { --rit-num: 18; } }
