/* Restrained motion polish for the landing page.
 * Enhances perceived quality without changing layout or product behaviour.
 */

:root {
  --motion-ease: cubic-bezier(.22, .61, .36, 1);
  --motion-ease-out: cubic-bezier(.16, 1, .3, 1);
  --motion-fast: 180ms;
  --motion-base: 320ms;
  --motion-slow: 520ms;
}

/* Scroll reveal is opt-in only when motion-polish.js is active. */
.motion-enabled [data-motion-reveal] {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity var(--motion-slow) var(--motion-ease-out),
    transform var(--motion-slow) var(--motion-ease-out);
  transition-delay: var(--motion-delay, 0ms);
  will-change: opacity, transform;
}

.motion-enabled [data-motion-reveal].is-motion-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* Buttons and pills: small tactile response, never bouncy. */
.btn,
.howto-tabs .nav-link,
.faq-button,
.float-circle {
  transition:
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    opacity var(--motion-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover,
  .howto-tabs .nav-link:hover {
    transform: translateY(-1px);
  }

  .btn-vnpay:hover,
  .hero-btn:hover {
    box-shadow: 0 8px 20px rgba(4, 91, 167, .14);
  }

  .offer-card,
  .benefit-card,
  .featured-brands-carousel .brand-card {
    transition:
      transform var(--motion-base) var(--motion-ease-out),
      box-shadow var(--motion-base) var(--motion-ease-out);
  }

  .offer-card:hover,
  .benefit-card:hover {
    transform: translateY(-4px);
  }

  .benefit-card:hover {
    box-shadow: 0 12px 30px rgba(91, 160, 194, .12);
  }

  .featured-brands-carousel .brand-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(20, 20, 20, .08);
  }
}

/* How-to step switching: image and copy feel connected. */
.phone-stage .phone-shot {
  transition:
    opacity 180ms ease,
    transform 220ms var(--motion-ease-out);
  transform: scale(1);
}

.phone-stage .phone-shot.is-changing {
  opacity: 0;
  transform: scale(.985);
}

.step-index,
.step-copy {
  transition:
    background-color 220ms ease,
    color 220ms ease,
    transform 220ms var(--motion-ease-out),
    opacity 220ms ease;
}

.step-item.active .step-index {
  transform: scale(1.045);
}

.step-item.active .step-copy {
  animation: step-copy-in 260ms var(--motion-ease-out) both;
}

@keyframes step-copy-in {
  from { opacity: 0; transform: translate3d(0, 5px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Bootstrap carousel keeps its semantics; only easing is softened. */
.featured-brands-carousel .carousel-item {
  transition: transform 560ms var(--motion-ease-out);
}

/* FAQ opens without a hard visual jump around the surrounding card. */
.faq-item {
  transition:
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.faq-item.is-open {
  box-shadow: 0 8px 24px rgba(91, 160, 194, .08);
}

/* Existing mobile interactions keep their logic; only easing is refined. */
@media (max-width: 1199.98px) {
  .site-header.header-autohide-enabled {
    transition: top 260ms var(--motion-ease-out);
  }

  .mobile-offcanvas {
    transition-timing-function: var(--motion-ease-out) !important;
  }
}

@media (max-width: 767.98px) {
  /* Keep transforms off .step-button itself: a transformed ancestor becomes
   * the containing block for the absolutely-positioned mobile step copy and
   * momentarily squeezes long text into one narrow step column. */
  .btn:active,
  .howto-tabs .nav-link:active {
    transform: scale(.985);
  }

  .step-button:active {
    transform: none !important;
  }

  .step-button:active .step-index {
    transform: scale(.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .motion-enabled [data-motion-reveal],
  .motion-enabled [data-motion-reveal].is-motion-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .btn,
  .howto-tabs .nav-link,
  .faq-button,
  .float-circle,
  .offer-card,
  .benefit-card,
  .featured-brands-carousel .brand-card,
  .phone-stage .phone-shot,
  .step-index,
  .step-copy,
  .faq-item {
    animation: none !important;
    transition: none !important;
  }

  /* These transforms are structural state, not decoration. Keep them intact. */
  .featured-brands-carousel .carousel-item,
  .mobile-offcanvas,
  .site-header.header-autohide-enabled {
    animation: none !important;
    transition: none !important;
  }
}
