/* =============================================
   ANIMATIONS
   لایه حرکت مشترک همه صفحات.
   همه چیز زیر html.anim است تا بدون جاوااسکریپت
   محتوا کاملاً قابل مشاهده بماند.
   ============================================= */

:root {
  --fx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fx-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
}


/* ---------------------------------------------
   1) لکه‌های نور پشت شیشه
   بدون این لایه، backdrop-filter چیزی برای
   نمونه‌برداری ندارد و شیشه تخت دیده می‌شود.
   --------------------------------------------- */

.anim body::before {
  content: '';
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 22% 26%, var(--aurora-1), transparent 70%),
    radial-gradient(34% 38% at 78% 20%, var(--aurora-2), transparent 70%),
    radial-gradient(42% 46% at 68% 82%, var(--aurora-3), transparent 70%),
    radial-gradient(36% 40% at 18% 76%, var(--aurora-4), transparent 70%);
  animation: aurora-drift 28s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-2.5%, 1.5%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.03); }
}


/* ---------------------------------------------
   2) ورود و خروج صفحه
   --------------------------------------------- */

.anim body {
  animation: page-in 0.6s var(--fx-ease-soft) both;
}

@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.anim body.is-leaving {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.3s ease, transform 0.3s var(--fx-ease);
  animation: none;
}


/* ---------------------------------------------
   3) نوار پیشرفت اسکرول
   --------------------------------------------- */

.fx-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  z-index: 300;
  transform: scaleX(0);
  transform-origin: right center;   /* RTL */
  background: linear-gradient(90deg, var(--accent), #06b6d4, #10b981);
  will-change: transform;
}


/* ---------------------------------------------
   4) هدر
   --------------------------------------------- */

/* با top انجام می‌شود، نه transform: هدر والدِ منوی
   position:fixed موبایل است و هر transform روی والد،
   fixed را به آن گره می‌زند. fill-mode هم backwards است
   تا بعد از پایان انیمیشن، کلاس is-condensed بتواند
   مقدار top را عوض کند. */
.anim .site-header {
  animation: header-drop 0.9s var(--fx-ease) backwards;
}

@keyframes header-drop {
  from { opacity: 0; top: -90px; }
  to   { opacity: 1; top: 14px; }
}


/* ---------------------------------------------
   5) سربرگ صفحه اصلی
   عمداً بدون scale — بزرگ‌نمایی تصویری با عرض ۱۰۰٪
   باعث سرریز افقی صفحه می‌شود.
   --------------------------------------------- */

.anim .hero-img,
.anim .content-hero-img {
  animation: hero-in 1.4s var(--fx-ease) both;
}

@keyframes hero-in {
  from { opacity: 0; filter: blur(16px) saturate(0.65); clip-path: inset(0 0 20% 0); }
  to   { opacity: 1; filter: blur(0) saturate(1);       clip-path: inset(0 0 0 0); }
}

.anim .hero-card,
.anim .content-hero-text {
  animation: rise-blur 1.1s var(--fx-ease) 0.35s both;
}

@keyframes rise-blur {
  from { opacity: 0; transform: translateY(34px); filter: blur(12px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}


/* ---------------------------------------------
   6) نمایش تدریجی هنگام اسکرول
   تاخیر پلکانی از جاوااسکریپت اعمال می‌شود، نه
   transition-delay، تا با ترنزیشن هاور تداخل نکند.
   --------------------------------------------- */

.anim [data-reveal] {
  --fx-ty: 34px;
  --fx-sc: 0.98;
  opacity: 0;
  filter: blur(7px);
  transform: translate3d(0, var(--fx-ty), 0) scale(var(--fx-sc));
  transition:
    opacity 0.8s var(--fx-ease),
    filter 0.8s var(--fx-ease),
    transform 0.8s var(--fx-ease);
  will-change: opacity, transform;
}

.anim [data-reveal="zoom"] { --fx-ty: 20px; --fx-sc: 0.9; }

.anim [data-reveal].is-visible {
  --fx-ty: 0px;
  --fx-sc: 1;
  opacity: 1;
  filter: blur(0);
}

.anim [data-reveal].fx-settled {
  will-change: auto;
}

/* کارت‌های قابل کلیک: هاور آرام، بدون تیلت و درخشش */
.anim .service-card[data-reveal],
.anim .employer-card[data-reveal],
.anim a.feature[data-reveal] {
  transition:
    opacity 0.8s var(--fx-ease),
    filter 0.8s var(--fx-ease),
    transform 0.35s var(--fx-ease),
    box-shadow 0.35s var(--fx-ease);
}

.anim .service-card[data-reveal].is-visible:hover,
.anim .employer-card[data-reveal].is-visible:hover,
.anim a.feature[data-reveal].is-visible:hover {
  --fx-ty: -4px;
}


/* ---------------------------------------------
   7) فوتر
   --------------------------------------------- */

.anim .site-footer li {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.6s var(--fx-ease), transform 0.6s var(--fx-ease);
  transition-delay: calc(var(--fx-i, 0) * 80ms);
}

.anim .site-footer.is-visible li {
  opacity: 1;
  transform: translateX(0);
}


/* ---------------------------------------------
   8) دکمه بازگشت به بالا
   --------------------------------------------- */

.fx-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 50px;
  height: 50px;
  z-index: 250;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.8);
  transition: opacity 0.35s var(--fx-ease), transform 0.35s var(--fx-ease),
              visibility 0.35s, box-shadow 0.3s ease;
}

.fx-to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.fx-to-top.is-shown:hover  { transform: translateY(-3px) scale(1.06); }
.fx-to-top.is-shown:active { transform: translateY(0) scale(0.94); }

.fx-to-top svg {
  width: 21px;
  height: 21px;
  stroke: var(--dark-text);
  stroke-width: 2.3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ---------------------------------------------
   9) احترام به تنظیم کاهش حرکت
   --------------------------------------------- */

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

  .anim [data-reveal],
  .anim .site-footer li {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}
