.hnf-banner-outer {
    all: initial !important;
    display: block !important;
    max-width: 1300px !important;
    margin: 20px auto !important;
    font-family: 'Yekan Bakh', Tahoma, sans-serif !important;
    clear: both !important;
    position: relative !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.hnf-banner-outer * {
    box-sizing: border-box;
}

/* --- سازگاری اجباری با صفحه‌سازهایی مثل WPBakery Grid Builder ---
   وقتی بنر داخل یک ردیف/ستون گرید صفحه‌ساز قرار می‌گیرد، آن ردیف/ستون گاهی
   بر اساس محتوای «در جریان معمول سند» ارتفاع خودش را محاسبه می‌کند. چون تمام
   محتوای داخلی بنر با position:absolute چیده شده (برای روی‌هم‌افتادن اسلایدها)،
   از دید آن محاسبه، بنر هیچ ارتفاعی ندارد و ردیف/ستون به ارتفاع صفر یا خیلی کم
   جمع می‌شود؛ نتیجه‌اش دقیقاً همین «فضای خالی» است. این قانون، هر ردیف/ستونی که
   بنر داخلش باشد را مجبور می‌کند خودش را کامل باز کند. */
.vc_row:has(.hnf-banner-outer),
.vc_row_inner:has(.hnf-banner-outer),
.vc_column:has(.hnf-banner-outer),
.vc_column-inner:has(.hnf-banner-outer),
.vc_column_inner:has(.hnf-banner-outer),
.wpb_wrapper:has(.hnf-banner-outer),
.w-post-elm:has(.hnf-banner-outer) {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
}

.hnf-banner-wrap {
    position: relative !important;
    width: 100% !important;
    height: var(--hnf-b-height, 480px) !important;
    min-height: var(--hnf-b-height, 480px) !important;
    border-radius: var(--hnf-b-radius, 20px) !important;
    overflow: hidden !important;
    background: var(--hnf-b-wrap-bg, #111) !important;
    display: block !important;
    float: none !important;
    z-index: auto;
}

.hnf-banner-slides {
    /* باید absolute باشد نه relative: چون spacer بالاتر یک عنصر واقعی در جریان سند
       با ارتفاع کامل است، اگر این عنصر relative (یعنی در جریان سند) می‌ماند، درست
       زیرِ spacer قرار می‌گرفت و کاملاً از کادر بیرون و نامرئی می‌شد - همین باگِ دقیقِ
       گزارش‌شده بود. */
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* عنصر نامرئی ولی «در جریان معمول سند» - برخلاف اسلایدهای position:absolute که از دید
   محاسبه‌ی ارتفاع طبیعی نامرئی‌اند، این عنصر با ارتفاع واقعی، مستقیماً به هر سیستم چیدمانی
   (گرید/فلکس صفحه‌ساز) اعلام می‌کند که این باکس واقعاً این‌قدر ارتفاع نیاز دارد. راه‌حلی
   مستقل از حدس‌زدن کلاس‌های صفحه‌ساز، برای رفع مشکل «جمع‌شدن ارتفاع به صفر». */
.hnf-banner-height-spacer {
    height: var(--hnf-b-height, 480px) !important;
    width: 1px !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.hnf-banner-slide {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.9s ease;
    margin: 0 !important;
    padding: 0 !important;
}

.hnf-banner-slide.hnf-banner-active {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 2 !important;
}

.hnf-banner-media {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    max-width: none !important;
}

.hnf-banner-color-fill {
    background-color: var(--hnf-b-overlay-color, #111) !important; /* fallback برای مرورگرهای بدون پشتیبانی color-mix */
    background-image: linear-gradient(135deg, var(--hnf-b-overlay-color, #111) 0%, color-mix(in srgb, var(--hnf-b-overlay-color, #111) 60%, black) 100%) !important;
}

.hnf-banner-transparent .hnf-banner-color-fill {
    background-color: transparent !important;
    background-image: none !important;
}

.hnf-banner-overlay {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: var(--hnf-b-overlay-opacity, 0.45) !important;
    z-index: 1 !important;
}

.hnf-banner-side-right .hnf-banner-overlay {
    background-image: linear-gradient(to left, var(--hnf-b-overlay-color, #000) 0%, transparent 65%) !important;
}
.hnf-banner-side-left .hnf-banner-overlay {
    background-image: linear-gradient(to right, var(--hnf-b-overlay-color, #000) 0%, transparent 65%) !important;
}

.hnf-banner-content {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 14px !important;
    width: min(58%, 640px) !important;
    padding: 40px !important;
    z-index: 3 !important;
    direction: rtl !important;
    margin: 0 !important;
    list-style: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.hnf-banner-content-right { right: 0 !important; left: auto !important; text-align: var(--hnf-b-align, right); }
.hnf-banner-content-left  { left: 0 !important; right: auto !important; text-align: var(--hnf-b-align, left); }

.hnf-banner-title {
    margin: 0 !important;
    font-size: var(--hnf-b-title-size, 42px) !important;
    color: var(--hnf-b-title-color, #ffffff) !important;
    font-weight: var(--hnf-b-title-weight, 800) !important;
    font-style: var(--hnf-b-title-style, normal) !important;
    line-height: 1.25;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.hnf-banner-desc {
    margin: 0 !important;
    font-size: var(--hnf-b-desc-size, 16px) !important;
    color: var(--hnf-b-desc-color, #f1f1f1) !important;
    font-style: var(--hnf-b-desc-style, normal) !important;
    line-height: 1.7;
    display: -webkit-box !important;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.hnf-banner-btn {
    align-self: flex-start;
    margin-top: 6px !important;
    padding: 12px 26px !important;
    border-radius: 999px !important;
    background: var(--hnf-b-btn-bg, #ffffff) !important;
    color: var(--hnf-b-btn-text, #1f1f1f) !important;
    font-weight: bold !important;
    font-size: 14px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    border: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.hnf-banner-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}

.hnf-banner-content-left .hnf-banner-btn { align-self: flex-start; }
.hnf-banner-content-right .hnf-banner-btn { align-self: flex-end; }

/* --- نشانگرهای نقطه‌ای (دش‌مانند شبیه Flow) --- */
.hnf-banner-dots {
    position: absolute !important;
    bottom: 18px !important;
    left: 24px !important;
    right: 24px !important;
    display: flex !important;
    gap: 6px;
    z-index: 4 !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.hnf-banner-dot {
    flex: 1 1 0;
    max-width: 46px;
    height: 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.35);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hnf-banner-dot-active {
    background: rgba(255,255,255,0.95);
}

/* --- واکنش‌گرا: موبایل --- */
@media (max-width: 599px) {
    .hnf-banner-content {
        width: 100%;
        padding: 24px;
        background: linear-gradient(to top, rgba(0,0,0,0.55), transparent 70%);
    }
    .hnf-banner-title { font-size: calc(var(--hnf-b-title-size, 42px) * 0.62); }
    .hnf-banner-desc  { font-size: calc(var(--hnf-b-desc-size, 16px) * 0.9); -webkit-line-clamp: 2; }
    .hnf-banner-overlay { background: linear-gradient(to top, rgba(0,0,0,0.6), transparent 60%); }
}

/* --- نمایش واکنش‌گرا بر اساس نوع دستگاه --- */
@media (max-width: 599px) {
    .hnf-hide-mobile { display: none !important; }
}
@media (min-width: 600px) and (max-width: 991px) {
    .hnf-hide-tablet { display: none !important; }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .hnf-hide-laptop { display: none !important; }
}
@media (min-width: 1200px) {
    .hnf-hide-desktop { display: none !important; }
}

/* ============================================================
   چیدمان «دو ستونه» (split): تصویر یک نیمه، متن نیمه‌ی دیگر،
   بدون روی‌هم‌افتادن و بدون لایه‌ی تیره‌ی خوانایی
   ============================================================ */
.hnf-banner-layout-split .hnf-banner-overlay,
.hnf-banner-layout-split .hnf-banner-gallery-dots {
    display: none !important;
}

.hnf-banner-layout-split .hnf-banner-media,
.hnf-banner-layout-split .hnf-banner-gallery {
    width: 50% !important;
}

.hnf-banner-layout-split.hnf-banner-side-right .hnf-banner-media,
.hnf-banner-layout-split.hnf-banner-side-right .hnf-banner-gallery { left: 0 !important; right: auto !important; }
.hnf-banner-layout-split.hnf-banner-side-left .hnf-banner-media,
.hnf-banner-layout-split.hnf-banner-side-left .hnf-banner-gallery { right: 0 !important; left: auto !important; }

.hnf-banner-layout-split .hnf-banner-content {
    width: 50% !important;
    background: var(--hnf-b-split-bg, #f8f8f8) !important;
    justify-content: center;
}

.hnf-banner-layout-split .hnf-banner-desc {
    -webkit-line-clamp: 4;
}

@media (max-width: 599px) {
    .hnf-banner-layout-split .hnf-banner-media,
    .hnf-banner-layout-split .hnf-banner-content,
    .hnf-banner-layout-split .hnf-banner-gallery {
        width: 100% !important;
        height: 50% !important;
    }
    .hnf-banner-layout-split .hnf-banner-content { top: auto !important; bottom: 0 !important; padding: 16px; }
    .hnf-banner-layout-split .hnf-banner-media,
    .hnf-banner-layout-split .hnf-banner-gallery { top: 0 !important; bottom: auto !important; left: 0 !important; right: 0 !important; }
}

/* ============================================================
   انواع افکت گذار بین اسلایدها
   پیش‌فرض «fade» از قوانین hnf-banner-slide/active بالا می‌آید؛
   بقیه‌ی حالت‌ها اینجا آن رفتار را برای حالت غیرفعال/فعال تغییر می‌دهند
   ============================================================ */

/* لغزشی (Slide) */
.hnf-banner-transition-slide .hnf-banner-slide {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(100%);
    transition: transform 0.7s cubic-bezier(.4,0,.2,1);
}
.hnf-banner-transition-slide .hnf-banner-slide.hnf-banner-active {
    transform: translateX(0);
    z-index: 2 !important;
}

/* مکعبی (Cube) - چرخش سه‌بعدی سبک */
.hnf-banner-transition-cube .hnf-banner-slides {
    perspective: 1600px;
}
.hnf-banner-transition-cube .hnf-banner-slide {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: rotateY(35deg) scale(0.94);
    transform-origin: right center;
    transition: transform 0.8s ease, opacity 0.8s ease, visibility 0.8s;
}
.hnf-banner-transition-cube .hnf-banner-slide.hnf-banner-active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: rotateY(0deg) scale(1);
    z-index: 2 !important;
}

/* دایره‌ای / نقطه‌ای (Circle Reveal) */
.hnf-banner-transition-circle .hnf-banner-slide {
    opacity: 1 !important;
    visibility: hidden !important;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0.9s ease, visibility 0.9s;
}
.hnf-banner-transition-circle .hnf-banner-slide.hnf-banner-active {
    visibility: visible !important;
    clip-path: circle(75% at 50% 50%);
    z-index: 2 !important;
}

/* ============================================================
   اسلایدشوی گالری داخل هر اسلاید (چند تصویر برای یک پست)
   ============================================================ */
.hnf-banner-gallery {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.hnf-banner-gallery-img {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 1s ease;
}

.hnf-banner-gallery-img.hnf-banner-gallery-active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ============================================================
   حالت «هوشمند» اندازه‌گیری بر اساس نسبت ابعاد تصویر (فقط اسلایدشو):
   به‌جای ارتفاع ثابت px برای هر دستگاه، کادر با عرض کامل و نسبت ابعاد
   مشخص‌شده، ارتفاعش را خودش و به‌صورت واقعاً واکنش‌گرا حساب می‌کند - پس
   اگر تصاویر همه یک نسبت ثابت داشته باشند (مثلاً ۴:۳)، هیچ‌وقت برش
   نمی‌خورند، در هیچ سایز صفحه‌ای.
   ============================================================ */
.hnf-banner-aspect-mode .hnf-banner-wrap {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: var(--hnf-b-aspect-ratio, 4 / 3) !important;
}

.hnf-banner-aspect-mode .hnf-banner-height-spacer {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: var(--hnf-b-aspect-ratio, 4 / 3) !important;
}
