/* Huantuo Official — motion / micro-interactions (Apple-like) */

/* —— Page ready —— */
body.is-ready .hero-inner > .reveal {
  animation: heroRise 0.95s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.is-ready .hero-inner > .reveal:nth-child(1) { animation-delay: 0.05s; }
body.is-ready .hero-inner > .reveal:nth-child(2) { animation-delay: 0.12s; }
body.is-ready .hero-inner > .reveal:nth-child(3) { animation-delay: 0.2s; }
body.is-ready .hero-inner > .reveal:nth-child(4) { animation-delay: 0.28s; }
body.is-ready .hero-inner > .reveal:nth-child(5) { animation-delay: 0.36s; }
body.is-ready .hero-inner > .reveal:nth-child(6) { animation-delay: 0.48s; }

@keyframes heroRise {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* Hero elements start hidden until body ready (avoid flash) */
.hero-full .hero-inner > .reveal {
  opacity: 0;
}
body.is-ready .hero-full .hero-inner > .reveal {
  /* animation handles final state */
}

/* —— Scroll progress —— */
.scroll-progress {
  height: 2.5px;
  background: linear-gradient(90deg, #64d2ff, #2997ff, #0071e3, #64d2ff);
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(41, 151, 255, 0.45);
  animation: progShine 2.8s linear infinite;
  transition: width 0.08s linear;
}

@keyframes progShine {
  to {
    background-position: 200% 0;
  }
}

/* —— Reveal (re-playable) —— */
.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  filter: blur(2px);
  transition:
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.7s ease;
  will-change: opacity, transform;
}

.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

.reveal-delay-1 { transition-delay: 0.06s; }
.reveal-delay-2 { transition-delay: 0.12s; }
.reveal-delay-3 { transition-delay: 0.18s; }
.reveal-delay-4 { transition-delay: 0.24s; }

/* Stagger via CSS var */
.reveal[style*="--i"] {
  transition-delay: calc(var(--i, 0) * 0.07s);
}

/* —— Nav —— */
.gnav {
  transition: background 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.gnav.scrolled {
  background: rgba(0, 0, 0, 0.72);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.gnav-logo-img {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), filter 0.35s;
}

.gnav-logo:hover .gnav-logo-img {
  transform: scale(1.08) rotate(-3deg);
  filter: drop-shadow(0 0 8px rgba(41, 151, 255, 0.55));
}

.gnav-links a {
  position: relative;
}

.gnav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.gnav-links a:hover::after {
  transform: scaleX(1);
}

.gnav-cta {
  transition: transform 0.2s, background 0.2s, box-shadow 0.25s;
}

.gnav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.4);
}

/* —— Buttons —— */
.btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.2s,
    color 0.2s,
    box-shadow 0.25s;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 255, 255, 0.18) 48%,
    transparent 65%
  );
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active,
.btn.is-press {
  transform: scale(0.97) translateY(0);
}

.btn-light:hover {
  box-shadow: 0 10px 28px rgba(255, 255, 255, 0.18);
}

.btn-dark:hover {
  box-shadow: 0 10px 28px rgba(0, 113, 227, 0.45);
}

.link-more {
  transition: gap 0.2s, opacity 0.2s, transform 0.2s;
  gap: 2px;
}

.link-more:hover {
  gap: 6px;
  transform: translateX(2px);
}

/* —— Product cards —— */
.product {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s;
  /* 链接在预览上方，必须保证层级不被放大区盖住 */
  isolation: isolate;
}

.product:hover {
  transform: translateY(-4px);
}

.product-links {
  position: relative;
  z-index: 3;
}

.product-visual {
  position: relative;
  z-index: 1;
  overflow: hidden; /* 放大裁切在框内，不盖住 Learn more / View demo */
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 只轻微下沉，不再整体上移放大（上移会压住上方链接） */
.product:hover .product-visual {
  transform: none;
}

.mock {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

.product:hover .mock {
  transform: scale(1.04);
}

/* —— Demo / tiles / price —— */
.demo-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.3s;
  isolation: isolate;
}

.demo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.demo-preview,
.demo-preview-link {
  overflow: hidden;
  border-radius: 16px;
}

.demo-preview .mock,
.demo-preview-link .mock {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

/* 只放大内部 mock，容器裁切，不盖住下方标题/按钮 */
.demo-card:hover .demo-preview .mock,
.demo-card:hover .demo-preview-link .mock {
  transform: scale(1.045);
}

.tile {
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.price-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

.price-card:hover {
  transform: translateY(-6px) scale(1.01);
}

.price-card.featured:hover {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.35);
}

/* —— Process steps —— */
.process-item {
  transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
}

.process-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
}

.process-item .step {
  display: inline-block;
  transition: transform 0.3s, color 0.3s;
}

.process-item:hover .step {
  transform: scale(1.08);
  color: #64d2ff;
}

/* —— FAQ —— */
.faq-item {
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
}

.faq-item.open {
  border-color: rgba(0, 113, 227, 0.25);
  box-shadow: 0 12px 32px rgba(0, 113, 227, 0.08);
}

.faq-a {
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s, opacity 0.3s;
  opacity: 0;
}

.faq-item.open .faq-a {
  opacity: 1;
}

/* —— Lead form —— */
.lead-form {
  transition: transform 0.35s, box-shadow 0.35s;
}

.lead-form:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.1);
}

.lead-field input,
.lead-field select {
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s;
}

.lead-field input:focus,
.lead-field select:focus {
  transform: translateY(-1px);
}

/* —— Stats count-up feel —— */
.stat strong {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s;
}

.stat.reveal.in strong {
  animation: statPop 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes statPop {
  from {
    transform: scale(0.85);
    opacity: 0.4;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* —— Phone mock —— */
.device-phone {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s;
}

.hero-device:hover .device-phone {
  animation-play-state: paused;
  transform: rotateX(2deg) rotateY(0deg) translateY(-10px) scale(1.03);
  box-shadow: 0 48px 90px rgba(0, 0, 0, 0.6);
}

.device-pill {
  animation: pillPulse 2.4s ease-in-out infinite;
}

@keyframes pillPulse {
  0%,
  100% {
    opacity: 0.88;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.12);
  }
}

/* —— Magnetic soft tilt on product/demo/price —— */
.tilt-soft {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.18s ease-out, box-shadow 0.3s;
}

.tilt-soft.is-tilting {
  z-index: 2;
}

/* —— Section ambient glow on enter —— */
.section-glow {
  position: relative;
}

.section-glow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: min(80%, 640px);
  height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(41, 151, 255, 0.12), transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s;
}

.section-glow.in-view::before {
  opacity: 1;
}

/* —— Compare row hover —— */
.compare tbody tr {
  transition: background 0.2s;
}

.compare tbody tr:hover {
  background: rgba(0, 113, 227, 0.04);
}

/* —— Mobile bar —— */
.m-bar {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

.m-bar.is-hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.m-bar-btn {
  transition: background 0.2s, letter-spacing 0.2s;
}

.m-bar-btn:hover {
  letter-spacing: 0.02em;
  background: #0077ed;
}

/* —— Back to top —— */
.back-top {
  position: fixed;
  right: 18px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 85;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(29, 29, 31, 0.88);
  color: #f5f5f7;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s, background 0.2s;
  backdrop-filter: blur(10px);
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.back-top:hover {
  background: #0071e3;
  border-color: transparent;
}

@media (min-width: 834px) {
  .back-top {
    bottom: 28px;
  }
}

/* —— Cursor glow on pricing (desktop) —— */
.pricing {
  position: relative;
  overflow: hidden;
}

.pricing-glow {
  pointer-events: none;
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.1), transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
}

.pricing.is-hot .pricing-glow {
  opacity: 1;
}

.pricing > * {
  position: relative;
  z-index: 1;
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .btn,
  .product,
  .demo-card,
  .tile,
  .price-card,
  .device-phone,
  .scroll-progress,
  .hero-orb {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  body.is-ready .hero-inner > .reveal {
    animation: none !important;
    opacity: 1 !important;
  }

  .tilt-soft {
    transform: none !important;
  }
}
