/* HermesBro — shared motion system (respects prefers-reduced-motion) */

:root {
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --motion-duration: 0.7s;
}

/* Ambient background drift */
body::before {
  animation: grid-drift 24s linear infinite;
}

@keyframes grid-drift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 48px 48px, 48px 48px; }
}

/* Hero glow pulse */
.hero {
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(63, 185, 80, 0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: hero-glow 6s ease-in-out infinite;
}

@keyframes hero-glow {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.08); }
}

/* Hero staggered entrance */
.hero-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  animation: hero-in var(--motion-duration) var(--ease-out-expo) forwards;
}

.hero-stagger > *:nth-child(1) { animation-delay: 0.08s; }
.hero-stagger > *:nth-child(2) { animation-delay: 0.18s; }
.hero-stagger > *:nth-child(3) { animation-delay: 0.28s; }
.hero-stagger > *:nth-child(4) { animation-delay: 0.38s; }
.hero-stagger > *:nth-child(5) { animation-delay: 0.48s; }

@keyframes hero-in {
  to { opacity: 1; transform: none; }
}

.hero-visual {
  opacity: 0;
  transform: scale(0.9);
  animation: hero-visual-in 1s var(--ease-out-expo) 0.35s forwards;
}

@keyframes hero-visual-in {
  to { opacity: 1; transform: scale(1); }
}

/* Scroll reveal */
.reveal,
.reveal-scale,
.reveal-left,
.reveal-right {
  opacity: 0;
  transition:
    opacity var(--motion-duration) var(--ease-out-expo),
    transform var(--motion-duration) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal { transform: translateY(22px); }
.reveal-scale { transform: scale(0.94) translateY(12px); }
.reveal-left { transform: translateX(-28px); }
.reveal-right { transform: translateX(28px); }

.reveal.visible,
.reveal-scale.visible,
.reveal-left.visible,
.reveal-right.visible {
  opacity: 1;
  transform: none;
}

/* Section headers */
.section-header.reveal .section-label,
.section-header.reveal .section-title,
.section-header.reveal .section-sub {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.section-header.visible .section-label { opacity: 1; transform: none; transition-delay: 0ms; }
.section-header.visible .section-title { opacity: 1; transform: none; transition-delay: 80ms; }
.section-header.visible .section-sub { opacity: 1; transform: none; transition-delay: 160ms; }

/* Nav scroll state */
nav.nav-scrolled {
  background: rgba(8, 11, 16, 0.97) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border-bottom-color: rgba(63, 185, 80, 0.15) !important;
}

/* Orbit ring slow rotation */
.orbit-ring {
  animation: ring-pulse 4s ease-in-out infinite, ring-spin 90s linear infinite;
}

@keyframes ring-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Eco flow arrows */
.eco-flow .arrow {
  display: inline-block;
  animation: arrow-flow 1.8s ease-in-out infinite;
}

.eco-flow .arrow:nth-of-type(2) { animation-delay: 0.4s; }

@keyframes arrow-flow {
  0%, 100% { opacity: 0.4; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(3px); }
}

/* Eco panel content transition */
.eco-panel {
  transition: border-color 0.3s, box-shadow 0.3s;
}

.eco-panel.panel-animate > * {
  animation: panel-in 0.45s var(--ease-out-expo) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.eco-node {
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.eco-node:hover {
  transform: translateY(-3px);
}

.eco-node.active {
  animation: node-pop 0.35s var(--ease-spring);
}

@keyframes node-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Card hover lift with glow */
.agent-card,
.repo-card,
.hub-tile,
.step {
  transition:
    border-color 0.25s,
    transform 0.3s var(--ease-out-expo),
    box-shadow 0.3s var(--ease-out-expo);
}

.agent-card:hover,
.repo-card:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 24px rgba(63, 185, 80, 0.08);
}

/* Button shine */
.btn-green,
.btn.btn-green {
  position: relative;
  overflow: hidden;
}

.btn-green::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  animation: btn-shine 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btn-shine {
  0%, 70%, 100% { left: -100%; }
  85% { left: 150%; }
}

/* Stat counter glow on update */
.stat .num.counting {
  animation: stat-flash 0.6s ease;
}

@keyframes stat-flash {
  0% { color: var(--green); text-shadow: 0 0 12px rgba(63, 185, 80, 0.5); }
  100% { color: var(--text); text-shadow: none; }
}

/* FAQ smoother accordion */
.faq-a {
  transition: max-height 0.4s var(--ease-out-expo), padding 0.4s var(--ease-out-expo), opacity 0.3s;
  opacity: 0;
}

.faq-a.open {
  opacity: 1;
}

/* CTA section */
.fcta {
  position: relative;
  overflow: hidden;
}

.fcta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 100%, rgba(63, 185, 80, 0.06), transparent);
  pointer-events: none;
  animation: cta-pulse 5s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Filter bar button ripple */
.filter-bar button {
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s var(--ease-spring);
}

.filter-bar button.active {
  transform: scale(1.04);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal-scale,
  .reveal-left,
  .reveal-right,
  .section-header.reveal .section-label,
  .section-header.reveal .section-title,
  .section-header.reveal .section-sub {
    opacity: 1;
    transform: none;
  }

  body::before,
  .hero::after,
  .orbit-ring,
  .eco-flow .arrow,
  .btn-green::after,
  .fcta::before {
    animation: none !important;
  }
}