/* ============================================================
   ANIMATIONS.CSS — GR Plumbing
   Keyframes · Scroll-triggered · Hover · Micro-interactions
   ============================================================ */

/* ─── KEYFRAMES ──────────────────────────────────────────── */

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleInBounce {
  0%   { opacity: 0; transform: scale(0.5); }
  70%  { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

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

@keyframes kenBurns {
  0%   { transform: scale(1.0) translate(0, 0); }
  50%  { transform: scale(1.08) translate(-1%, -1%); }
  100% { transform: scale(1.0) translate(0, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-18px) rotate(3deg); }
  66%       { transform: translateY(-8px) rotate(-2deg); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-24px); }
}

@keyframes pulsePing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.85; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,26,26,0); }
  50%       { box-shadow: 0 0 0 12px rgba(200,26,26,0.18); }
}

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

@keyframes goldLineGrow {
  from { width: 0; }
  to   { width: 56px; }
}

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

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

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

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

@keyframes bounceIn {
  0%   { transform: translateY(24px); opacity: 0; }
  60%  { transform: translateY(-6px); opacity: 1; }
  80%  { transform: translateY(3px); }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes stickyPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes particleFloat {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.5; }
  50%  { transform: translateY(-80px) translateX(20px) scale(1.2); opacity: 0.8; }
  100% { transform: translateY(-160px) translateX(-10px) scale(0.6); opacity: 0; }
}

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

/* ─── HERO BACKGROUND ────────────────────────────────────── */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform-origin: center center;
  animation: kenBurns 18s ease-in-out infinite;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(0,0,0,0.88) 0%,
    rgba(10,10,10,0.70) 50%,
    rgba(0,0,0,0.82) 100%
  );
}

/* ─── FLOATING PARTICLES (hero) ──────────────────────────── */
.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,26,26,0.6) 0%, transparent 70%);
  animation: particleFloat linear infinite;
}

.particle:nth-child(1) { width: 8px; height: 8px;  left: 15%; bottom: 10%; animation-duration: 6s; animation-delay: 0s; }
.particle:nth-child(2) { width: 5px; height: 5px;  left: 35%; bottom: 15%; animation-duration: 8s; animation-delay: 1.5s; }
.particle:nth-child(3) { width: 10px; height: 10px; left: 55%; bottom: 8%;  animation-duration: 7s; animation-delay: 0.8s; }
.particle:nth-child(4) { width: 6px; height: 6px;  left: 75%; bottom: 20%; animation-duration: 9s; animation-delay: 2s; }
.particle:nth-child(5) { width: 4px; height: 4px;  left: 88%; bottom: 12%; animation-duration: 5.5s; animation-delay: 0.4s; }

/* Floating icon */
.floating-icon {
  position: absolute;
  right: 8%;
  top: 25%;
  width: 80px;
  opacity: 0.12;
  animation: floatSlow 6s ease-in-out infinite;
  pointer-events: none;
}

/* ─── SCROLL-TRIGGER CLASSES ─────────────────────────────── */
/* Initial hidden state */
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1),
              transform 0.7s cubic-bezier(0.4,0,0.2,1);
}

.reveal       { transform: translateY(36px); }
.reveal-left  { transform: translateX(-50px); }
.reveal-right { transform: translateX(50px); }
.reveal-scale { transform: scale(0.85); }

/* Visible state (JS adds this) */
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible {
  opacity: 1;
  transform: none;
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.4,0,0.2,1),
              transform 0.6s cubic-bezier(0.4,0,0.2,1);
}

.stagger.visible > *:nth-child(1)  { transition-delay: 0.05s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(2)  { transition-delay: 0.12s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(3)  { transition-delay: 0.19s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(4)  { transition-delay: 0.26s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(5)  { transition-delay: 0.33s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(6)  { transition-delay: 0.40s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(7)  { transition-delay: 0.47s; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(8)  { transition-delay: 0.54s; opacity: 1; transform: none; }

/* ─── HERO TEXT ANIMATIONS ───────────────────────────────── */
.hero-eyebrow  { animation: fadeInDown 0.7s ease-out 0.2s both; }
.hero-title    { animation: fadeInUp   0.8s ease-out 0.35s both; }
.hero-subtitle { animation: fadeInUp   0.8s ease-out 0.50s both; }
.hero-body     { animation: fadeInUp   0.7s ease-out 0.62s both; }
.hero-btns     { animation: scaleIn    0.6s ease-out 0.75s both; }
.hero-trust    { animation: fadeInUp   0.6s ease-out 0.90s both; }

/* ─── GOLD LINE ANIMATION ────────────────────────────────── */
.gold-line.animate {
  width: 0;
  animation: goldLineGrow 0.6s ease-out 0.2s forwards;
}

/* ─── COUNTER ANIMATION ──────────────────────────────────── */
.stat-number.counting {
  animation: countUp 0.3s ease;
}

/* ─── SHIMMER TEXT ───────────────────────────────────────── */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent-light) 40%,
    var(--accent) 60%,
    var(--accent-light) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}

/* ─── STICKY BUTTON ENTRANCE ─────────────────────────────── */
.sticky-mobile-btns.entered {
  animation: bounceIn 0.6s ease-out both;
}

.sticky-mobile-btns a.pulse {
  animation: stickyPulse 1.2s ease-in-out 2;
}

/* ─── NAV SCROLL INDICATOR ───────────────────────────────── */
.nav-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--gradient-gold);
  z-index: 1001;
  width: 0%;
  transition: width 0.1s linear;
}

/* ─── PAGE LOAD FADE IN ──────────────────────────────────── */
.page-fade-in {
  animation: fadeInUp 0.5s ease-out 0.1s both;
}

/* ─── SCROLL CUE (hero bottom) ───────────────────────────── */
.scroll-cue {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: fadeInUp 0.6s ease-out 1.2s both;
  cursor: pointer;
}

.scroll-cue-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.5));
  animation: float 2s ease-in-out infinite;
}

.scroll-cue span {
  font-family: var(--font-accent);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

/* ─── CARD HOVER GLOW ────────────────────────────────────── */
.service-card:hover {
  animation: none; /* override any global, keep transform */
}

/* ─── BUTTON PULSE (call to action) ─────────────────────── */
@keyframes btnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(200,26,26,0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(200,26,26,0); }
  100% { box-shadow: 0 0 0 0 rgba(200,26,26,0); }
}

.btn-pulse-gold { animation: btnPulse 2s ease-out infinite; }

@keyframes btnPulseRed {
  0%   { box-shadow: 0 0 0 0 rgba(185,28,28,0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(185,28,28,0); }
  100% { box-shadow: 0 0 0 0 rgba(185,28,28,0); }
}

.btn-pulse-red { animation: btnPulseRed 2s ease-out infinite; }

/* ─── SECTION DIAGONAL ───────────────────────────────────── */
.diagonal-section {
  clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
  margin: -3% 0;
  padding-top: calc(var(--section-py) + 5%);
  padding-bottom: calc(var(--section-py) + 5%);
}

@media (max-width: 768px) {
  .diagonal-section {
    clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 100%);
    margin: -2% 0;
  }
}

/* ─── ANIMATED GOLD BORDER ───────────────────────────────── */
@keyframes borderRun {
  0%   { background-position: 0% 0%; }
  100% { background-position: 400% 0%; }
}

.animated-border {
  position: relative;
}

.animated-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(90deg,
    var(--accent), var(--accent-light), var(--primary), var(--accent));
  background-size: 400% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderRun 4s linear infinite;
}

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

  .hero-bg img { animation: none; }
  .particle { display: none; }
  .floating-icon { display: none; }
  .ticker-track { animation: none; }
}
