/* =============================================================
   هیرو — کلاس‌های .sc-hero*  (توضیح کامل: hero.php)
   فقط از توکن‌های تم چایلد استفاده می‌کند. نقطهٔ شکست: ۱۰۲۴px
   (زیر ۱۰۲۴ → اسلایدهای موبایل و تبلت؛ از ۱۰۲۴ به بالا → چیدمان دسکتاپ)

   چیدمان‌های دسکتاپ (کلاس روی خود هیرو):
     .sc-hero--halves  دو نیمه، هر نیمه ۱ یا ۴ عکس (۴:۳)
     .sc-hero--mosaic  یک بزرگ + چهار کوچک (۴:۳)
     .sc-hero--big2    یک بزرگ + دو کوچک (۱۶:۹)
     .sc-hero--cards3  سه کارت (۴:۳)
     .sc-hero--single  یک بنر پهن (۳:۱)
     .is-flip          عکس بزرگ سمت چپ
============================================================= */

.sc-hero {
    --sc-hero-gap:    var(--space-s);                 /* فاصلهٔ بین نیمه‌ها و بین عکس‌های کوچک */
    --sc-hero-r:      calc(var(--border-radius-xl) / 2);        /* گردی گوشه‌ها */
    --sc-hero-ratio:  4 / 3;                          /* نسبت هر نیمهٔ دسکتاپ */
    --sc-hero-mratio: 2.4 / 1;                        /* نسبت بنر موبایل و تبلت */
    --sc-hero-bg:     var(--surface-warm-light);
    --sc-hero-arrow:  2.75rem;
    --sc-hero-pad:    var(--bkh-gutter, var(--space-m));   /* همان حاشیهٔ کناری هدر */
    --sc-hero-peek:   1.5rem;                         /* موبایل: مقدار دیده‌شدن لبهٔ بنر بعدی */

    box-sizing: border-box;
    width: 100%;
    max-width: var(--bkh-max, 1600px);                /* هم‌عرض هدر */
    margin-inline: auto;
    padding-inline: var(--sc-hero-pad);
    margin-block: var(--space-s) var(--space-l);
}

/* وقتی ظرف اطراف خودش فاصله می‌گذارد (مثلاً بلوک GenerateBlocks): [sc_hero flush="1"] */
.sc-hero--flush { --sc-hero-pad: 0px; max-width: none; }

/* عرض (تنظیم «عرض» هیرو): پیش‌فرض هم‌عرض سربرگ؛ لبه تا لبه؛ حداکثر عرض دلخواه (وسط صفحه) */
.sc-hero--w-full   { max-width: none; --sc-hero-pad: 0px; }
.sc-hero--w-full .sc-hero__tile, .sc-hero--w-full .sc-hero__tile--post .sc-post { border-radius: 0; }
.sc-hero--w-custom { max-width: calc(var(--sc-hero-maxw, 1200px) + 2 * var(--sc-hero-pad)); }

/* ارتفاع ثابت دسکتاپ (تنظیم «ارتفاع»): کاشی‌ها به‌جای نسبت ثابت، ارتفاع را پر می‌کنند و عکس از وسط بریده می‌شود */
@media (min-width: 1024px) {
    .sc-hero.has-h .sc-hero__grid { height: var(--sc-hero-h); grid-template-rows: repeat(var(--sc-hero-rows, 1), minmax(0, 1fr)); }
    .sc-hero.has-h.sc-hero--mosaic, .sc-hero.has-h.sc-hero--big2 { --sc-hero-rows: 2; }
    .sc-hero.has-h .sc-hero__grid > * { aspect-ratio: auto !important; height: auto; }
    .sc-hero.has-h .sc-hero__half { aspect-ratio: auto; height: var(--sc-hero-h); grid-auto-rows: minmax(0, 1fr); }
    .sc-hero.has-h .sc-hero__half .sc-hero__img { position: absolute; inset: 0; }
}

/* اگر برای یک دستگاه اصلاً بنری نیست، کل هیرو در آن دستگاه جمع می‌شود */
@media (max-width: 1023px) { .sc-hero[data-has-mobile="0"] { display: none; } }
@media (min-width: 1024px) { .sc-hero[data-has-desktop="0"] { display: none; } }

.sc-hero__stage { position: relative; }

/* ---- ریل اسلایدها ---- */

.sc-hero__track {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y pinch-zoom;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.sc-hero__track::-webkit-scrollbar { display: none; }

.sc-hero__slide {
    flex: 0 0 100%;
    min-width: 0;
    margin: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* ---- موبایل و تبلت: بنر با گوشهٔ گرد، لبهٔ بنر بعدی کمی دیده می‌شود (نشانهٔ «بکش») ---- */

@media (max-width: 1023px) {
    .sc-hero__track {
        gap: var(--sc-hero-gap);
        margin-inline: calc(-1 * var(--sc-hero-pad));     /* ریل تا لبهٔ صفحه باز می‌شود */
        padding-inline: var(--sc-hero-pad);
        scroll-padding-inline: var(--sc-hero-pad);
    }
    .sc-hero__slide { flex-basis: calc(100% - var(--sc-hero-peek)); }
    .sc-hero[data-mobile-count="1"] .sc-hero__slide { flex-basis: 100%; }
}

/* ---- اسلاید موبایل/تبلت (زیر ۱۰۲۴) ---- */

.sc-hero__slide--desktop { display: none; }
.sc-hero__slide--mobile .sc-hero__tile { aspect-ratio: var(--sc-hero-mratio); }

/* ---- اسلاید دسکتاپ (۱۰۲۴ به بالا) ---- */

@media (min-width: 1024px) {
    .sc-hero__slide--mobile  { display: none; }
    .sc-hero__slide--desktop { display: block; }
    .sc-hero--halves .sc-hero__slide--desktop {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--sc-hero-gap);
    }
    .sc-hero--halves.is-flip .sc-hero__half:first-child { order: 2; }
}

/* ---- چیدمان‌های ثابت: کاشی‌ها با نام جا (a = عکس اصلی) ----
   فقط کاشی‌های کوچک نسبت دارند؛ کاشی بزرگ ارتفاعش را از آن‌ها می‌گیرد، پس لبه‌ها همیشه هم‌ترازند.
   (در RTL ستون اول سمت راست است: عکس بزرگ راست؛ با is-flip چپ) */

.sc-hero__grid {
    display: grid;
    gap: var(--sc-hero-gap);
}
.sc-hero__grid > .sc-hero__tile { height: auto; }
.sc-hero__grid .sc-hero__img { position: absolute; inset: 0; }   /* عکس اندازهٔ ردیف‌ها را بزرگ نکند */
.sc-hero__t0 { grid-area: a; }
.sc-hero__t1 { grid-area: b; }
.sc-hero__t2 { grid-area: c; }
.sc-hero__t3 { grid-area: d; }
.sc-hero__t4 { grid-area: e; }

.sc-hero--mosaic .sc-hero__grid        { grid-template: auto auto / 2fr 1fr 1fr; grid-template-areas: "a b c" "a d e"; }
.sc-hero--mosaic.is-flip .sc-hero__grid { grid-template-columns: 1fr 1fr 2fr; grid-template-areas: "b c a" "d e a"; }
.sc-hero--mosaic .sc-hero__grid > :not(.sc-hero__t0) { aspect-ratio: 4 / 3; }

.sc-hero--big2 .sc-hero__grid        { grid-template: auto auto / 2fr 1fr; grid-template-areas: "a b" "a c"; }
.sc-hero--big2.is-flip .sc-hero__grid { grid-template-columns: 1fr 2fr; grid-template-areas: "b a" "c a"; }
.sc-hero--big2 .sc-hero__grid > :not(.sc-hero__t0) { aspect-ratio: 16 / 9; }

.sc-hero--cards3 .sc-hero__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "a b c"; }
.sc-hero--cards3 .sc-hero__grid > * { aspect-ratio: 4 / 3; }

.sc-hero--single .sc-hero__grid { grid-template-areas: "a"; }
.sc-hero--single .sc-hero__grid > * { aspect-ratio: var(--sc-hero-dratio, 3 / 1); }

.sc-hero__half {
    display: grid;
    gap: var(--sc-hero-gap);
    min-width: 0;
    aspect-ratio: var(--sc-hero-ratio);
}
.sc-hero__half--4 { grid-template: 1fr 1fr / 1fr 1fr; }

/* ---- هر عکس (کاشی) ---- */

.sc-hero__tile {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border-radius: var(--sc-hero-r);
    background: var(--sc-hero-bg);
    color: inherit;
    text-decoration: none;
}
.sc-hero__slide--mobile .sc-hero__tile { height: auto; }
.sc-hero__slide--mobile .sc-hero__img { position: absolute; inset: 0; }   /* هر عکسی در قاب موبایل، بدون کش آمدن قاب */
.sc-hero__tile picture { display: contents; }

.sc-hero__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .sc-hero__img { transition: transform .5s ease; }
    a.sc-hero__tile:hover .sc-hero__img { transform: scale(1.02); }
}

a.sc-hero__tile:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: -3px;
}

/* ---- فلش‌ها (فقط دسکتاپ با ماوس) ---- */

.sc-hero__arrow {
    --f: 1;
    position: absolute;
    z-index: 3;
    inset-block-start: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--sc-hero-arrow);
    height: var(--sc-hero-arrow);
    margin-block-start: calc(var(--sc-hero-arrow) / -2);
    padding: 0;
    border: 1px solid var(--gray-100);
    border-radius: 50%;
    background: var(--surface-base);
    color: var(--ink-primary);
    box-shadow: var(--shadow-s);
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.sc-hero__arrow svg { transform: scaleX(var(--f)); }
.sc-hero__arrow--prev { inset-inline-start: calc(var(--sc-hero-arrow) / -2); --f: -1; }
.sc-hero__arrow--next { inset-inline-end:   calc(var(--sc-hero-arrow) / -2); }
html[dir="rtl"] .sc-hero__arrow--prev { --f: 1; }
html[dir="rtl"] .sc-hero__arrow--next { --f: -1; }

.sc-hero__arrow:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sc-hero__arrow:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    .sc-hero__arrow { display: inline-flex; }
}

/* ---- دکمهٔ توقف حرکت خودکار ----
   ظاهر شلوغی ایجاد نمی‌کند؛ فقط وقتی با کیبورد/صفحه‌خوان به آن برسند دیده می‌شود (دسترس‌پذیری).
   با ماوس روی هیرو یا لمس آن، حرکت خودکار همین‌طور متوقف می‌شود. */

.sc-hero__bar {
    position: absolute;
    z-index: 4;
    inset-block-end: .875rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    border-radius: var(--border-radius-full);
    background: rgba(27, 27, 27, .8); background: color-mix(in srgb, var(--ink-primary) 80%, transparent);
    color: var(--on-dark);
    white-space: nowrap;
}
.sc-hero__bar:focus-within {
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    padding: .25rem;
}

.sc-hero__count { direction: ltr; unicode-bidi: isolate; }

.sc-hero__pp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.sc-hero__pp:focus-visible { outline: 2px solid var(--on-dark); outline-offset: 1px; }
.sc-hero__ico-play { display: none; }
.sc-hero.is-paused .sc-hero__ico-pause { display: none; }
.sc-hero.is-paused .sc-hero__ico-play  { display: block; }
.sc-hero:not(.has-auto) .sc-hero__pp { display: none; }

/* ---- نقطه‌ها (موبایل و تبلت): زیر بنر، وسط ---- */

.sc-hero__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-block-start: var(--space-xxs);
}
@media (min-width: 1024px) { .sc-hero__dots { display: none; } }

.sc-hero__dot {
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.sc-hero__dot::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: .5rem;
    height: .5rem;
    margin: -.25rem 0 0 -.25rem;
    border-radius: 50%;
    background: var(--gray-500);
    transition: background-color .2s ease, transform .2s ease;
}
.sc-hero__dot[aria-current="true"]::before { background: var(--brand); transform: scale(1.25); }
.sc-hero__dot:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 50%; }

/* وقتی فقط یک اسلاید است، کنترل‌ها لازم نیست */
.sc-hero.is-single .sc-hero__arrow,
.sc-hero.is-single .sc-hero__bar,
.sc-hero.is-single .sc-hero__dots { display: none; }

.sc-hero__notice {
    margin: var(--space-xs) 0 0;
    padding: var(--space-xs) var(--space-s);
    border: 1px dashed var(--ink-disabled);
    border-radius: var(--border-radius-m);
    color: var(--ink-secondary);
    font-size: .8125rem;
}

/* عنوان اصلی صفحه (H1): برای گوگل و صفحه‌خوان‌ها هست، روی صفحه دیده نمی‌شود.
   از display:none استفاده نشود؛ در آن حالت گوگل متن را نادیده می‌گیرد. */
.sc-hero-h1 {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =============================================================
   هیروی مقاله‌ای: هر کاشی یک کارت «روی عکس» از کامپوننت کارت مقاله
============================================================= */

.sc-hero .sc-post { --pc-r: var(--sc-hero-r); }
.sc-hero .sc-post__media picture { display: contents; }
.sc-hero__tile--post { background: var(--surface-dark); }
.sc-hero__tile--post .sc-post--overlay { height: 100%; aspect-ratio: auto; border-radius: inherit; }
.sc-hero__slide--mobile .sc-hero__tile--post { --pc-ov-fs: 1.125rem; }

@media (min-width: 1024px) {
    .sc-hero__tile--post            { --pc-ov-fs: 1.0625rem; }
    .sc-hero__tile--post .sc-post__body { padding: 1rem 1.125rem; }
    .sc-hero__tile--post.is-big     { --pc-ov-fs: clamp(1.375rem, .55rem + 1.2vw, 2rem); --pc-lines: 3; }
    .sc-hero__tile--post.is-big .sc-post__body { padding: clamp(1.25rem, .5rem + 1.2vw, 2rem); gap: .6rem; }
    .sc-hero__tile--post.is-big .sc-post__excerpt { max-width: 40em; }
    .sc-hero--cards3 .sc-hero__tile--post { --pc-ov-fs: 1.25rem; }
}

/* دسکتاپ: فاصلهٔ بین کارت‌ها کمتر (iHerb حدود ۱۲ تا ۲۰ پیکسل) */
@media (min-width: 1024px) {
    .sc-hero { --sc-hero-gap: 12px; }
}
