/* =========================================================
   NovaPulse Ultra-Smooth Physics & Motion Design Engine
   Spring Dynamics, Ambient Glows, Cursor Spotlight & Scroll Reveals
   ========================================================= */

/* --- Custom Smooth Scrollbar --- */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-focus);
  border-radius: 9999px;
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* --- Spring & Fluid Keyframes --- */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes floatDock {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

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

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
  50% { box-shadow: 0 0 35px rgba(99, 102, 241, 0.35); }
}

@keyframes soundBars {
  0% { height: 4px; }
  100% { height: 18px; }
}

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

/* --- Scroll Reveal Classes (Driven by IntersectionObserver) --- */
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger Children within Grid */
.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.40s; }

/* Page Route Transition */
.page-fade-in {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Interactive Card Spotlight Effect --- */
.article-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.1),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 2;
}

.article-card:hover::before {
  opacity: 1;
}

/* Magnetic Button Ripple */
.btn-primary, .btn-theme-switch, .search-trigger, .category-pill {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s ease,
              border-color 0.25s ease;
}

.btn-primary:active, .btn-theme-switch:active {
  transform: scale(0.95);
}

/* Floating Dock Motion */
.floating-reader-dock {
  animation: floatDock 6s ease-in-out infinite alternate,
             fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-reader-dock:hover {
  animation-play-state: paused;
  transform: translate(-50%, -2px) scale(1.02);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25), 0 0 35px var(--accent-glow);
}

/* Audio Wave Visualizer */
.audio-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.audio-bar {
  width: 3px;
  height: 5px;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: height 0.2s ease;
}

.audio-playing .audio-bar {
  animation: soundBars 0.8s ease-in-out infinite alternate;
}
.audio-playing .audio-bar:nth-child(2) { animation-delay: 0.15s; }
.audio-playing .audio-bar:nth-child(3) { animation-delay: 0.35s; }
.audio-playing .audio-bar:nth-child(4) { animation-delay: 0.1s; }

/* Skeleton Loading Shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(120, 120, 140, 0.06) 25%,
    rgba(120, 120, 140, 0.14) 50%,
    rgba(120, 120, 140, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; }
.skeleton-title { height: 2rem; width: 75%; margin-bottom: 0.8rem; }
.skeleton-card { height: 380px; border-radius: var(--radius-lg); }

/* Accordion Smooth Expand */
.faq-answer {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Micro-Interactions & Aesthetic Polish Enhancements --- */

/* Smooth Theme Switching Transitions */
body, .site-header, .editorial-topbar, .article-card, .footer-section, .mobile-drawer {
  transition: background-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Category Pill Hover & Active Fluid Dynamics */
.category-pill {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.category-pill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.category-pill:hover::after {
  left: 150%;
}

.category-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* Image Zoom & Card Hover Elevation */
.article-card .card-image-wrap img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
}

.article-card:hover .card-image-wrap img {
  transform: scale(1.05);
}

/* Card Hover Border Glow */
.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.15), 0 0 25px var(--accent-glow);
}

[data-theme="dark"] .article-card:hover {
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-glow);
}

/* Copy Code Tooltip Feedback */
.code-copy-btn {
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-copy-btn:hover {
  transform: scale(1.08);
}

.code-copy-btn:active {
  transform: scale(0.92);
}

/* Live Signal Badge Pulse */
.signal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse 2s infinite ease-in-out;
}

/* Reduced Motion Support */
@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;
  }
}
