/*
 * 四页入场动效 — 每页独立气质（非同一套上浮）
 * Home：Hero 轻快上浮 → 工厂区横向 reveal → 产品卡依次「托起」
 * Products：标题压弹 + 导语「对焦」→ 产品行左右交错滑入 → 监控区缓升
 * Solutions：Hero 慢节奏沉降 → How We 分栏阶梯 → 各 Vertical Market 左右交替 → Advantage 卡片感缩放
 * Why Name：首屏模糊收焦（叙事感）→ 中段轻量上浮 → 数字块微弹
 */

/* ========== Home ========== */
@keyframes es-home-hero-rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes es-home-factory-reveal {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes es-home-scale-up {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes es-home-card-lift {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes es-home-form-soft {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Products ========== */
@keyframes es-prod-title-snap {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes es-prod-lead-focus {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes es-prod-row-from-left {
  from {
    opacity: 0;
    transform: translateX(-56px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes es-prod-row-from-right {
  from {
    opacity: 0;
    transform: translateX(56px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes es-prod-monitor-float {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Solutions ========== */
@keyframes es-sol-hero-settle {
  from {
    opacity: 0;
    transform: translateY(36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes es-sol-step-col {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes es-sol-band-left {
  from {
    opacity: 0;
    transform: translateX(-48px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes es-sol-band-right {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes es-sol-panel-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ========== Why Name ========== */
@keyframes es-why-blur-in {
  from {
    opacity: 0;
    filter: blur(16px);
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes es-why-line-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes es-why-stat-pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* ----- Home：分段不同 keyframes ----- */
  .page--home main.es-page-main--animated .group_2 > *:nth-child(1),
  .page--home main.es-page-main--animated .group_2 > *:nth-child(2),
  .page--home main.es-page-main--animated .group_2 > *:nth-child(3),
  .page--home main.es-page-main--animated .group_2 > *:nth-child(4),
  .page--home main.es-page-main--animated .group_2 > *:nth-child(5) {
    opacity: 0;
    animation: es-home-hero-rise 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(1) {
    animation-delay: 0.05s;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(2) {
    animation-delay: 0.12s;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(3) {
    animation-delay: 0.2s;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(4) {
    animation-delay: 0.28s;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(5) {
    animation-delay: 0.34s;
  }

  .page--home main.es-page-main--animated .group_2 > *:nth-child(6) {
    opacity: 0;
    animation: es-home-factory-reveal 0.92s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.38s;
  }

  .page--home main.es-page-main--animated .group_2 > *:nth-child(7) {
    opacity: 0;
    animation: es-home-scale-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.48s;
  }

  .page--home main.es-page-main--animated .group_2 > *:nth-child(8) {
    opacity: 0;
    animation: es-home-hero-rise 0.5s ease-out forwards;
    animation-delay: 0.52s;
  }

  .page--home main.es-page-main--animated .es-product-card {
    opacity: 0;
    animation: es-home-card-lift 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--home main.es-page-main--animated .es-product-card:nth-child(1) {
    animation-delay: 0.58s;
  }
  .page--home main.es-page-main--animated .es-product-card:nth-child(2) {
    animation-delay: 0.66s;
  }
  .page--home main.es-page-main--animated .es-product-card:nth-child(3) {
    animation-delay: 0.74s;
  }
  .page--home main.es-page-main--animated .es-product-card:nth-child(4) {
    animation-delay: 0.82s;
  }
  .page--home main.es-page-main--animated .es-product-card:nth-child(5) {
    animation-delay: 0.9s;
  }

  .page--home main.es-page-main--animated .group_2 > *:nth-child(9),
  .page--home main.es-page-main--animated .group_2 > *:nth-child(10) {
    opacity: 0;
    animation: es-home-scale-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(9) {
    animation-delay: 0.72s;
  }
  .page--home main.es-page-main--animated .group_2 > *:nth-child(10) {
    animation-delay: 0.78s;
  }

  .page--home main.es-page-main--animated .group_2 > *:nth-child(11) {
    opacity: 0;
    animation: es-home-hero-rise 0.55s ease-out forwards;
    animation-delay: 0.82s;
  }

  /* 仅表单容器入场；下拉菜单不再参与 nth-child(13) 动画，避免展开时仍带 transform/opacity 残留导致顿挫 */
  .page--home main.es-page-main--animated .group_2 > *:nth-child(12) {
    opacity: 0;
    animation: es-home-form-soft 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.88s;
  }

  /* WhatsApp 浮动按钮不参与 hero 分段入场（nth-child(5)），避免初始 opacity:0 */
  .page--home main.es-page-main--animated .group_2 > a.es-home-wa-float {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
  }

  /* ----- Products：与 Home 完全不同的编排 ----- */
  .page--products main.es-page-main--animated .box_2 > .text-wrapper_2 {
    opacity: 0;
    animation: es-prod-title-snap 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.06s;
    transform-origin: 0 50%;
  }

  .page--products main.es-page-main--animated .box_2 > .text_11 {
    opacity: 0;
    animation: es-prod-lead-focus 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.18s;
  }

  .page--products main.es-page-main--animated .es-product-row:nth-child(odd) {
    opacity: 0;
    animation: es-prod-row-from-left 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(even) {
    opacity: 0;
    animation: es-prod-row-from-right 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(1) {
    animation-delay: 0.32s;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(2) {
    animation-delay: 0.42s;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(3) {
    animation-delay: 0.52s;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(4) {
    animation-delay: 0.62s;
  }
  .page--products main.es-page-main--animated .es-product-row:nth-child(5) {
    animation-delay: 0.72s;
  }

  .page--products main.es-page-main--animated .es-products-monitoring {
    opacity: 0;
    animation: es-prod-monitor-float 1.05s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.55s;
  }

  /* ----- Solutions：慢 Hero + 分栏 + 交错市场带 + 面板 ----- */
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(1),
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(2),
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(3),
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(4) {
    opacity: 0;
    animation: es-sol-hero-settle 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(1) {
    animation-delay: 0.06s;
  }
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(2) {
    animation-delay: 0.14s;
  }
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(3) {
    animation-delay: 0.22s;
  }
  .page--solutions main.es-page-main--animated .section_2 > *:nth-child(4) {
    animation-delay: 0.3s;
  }

  .page--solutions main.es-page-main--animated .es-how-work__col:nth-child(1) {
    animation-delay: 0.38s;
  }
  .page--solutions main.es-page-main--animated .es-how-work__col:nth-child(2) {
    animation-delay: 0.46s;
  }
  .page--solutions main.es-page-main--animated .es-how-work__col:nth-child(3) {
    animation-delay: 0.54s;
  }
  .page--solutions main.es-page-main--animated .es-how-work__col:nth-child(4) {
    animation-delay: 0.62s;
  }
  .page--solutions main.es-page-main--animated .es-how-work__col:nth-child(5) {
    animation-delay: 0.7s;
  }
  .page--solutions main.es-page-main--animated .es-how-work__col {
    opacity: 0;
    animation: es-sol-step-col 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .page--solutions main.es-page-main--animated .section_2 > .box_4 {
    opacity: 0;
    animation: es-sol-band-left 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.52s;
  }
  .page--solutions main.es-page-main--animated .section_2 > .box_6 {
    opacity: 0;
    animation: es-sol-band-right 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.6s;
  }
  .page--solutions main.es-page-main--animated .section_2 > .box_8 {
    opacity: 0;
    animation: es-sol-band-left 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.68s;
  }

  .page--solutions main.es-page-main--animated .section_2 > .box_10 {
    opacity: 0;
    animation: es-sol-panel-in 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.72s;
  }

  /* 隐藏占位条不参与动效，避免闪一下 */
  .page--solutions main.es-page-main--animated .section_2 > .box_2 {
    opacity: 1 !important;
    animation: none !important;
  }

  /* ----- Why Name：模糊叙事 + 分段节奏 ----- */
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(1) {
    opacity: 0;
    animation: es-why-blur-in 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.08s;
  }

  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(2),
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(3) {
    opacity: 0;
    animation: es-why-line-rise 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(2) {
    animation-delay: 0.35s;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(3) {
    animation-delay: 0.45s;
  }

  .page--why-name main.es-page-main--animated .box_2 > .group_2 {
    opacity: 0;
    animation: es-why-stat-pop 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.55s;
  }

  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(5),
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(6),
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(7),
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(8),
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(9) {
    opacity: 0;
    animation: es-why-line-rise 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(5) {
    animation-delay: 0.58s;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(6) {
    animation-delay: 0.66s;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(7) {
    animation-delay: 0.74s;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(8) {
    animation-delay: 0.82s;
  }
  .page--why-name main.es-page-main--animated .box_2 > *:nth-child(9) {
    animation-delay: 0.9s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page--home main.es-page-main--animated .group_2 > *,
  .page--home main.es-page-main--animated .es-product-card,
  .page--products main.es-page-main--animated .box_2 > *,
  .page--products main.es-page-main--animated .es-product-row,
  .page--products main.es-page-main--animated .es-products-monitoring,
  .page--solutions main.es-page-main--animated .section_2 > *,
  .page--solutions main.es-page-main--animated .es-how-work__col,
  .page--why-name main.es-page-main--animated .box_2 > * {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
  }
}
