/*
 * EstateHub - page animations
 * ----------------------------------------------------------------
 * Loaded on every layout (public site + admin/sales-closer/seller panels).
 * It works together with public/js/animations.js.
 *
 * Rules we follow:
 *  1. Nothing here changes the layout, only opacity / translate / small transforms.
 *  2. Everything that moves is wrapped in "prefers-reduced-motion: no-preference",
 *     so people who turned animations off in their system never see movement.
 */

/* -------- Scroll reveal: JS adds .reveal to hidden elements, then plays the animation -------- */
.reveal { opacity: 0; }

/* -------- Scroll progress bar (created by JS, public pages only) -------- */
.ah-progress {
  position: fixed; top: 0; left: 0; z-index: 1000;
  width: 100%; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--secondary, #d8a45d), var(--primary, #1f5c4a));
  transform: scaleX(0); transform-origin: 0 50%;
}

/* -------- Back to top button (created by JS, public pages only) -------- */
.ah-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: grid; place-items: center; width: 46px; height: 46px;
  border: 0; border-radius: 50%; cursor: pointer;
  color: #fff; background: var(--primary, #1f5c4a); font-size: 18px; line-height: 1;
  box-shadow: 0 10px 26px rgba(24, 35, 31, .28);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .3s, visibility .3s, transform .3s, background .2s;
}
.ah-top.is-shown { opacity: 1; visibility: visible; transform: none; }
.ah-top:hover { background: var(--primary-dark, #174637); transform: translateY(-3px); }

/* -------- Small hover polish (safe: only adds, never overrides existing hover styles) -------- */
.footer-links a { display: inline-block; transition: color .2s, transform .2s; }
.footer-links a:hover { transform: translateX(4px); }
.social-icon { transition: transform .25s, background .25s, color .25s; }
.social-icon:hover { transform: translateY(-3px); }
.btn:active, .nav-button:active, .auth-btn:active { transform: scale(.97); }

@media (prefers-reduced-motion: no-preference) {
  @keyframes ah-fade-in { from { opacity: 0; } }
  @keyframes ah-fade-up { from { opacity: 0; translate: 0 28px; } }
  @keyframes ah-toast-in { from { opacity: 0; translate: 0 -14px; } }

  /* Whole page fades in softly */
  body { animation: ah-fade-in .5s ease-out backwards; }

  /* Hero / page heading: children rise one after another (fill "backwards" = no leftover styles) */
  .hero-content > *,
  .page-hero .container > *,
  .cms-hero .container > *,
  .property-detail-head {
    animation: ah-fade-up .9s cubic-bezier(.2, .7, .2, 1) backwards;
  }
  .hero-content > :nth-child(2), .page-hero .container > :nth-child(2), .cms-hero .container > :nth-child(2) { animation-delay: .12s; }
  .hero-content > :nth-child(3), .page-hero .container > :nth-child(3), .cms-hero .container > :nth-child(3) { animation-delay: .24s; }
  .hero-content > :nth-child(4), .page-hero .container > :nth-child(4), .cms-hero .container > :nth-child(4) { animation-delay: .36s; }
  .hero-content > :nth-child(5), .page-hero .container > :nth-child(5) { animation-delay: .48s; }
  .hero-content > :nth-child(n+6) { animation-delay: .6s; }

  /* Toast messages slide in (they already fade out in layout-fix.css) */
  .flash-message { animation: ah-toast-in .45s ease-out backwards; }
}
