/* ==========================================================================
   Di Arche Construction — Animation Keyframes & Utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   CORE KEYFRAMES
   -------------------------------------------------------------------------- */

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

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

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

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

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

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

@keyframes borderGrow {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

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

@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

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


/* --------------------------------------------------------------------------
   ADDITIONAL KEYFRAMES
   -------------------------------------------------------------------------- */

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

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

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

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes underlineGrow {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes widthExpand {
  from {
    max-width: 0;
    opacity: 0;
  }
  to {
    max-width: 500px;
    opacity: 1;
  }
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(184, 115, 51, 0.25);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(184, 115, 51, 0);
  }
}


/* --------------------------------------------------------------------------
   HERO ENTRANCE — STAGGER CLASSES
   -------------------------------------------------------------------------- */

.hero-animate-1,
.hero-animate-2,
.hero-animate-3,
.hero-animate-4 {
  opacity: 0;
  animation-fill-mode: forwards;
  animation-duration: 0.8s;
  animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-animate-1 {
  animation-name: slideUp;
  animation-delay: 0.2s;
}

.hero-animate-2 {
  animation-name: slideUp;
  animation-delay: 0.4s;
}

.hero-animate-3 {
  animation-name: slideUp;
  animation-delay: 0.6s;
}

.hero-animate-4 {
  animation-name: slideUp;
  animation-delay: 0.8s;
}


/* --------------------------------------------------------------------------
   SCROLL-TRIGGERED ANIMATION CLASSES
   Use with Intersection Observer (JS adds .animated when element is in view)
   -------------------------------------------------------------------------- */

/* Base: elements are hidden until triggered */
[data-animate] {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].animated {
  opacity: 1;
}

/* Slide Up */
[data-animate="slide-up"] {
  transform: translateY(40px);
}

[data-animate="slide-up"].animated {
  transform: translateY(0);
}

/* Slide Down */
[data-animate="slide-down"] {
  transform: translateY(-30px);
}

[data-animate="slide-down"].animated {
  transform: translateY(0);
}

/* Slide Right */
[data-animate="slide-right"] {
  transform: translateX(40px);
}

[data-animate="slide-right"].animated {
  transform: translateX(0);
}

/* Slide Left */
[data-animate="slide-left"] {
  transform: translateX(-40px);
}

[data-animate="slide-left"].animated {
  transform: translateX(0);
}

/* Fade In */
[data-animate="fade-in"].animated {
  opacity: 1;
}

/* Scale In */
[data-animate="scale-in"] {
  transform: scale(0.92);
}

[data-animate="scale-in"].animated {
  transform: scale(1);
}

/* Zoom In */
[data-animate="zoom-in"] {
  transform: scale(0.8);
}

[data-animate="zoom-in"].animated {
  transform: scale(1);
}

/* Rotate In */
[data-animate="rotate-in"] {
  transform: rotate(-5deg) scale(0.95);
}

[data-animate="rotate-in"].animated {
  transform: rotate(0) scale(1);
}

/* Border Grow */
[data-animate="border-grow"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--color-accent, #B87333);
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-animate="border-grow"].animated::after {
  width: 60px;
}


/* --------------------------------------------------------------------------
   STAGGER DELAY UTILITY CLASSES
   Apply these alongside data-animate for sequential element reveals
   -------------------------------------------------------------------------- */

[data-delay="1"] { transition-delay: 0.1s !important; }
[data-delay="2"] { transition-delay: 0.2s !important; }
[data-delay="3"] { transition-delay: 0.3s !important; }
[data-delay="4"] { transition-delay: 0.4s !important; }
[data-delay="5"] { transition-delay: 0.5s !important; }
[data-delay="6"] { transition-delay: 0.6s !important; }
[data-delay="7"] { transition-delay: 0.7s !important; }
[data-delay="8"] { transition-delay: 0.8s !important; }


/* --------------------------------------------------------------------------
   AOS-COMPATIBLE CUSTOM ANIMATIONS
   These mirror the AOS library naming so they work as drop-in replacements.
   Use with: data-aos="custom-slide-up" etc.
   -------------------------------------------------------------------------- */

[data-aos="custom-slide-up"] {
  opacity: 0;
  transform: translateY(40px);
  transition-property: opacity, transform;
}

[data-aos="custom-slide-up"].aos-animate {
  opacity: 1;
  transform: translateY(0);
}

[data-aos="custom-slide-left"] {
  opacity: 0;
  transform: translateX(-40px);
  transition-property: opacity, transform;
}

[data-aos="custom-slide-left"].aos-animate {
  opacity: 1;
  transform: translateX(0);
}

[data-aos="custom-slide-right"] {
  opacity: 0;
  transform: translateX(40px);
  transition-property: opacity, transform;
}

[data-aos="custom-slide-right"].aos-animate {
  opacity: 1;
  transform: translateX(0);
}

[data-aos="custom-scale"] {
  opacity: 0;
  transform: scale(0.9);
  transition-property: opacity, transform;
}

[data-aos="custom-scale"].aos-animate {
  opacity: 1;
  transform: scale(1);
}

[data-aos="custom-fade-up-stagger"] {
  opacity: 0;
  transform: translateY(30px);
  transition-property: opacity, transform;
}

[data-aos="custom-fade-up-stagger"].aos-animate {
  opacity: 1;
  transform: translateY(0);
}


/* --------------------------------------------------------------------------
   COMPONENT-SPECIFIC ANIMATION CLASSES
   -------------------------------------------------------------------------- */

/* Stats counter animation */
.stat-animate {
  animation: countUp 0.6s ease forwards;
}

.stat-animate:nth-child(1) { animation-delay: 0.1s; }
.stat-animate:nth-child(2) { animation-delay: 0.2s; }
.stat-animate:nth-child(3) { animation-delay: 0.3s; }
.stat-animate:nth-child(4) { animation-delay: 0.4s; }

/* Card stagger */
.card-stagger > *:nth-child(1) { transition-delay: 0s; }
.card-stagger > *:nth-child(2) { transition-delay: 0.1s; }
.card-stagger > *:nth-child(3) { transition-delay: 0.2s; }
.card-stagger > *:nth-child(4) { transition-delay: 0.3s; }
.card-stagger > *:nth-child(5) { transition-delay: 0.4s; }
.card-stagger > *:nth-child(6) { transition-delay: 0.5s; }

/* Service card icon hover bounce */
.service-card:hover .service-card__icon {
  animation: float 1.5s ease infinite;
}

/* Gallery item reveal */
.gallery-item[data-animate] {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* CTA pulse on the primary button */
.btn-primary.btn--pulse {
  animation: subtlePulse 2s ease infinite;
}

/* Loading skeleton shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-light-gray, #F0EEEB) 25%,
    #e8e6e2 50%,
    var(--color-light-gray, #F0EEEB) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm, 4px);
}

.skeleton--text {
  height: 16px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton--heading {
  height: 28px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton--image {
  width: 100%;
  aspect-ratio: 16 / 10;
}

/* Scroll indicator bounce (hero) */
.hero__scroll-icon::before {
  animation: bounce 2s ease-in-out infinite;
}

/* Floating decorative elements */
.float-animation {
  animation: float 3s ease-in-out infinite;
}

.float-animation--slow {
  animation: float 5s ease-in-out infinite;
}


/* --------------------------------------------------------------------------
   TRANSITION UTILITIES
   -------------------------------------------------------------------------- */

.transition-none { transition: none !important; }
.transition-fast { transition: all 0.2s ease; }
.transition-base { transition: all 0.3s ease; }
.transition-slow { transition: all 0.6s ease; }
.transition-smooth { transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }


/* --------------------------------------------------------------------------
   REDUCED MOTION — ACCESSIBILITY
   Respects user's OS-level preference to minimize motion.
   -------------------------------------------------------------------------- */

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

  .hero-animate-1,
  .hero-animate-2,
  .hero-animate-3,
  .hero-animate-4 {
    opacity: 1;
    animation: none;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }

  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero__scroll-icon::before {
    animation: none;
  }

  .spinner {
    animation: spin 1.5s linear infinite;
  }

  .skeleton {
    animation: none;
    background: var(--color-light-gray, #F0EEEB);
  }
}
