/* =============================================================================
   افکت‌ها، انیمیشن‌ها و امضای بصریِ هر قالب
   -----------------------------------------------------------------------------
   این فایل عمداً جداست تا فایل‌های قالب (editorial.css / soft.css) و
   public-shell.css دست‌نخورده بمانند.

   تقسیم کار بین سه قالب:
     • کلاسیک  → حرکت کم و رسمی؛ تصویر دست‌نخورده. (شخصیت: محافظه‌کار)
     • مینیمال → قالبِ «حرکت»؛ پرده‌ی بازشونده، محو تایپوگرافیک، ورود آبشاری.
     • نرم     → قالبِ «رنگ»؛ فیلتر رنگی تصاویر و سایه‌های هم‌رنگِ برند.

   همه‌ی موارد از --pub-primary / --pub-dark تغذیه می‌شوند، پس با تغییر رنگ
   سازمانی در مدیریت، افکت‌ها هم همان رنگ را می‌گیرند.
   هیچ انیمیشنی با prefers-reduced-motion اجرا نمی‌شود.
   ============================================================================= */

:root {
    --rv-dur: .62s;
    --rv-ease: cubic-bezier(.22, .61, .36, 1);
    --rv-step: 55ms;      /* فاصله‌ی ورود پیاپی اعضای یک گروه */
    --rv-rise: 16px;
}

/* ---------- ۱) موتور مشترکِ نمایان‌شدن ----------
   عمداً با animation نوشته شده، نه transition: کارت‌ها transition مخصوصِ hover
   دارند و اگر ورود هم transition بود، لیستِ transition همدیگر را پاک می‌کردند
   و تأخیرِ آبشاری از بین می‌رفت. animation با transition تداخل ندارد. */
.rv { opacity: 0; }

.rv.is-in {
    animation-duration: var(--rv-dur);
    animation-timing-function: var(--rv-ease);
    animation-delay: calc(var(--rv-i, 0) * var(--rv-step));
    animation-fill-mode: both;
    animation-name: rv-fade;
}

.rv.rv-up.is-in { animation-name: rv-up; }
.rv.rv-zoom.is-in { animation-name: rv-zoom; }
.rv.rv-wipe.is-in { animation-name: rv-wipe; }

@keyframes rv-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rv-up {
    from { opacity: 0; transform: translateY(var(--rv-rise)); }
    to { opacity: 1; transform: none; }
}

@keyframes rv-zoom {
    from { opacity: 0; transform: scale(.94); }
    to { opacity: 1; transform: none; }
}

/* پرده‌ی بازشونده — در RTL از راست باز می‌شود */
@keyframes rv-wipe {
    from { opacity: 0; clip-path: inset(0 0 0 100%); }
    to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes rv-wipe-ltr {
    from { opacity: 0; clip-path: inset(0 100% 0 0); }
    to { opacity: 1; clip-path: inset(0 0 0 0); }
}

[dir="ltr"] .rv.rv-wipe.is-in { animation-name: rv-wipe-ltr; }

/* عنوان‌ها در قالب مینیمال: محو + نشستنِ فاصله‌ی حروف */
.rv-head { opacity: 0; }

.rv-head.is-in {
    animation: rv-head .82s var(--rv-ease) calc(var(--rv-i, 0) * var(--rv-step)) both;
}

@keyframes rv-head {
    from { opacity: 0; transform: translateY(14px); filter: blur(7px); letter-spacing: .04em; }
    to { opacity: 1; transform: none; filter: blur(0); letter-spacing: inherit; }
}

/* ---------- ۲) تصاویر: ورود نرم پس از بارگذاری ---------- */
.img-in {
    opacity: 0;
    transform: scale(1.03);
    transition: opacity .6s var(--rv-ease), transform .8s var(--rv-ease);
}

.img-in.is-loaded {
    opacity: 1;
    transform: none;
}

/* ---------- ۳) جدول‌ها: ورود سطر‌به‌سطر ---------- */
.tbl-in tbody > tr { opacity: 0; }

.tbl-in.is-in tbody > tr {
    animation: rv-row .45s var(--rv-ease) calc(var(--rv-i, 0) * 45ms) both;
}

@keyframes rv-row {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: none; }
}

/* =============================================================================
   قالب ۱ — کلاسیک: حرکت کم، رسمی، بدون دست‌کاری تصویر
   ============================================================================= */
body.public-theme-classic {
    --rv-dur: .48s;
    --rv-step: 40ms;
    --rv-rise: 10px;
}

body.public-theme-classic .post-classic,
body.public-theme-classic .prod-card,
body.public-theme-classic .svc-card,
body.public-theme-classic .public-card {
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

body.public-theme-classic .post-classic:hover,
body.public-theme-classic .prod-card:hover,
body.public-theme-classic .svc-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--pub-primary) 55%, #d9d9d9);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .07);
}

/* =============================================================================
   قالب ۲ — مینیمال: قالبِ «حرکت»
   پرده‌ای که از لبه‌ی شروع باز می‌شود + محوِ تایپوگرافیک + ورود آبشاری
   ============================================================================= */
body.public-theme-editorial {
    --rv-dur: .78s;
    --rv-ease: cubic-bezier(.16, 1, .3, 1);
    --rv-step: 72ms;
    --rv-rise: 22px;
}

/* تصویر: کمی بزرگ‌تر وارد می‌شود و سر جایش می‌نشیند */
body.public-theme-editorial .img-in { transform: scale(1.07); }

/* کارت: خطِ رنگیِ برند از لبه‌ی شروع رشد می‌کند */
body.public-theme-editorial .post-classic,
body.public-theme-editorial .prod-card,
body.public-theme-editorial .svc-card {
    position: relative;
    transition: transform .35s var(--rv-ease), box-shadow .35s var(--rv-ease);
}

body.public-theme-editorial .post-classic::after,
body.public-theme-editorial .prod-card::after,
body.public-theme-editorial .svc-card::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inset-inline-start: 0;
    block-size: 2px;
    inline-size: 0;
    background: var(--pub-primary);
    transition: inline-size .4s var(--rv-ease);
}

body.public-theme-editorial .post-classic:hover,
body.public-theme-editorial .prod-card:hover,
body.public-theme-editorial .svc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .08);
}

body.public-theme-editorial .post-classic:hover::after,
body.public-theme-editorial .prod-card:hover::after,
body.public-theme-editorial .svc-card:hover::after { inline-size: 100%; }

/* تصویر کارت: بزرگ‌نماییِ آرام داخل قابِ ثابت */
body.public-theme-editorial .prod-cover,
body.public-theme-editorial .cover-img {
    transition: transform .6s var(--rv-ease);
}

body.public-theme-editorial .prod-card:hover .prod-cover,
body.public-theme-editorial .post-classic:hover .cover-img { transform: scale(1.05); }

/* =============================================================================
   قالب ۳ — نرم: قالبِ «رنگ»
   تصاویر با فیلترِ ملایم و پوششِ هم‌رنگِ برند؛ روی هوور رنگِ کامل برمی‌گردد
   ============================================================================= */
body.public-theme-soft {
    --rv-dur: .66s;
    --rv-ease: cubic-bezier(.34, 1.4, .64, 1);
    --rv-step: 60ms;
    --rv-rise: 14px;
    --tint: color-mix(in srgb, var(--pub-primary) 26%, transparent);
    --glow: color-mix(in srgb, var(--pub-primary) 24%, transparent);
}

/* قابِ تصویر: فیلتر رنگی + لایه‌ی تینتِ برند */
body.public-theme-soft .prod-card > a,
body.public-theme-soft .img-thumbnail-variant-1 figure,
body.public-theme-soft .tinted {
    position: relative;
    display: block;
    overflow: hidden;
}

body.public-theme-soft .prod-card > a::after,
body.public-theme-soft .img-thumbnail-variant-1 figure::after,
body.public-theme-soft .tinted::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--tint);
    mix-blend-mode: color;
    opacity: 1;
    transition: opacity .45s var(--rv-ease);
    pointer-events: none;
}

body.public-theme-soft .prod-cover,
body.public-theme-soft .cover-img,
body.public-theme-soft .img-thumbnail-variant-1 figure img {
    filter: saturate(.68) contrast(1.05) brightness(1.02);
    transition: filter .45s var(--rv-ease), transform .6s var(--rv-ease);
}

body.public-theme-soft .prod-card:hover > a::after,
body.public-theme-soft .img-thumbnail-variant-1 figure:hover::after,
body.public-theme-soft .tinted:hover::after { opacity: 0; }

body.public-theme-soft .prod-card:hover .prod-cover,
body.public-theme-soft .img-thumbnail-variant-1 figure:hover img {
    filter: saturate(1.06) contrast(1) brightness(1);
    transform: scale(1.045);
}

/* سایه‌ی هم‌رنگِ برند به‌جای سایه‌ی خاکستری */
body.public-theme-soft .post-classic,
body.public-theme-soft .prod-card,
body.public-theme-soft .svc-card,
body.public-theme-soft .public-card {
    transition: transform .38s var(--rv-ease), box-shadow .38s var(--rv-ease);
}

body.public-theme-soft .post-classic:hover,
body.public-theme-soft .prod-card:hover,
body.public-theme-soft .svc-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 44px var(--glow);
}

/* شست‌وشوی رنگیِ بسیار ملایم پشت بخش‌های روشن */
body.public-theme-soft .bg-gray-lighter {
    background-image:
        radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--pub-primary) 9%, transparent) 0%, transparent 62%),
        radial-gradient(100% 70% at 0% 100%, color-mix(in srgb, var(--pub-dark) 6%, transparent) 0%, transparent 58%);
}

/* سرصفحه‌ی جدول با تهِ‌رنگِ برند */
body.public-theme-soft .tbl-in thead th {
    background: color-mix(in srgb, var(--pub-primary) 12%, #fff);
    border-block-end-color: color-mix(in srgb, var(--pub-primary) 34%, #e6e6e6);
}

body.public-theme-soft .tbl-in tbody > tr:hover {
    background: color-mix(in srgb, var(--pub-primary) 6%, transparent);
}

/* =============================================================================
   احترام به تنظیم کاربر: بدون حرکت
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {

    /* همه‌چیز بی‌درنگ در جای نهایی خودش دیده می‌شود.
       فیلترِ رنگیِ قالب «نرم» عمداً دست‌نخورده می‌ماند: آن یک تصمیم طراحی است،
       نه حرکت — و حذفش ظاهرِ قالب را عوض می‌کند نه راحتیِ کاربر را. */
    .rv,
    .rv.is-in,
    .rv-head,
    .rv-head.is-in,
    .img-in,
    .tbl-in tbody > tr,
    .tbl-in.is-in tbody > tr {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
        letter-spacing: inherit !important;
        animation: none !important;
        transition: none !important;
    }

    .rv-head,
    .rv-head.is-in { filter: none !important; }

    /* حرکت‌های هوور و اسلایدر */
    body.public-theme-classic .post-classic,
    body.public-theme-classic .prod-card,
    body.public-theme-classic .svc-card,
    body.public-theme-classic .public-card,
    body.public-theme-editorial .post-classic,
    body.public-theme-editorial .prod-card,
    body.public-theme-editorial .svc-card,
    body.public-theme-editorial .prod-cover,
    body.public-theme-editorial .cover-img,
    body.public-theme-soft .post-classic,
    body.public-theme-soft .prod-card,
    body.public-theme-soft .svc-card,
    body.public-theme-soft .public-card,
    body.public-theme-soft .prod-cover,
    body.public-theme-soft .cover-img,
    body.public-theme-soft .img-thumbnail-variant-1 figure img {
        transition: none !important;
    }

    body.public-theme-soft .home-swiper .swiper-slide.is-active { animation: none !important; }
}
