/* ============================================
   RCS Buyers Advocate - Modern Animations
   ============================================ */

/* -----------------------------------------
   CSS Variables for Animations
------------------------------------------ */
:root {
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --animation-fade-distance: 30px;
}

/* -----------------------------------------
   Keyframe Animations
------------------------------------------ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(var(--animation-fade-distance));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(calc(var(--animation-fade-distance) * -1));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(calc(var(--animation-fade-distance) * -1));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(var(--animation-fade-distance));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg);
  }
  to {
    opacity: 1;
    transform: rotate(0);
  }
}

@keyframes iconPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(31, 58, 95, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(31, 58, 95, 0);
  }
}

@keyframes underlineGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* -----------------------------------------
   Animation Utility Classes
------------------------------------------ */

.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(var(--animation-fade-distance));
}

.fade-in-up.animated {
  animation: fadeInUp 0.6s ease forwards;
}

.fade-in-down {
  opacity: 0;
  transform: translateY(calc(var(--animation-fade-distance) * -1));
}

.fade-in-down.animated {
  animation: fadeInDown 0.6s ease forwards;
}

.fade-in-left {
  opacity: 0;
  transform: translateX(calc(var(--animation-fade-distance) * -1));
}

.fade-in-left.animated {
  animation: fadeInLeft 0.6s ease forwards;
}

.fade-in-right {
  opacity: 0;
  transform: translateX(var(--animation-fade-distance));
}

.fade-in-right.animated {
  animation: fadeInRight 0.6s ease forwards;
}

.scale-in {
  opacity: 0;
  transform: scale(0.9);
}

.scale-in.animated {
  animation: scaleIn 0.5s ease forwards;
}

/* Animation Delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* -----------------------------------------
   Enhanced Button Animations
------------------------------------------ */

.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(31, 58, 95, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--navy) 0%, #2a4a73 100%);
}

.btn.ghost:hover {
  background: var(--navy);
  color: #fff;
}

/* -----------------------------------------
   Card Hover Effects
------------------------------------------ */

.card {
  transition: all var(--transition-normal);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Step Cards */
.step-card {
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.step-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(195, 168, 107, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

.step-card:hover::before {
  left: 100%;
}

.step-card:hover {
  border-color: var(--gold);
  border-style: solid;
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Result Cards */
.result {
  transition: all var(--transition-normal);
}

.result:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.result img {
  transition: transform 0.5s ease;
}

.result:hover img {
  transform: scale(1.05);
}

/* Quote Cards */
.quote {
  transition: all var(--transition-normal);
}

.quote:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

/* -----------------------------------------
   Badge Animations
------------------------------------------ */

.badge {
  transition: all var(--transition-fast);
  position: relative;
}

.badge:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  transform: translateY(-2px);
}

.badge::after {
  content: '→';
  margin-left: 0;
  opacity: 0;
  transition: all var(--transition-fast);
}

.badge:hover::after {
  margin-left: 6px;
  opacity: 1;
}

/* -----------------------------------------
   Hero Section Animations
------------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 50%,
    rgba(195, 168, 107, 0.08) 0%,
    transparent 50%
  );
  animation: float 8s ease-in-out infinite;
  pointer-events: none;
}

.hero .eyebrow {
  animation: fadeInDown 0.6s ease forwards;
  opacity: 0;
}

.hero h1 {
  animation: fadeInUp 0.6s ease 0.1s forwards;
  opacity: 0;
}

.hero .lead {
  animation: fadeInUp 0.6s ease 0.2s forwards;
  opacity: 0;
}

.hero .cta-row {
  animation: fadeInUp 0.6s ease 0.3s forwards;
  opacity: 0;
}

.hero .badges {
  animation: fadeInUp 0.6s ease 0.4s forwards;
  opacity: 0;
}

.hero .card {
  animation: scaleIn 0.8s ease 0.3s forwards;
  opacity: 0;
}

/* -----------------------------------------
   Icon Animations
------------------------------------------ */

.icon {
  transition: all var(--transition-normal);
}

.icon:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 20px rgba(31, 58, 95, 0.2);
}

/* -----------------------------------------
   Enhanced List Styling with Icons
------------------------------------------ */

ul.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.feature-list li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 14px;
  transition: all var(--transition-fast);
}

ul.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c3a86b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: all var(--transition-fast);
}

ul.feature-list li:hover {
  padding-left: 36px;
  color: var(--navy);
}

ul.feature-list li:hover::before {
  transform: scale(1.2);
}

/* Arrow list */
ul.arrow-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.arrow-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

ul.arrow-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--gold);
  font-weight: bold;
  transition: all var(--transition-fast);
}

ul.arrow-list li:hover {
  padding-left: 32px;
}

ul.arrow-list li:hover::before {
  transform: translateX(4px);
  color: var(--navy);
}

/* -----------------------------------------
   Section Reveal Animations
------------------------------------------ */

section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* -----------------------------------------
   Navigation Enhancements
------------------------------------------ */

.nav-links a {
  position: relative;
}

.nav-links a:not(.btn):not(.selected)::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-normal);
}

.nav-links a:not(.btn):not(.selected):hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Submenu animation enhancement */
.nav-item .submenu {
  transform-origin: top center;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.nav-item:hover .submenu {
  animation: fadeInDown 0.3s ease forwards;
}

/* -----------------------------------------
   CTA Band Animation
------------------------------------------ */

.cta-band {
  transition: all var(--transition-normal);
}

.cta-band:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(31, 58, 95, 0.25);
}

/* -----------------------------------------
   Image Hover Effects
------------------------------------------ */

img {
  transition: transform 0.5s ease, filter 0.5s ease;
}

.card img:hover {
  transform: scale(1.03);
}

/* -----------------------------------------
   Feature Box Animations
------------------------------------------ */

.featurebox {
  transition: all var(--transition-normal);
}

.featurebox:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  border-color: var(--gold);
}

/* -----------------------------------------
   Link Hover Effects
------------------------------------------ */

a {
  transition: color var(--transition-fast);
}

.darksection a {
  position: relative;
  color: var(--gold);
}

.darksection a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width var(--transition-normal);
}

.darksection a:hover::after {
  width: 100%;
}

/* -----------------------------------------
   Stagger Animation for Grid Items
------------------------------------------ */

.steps .step-card:nth-child(1) { animation-delay: 0.1s; }
.steps .step-card:nth-child(2) { animation-delay: 0.2s; }
.steps .step-card:nth-child(3) { animation-delay: 0.3s; }
.steps .step-card:nth-child(4) { animation-delay: 0.4s; }

.grid-3 .card:nth-child(1) { animation-delay: 0.1s; }
.grid-3 .card:nth-child(2) { animation-delay: 0.2s; }
.grid-3 .card:nth-child(3) { animation-delay: 0.3s; }

/* -----------------------------------------
   Loading States
------------------------------------------ */

.loading-shimmer {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* -----------------------------------------
   Focus States for Accessibility
------------------------------------------ */

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* -----------------------------------------
   Mobile Menu Animations
------------------------------------------ */

.mobile-menu {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu.open {
  animation: fadeIn 0.3s ease forwards;
}

.mobile-menu a {
  opacity: 0;
  transform: translateX(-20px);
  animation: fadeInLeft 0.3s ease forwards;
}

.mobile-menu.open a:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu.open a:nth-child(2) { animation-delay: 0.1s; }
.mobile-menu.open a:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu.open a:nth-child(4) { animation-delay: 0.2s; }
.mobile-menu.open a:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu.open a:nth-child(6) { animation-delay: 0.3s; }

/* -----------------------------------------
   Print Styles
------------------------------------------ */

@media print {
  .animate-on-scroll,
  .fade-in-up,
  .fade-in-down,
  .fade-in-left,
  .fade-in-right,
  .scale-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* -----------------------------------------
   Reduced Motion
------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
