/* ============================================================
   ANIMATIONS LAYER — investwithdreams.com
   Premium dark financial site animations.
   Performance: transform/opacity only, GPU-accelerated.
   ============================================================ */

/* ------------------------------------------------------------
   1. SCROLL REVEAL SYSTEM
   ------------------------------------------------------------ */

.reveal {
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Direction variants — starting positions */
.reveal-up {
  transform: translateY(40px);
}

.reveal-left {
  transform: translateX(-40px);
}

.reveal-right {
  transform: translateX(40px);
}

.reveal-scale {
  transform: scale(0.9);
}

/* Default reveal (no direction) gets a subtle upward drift */
.reveal:not(.reveal-up):not(.reveal-left):not(.reveal-right):not(.reveal-scale) {
  transform: translateY(20px);
}

/* Active state — element is in viewport */
.reveal.active {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Stagger delays */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }


/* ------------------------------------------------------------
   2. PARALLAX
   ------------------------------------------------------------ */

.parallax-container {
  position: relative;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  inset: -20% 0;
  width: 100%;
  height: 140%;
  will-change: transform;
  pointer-events: none;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}


/* ------------------------------------------------------------
   3. COUNTER ANIMATION
   ------------------------------------------------------------ */

.counter-animate {
  display: inline-block;
  will-change: transform;
  transition: transform 0.3s ease-out;
}

.counter-animate.complete {
  animation: counter-pulse 0.4s ease-out;
}

@keyframes counter-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}


/* ------------------------------------------------------------
   4. CHART ANIMATIONS
   ------------------------------------------------------------ */

.chart-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  will-change: stroke-dashoffset;
}

.chart-line.active {
  animation: chart-draw 2s ease-out forwards;
}

@keyframes chart-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.chart-tooltip {
  opacity: 0;
  transform: translateY(4px);
  will-change: opacity, transform;
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  pointer-events: none;
}

.chart-tooltip.visible,
*:hover > .chart-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}


/* ------------------------------------------------------------
   5. HERO ANIMATIONS
   ------------------------------------------------------------ */

.hero-title,
.hero-subtitle,
.hero-ctas,
.trust-badges {
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
  animation-fill-mode: forwards;
  animation-duration: 0.8s;
  animation-timing-function: ease-out;
}

.hero-title {
  animation-name: hero-fade-up;
  animation-delay: 0.5s;
}

.hero-subtitle {
  animation-name: hero-fade-up;
  animation-delay: 0.8s;
}

.hero-ctas {
  animation-name: hero-fade-up;
  animation-delay: 1.1s;
}

.trust-badges {
  animation-name: hero-fade-up;
  animation-delay: 1.4s;
}

@keyframes hero-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll indicator bounce */
.scroll-indicator {
  will-change: transform;
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(10px); }
}


/* ------------------------------------------------------------
   6. CARD HOVER MICRO-INTERACTIONS
   ------------------------------------------------------------ */

/* Gold shimmer sweep */
.card-hover {
  position: relative;
  overflow: hidden;
}

.card-hover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 30%,
    rgba(212, 175, 55, 0.08) 45%,
    rgba(212, 175, 55, 0.14) 50%,
    rgba(212, 175, 55, 0.08) 55%,
    transparent 70%,
    transparent 100%
  );
  transform: translateX(-100%);
  will-change: transform;
  transition: transform 0.6s ease-out;
  pointer-events: none;
  z-index: 1;
}

.card-hover:hover::before {
  transform: translateX(100%);
}

/* Card icon micro-interaction */
.card-hover .card-icon {
  will-change: transform;
  transition: transform 0.35s ease-out, color 0.35s ease-out;
}

.card-hover:hover .card-icon {
  transform: scale(1.12);
  color: #d4af37;
}


/* ------------------------------------------------------------
   7. NAV ANIMATION
   ------------------------------------------------------------ */

.navbar {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  will-change: background-color;
}

.navbar.scrolled {
  background-color: rgba(10, 10, 15, 0.95);
  box-shadow: 0 1px 0 rgba(212, 175, 55, 0.1);
}

/* Underline hover effect */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #d4af37, #f5d76e);
  will-change: width;
  transition: width 0.3s ease-out;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}


/* ------------------------------------------------------------
   8. PAGE LOADER / TRANSITION
   ------------------------------------------------------------ */

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0f;
  will-change: opacity;
  transition: opacity 0.5s ease-out;
}

.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.page-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 175, 55, 0.15);
  border-top-color: #d4af37;
  border-radius: 50%;
  will-change: transform;
  animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}


/* ------------------------------------------------------------
   9. FLOATING PARTICLES
   ------------------------------------------------------------ */

.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.25);
  will-change: transform, opacity;
  animation: particle-float linear infinite;
}

/* Variety through nth-child — different durations and start positions */
.particle:nth-child(odd)  { animation-duration: 18s; }
.particle:nth-child(even) { animation-duration: 24s; }

.particle:nth-child(3n)   { animation-delay: -6s;  opacity: 0.15; }
.particle:nth-child(3n+1) { animation-delay: -12s; opacity: 0.25; }
.particle:nth-child(3n+2) { animation-delay: -3s;  opacity: 0.2;  }

@keyframes particle-float {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(80vh) translateX(10px) scale(1);
  }
  90% {
    opacity: 1;
    transform: translateY(10vh) translateX(-15px) scale(1);
  }
  100% {
    transform: translateY(-5vh) translateX(5px) scale(0);
    opacity: 0;
  }
}


/* ------------------------------------------------------------
   10. GLOW EFFECTS
   ------------------------------------------------------------ */

.glow-gold {
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.15),
                0 0 20px rgba(212, 175, 55, 0.06);
  }
  50% {
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.3),
                0 0 40px rgba(212, 175, 55, 0.12);
  }
}

/* Text glow variant */
.glow-gold-text {
  animation: text-glow-pulse 3s ease-in-out infinite;
}

@keyframes text-glow-pulse {
  0%, 100% { text-shadow: 0 0 8px rgba(212, 175, 55, 0.2); }
  50%      { text-shadow: 0 0 18px rgba(212, 175, 55, 0.4); }
}



/* ------------------------------------------------------------
   12. BUTTON MICRO-INTERACTIONS
   ------------------------------------------------------------ */

.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.25) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.5s ease-out, opacity 0.4s ease-out;
  pointer-events: none;
}

.btn.ripple::after {
  opacity: 1;
  transform: scale(2.5);
}

/* Magnetic hover for primary buttons */
.btn-primary {
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out, background 0.25s ease-out;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(201, 168, 76, 0.3), 0 0 60px rgba(201, 168, 76, 0.08);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.1s;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}


/* ------------------------------------------------------------
   13. CARD LIFT & TILT (3D)
   ------------------------------------------------------------ */

.card, .stat-card, .service-feature-card, .diff-item, .blog-card {
  transition: transform 0.35s ease-out, box-shadow 0.35s ease-out, border-color 0.35s ease-out;
}

.card:hover, .service-feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(201, 168, 76, 0.1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  border-color: rgba(201, 168, 76, 0.25);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
  border-color: rgba(201, 168, 76, 0.2);
}

.diff-item:hover {
  transform: translateX(8px);
}

.diff-item:hover .diff-number {
  color: #c9a84c;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
  transition: color 0.3s, text-shadow 0.3s;
}


/* ------------------------------------------------------------
   14. SECTION BACKGROUND IMAGE SYSTEM
   ------------------------------------------------------------ */

.section-bg {
  position: relative;
  overflow: hidden;
}

.section-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.06;
  z-index: 0;
  pointer-events: none;
  filter: grayscale(40%);
}

.section-bg > * {
  position: relative;
  z-index: 1;
}

/* Named background variants */
.section-bg-towers::before { background-image: url('../images/bg-towers.jpg'); }
.section-bg-charts::before { background-image: url('../images/bg-charts.jpg'); }
.section-bg-skyline::before { background-image: url('../images/bg-skyline.jpg'); }
.section-bg-office::before { background-image: url('../images/bg-office.jpg'); }
.section-bg-data::before { background-image: url('../images/bg-data.jpg'); }
.section-bg-abstract::before { background-image: url('../images/bg-abstract.jpg'); }
.section-bg-architecture::before { background-image: url('../images/bg-architecture.jpg'); }

/* Stronger opacity for dark sections */
.section-dark.section-bg::before {
  opacity: 0.1;
}

/* Hero background enhancement */
.page-hero.section-bg::before {
  opacity: 0.12;
  filter: grayscale(20%);
}


/* ------------------------------------------------------------
   15. SMOOTH SCROLL & LINK TRANSITIONS
   ------------------------------------------------------------ */

html {
  scroll-behavior: smooth;
}

a {
  transition: color 0.25s ease-out;
}

/* Gold underline grow effect for text links */
.content-link {
  position: relative;
  color: #c9a84c;
  text-decoration: none;
}

.content-link::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: #c9a84c;
  transition: width 0.3s ease-out;
}

.content-link:hover::after {
  width: 100%;
}


/* ------------------------------------------------------------
   16. ICON SPIN ON HOVER
   ------------------------------------------------------------ */

.icon-hover-spin {
  transition: transform 0.4s ease-out;
}

.icon-hover-spin:hover {
  transform: rotate(15deg) scale(1.1);
}

/* Trust badge bounce */
.trust-badge {
  transition: transform 0.3s ease-out;
}

.trust-badge:hover {
  transform: translateY(-3px);
}


/* ------------------------------------------------------------
   17. FAQ ACCORDION ANIMATION
   ------------------------------------------------------------ */

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
  opacity: 0;
  padding: 0 1.25rem;
}

.faq-card.open .faq-answer {
  max-height: 300px;
  opacity: 1;
  padding: 0 1.25rem 1.25rem;
}

.faq-toggle-icon {
  transition: transform 0.3s ease-out;
}

.faq-card.open .faq-toggle-icon {
  transform: rotate(45deg);
}


/* ------------------------------------------------------------
   18. TOOLTIP SYSTEM
   ------------------------------------------------------------ */

[data-tooltip] {
  position: relative;
  cursor: pointer;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1e293b;
  color: #f0f2f5;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  border: 1px solid rgba(201, 168, 76, 0.15);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ------------------------------------------------------------
   19. NUMBER COUNTER ENTRANCE
   ------------------------------------------------------------ */

@keyframes count-up-entrance {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  60% {
    opacity: 1;
    transform: translateY(-3px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stat-number {
  will-change: transform;
}

.stat-number.animated {
  animation: count-up-entrance 0.6s ease-out forwards;
}


/* ------------------------------------------------------------
   20. SCROLL PROGRESS BAR
   ------------------------------------------------------------ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #c9a84c, #f5d76e);
  z-index: 10001;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}


/* ------------------------------------------------------------
   21. IMAGE REVEAL ON SCROLL
   ------------------------------------------------------------ */

.img-reveal {
  overflow: hidden;
  position: relative;
}

.img-reveal img {
  transition: transform 0.8s ease-out, filter 0.8s ease-out;
  transform: scale(1.05);
  filter: brightness(0.7);
}

.img-reveal.active img {
  transform: scale(1);
  filter: brightness(1);
}


/* ------------------------------------------------------------
   22. BREADCRUMB ANIMATION
   ------------------------------------------------------------ */

.breadcrumb a,
.breadcrumb span {
  opacity: 0;
  transform: translateX(-8px);
  animation: breadcrumb-in 0.4s ease-out forwards;
}

.breadcrumb a:nth-child(1) { animation-delay: 0.1s; }
.breadcrumb .breadcrumb-sep:nth-of-type(1) { animation-delay: 0.15s; }
.breadcrumb a:nth-child(3),
.breadcrumb span:nth-child(3) { animation-delay: 0.2s; }
.breadcrumb .breadcrumb-sep:nth-of-type(2) { animation-delay: 0.25s; }
.breadcrumb .breadcrumb-current { animation-delay: 0.3s; }

@keyframes breadcrumb-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ------------------------------------------------------------
   11. ACCESSIBILITY — prefers-reduced-motion
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .parallax-bg {
    will-change: auto;
  }

  .particle {
    display: none;
  }
}
