/* =====================================================================
   Motion — لایه‌ی حرکت مشترک همه‌ی لندینگ‌ها (بعد از core.css و theme بارگذاری می‌شود)
   فقط transform / opacity (و mask برای دونات)؛ همه‌چیز با prefers-reduced-motion ملایم‌تر می‌شود.
   منحنی‌ها: ورود/خروج = ease-out قوی، حرکت روی صفحه = ease-in-out قوی.
   ===================================================================== */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  interpolate-size: allow-keywords;
}

/* ---------- ورود اولیه‌ی هیرو (بدون state مخفی: اگر انیمیشن اجرا نشود، همه‌چیز دیده می‌شود) ---------- */
.js .hr { animation: hr-in 0.9s var(--ease-out) var(--d, 0s) backwards; }
@keyframes hr-in { from { opacity: 0; transform: translateY(18px); } }

.js .nav { animation: nav-in 0.8s var(--ease-out) backwards; }
@keyframes nav-in { from { transform: translateY(-100%); opacity: 0; } }

.js .hero__art img { animation: art-in 1.8s var(--ease-out) backwards; transform-origin: 50% 100%; }
@keyframes art-in { from { opacity: 0; transform: scale(1.1) translateY(4%); } }

.js .hero__sun { animation: sun-in 2.2s var(--ease-out) 0.1s backwards, sun 9s ease-in-out 2.3s infinite alternate; }
@keyframes sun-in { from { opacity: 0; transform: translate(-50%, 50%) scale(0.6); } }

.js .float { animation: float-in 1s var(--ease-out) var(--d, 1s) backwards, bob 7s ease-in-out calc(var(--d, 1s) + 1s) infinite; }
.js .float--nav { --d: 1s; }
.js .float--ret { --d: 1.15s; }
.js .float--users { --d: 1.3s; }
@keyframes float-in { from { opacity: 0; transform: translateY(40px) scale(0.94); } }

/* عنوان: هر کلمه از پشت یک ماسک بالا می‌آید */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0.16em 0 0.2em; margin: -0.16em 0 -0.2em; }
.w > span { display: inline-block; }
.hero__title .w > span { animation: word-up 1s var(--ease-out) calc(0.2s + var(--i) * 70ms) backwards; }
@keyframes word-up { from { transform: translateY(115%); } }
.js .h2.split:not(.in) .w > span { transform: translateY(115%); }
.js .h2.split .w > span { transition: transform 0.85s var(--ease-out) calc(var(--i) * 45ms); }

/* ---------- ورود هنگام اسکرول (جایگزین نسخه‌ی core با منحنی قوی‌تر) ---------- */
.js .rv { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease-out var(--d, 0s), transform 0.8s var(--ease-out) var(--d, 0s); }
.js .rv.in { opacity: 1; transform: none; }

/* خط کنار برچسب سکشن از صفر باز می‌شود */
.js .eyebrow::before { transform-origin: right center; transition: transform 0.7s var(--ease-out) 0.15s; }
.js .eyebrow:not(.in)::before { transform: scaleX(0); }

/* نوار پیشرفت اسکرول */
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 80; background: var(--accent); transform: scaleX(0); transform-origin: right center; pointer-events: none; }

/* ---------- فیدبک لمس/کلیک ---------- */
.btn, .presets button, .seg button, .nav__burger, .socials a { transition-property: transform, box-shadow, background-color, color, border-color; }
.btn:active, .presets button:active, .seg button:active, .nav__burger:active { transform: scale(0.97); transition-duration: 0.12s; transition-timing-function: ease-out; }
.range::-webkit-slider-thumb { transition: transform 0.2s var(--ease-out); }
.range:active::-webkit-slider-thumb { transform: scale(1.18); }
.range::-moz-range-thumb { transition: transform 0.2s var(--ease-out); }
.range:active::-moz-range-thumb { transform: scale(1.18); }

/* برق ملایم روی دکمه‌ی اصلی (فقط ماوس) */
.btn--gold { position: relative; overflow: hidden; isolation: isolate; }
.btn--gold::after { content: ""; position: absolute; inset: -20% auto -20% 0; width: 45%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent); transform: translateX(-160%) skewX(-18deg); pointer-events: none; z-index: -1; }
@media (hover: hover) and (pointer: fine) {
  .btn--gold:hover::after { transform: translateX(380%) skewX(-18deg); transition: transform 0.8s var(--ease-out); }
  .feat:hover, .persona:hover, .stat:hover { transform: translateY(-4px); border-color: var(--accent-line); }
  .feat, .persona, .stat { transition: transform 0.3s var(--ease-out), border-color 0.3s; }
}

/* ---------- دونات: چرخش باز شدن ---------- */
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@supports (mask-image: conic-gradient(#000, #000)) {
  .js .alloc__chart .donut {
    -webkit-mask-image: conic-gradient(from 90deg, #000 var(--sweep), transparent calc(var(--sweep) + 0.4deg));
    mask-image: conic-gradient(from 90deg, #000 var(--sweep), transparent calc(var(--sweep) + 0.4deg));
  }
  .js .alloc__chart:not(.in) .donut { --sweep: 0deg; }
  .js .alloc__chart.in .donut { --sweep: 360deg; animation: sweep 1.3s var(--ease-in-out) 0.1s backwards; }
  @keyframes sweep { from { --sweep: 0deg; } }
}

/* ---------- آکاردئون (در مرورگرهایی که ::details-content دارند) ---------- */
@supports selector(::details-content) {
  .acc details::details-content { block-size: 0; opacity: 0; overflow: clip; transition: block-size 0.35s var(--ease-out), opacity 0.25s ease-out, content-visibility 0.35s allow-discrete; }
  .acc details[open]::details-content { block-size: auto; opacity: 1; }
}

/* ---------- موفقیت فرم ---------- */
.lead-ok:not([hidden]) .ico { animation: pop 0.7s cubic-bezier(0.34, 1.45, 0.64, 1) backwards; }
.lead-ok:not([hidden]) .h2 { animation: hr-in 0.6s var(--ease-out) 0.15s backwards; }
.lead-ok:not([hidden]) .lead { animation: hr-in 0.6s var(--ease-out) 0.25s backwards; }
@keyframes pop { from { opacity: 0; transform: scale(0.5); } }

/* ---------- کاهش حرکت: بدون جابه‌جایی، فقط محو شدن ملایم ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .hr, .js .nav, .js .hero__art img, .js .float, .hero__title .w > span, .lead-ok:not([hidden]) .ico, .lead-ok:not([hidden]) .h2, .lead-ok:not([hidden]) .lead { animation: fade-only 0.4s ease backwards; }
  .js .hero__sun { animation: sun-in 0.4s ease backwards; }
  @keyframes fade-only { from { opacity: 0; } }
  .js .rv, .js .rv.in { transform: none; transition: opacity 0.3s ease; transition-delay: 0s; }
  .js .h2.split:not(.in) .w > span { transform: none; }
  .js .h2.split .w > span { transition: none; }
  .js .eyebrow::before { transition: none; }
  .js .eyebrow:not(.in)::before { transform: none; }
  .js .alloc__chart.in .donut { animation: none; }
  .btn--gold::after { display: none; }
  .progress { display: none; }
  .acc details::details-content { transition: none; }
}
