/* ==========================================================================
   New Home Realty - Enhanced Animations
   ========================================================================== */

/* ==========================================================================
   1. CSS Variables for Animation Timing
   ========================================================================== */
:root {
  --animation-fast: 0.3s;
  --animation-normal: 0.5s;
  --animation-slow: 0.8s;
  --animation-very-slow: 1.2s;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==========================================================================
   2. Keyframe Animations
   ========================================================================== */

/* Fade In Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -40px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translate3d(-40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translate3d(40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleUp {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

/* Floating Animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* Shimmer/Loading Animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Progress Bar Animation */
@keyframes progressBar {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Slide Animations */
@keyframes slideInLeft {
  from {
    transform: translate3d(-100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInRight {
  from {
    transform: translate3d(100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

/* Flip Animation */
@keyframes flipIn {
  from {
    transform: perspective(400px) rotateY(-90deg);
    opacity: 0;
  }
  to {
    transform: perspective(400px) rotateY(0deg);
    opacity: 1;
  }
}

/* Zoom Animation for Images */
@keyframes zoomIn {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.1);
  }
}

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

/* Underline Expand Animation */
@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Rotate Animation */
@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Bounce Animation */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* ==========================================================================
   3. Property Card Animations & Hover Effects
   ========================================================================== */

/* Property Card Base Animation */
.property-card,
.home-feature-listing-content {
  transition: all var(--animation-normal) var(--ease-smooth);
  will-change: transform, box-shadow;
}

.property-card:hover,
.home-feature-listing-content:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(9, 38, 29, 0.15);
}

/* Property Image Zoom Effect */
.property-image img,
.reveal-image {
  transition: transform var(--animation-slow) var(--ease-smooth);
  will-change: transform;
}

.property-card:hover .property-image img,
.property-card:hover .reveal-image,
.home-feature-listing-content:hover .reveal-image {
  transform: scale(1.1);
}

/* Property Card Details Slide Up */
.property-card-body {
  transition: transform var(--animation-normal) var(--ease-smooth);
}

.property-card:hover .property-card-body {
  transform: translateY(-5px);
}

/* Property Price Animation */
.property-price {
  transition: all var(--animation-fast) var(--ease-smooth);
}

.property-card:hover .property-price {
  color: var(--color-secondary);
  transform: scale(1.05);
}

/* ==========================================================================
   4. Button Animations & Hover Effects
   ========================================================================== */

.button-primary-outline,
.button-secondary-outline,
.button-primary,
.button-secondary {
  position: relative;
  overflow: hidden;
  transition: all var(--animation-normal) var(--ease-smooth);
}

/* Button Hover Lift Effect */
.button-primary-outline:hover,
.button-secondary-outline:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(9, 38, 29, 0.2);
}

/* Button Icon Animation */
.button-icon {
  transition: transform var(--animation-normal) var(--ease-bounce);
}

.button-primary-outline:hover .button-icon,
.button-secondary-outline:hover .button-icon {
  transform: translateX(5px);
}

/* Button Ripple Effect */
.button-primary-outline::before,
.button-secondary-outline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width var(--animation-normal) var(--ease-smooth),
              height var(--animation-normal) var(--ease-smooth);
}

.button-primary-outline:hover::before,
.button-secondary-outline:hover::before {
  width: 300px;
  height: 300px;
}

/* ==========================================================================
   5. Navigation Animations
   ========================================================================== */

/* Navbar Link Underline Animation */
.navbar-link {
  position: relative;
  transition: color var(--animation-fast) var(--ease-smooth);
}

.navbar-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-secondary);
  transition: width var(--animation-normal) var(--ease-smooth);
}

.navbar-link:hover::after,
.navbar-link.w--current::after {
  width: 100%;
}

.navbar-link:hover {
  color: var(--color-secondary);
}

/* Dropdown Animation */
.navbar-dropdown-list,
.property-search-dropdown-list {
  animation: fadeInDown var(--animation-fast) var(--ease-smooth);
}

/* ==========================================================================
   6. Image Loading & Reveal Animations
   ========================================================================== */

/* Image Loading Shimmer */
.image-loading {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e0e0e0 50%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Image Reveal Effect */
.reveal-image-trigger {
  position: relative;
  overflow: hidden;
}

.reveal-image-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  transform-origin: left;
  z-index: 2;
}

.animate-reveal .reveal-image-cover {
  animation: slideOut var(--animation-slow) var(--ease-smooth) forwards;
}

@keyframes slideOut {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ==========================================================================
   7. Form & Input Animations
   ========================================================================== */

.search-input,
.w-input {
  transition: all var(--animation-normal) var(--ease-smooth);
}

.search-input:focus,
.w-input:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(9, 38, 29, 0.1);
}

/* Form Validation Animation */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-10px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }
}

.input-error {
  animation: shake 0.5s;
  border-color: #ff4444 !important;
}

/* ==========================================================================
   8. Icon & SVG Animations
   ========================================================================== */

.home-about-icon-image,
.icon-wrapper {
  transition: transform var(--animation-normal) var(--ease-bounce);
}

.home-about-icon-item:hover .home-about-icon-image {
  transform: translateY(-5px) scale(1.05);
}

.icon-wrapper:hover {
  transform: rotate(45deg) scale(1.1);
}

/* Icon Pulse Effect */
.icon-pulse {
  animation: pulse 2s infinite;
}

/* ==========================================================================
   9. Testimonial Slider Animations
   ========================================================================== */

.home-testimony-card {
  transition: transform var(--animation-normal) var(--ease-smooth);
}

.home-testimony-slider-item.w-slide-active .home-testimony-card {
  animation: scaleIn var(--animation-slow) var(--ease-smooth);
}

/* Slider Arrow Animation */
.home-testimony-slider-arrow {
  transition: all var(--animation-fast) var(--ease-smooth);
}

.home-testimony-slider-arrow:hover {
  transform: scale(1.1);
  background: var(--color-secondary);
}

/* ==========================================================================
   10. Modal Animations
   ========================================================================== */

.modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--animation-normal) var(--ease-smooth);
}

.modal.show {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 16px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.8) translateY(50px);
  opacity: 0;
  transition: all var(--animation-normal) var(--ease-bounce);
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 32px;
  margin-bottom: 16px;
  color: var(--color-primary);
}

.modal-price {
  font-size: 28px;
  font-weight: 600;
  color: var(--color-secondary);
  margin-bottom: 16px;
}

.modal-text {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--color-grey);
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 36px;
  cursor: pointer;
  color: var(--color-grey);
  transition: all var(--animation-fast) var(--ease-smooth);
}

.close-button:hover {
  color: var(--color-secondary);
  transform: rotate(90deg) scale(1.2);
}

/* ==========================================================================
   11. Scroll Progress Bar
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--color-secondary),
    var(--color-primary)
  );
  z-index: 9998;
  transition: width 0.1s ease-out;
}

/* ==========================================================================
   12. Page Transition Overlay
   ========================================================================== */

.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  z-index: 10000;
  transform: translateY(-100%);
  pointer-events: none;
}

/* ==========================================================================
   13. Stagger Animation Classes (for GSAP)
   ========================================================================== */

.stagger-item {
  opacity: 0;
  transform: translateY(30px);
}

.stagger-item.animated {
  animation: fadeInUp var(--animation-normal) var(--ease-smooth) forwards;
}

/* Delay classes for stagger effects */
.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; }

/* ==========================================================================
   14. Counter Animation Classes
   ========================================================================== */

.counter {
  display: inline-block;
  animation: countUp var(--animation-normal) var(--ease-smooth);
}

/* ==========================================================================
   15. Parallax Elements
   ========================================================================== */

.parallax-element {
  will-change: transform;
  transition: transform 0.1s ease-out;
}

/* ==========================================================================
   16. FAQ Accordion Animations
   ========================================================================== */

.faq-accordion {
  transition: all var(--animation-normal) var(--ease-smooth);
}

.faq-accordion:hover {
  background: rgba(255, 188, 20, 0.05);
}

.faq-icon-bar {
  transition: all var(--animation-fast) var(--ease-smooth);
}

.faq-accordion.w--open .faq-icon-bar._2 {
  transform: rotate(90deg);
  opacity: 0;
}

.accordion-pane {
  animation: fadeInDown var(--animation-normal) var(--ease-smooth);
}

/* ==========================================================================
   17. Breadcrumb Animations
   ========================================================================== */

.breadcrumbs-link {
  position: relative;
  transition: color var(--animation-fast) var(--ease-smooth);
}

.breadcrumbs-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-secondary);
  transition: width var(--animation-normal) var(--ease-smooth);
}

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

/* ==========================================================================
   18. Footer Social Icons
   ========================================================================== */

.footer-social-icon-item {
  transition: all var(--animation-normal) var(--ease-bounce);
}

.footer-social-icon-item:hover {
  transform: translateY(-5px) scale(1.1);
  background: var(--color-secondary);
}

/* ==========================================================================
   19. Global CTA Section
   ========================================================================== */

.global-cta .image-box {
  transition: transform var(--animation-slow) var(--ease-smooth);
}

.global-cta:hover .image-box {
  transform: scale(1.02);
}

/* ==========================================================================
   20. Accessibility - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .float,
  .floatGentle,
  .pulse,
  .shimmer {
    animation: none !important;
  }
}

/* ==========================================================================
   21. Loading States
   ========================================================================== */

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(9, 38, 29, 0.1);
  border-radius: 50%;
  border-top-color: var(--color-secondary);
  animation: rotate360 1s linear infinite;
}

/* ==========================================================================
   22. Utility Animation Classes
   ========================================================================== */

.fade-in {
  animation: fadeIn var(--animation-normal) var(--ease-smooth);
}

.fade-in-up {
  animation: fadeInUp var(--animation-normal) var(--ease-smooth);
}

.fade-in-down {
  animation: fadeInDown var(--animation-normal) var(--ease-smooth);
}

.fade-in-left {
  animation: fadeInLeft var(--animation-normal) var(--ease-smooth);
}

.fade-in-right {
  animation: fadeInRight var(--animation-normal) var(--ease-smooth);
}

.scale-in {
  animation: scaleIn var(--animation-normal) var(--ease-smooth);
}

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

.float-gentle-animation {
  animation: floatGentle 4s ease-in-out infinite;
}

.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

.bounce-animation {
  animation: bounce 1s ease-in-out;
}

/* ==========================================================================
   24. Glow Effects
   ========================================================================== */

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 188, 20, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 188, 20, 0.8);
  }
}

.glow-effect {
  animation: glow 2s ease-in-out infinite;
}

/* ==========================================================================
   25. Text Animation Effects
   ========================================================================== */

.text-gradient {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   26. Hover Glow for Important CTAs
   ========================================================================== */

.cta-glow:hover {
  box-shadow: 0 0 30px rgba(255, 188, 20, 0.6);
}

/* ==========================================================================
   27. Back to Top Button
   ========================================================================== */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--color-secondary);
  color: var(--color-primary);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--animation-normal) var(--ease-smooth);
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary);
  color: var(--color-secondary);
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.back-to-top:active {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}

/* ==========================================================================
   28. Custom Cursor
   ========================================================================== */

.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-secondary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background-color 0.3s;
  mix-blend-mode: difference;
  display: none;
}

@media (min-width: 992px) {
  .custom-cursor {
    display: block;
  }
}

.custom-cursor.active {
  width: 50px;
  height: 50px;
  background-color: rgba(255, 188, 20, 0.2);
  border-color: transparent;
}

/* ==========================================================================
   29. Smooth Scroll (Lenis)
   ========================================================================== */

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* ==========================================================================
   30. Magnetic Buttons
   ========================================================================== */

.magnetic-button {
  display: inline-block;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ==========================================================================
   31. Text Animations
   ========================================================================== */

.char-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.char-reveal span {
  display: inline-block;
  transform: translateY(100%);
  opacity: 0;
  animation: revealChar 0.5s cubic-bezier(0.5, 0, 0, 1) forwards;
}

@keyframes revealChar {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
