/**
 * Homepage animations — CSS only. Pair with assets/landing/js/animations.js
 * All motion gated behind prefers-reduced-motion: no-preference.
 */

.eb-will-animate {
  will-change: transform, opacity;
}

/* Visible before animations.js runs */
html:not(.js-eb-animate) [data-animate] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  html.js-eb-animate [data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    transition-delay: var(--eb-delay, 0ms);
  }

  html.js-eb-animate [data-animate].eb-in {
    opacity: 1;
    transform: translateY(0);
  }

  html.js-eb-animate [data-animate="fade"] {
    transform: none;
  }

  html.js-eb-animate [data-animate="left"] {
    transform: translateX(-30px);
  }

  html.js-eb-animate [data-animate="left"].eb-in {
    transform: translateX(0);
  }

  html.js-eb-animate [data-animate="pop"] {
    transform: scale(0.9);
  }

  html.js-eb-animate [data-animate="pop"].eb-in {
    transform: scale(1);
  }

  html.js-eb-animate [data-animate="scale-in"] {
    transform: scale(0.85);
  }

  html.js-eb-animate [data-animate="scale-in"].eb-in {
    transform: scale(1);
  }

  /* Navbar — slide down on load */
  .eb-site-header .lp-nav--glass {
    animation: eb-nav-in 0.4s ease forwards;
  }

  @keyframes eb-nav-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .lp-nav__links a,
  .lp-nav__trigger,
  .lp-nav__link {
    position: relative;
    text-decoration: none;
  }

  .lp-nav__links a::after,
  .lp-nav__trigger::after,
  .lp-nav__link::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: currentColor;
    transition: width 0.2s ease;
  }

  .lp-nav__links a:hover::after,
  .lp-nav__trigger:hover::after,
  .lp-nav__link:hover::after {
    width: 100%;
  }

  /* Hero */
  .eb-hero-cine__title .eb-hero-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: eb-hero-word 0.35s ease-out forwards;
    animation-delay: calc(var(--word-i, 0) * 60ms);
  }

  @keyframes eb-hero-word {
    to { opacity: 1; transform: translateY(0); }
  }

  .eb-hero-cine__lead {
    animation: eb-hero-fade 0.4s ease-out 0.4s both;
  }

  .eb-hero-cine__ctas .lp-btn {
    opacity: 0;
    transform: scale(0.92);
    animation: eb-hero-cta 0.35s ease-out forwards;
    animation-delay: calc(0.48s + var(--cta-i, 0) * 80ms);
  }

  @keyframes eb-hero-fade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes eb-hero-cta {
    to { opacity: 1; transform: scale(1); }
  }

  .eb-hero-cine__trust {
    animation: eb-hero-trust-in 0.45s ease-out 0.6s both;
  }

  @keyframes eb-hero-trust-in {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .eb-hero-cine__trust-pill,
  .eb-eco-node {
    opacity: 0;
    animation: eb-fade-in-pill 0.3s ease-out forwards;
    animation-delay: calc(0.7s + var(--pill-i, var(--eco-delay, 0)) * 50ms);
  }

  @keyframes eb-fade-in-pill {
    to { opacity: 1; }
  }

  /* Pricing */
  .eb-price-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .eb-price-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }

  .eb-price-card--featured {
    animation: eb-glow 3s ease-in-out infinite;
  }

  @keyframes eb-glow {
    0%, 100% { box-shadow: 0 0 0 1px rgba(79, 142, 247, 0.3); }
    50% { box-shadow: 0 0 24px 4px rgba(79, 142, 247, 0.25); }
  }

  .eb-counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
  }

  .eb-check-pop {
    display: inline-block;
    animation: eb-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }

  @keyframes eb-pop {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }

  .lp-btn {
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  }

  .lp-btn--primary:hover {
    transform: translateY(-2px) scale(1.02);
  }

  /* Platform architecture */
  .eb-platform-net__line {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .eb-platform-net.is-drawn .eb-platform-net__line {
    transform: scaleX(1);
  }

  .eb-platform-net.is-drawn .eb-platform-net__chip {
    animation: eb-net-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: calc(var(--net-i, 0) * 80ms);
  }

  @keyframes eb-net-pop {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
  }

  /* Business flow */
  .eb-biz-flow__step.eb-flow-visible {
    animation: eb-flow-in 0.45s ease both;
    animation-delay: calc(var(--flow-i, 0) * 100ms);
  }

  @keyframes eb-flow-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .eb-bos__step.is-active .eb-bos__node {
    animation: eb-bos-pulse 0.35s ease;
  }

  @keyframes eb-bos-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    100% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.35); }
  }

  /* Module map SVG */
  .eb-modmap__line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.6s ease;
  }

  .eb-modmap__stage.is-drawn .eb-modmap__line {
    stroke-dashoffset: 0;
  }

  .eb-modmap__stage.is-drawn .eb-modmap__node {
    animation: eb-net-pop 0.35s ease backwards;
    animation-delay: calc(var(--mod-i, 0) * 80ms);
  }

  /* Proof gallery */
  .eb-proof-gallery__tabs {
    position: relative;
  }

  .eb-proof-gallery__tab-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--eb-primary);
    transition: transform 0.25s ease, width 0.25s ease;
    pointer-events: none;
  }

  .eb-proof-gallery__stage.is-switching .eb-proof-slide.is-active {
    animation: eb-proof-out 0.1s ease forwards;
  }

  .eb-proof-gallery__stage.is-switching-in .eb-proof-slide.is-active {
    animation: eb-proof-in 0.2s ease forwards;
  }

  @keyframes eb-proof-out {
    to { opacity: 0; transform: translateY(10px); }
  }

  @keyframes eb-proof-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Pricing matrix rows — stagger via landing-experience.css base visibility */
  .eb-pricing-matrix__table tbody tr {
    transition: opacity 0.35s ease, background 0.25s ease;
  }

  .eb-pricing-matrix__table tbody tr.eb-in .eb-check {
    animation: eb-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.js-eb-animate [data-animate] {
    opacity: 1;
    transform: none;
  }
}
