/* BrandNewHomes.in - Motion Enhancements & Zero-Bloat Micro-Animations */
/* Vanilla CSS, Hardware Accelerated, 60fps, Zero CLS */

/* -------------------------------------------------------------------------- */
/* 1. View Transitions API (Seamless Page-to-Page Navigation Cross-Fade)      */
/* -------------------------------------------------------------------------- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 180ms cubic-bezier(0.16, 1, 0.3, 1) both bnh-fade-out;
}

::view-transition-new(root) {
  animation: 240ms cubic-bezier(0.16, 1, 0.3, 1) both bnh-fade-in;
}

@keyframes bnh-fade-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.99); }
}

@keyframes bnh-fade-in {
  from { opacity: 0; transform: scale(1.01); }
  to { opacity: 1; transform: scale(1); }
}

/* -------------------------------------------------------------------------- */
/* 2. Card Hover Elevation & Smooth 200ms Cubic-Bezier Transforms            */
/* -------------------------------------------------------------------------- */
.home-card,
.property-card,
.bnh-elevated-card {
  will-change: transform, box-shadow;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 200ms ease;
  contain: content;
}

.home-card:hover,
.property-card:hover,
.bnh-elevated-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -8px rgba(10, 37, 64, 0.12),
              0 4px 12px -2px rgba(10, 37, 64, 0.06);
  border-color: rgba(0, 82, 212, 0.28);
}

.home-card:active,
.property-card:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -4px rgba(10, 37, 64, 0.1);
  transition-duration: 80ms;
}

/* -------------------------------------------------------------------------- */
/* 3. Sticky Refinement Bar & Docking Transitions                            */
/* -------------------------------------------------------------------------- */
.sticky-refinement-dock,
.search-refinement-bar.is-sticky,
.portal-refinement-header.is-docked {
  position: sticky;
  top: 0;
  z-index: 99;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.06);
  transition: background-color 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Dark mode header docking variant */
[data-theme="dark"] .sticky-refinement-dock,
.dark-refinement-bar.is-sticky {
  background: rgba(15, 23, 42, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
}

/* -------------------------------------------------------------------------- */
/* 4. Price Counter & Stat Numbers (Tabular, High Clarity, Shimmer)          */
/* -------------------------------------------------------------------------- */
.price-counter-val,
.stat-counter-number,
.mstat-val {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  display: inline-block;
  transition: color 200ms ease, transform 200ms ease;
}

.price-counter-val.is-incrementing {
  animation: bnh-number-pop 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bnh-number-pop {
  0% { transform: translateY(3px); opacity: 0.6; }
  100% { transform: translateY(0); opacity: 1; }
}

/* -------------------------------------------------------------------------- */
/* 5. Zero-CLS Skeleton Loading States & Shimmer Waves                       */
/* -------------------------------------------------------------------------- */
.bnh-skeleton {
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.bnh-skeleton[data-aspect="16/9"],
.bnh-skeleton-16-9 {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.bnh-skeleton[data-aspect="4/3"],
.bnh-skeleton-4-3 {
  aspect-ratio: 4 / 3;
  width: 100%;
}

.bnh-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: bnh-shimmer 1.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bnh-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* -------------------------------------------------------------------------- */
/* 6. CSS Scroll-Driven Animations (Native Compositor-Driven Motion)         */
/* -------------------------------------------------------------------------- */
.bnh-scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #0052d4, #60efff 60%, #d4af37 100%);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 99999;
  pointer-events: none;
}

@supports (animation-timeline: scroll()) {
  .bnh-scroll-progress-bar {
    animation: bnh-scroll-grow auto linear forwards;
    animation-timeline: scroll(root block);
  }

  @keyframes bnh-scroll-grow {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }

  /* Subtle Hero Parallax Fade (Strict GPU Compositor: transform & opacity) */
  .hero-subtle-scroll-parallax {
    animation: bnh-hero-subtle-parallax auto linear forwards;
    animation-timeline: scroll(root block);
    animation-range: 0px 450px;
  }

  @keyframes bnh-hero-subtle-parallax {
    to {
      transform: translateY(18px);
      opacity: 0.94;
    }
  }
}

/* -------------------------------------------------------------------------- */
/* 7. Reduced Motion Accessibility Rule                                       */
/* -------------------------------------------------------------------------- */
@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;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
  .bnh-scroll-progress-bar {
    display: none !important;
  }
}
