/* ============================================================
   PRAECO — Animations
   CSS-only animations + class hooks for JS scroll triggers
   ============================================================ */

/* === Praeco Mark — Radial Pulse ============================ */
.praeco-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.praeco-mark__circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.praeco-mark__circle svg {
  width: 36px;
  height: 36px;
  fill: var(--white, #FFFFFF);
}
.praeco-mark__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0;
  z-index: 1;
  animation: markPulse 2.5s ease-out infinite;
}
.praeco-mark__pulse:nth-child(2) { animation-delay: 0.8s; }
.praeco-mark__pulse:nth-child(3) { animation-delay: 1.6s; }

@keyframes markPulse {
  0%   { opacity: 0.5; width: 80px; height: 80px; }
  100% { opacity: 0; width: 160px; height: 160px; }
}

/* Small mark variant */
.praeco-mark--sm .praeco-mark__circle {
  width: 32px;
  height: 32px;
}
.praeco-mark--sm .praeco-mark__circle svg {
  width: 14px;
  height: 14px;
}
.praeco-mark--sm .praeco-mark__pulse { display: none; }

/* === Animation 1: Introduction Flow ======================== */
.anim-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 60px;
  width: 320px;
  margin: 0 auto;
  position: relative;
}
.anim-flow__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0;
  animation: flowDotIn 4s ease infinite;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.anim-flow__dot:nth-child(1) { animation-delay: 0s; }
.anim-flow__dot:nth-child(3) { animation-delay: 0.4s; }
.anim-flow__dot:nth-child(5) { animation-delay: 0.8s; }

.anim-flow__line {
  width: 80px;
  height: 2px;
  background: var(--gray-lt);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.anim-flow__line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  animation: flowLine 4s ease infinite;
}
.anim-flow__line:nth-child(2)::after { animation-delay: 0.2s; }
.anim-flow__line:nth-child(4)::after { animation-delay: 0.6s; }

/* Gold pulse back */
.anim-flow__gold {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: goldPulseBack 4s ease infinite;
  animation-delay: 1.8s;
  z-index: 3;
}

@keyframes flowDotIn {
  0%, 5%   { opacity: 0; transform: scale(0); }
  10%, 70% { opacity: 1; transform: scale(1); }
  85%, 100%{ opacity: 0; transform: scale(0); }
}
@keyframes flowLine {
  0%, 5%   { transform: scaleX(0); }
  15%, 70% { transform: scaleX(1); }
  85%, 100%{ transform: scaleX(0); }
}
@keyframes goldPulseBack {
  0%, 5%   { opacity: 0; right: 0; }
  10%      { opacity: 1; }
  50%      { right: calc(100% - 10px); opacity: 1; }
  60%, 100%{ opacity: 0; right: calc(100% - 10px); }
}

/* Dot labels */
.anim-flow__labels {
  display: flex;
  justify-content: space-between;
  width: 320px;
  margin: var(--grid) auto 0;
}
.anim-flow__label {
  font-size: 0.6875rem;
  color: var(--ink-muted);
  text-align: center;
  width: 80px;
}

/* === Animation 2: Kit Copy ================================= */
.anim-kit {
  width: 200px;
  height: 120px;
  position: relative;
  overflow: hidden;
}
.anim-kit__card {
  width: 120px;
  height: 70px;
  background: var(--white);
  border: 1.5px solid var(--gray-lt);
  border-radius: 8px;
  position: absolute;
  top: 25px;
  left: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: kitCardAnim 3s ease infinite;
}
.anim-kit__card-lines {
  width: 60px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.anim-kit__card-line {
  height: 3px;
  background: var(--gray-lt);
  border-radius: 2px;
}
.anim-kit__card-line:nth-child(2) { width: 80%; }
.anim-kit__card-btn {
  margin-top: 6px;
  width: 40px;
  height: 12px;
  border-radius: 3px;
  background: var(--green);
  opacity: 0.7;
}
.anim-kit__cursor {
  position: absolute;
  width: 12px;
  height: 16px;
  opacity: 0;
  animation: kitCursor 3s ease infinite;
}
.anim-kit__cursor::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 6px solid var(--ink);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  transform: rotate(-45deg);
}
.anim-kit__check {
  position: absolute;
  top: 45px;
  left: 85px;
  width: 24px;
  height: 24px;
  opacity: 0;
  animation: kitCheck 3s ease infinite;
  color: var(--green);
}
.anim-kit__check::before {
  content: '\2713';
  font-size: 20px;
  font-weight: 700;
}

@keyframes kitCardAnim {
  0%, 30%  { opacity: 1; transform: translateX(0); }
  50%, 65% { opacity: 1; transform: translateX(-120px); }
  80%, 100%{ opacity: 0; transform: translateX(-120px); }
}
@keyframes kitCursor {
  0%, 10%  { opacity: 0; top: 30px; left: 60px; }
  20%      { opacity: 1; top: 68px; left: 95px; }
  35%      { opacity: 1; top: 68px; left: 95px; }
  45%, 100%{ opacity: 0; }
}
@keyframes kitCheck {
  0%, 65%  { opacity: 0; transform: scale(0); }
  75%      { opacity: 1; transform: scale(1.2); }
  85%, 95% { opacity: 1; transform: scale(1); }
  100%     { opacity: 0; }
}

/* === Animation 3: Conversion =============================== */
.anim-convert {
  width: 200px;
  height: 120px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.anim-convert__link {
  width: 60px;
  height: 8px;
  border-radius: 4px;
  background: var(--green);
  opacity: 0;
  animation: convLink 5s ease infinite;
}
.anim-convert__gauge {
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: var(--gray-lt);
  margin-top: 12px;
  overflow: hidden;
  opacity: 0;
  animation: convGaugeShow 5s ease infinite;
}
.anim-convert__gauge-fill {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green), var(--gold));
  animation: convGaugeFill 5s ease infinite;
}
.anim-convert__handshake {
  margin-top: 12px;
  font-size: 24px;
  opacity: 0;
  animation: convHandshake 5s ease infinite;
}
.anim-convert__coins {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  animation: convCoins 5s ease infinite;
}
.anim-convert__coin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  animation: coinBounce 5s ease infinite;
}
.anim-convert__coin:nth-child(2) { animation-delay: 0.1s; }
.anim-convert__coin:nth-child(3) { animation-delay: 0.2s; }

@keyframes convLink {
  0%, 5%    { opacity: 0; }
  10%, 20%  { opacity: 1; }
  30%, 100% { opacity: 0.3; }
}
@keyframes convGaugeShow {
  0%, 15%   { opacity: 0; }
  25%, 85%  { opacity: 1; }
  95%, 100% { opacity: 0; }
}
@keyframes convGaugeFill {
  0%, 20%   { width: 0; }
  50%       { width: 100%; }
  85%, 100% { width: 100%; }
}
@keyframes convHandshake {
  0%, 45%   { opacity: 0; transform: scale(0); }
  55%       { opacity: 1; transform: scale(1.15); }
  65%, 80%  { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; }
}
@keyframes convCoins {
  0%, 55%   { opacity: 0; }
  65%, 80%  { opacity: 1; }
  90%, 100% { opacity: 0; }
}
@keyframes coinBounce {
  0%, 58%   { transform: translateY(0); }
  62%       { transform: translateY(-8px); }
  66%       { transform: translateY(0); }
  70%       { transform: translateY(-4px); }
  74%, 100% { transform: translateY(0); }
}

/* === Animation 4: Payment Split ============================ */
.anim-split {
  width: 220px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.anim-split__bar {
  width: 200px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: var(--gray-lt);
}
.anim-split__seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--white);
  overflow: hidden;
  white-space: nowrap;
}
.anim-split__seg--company {
  width: 0;
  background: var(--green);
  animation: splitCompany 3s ease infinite;
}
.anim-split__seg--partner {
  width: 0;
  background: var(--gold);
  animation: splitPartner 3s ease infinite;
}
.anim-split__seg--praeco {
  width: 0;
  background: var(--gray);
  animation: splitPraeco 3s ease infinite;
}
.anim-split__labels {
  display: flex;
  justify-content: space-between;
  width: 200px;
  margin-top: 6px;
  opacity: 0;
  animation: splitLabelsShow 3s ease infinite;
}
.anim-split__label {
  font-size: 0.625rem;
  color: var(--ink-muted);
}

@keyframes splitCompany {
  0%, 10%  { width: 0; }
  30%, 80% { width: 80%; }
  95%, 100%{ width: 0; }
}
@keyframes splitPartner {
  0%, 20%  { width: 0; }
  40%, 80% { width: 18%; }
  95%, 100%{ width: 0; }
}
@keyframes splitPraeco {
  0%, 30%  { width: 0; }
  50%, 80% { width: 2%; }
  95%, 100%{ width: 0; }
}
@keyframes splitLabelsShow {
  0%, 35%  { opacity: 0; }
  50%, 80% { opacity: 1; }
  95%, 100%{ opacity: 0; }
}

/* === Animation 5: Self-Healing ============================= */
.anim-heal {
  width: 200px;
  height: 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.anim-heal__indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  animation: healIndicator 4s ease infinite;
}
.anim-heal__indicator:nth-child(2) {
  animation-name: healIndicatorFail;
}
.anim-heal__indicator:nth-child(3),
.anim-heal__indicator:nth-child(4) {
  animation: none;
  background: var(--green);
}
.anim-heal__icon {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  opacity: 0;
  animation: healIcon 4s ease infinite;
}

@keyframes healIndicator {
  0%, 100% { background: var(--green); }
}
@keyframes healIndicatorFail {
  0%, 15%  { background: var(--green); }
  20%, 50% { background: #D64545; }
  65%, 100%{ background: var(--green); }
}
@keyframes healIcon {
  0%, 20%  { opacity: 0; content: ''; }
  25%, 40% { opacity: 1; }
  50%, 60% { opacity: 1; }
  70%, 100%{ opacity: 0; }
}

/* === Micro-animation: card hover icons ===================== */
.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: calc(var(--grid) * 2);
  font-size: 24px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
}
.card-icon--partner  { background: rgba(45, 106, 79, 0.1); color: var(--green); }
.card-icon--company  { background: rgba(201, 169, 97, 0.15); color: var(--gold); }
.card-icon--customer { background: rgba(45, 106, 79, 0.1); color: var(--green); }

/* === Counter Animation ===================================== */
.counter[data-animated="true"] {
  animation: counterPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes counterPop {
  0%   { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* === Reduced Motion ======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
