/* ============================================================
   style.css — Custom Styles for 加拿大28智能预测平台
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #6366f1;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --rounded-2xl: 1rem;
  --transition-base: 300ms ease;
}

/* ---------- Smooth Scroll Behavior ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4f46e5, #4338ca);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #6366f1 #f1f5f9;
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 30%, #ec4899 70%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ---------- Glass Morphism Navbar ---------- */
#navbar {
  background: transparent;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

#navbar.scrolled {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#navbar.scrolled .text-white,
#navbar.scrolled .drop-shadow-md {
  --tw-text-opacity: 1;
  color: rgb(17 24 39 / var(--tw-text-opacity));
  text-shadow: none;
}

#navbar.scrolled .text-indigo-300 {
  --tw-text-opacity: 1;
  color: rgb(99 102 241 / var(--tw-text-opacity));
}

#navbar.scrolled .text-white\/90 {
  color: rgb(55 65 81);
}

#navbar.scrolled .text-white\/90:hover {
  color: rgb(79 70 229);
  background: rgba(79, 70, 229, 0.06);
}

#navbar.scrolled .hamburger-line {
  background-color: #374151;
}

/* ---------- Hamburger Menu Animation ---------- */
#mobile-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

#mobile-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(10px);
}

#mobile-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ---------- Mobile Menu ---------- */
#mobile-menu.show {
  display: block;
  animation: slideDown 0.3s ease-out;
}

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

/* ---------- Button Primary ---------- */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after {
  width: 300px;
  height: 300px;
}

/* Button Pulse Animation */
.btn-pulse {
  animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 18px rgba(255, 255, 255, 0);
  }
}

/* ---------- Feature Card Hover Effects ---------- */
.feature-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-card:hover {
  transform: translateY(-8px);
}

/* ---------- Card Hover Float Animation ---------- */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.testimonial-card:hover {
  animation: float 3s ease-in-out infinite;
}

/* ---------- FAQ Accordion Transitions ---------- */
.faq-item {
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.faq-item:hover {
  border-color: #c7d2fe;
}

.faq-item.active {
  border-color: #818cf8;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.1);
}

.faq-toggle.active .faq-icon {
  transform: rotate(180deg);
}

.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease;
}

.faq-content.open {
  max-height: 500px;
}

/* ---------- Fade-in Animations (Intersection Observer) ---------- */
.fade-in-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-up-delayed {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}

.fade-in-up-delayed.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for feature cards */
.feature-card:nth-child(1).visible { transition-delay: 0.05s; }
.feature-card:nth-child(2).visible { transition-delay: 0.1s; }
.feature-card:nth-child(3).visible { transition-delay: 0.15s; }
.feature-card:nth-child(4).visible { transition-delay: 0.2s; }
.feature-card:nth-child(5).visible { transition-delay: 0.25s; }
.feature-card:nth-child(6).visible { transition-delay: 0.3s; }

/* ---------- Scroll Indicator Dot Animation ---------- */
.scroll-dot {
  animation: scrollBounce 1.8s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(10px);
    opacity: 0.3;
  }
}

/* ---------- Responsive Tweaks ---------- */
@media (max-width: 640px) {
  html {
    scroll-padding-top: 4rem;
  }

  .gradient-text {
    background-size: 150% 150%;
  }
}

@media (max-width: 768px) {
  .feature-card:hover {
    transform: translateY(-4px);
  }

  #navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
  }
}

@media (min-width: 1024px) {
  .fade-in-up-delayed.visible {
    transition-delay: 0.3s;
  }
}

/* ---------- Selection Styling ---------- */
::selection {
  background: rgba(79, 70, 229, 0.2);
  color: #4338ca;
}

/* ---------- Focus Styles ---------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ---------- Anti-aliasing ---------- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
