/* ==========================================================================
   14 — Animations: scroll reveal، تیترهای کلمه‌به‌کلمه، کارت‌های سه‌بعدی،
        پارالاکس، هدر پنهان‌شونده + keyframeهای مشترک
   ========================================================================== */

/* ---------- Scroll reveal ---------- */
.js [data-reveal] {
	opacity: 0; transform: translateY(46px) scale(.98); filter: blur(6px);
	transition: opacity .9s var(--ease), transform 1.1s var(--ease), filter .9s var(--ease);
}
.js [data-reveal="art"] { transform: scale(.9) rotate(-2deg); transition-duration: 1.3s; }
.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
.js [data-d="1"] { transition-delay: .1s; }
.js [data-d="2"] { transition-delay: .2s; }
.js [data-d="3"] { transition-delay: .3s; }
.js [data-d="4"] { transition-delay: .4s; }
.js [data-d="5"] { transition-delay: .5s; }
.js [data-d="6"] { transition-delay: .6s; }

/* کارت‌های گرید یکی‌یکی */
.js .p-grid > .p-card:nth-child(4n+2), .js ul.products > .p-card:nth-child(4n+2) { transition-delay: .08s; }
.js .p-grid > .p-card:nth-child(4n+3), .js ul.products > .p-card:nth-child(4n+3) { transition-delay: .16s; }
.js .p-grid > .p-card:nth-child(4n+4), .js ul.products > .p-card:nth-child(4n+4) { transition-delay: .24s; }

/* تصویر کارت‌ها: زوم‌اوت نرم هنگام ظاهر شدن */
.js .p-card[data-reveal] .p-card__img, .js .post-card[data-reveal] .post-card__media img { transform: scale(1.18); transition: transform 1.6s var(--ease), opacity .5s; }
.js .p-card.is-in .p-card__img, .js .post-card.is-in .post-card__media img { transform: scale(1); }

/* ---------- Split headings ---------- */
.split .sw { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.split .sw > span { display: inline-block; transform: translateY(108%) rotate(3deg); transition: transform .95s var(--ease); transition-delay: calc(var(--i, 0) * 55ms + .05s); }
.split.is-in .sw > span { transform: none; }
.split em .sw > span { color: var(--gold); }

/* ---------- Tilt & glare ---------- */
.p-card, .cat, .post-card, .spot, .review, .process__step, .timeline__item, .c-card { transform-style: preserve-3d; will-change: transform; }
.is-tilt { transition: transform .12s linear, box-shadow var(--t) !important; box-shadow: var(--sh-3) !important; }
.p-card::after, .cat::after, .post-card::after, .spot::after {
	content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
	background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.28), transparent 45%);
	opacity: 0; transition: opacity .4s;
}
.is-tilt::after { opacity: 1; }
.cat, .post-card, .spot { position: relative; }

/* دکمه‌های مغناطیسی */
[data-magnetic], .btn--gold.btn--lg { transition: transform .35s var(--ease), background var(--t), box-shadow var(--t), color var(--t); }

/* پارالاکس نرم */
.story__frame, .cat__art, .shop-hero__art, .natural__ico, .process__pattern { transition: translate .15s linear; }

/* ---------- Section details ---------- */
.kicker .ico { transition: transform .8s var(--ease); }
[data-reveal].is-in .kicker .ico, .sec-head.is-in .kicker .ico { animation: leafIn 1s .2s var(--ease) both; }
.process__step.is-in .process__ico { animation: popIn .8s .2s var(--ease) both; }
@media (min-width: 1024px) {
	.process__step:not(:last-child)::after { transform: scaleX(0); transform-origin: right; transition: transform .8s .6s var(--ease); }
	.process__step.is-in:not(:last-child)::after { transform: scaleX(1); }
}
.benefit.is-in .benefit__ico { animation: popIn .7s .15s var(--ease) both; }
.timeline__item.is-in .timeline__dot { animation: popIn .7s .2s var(--ease) both; }
.cat__go, .p-card__btn { transition: transform .45s var(--ease), background var(--t), color var(--t); }

/* هدر پنهان‌شونده */
.site-header.is-hidden { transform: translateY(-105%); }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(-16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes stepIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.35); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes popIn { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
@keyframes leafIn { from { transform: rotate(-90deg) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- موبایل و لمسی (آیفون/اندروید): جلوه‌های قابل‌دیدن بدون ماوس ---------- */
@media (hover: none), (pointer: coarse) {
	/* کارت‌ها یکی از راست و یکی از چپ با کمی چرخش وارد می‌شوند */
	.js .p-grid > [data-reveal]:nth-child(odd), .js ul.products > [data-reveal]:nth-child(odd),
	.js .posts-grid > [data-reveal]:nth-child(odd), .js .cats__grid > [data-reveal]:nth-child(odd) { transform: translateX(42px) rotate(2.5deg) scale(.94); }
	.js .p-grid > [data-reveal]:nth-child(even), .js ul.products > [data-reveal]:nth-child(even),
	.js .posts-grid > [data-reveal]:nth-child(even), .js .cats__grid > [data-reveal]:nth-child(even) { transform: translateX(-42px) rotate(-2.5deg) scale(.94); }
	.js .process__step[data-reveal], .js .benefit[data-reveal], .js .timeline__item[data-reveal] { transform: translateX(60px) scale(.96); }
	.js [data-reveal].is-in { transform: none !important; }

	/* بازخورد لمس */
	.js .p-card.is-in:active, .js .cat.is-in:active, .js .post-card.is-in:active, .js .spot.is-in:active, .js .benefit.is-in:active, .hero__cats a:active, .p-card:active, .cat:active { transform: scale(.97) !important; transition: transform .15s ease !important; }
	.btn:active, .p-card__btn:active { transform: scale(.94); }
}

/* حرکت‌های آرام دائمی (در همه دستگاه‌ها) */
.cat__art { animation: floaty 5s var(--ease-io) infinite; }
.cat:nth-child(2) .cat__art { animation-delay: -1.2s; }
.cat:nth-child(3) .cat__art { animation-delay: -2.4s; }
.cat:nth-child(4) .cat__art { animation-delay: -3.6s; }
.process__step.is-in .process__ico { animation: popIn .8s .2s var(--ease) both, bob 4s 1.2s var(--ease-io) infinite; }
.benefit__ico { animation: wobble 6s var(--ease-io) infinite; }
.benefit:nth-child(2) .benefit__ico { animation-delay: -1.5s; }
.benefit:nth-child(3) .benefit__ico { animation-delay: -3s; }
.benefit:nth-child(4) .benefit__ico { animation-delay: -4.5s; }
.p-card__badges .badge--sale { animation: salePulse 2.6s var(--ease-io) infinite; }
.story__steps span { animation: ring 3s var(--ease-io) infinite; }
.story__steps li:nth-child(2) span { animation-delay: -1s; }
.story__steps li:nth-child(3) span { animation-delay: -2s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg) scale(1.08); } 90% { transform: rotate(8deg) scale(1.08); } 95% { transform: rotate(-4deg); } }
@keyframes salePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(154,59,25,.45); } 50% { box-shadow: 0 0 0 7px rgba(154,59,25,0); } }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(201,154,39,.5); } 50% { box-shadow: 0 0 0 8px rgba(201,154,39,0); } }

/* «کاهش حرکت» سیستم‌عامل: انیمیشن‌ها فعال می‌مانند (درخواست صاحب سایت) */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}
