/**
 * Newtil.com UI Motion & Micro-interactions
 * Compliant with 2026-10-30 Newtil Animation Implementation Plan
 * High performance GPU-accelerated (transform/opacity only), Core Web Vitals safe
 */

/* 1. Header & Hero Real-time Marquee Ticker */
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  position: relative;
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
  mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
}

.marquee-content {
  display: inline-flex;
  align-items: center;
  gap: 2rem;
  animation: newtil-marquee 28s linear infinite;
  will-change: transform;
}

.marquee-container:hover .marquee-content {
  animation-play-state: paused;
}

@keyframes newtil-marquee {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* 2. Category Tab Stagger Slide & Fade */
.tool-grid-item.is-entering {
  opacity: 0;
  transform: translateY(16px);
  animation: toolCardEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--stagger-idx, 0) * 0.035s);
  will-change: opacity, transform;
}

@keyframes toolCardEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 3. Featured 3D Tilt Card */
.tool-card-featured {
  perspective: 900px;
  transform-style: preserve-3d;
  will-change: transform;
}

.tool-card-featured .tool-card-inner {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  transform-style: preserve-3d;
  position: relative;
  overflow: hidden;
}

.tool-card-featured:hover .tool-card-inner {
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.12), 0 8px 16px -8px rgba(37, 99, 235, 0.16);
}

.tool-card-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), rgba(255, 255, 255, 0.18) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
  border-radius: inherit;
}

.tool-card-featured:hover .tool-card-glare {
  opacity: 1;
}

/* 4. Spring Micro-Scale Button Feedback */
.btn-spring-click {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.15s ease;
  will-change: transform;
}

.btn-spring-click:active {
  transform: scale(0.95);
  transition-duration: 0.08s;
}

.btn-spring-click.is-springing {
  animation: newtilSpringBounce 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes newtilSpringBounce {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* 5. Count-up Metric Highlighting */
.countup-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease, text-shadow 0.25s ease;
}

.countup-value.countup-active {
  color: #2563eb;
  text-shadow: 0 0 12px rgba(37, 99, 235, 0.25);
}

/* 6. Accessibility & Reduced Motion Defense (100% Core Web Vitals) */
@media (prefers-reduced-motion: reduce) {
  .marquee-content {
    animation: none !important;
    transform: none !important;
  }
  .tool-grid-item.is-entering {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .tool-card-featured .tool-card-inner {
    transform: none !important;
    transition: none !important;
  }
  .tool-card-glare {
    display: none !important;
  }
  .btn-spring-click {
    transition: none !important;
  }
  .btn-spring-click.is-springing {
    animation: none !important;
  }
}
