/* Site-level custom CSS (non-Tailwind) */

html {
  scroll-behavior: smooth;
}

/* Mobile: prefer native scrolling (no smooth scrolling / no snap / no heavy animations). */
@media (pointer: coarse), (hover: none) {
  html {
    scroll-behavior: auto;
    scroll-snap-type: none !important;
  }

  body {
    scroll-snap-type: none !important;
  }

  .marquee-track {
    animation: none !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
  }
}

/* Prevent accidental horizontal scrolling (mobile + some Android WebViews) */
html,
body {
  width: 100%;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

/* Anchor offset for fixed top navbar (h-20 = 5rem) */
#features,
#comparison,
#cases,
#faq,
#contact {
  scroll-margin-top: 6rem;
}

/* Provide consistent section breathing room (some sections have no Tailwind py-*). */
#features,
#cases,
#faq {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

/* Desktop: add extra bottom space so fixed widgets don't cover the footer. */
@media screen and (min-width: 1025px) {
  body {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }
}

/* Mobile spacing tuning */
@media screen and (max-width: 640px) {
  /* Mobile: add more top spacing after header -> sections */
  #features,
  #faq {
    padding-top: 4rem;
    padding-bottom: 4.5rem;
  }

  /* 图1：案例区标题上方间距稍微收紧 */
  #cases {
    padding-top: 3rem;
    padding-bottom: 4.5rem;
  }

  /* Mobile: VS badge shouldn't cover content; make it smaller and slightly offset. */
  #comparison .comparison-vs {
    top: calc(50% + 36px);
    pointer-events: none;
  }
  #comparison .comparison-vs-badge {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
  }

  html,
  body {
    overflow-x: hidden !important;
  }

  /* Mobile performance: avoid heavy compositing during scroll */
  .bg-glass,
  .faq-item {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Tailwind backdrop blur utilities (e.g. backdrop-blur-sm/md) */
  [class*="backdrop-blur"] {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Reduce very heavy shadows on mobile */
  .shadow-2xl {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35) !important;
  }

  /* fixed nav smaller: reduce anchor offset accordingly */
  #features,
  #comparison,
  #cases,
  #faq,
  #contact {
    scroll-margin-top: 5rem;
  }

  /* tighten side padding a bit (px-4 -> ~12px) */
  .px-4 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Mobile spacing: loosen vertical rhythm (previously compressed) */
  .py-16 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }

  /* Hero */
  .pt-24 {
    padding-top: 5rem !important;
  }
  .pb-10 {
    padding-bottom: 3rem !important;
  }
  .pb-12 {
    padding-bottom: 3rem !important;
  }

  /* Section headings & blocks */
  .mb-20 {
    margin-bottom: 4rem !important;
  }
  .mb-16 {
    margin-bottom: 3.5rem !important;
  }
  .mb-12 {
    margin-bottom: 3rem !important;
  }
  .mb-10 {
    margin-bottom: 3rem !important;
  }
  .mb-8 {
    margin-bottom: 2.25rem !important;
  }

  /* Layout gaps */
  .gap-16 {
    gap: 3rem !important;
  }
  .gap-10 {
    gap: 2.25rem !important;
  }
  .gap-8 {
    gap: 1.5rem !important;
  }
  .p-8 {
    padding: 1.75rem !important;
  }

  /* Tailwind space-y utilities use margin-top; tighten the key one we set in HTML */
  #features .space-y-16 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 3.5rem !important;
  }

  /* Reduce case grid gap a touch */
  #cases-list {
    gap: 1rem !important;
    margin-bottom: 3rem !important;
  }

  /* reduce big section title spacing */
  .text-center.mb-16 {
    margin-bottom: 3.5rem !important;
  }

  /* reduce hero CTA gaps */
  header .gap-6 {
    gap: 18px !important;
  }

  /* Extra safety: prevent any child from causing horizontal overflow */
  body > * {
    max-width: 100vw;
  }
}

.text-neon {
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5), 0 0 20px rgba(0, 229, 255, 0.3);
}

.text-neon-cyan {
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.7);
}

.bg-glass {
  background: rgba(8, 8, 8, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gradient-text {
  background: linear-gradient(to right, #ffffff, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: #1a1a1a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #00e5ff;
}

/* Seamless marquee (shift is computed in JS) */
.marquee-track {
  animation: marquee-seamless var(--marquee-duration, 25s) linear infinite;
}

@keyframes marquee-seamless {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--marquee-shift, 0px)));
  }
}

/* One-screen scrolling: section transition when entering viewport */
.reveal-on-scroll {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 600ms ease, transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-inview {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* FAQ accordion (animated) */
.faq-item {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.faq-item:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 229, 255, 0.08);
}

.faq-item.is-open {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 35px rgba(0, 229, 255, 0.08);
}

.faq-answer-wrap {
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: height 320ms ease, opacity 240ms ease, transform 320ms ease;
  will-change: height;
}

.faq-item.is-open .faq-answer-wrap {
  opacity: 1;
  transform: none;
}

.faq-answer {
  padding-top: 10px;
}

.faq-answer::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .faq-item,
  .faq-answer-wrap {
    transition: none;
  }
}
