/* Hallmark · macrostructure: Stat-Led · tone: modern-minimal · anchor hue: royal-blue
 * Taste skill: Anti-slop motion system · Hardware-accelerated · GPU compositor-only
 * Durations: 150ms-600ms · Easings: cubic-bezier(0.16, 1, 0.3, 1) · Zero layout thrashing
 */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.87, 0, 0.13, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-instant: 100ms;
  --dur-fast: 200ms;
  --dur-normal: 350ms;
  --dur-slow: 600ms;
  --dur-enter: 800ms;
}

/* 1. Scroll Reading Progress Bar */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 45%, #10b981 100%);
  z-index: 99999;
  pointer-events: none;
  transform: translateZ(0);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
  transition: width 60ms linear;
}

/* 2. Interactive Card Mouse Spotlight / Glow (Linear & Raycast style) */
.spotlight-card,
.card-clean {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: border-color var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out),
              transform var(--dur-normal) var(--ease-out);
}

.spotlight-card::before,
.card-clean::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
  background: radial-gradient(
    550px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(37, 99, 235, 0.07),
    transparent 65%
  );
  z-index: 1;
}

.spotlight-card::after,
.card-clean::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
  padding: 1.5px;
  background: radial-gradient(
    380px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(59, 130, 246, 0.55),
    transparent 60%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 2;
}

.spotlight-card:hover::before,
.card-clean:hover::before,
.spotlight-card:hover::after,
.card-clean:hover::after {
  opacity: 1;
}

.spotlight-card:hover,
.card-clean:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.08), 0 0 1px 1px rgba(37, 99, 235, 0.12);
}

/* 3. Staggered Intersection Scroll Reveals */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 650ms var(--ease-out),
              transform 650ms var(--ease-out);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger utilities for lists and grids */
.stagger-1 { transition-delay: 60ms; }
.stagger-2 { transition-delay: 120ms; }
.stagger-3 { transition-delay: 180ms; }
.stagger-4 { transition-delay: 240ms; }
.stagger-5 { transition-delay: 300ms; }
.stagger-6 { transition-delay: 360ms; }

/* 4. Infinite Smooth Ticker / Marquee */
.marquee-wrapper {
  overflow: hidden;
  position: relative;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}

.marquee-track {
  display: flex;
  width: max-content;
  gap: 2rem;
  animation: marqueeLoop 38s linear infinite;
  will-change: transform;
}

.marquee-track-reverse {
  animation: marqueeLoopReverse 42s linear infinite;
}

.marquee-wrapper:hover .marquee-track {
  animation-play-state: paused;
}

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

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

/* 5. Tactile Button & Card Physics */
.btn-motion,
.btn-tactile {
  position: relative;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  will-change: transform;
}

.btn-motion:hover,
.btn-tactile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -4px rgba(37, 99, 235, 0.28);
}

.btn-motion:active,
.btn-tactile:active {
  transform: scale(0.97) translateY(0);
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.2);
  transition-duration: 60ms;
}

/* 6. Interactive Pill Tab Slider */
.pill-tab-container {
  position: relative;
  display: inline-flex;
  background-color: #f1f5f9;
  border-radius: 9999px;
  padding: 4px;
  border: 1px solid #e2e8f0;
}

.pill-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  border-radius: 9999px;
  background-color: #2563eb;
  transition: transform 300ms var(--ease-out),
              width 300ms var(--ease-out);
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.pill-tab-btn {
  position: relative;
  z-index: 2;
  transition: color 200ms var(--ease-out);
}

.pill-tab-btn.is-active {
  color: #ffffff !important;
}

/* 7. Live Typing & Workflow Simulation Mockup */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: #2563eb;
  margin-left: 2px;
  vertical-align: middle;
  animation: cursorBlink 900ms infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.task-pulse {
  animation: pulseLight 2s infinite var(--ease-in-out);
}

@keyframes pulseLight {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.03); }
}

/* 8. Floating Back-to-Top Button */
#backToTopBtn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 280ms var(--ease-out),
              transform 280ms var(--ease-out),
              visibility 280ms var(--ease-out),
              background-color 200ms var(--ease-out);
}

#backToTopBtn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#backToTopBtn:hover {
  background: #1d4ed8;
  transform: translateY(-3px) scale(1.05);
}

#backToTopBtn:active {
  transform: scale(0.95);
}

/* 9. Visual Calculator Comparison Bars */
.cost-bar-track {
  width: 100%;
  height: 10px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.cost-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 400ms var(--ease-out);
  will-change: width;
}

/* 10. Savings Celebration Badge & Glow */
@keyframes celebrationPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { transform: scale(1.04); box-shadow: 0 0 20px 6px rgba(16, 185, 129, 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.celebration-active {
  animation: celebrationPulse 1.2s infinite var(--ease-in-out);
}

/* Confetti particles */
.confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 100000;
  border-radius: 2px;
  will-change: transform, opacity;
}

/* 11. Accordion FAQ Motion */
.faq-grid-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms var(--ease-out);
}

.faq-grid-wrapper.open {
  grid-template-rows: 1fr;
}

.faq-inner {
  overflow: hidden;
}

.faq-icon-rot {
  transition: transform 250ms var(--ease-out);
}

.faq-icon-rot.rotated {
  transform: rotate(45deg);
}

/* 12. Accessibility: Prefers-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;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
  .marquee-track {
    animation: none !important;
    transform: none !important;
  }
  .spotlight-card::before,
  .card-clean::before,
  .spotlight-card::after,
  .card-clean::after {
    display: none !important;
  }
  #progress-bar {
    display: none !important;
  }
}
