/* ============================================================
   FLAVOR THEME v2 — animations.css
   "Vivid" — Gradient mesh, scroll reveal, hover effects
   ============================================================ */

/* ----- Keyframes ----- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

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

@keyframes progressBar {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Vivid gradient mesh — 3 soft blobs drifting slowly */
@keyframes meshFloat {
  0%   { background-position: 0% 0%, 100% 100%, 50% 50%; }
  33%  { background-position: 30% 70%, 70% 20%, 20% 80%; }
  66%  { background-position: 80% 30%, 20% 80%, 70% 20%; }
  100% { background-position: 0% 0%, 100% 100%, 50% 50%; }
}

/* ----- Gradient mesh background ----- */
.mesh-bg {
  position: relative;
}
.mesh-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 600px at 20% 30%, rgba(79,70,229,0.06), transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 70%, rgba(249,115,22,0.05), transparent 70%),
    radial-gradient(ellipse 550px 550px at 50% 50%, rgba(139,92,246,0.04), transparent 70%);
  animation: meshFloat var(--t-mesh-duration, 15s) ease-in-out infinite;
}
/* Content above mesh */
.mesh-bg > * {
  position: relative;
  z-index: 1;
}

/* Dark mode: muted mesh colors */
[data-theme="dark"] .mesh-bg::before,
.dark .mesh-bg::before {
  background:
    radial-gradient(ellipse 600px 600px at 20% 30%, rgba(99,102,241,0.08), transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 70%, rgba(251,146,60,0.05), transparent 70%),
    radial-gradient(ellipse 550px 550px at 50% 50%, rgba(167,139,250,0.06), transparent 70%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mesh-bg::before {
    background:
      radial-gradient(ellipse 600px 600px at 20% 30%, rgba(99,102,241,0.08), transparent 70%),
      radial-gradient(ellipse 500px 500px at 80% 70%, rgba(251,146,60,0.05), transparent 70%),
      radial-gradient(ellipse 550px 550px at 50% 50%, rgba(167,139,250,0.06), transparent 70%);
  }
}

/* ----- Scroll reveal ----- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--t-easing), transform 600ms var(--t-easing);
}
.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.scroll-reveal.is-visible > .stagger-item:nth-child(1) { transition-delay: 0ms; }
.scroll-reveal.is-visible > .stagger-item:nth-child(2) { transition-delay: 80ms; }
.scroll-reveal.is-visible > .stagger-item:nth-child(3) { transition-delay: 160ms; }
.scroll-reveal.is-visible > .stagger-item:nth-child(4) { transition-delay: 240ms; }
.scroll-reveal.is-visible > .stagger-item:nth-child(5) { transition-delay: 320ms; }
.scroll-reveal.is-visible > .stagger-item:nth-child(6) { transition-delay: 400ms; }

.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--t-easing), transform 600ms var(--t-easing);
}
.scroll-reveal.is-visible > .stagger-item {
  opacity: 1;
  transform: translateY(0);
}

/* ----- Card hover — Vivid lift ----- */
.hover-lift {
  transition: transform var(--t-duration) var(--t-easing),
              box-shadow var(--t-duration) var(--t-easing);
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px var(--t-shadow-hover), 0 4px 12px var(--t-shadow);
}

/* ----- Image hover zoom ----- */
.hover-zoom {
  overflow: hidden;
}
.hover-zoom img {
  transition: transform var(--t-duration-slow) var(--t-easing);
}
.hover-zoom:hover img {
  transform: scale(1.04);
}

/* ----- Link underline slide — gradient ----- */
.link-slide {
  position: relative;
  display: inline;
  background-image: linear-gradient(90deg, var(--t-primary), var(--t-accent));
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--t-duration) var(--t-easing);
}
.link-slide:hover {
  background-size: 100% 2px;
}

/* ----- Button press ----- */
.btn:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}

/* ----- FAQ icon rotation ----- */
.faq-item__icon {
  transition: transform var(--t-duration) var(--t-easing);
}
.faq-item.is-open .faq-item__icon {
  transform: rotate(180deg);
}

/* ----- Hero word stagger ----- */
.hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(15px);
  animation: fadeUp 500ms var(--t-easing) forwards;
}

/* ----- Mobile menu transitions ----- */
.mobile-overlay {
  transition: opacity var(--t-duration) var(--t-easing),
              visibility var(--t-duration);
}
.mobile-drawer {
  transition: transform var(--t-duration) var(--t-easing);
}

/* ----- Loading spinner ----- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--t-border);
  border-top-color: var(--t-primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* ----- Pulse dot ----- */
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--t-success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* ----- Respect reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .scroll-reveal {
    opacity: 1;
    transform: none;
  }
  .stagger-item {
    opacity: 1;
    transform: none;
  }
  .hero-word {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .mesh-bg::before {
    animation: none;
  }
}
