/* ==========================================================================
   Hero Carousel — اسلایدشوی صفحه‌ی اصلی (بدون وابستگی خارجی)
   متغیرهای قابل‌تنظیم در ابتدای فایل؛ پشتیبانی RTL/LTR با data-dir
   ========================================================================== */
.hero-carousel {
    /* رنگ‌ها و اندازه‌ها */
    --hc-accent: var(--primary, #8C2F39);
    --hc-text-light: #fff;
    --hc-text-dark: #2a1a1f;
    --hc-ctrl-bg: rgba(255, 255, 255, .14);
    --hc-ctrl-bg-hover: rgba(255, 255, 255, .3);
    --hc-ctrl-size: 46px;
    --hc-anim: 600ms;
    --hc-ease: cubic-bezier(.22, .61, .36, 1);
    --hc-hd: 100;   /* ارتفاع دسکتاپ (درصد ارتفاع صفحه) */
    --hc-hm: 70;    /* ارتفاع موبایل */

    position: relative;
    isolation: isolate;
    background: #1b1215;
    color: var(--hc-text-light);
}

/* ---- قاب و مسیر اسلایدها ---- */
.hc-viewport {
    position: relative;
    overflow: hidden;
    height: 70vh; height: calc(var(--hc-hm) * 1svh);
    min-height: 380px;
    touch-action: pan-y;           /* اسکرول عمودی آزاد، افقی برای swipe */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.hc-viewport.is-dragging { cursor: grabbing; }
@media (min-width: 768px) {
    .hc-viewport { height: 100vh; height: calc(var(--hc-hd) * 1svh); min-height: 460px; }
}

.hc-track {
    display: flex;
    height: 100%;
    will-change: transform;
    transition: transform var(--hc-anim) var(--hc-ease), opacity .3s ease;
}
.hc-track.is-dragging { transition: none; }
.hc-track.is-fading { opacity: 0; transition: opacity .3s ease; }

.hc-slide { position: relative; flex: 0 0 100%; min-width: 0; height: 100%; overflow: hidden; }

/* ---- تصویر (picture/img واقعی برای سئو) ---- */
.hc-media, .hc-media img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hc-media img { object-fit: cover; -webkit-user-drag: none; pointer-events: none; }

/* ---- لایه‌ی گرادیانی روی تصویر ---- */
.hc-overlay { position: absolute; inset: 0; pointer-events: none; }
.hc-slide[data-theme="light"] .hc-overlay {
    background: linear-gradient(to top, rgba(0,0,0, calc(var(--hc-ov) * 1.15)), rgba(0,0,0, calc(var(--hc-ov) * .7)));
}
.hc-slide[data-theme="dark"] .hc-overlay {
    background: linear-gradient(to top, rgba(255,255,255, calc(var(--hc-ov) * 1.15)), rgba(255,255,255, calc(var(--hc-ov) * .7)));
}

/* ---- محتوای متنی ---- */
.hc-content {
    position: relative; z-index: 2; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 14px; text-align: center;
    padding: 72px clamp(20px, 8vw, 120px) 96px;
    max-width: 1200px; margin-inline: auto;
}
.hc-slide[data-align="start"] .hc-content { align-items: flex-start; text-align: start; }
.hc-slide[data-align="end"]   .hc-content { align-items: flex-end;   text-align: end; }
.hc-slide[data-theme="light"] .hc-content { color: var(--hc-text-light); text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.hc-slide[data-theme="dark"]  .hc-content { color: var(--hc-text-dark);  text-shadow: none; }

.hc-title {
    margin: 0; font-family: 'Lalezar', 'Vazirmatn', sans-serif; font-weight: 400;
    font-size: clamp(30px, 5.2vw, 64px); line-height: 1.45; max-width: 18ch;
}
.hc-sub { margin: 0; font-size: clamp(15px, 1.9vw, 21px); line-height: 2; max-width: 52ch; opacity: .96; }

.hc-cta {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
    padding: 13px 34px; border-radius: 999px; font-weight: 700; font-size: 15.5px; text-decoration: none; text-shadow: none;
    background: var(--hc-accent); color: #fff; border: 2px solid var(--hc-accent);
    box-shadow: 0 12px 28px -12px rgba(0,0,0,.6);
    transition: transform .25s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
}
.hc-cta:hover { background: #fff; color: var(--hc-accent); transform: translateY(-2px); box-shadow: 0 16px 32px -14px rgba(0,0,0,.7); }

/* ---- انیمیشن ورود (fade + slide از پایین، ۶۰۰ms) و خروج (fade out) ---- */
.hc-content > * { opacity: 0; }
.hc-slide:not(.is-active) .hc-content { opacity: 0; transition: opacity .35s ease; }
.hc-slide.is-active .hc-content > * { animation: hcUp var(--hc-anim) var(--hc-ease) both; }
.hc-slide.is-active .hc-content > :nth-child(2) { animation-delay: .1s; }
.hc-slide.is-active .hc-content > :nth-child(3) { animation-delay: .2s; }
@keyframes hcUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* ---- کنترل‌ها ---- */
.hc-btn {
    appearance: none; border: 0; cursor: pointer; color: #fff; background: var(--hc-ctrl-bg);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    width: var(--hc-ctrl-size); height: var(--hc-ctrl-size); border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    border: 1px solid rgba(255,255,255,.28);
    transition: background .2s ease, transform .2s ease, opacity .2s ease;
}
.hc-btn:hover { background: var(--hc-ctrl-bg-hover); }
.hc-btn:disabled { opacity: .35; cursor: default; }
.hc-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.hc-arrow { position: absolute; top: 50%; z-index: 4; transform: translateY(-50%); }
.hc-arrow:hover { transform: translateY(-50%) scale(1.07); }
.hc-prev { inset-inline-start: clamp(10px, 2vw, 28px); }
.hc-next { inset-inline-end:   clamp(10px, 2vw, 28px); }
/* جهت آیکون‌ها: آیکون پایه به چپ اشاره می‌کند */
.hero-carousel[data-dir="rtl"] .hc-prev svg { transform: scaleX(-1); }
.hero-carousel[data-dir="ltr"] .hc-next svg { transform: scaleX(-1); }

.hc-bottom {
    position: absolute; z-index: 4; inset-inline: 0; bottom: 0;
    padding: 0 clamp(14px, 3vw, 36px) 20px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.hc-progress { width: min(360px, 70%); height: 3px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; }
.hc-progress i { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: right center; }
.hero-carousel[data-dir="ltr"] .hc-progress i { transform-origin: left center; }
.hc-row { display: flex; align-items: center; gap: 14px; }
.hc-dots { display: flex; gap: 8px; align-items: center; }
.hc-dot {
    appearance: none; border: 0; padding: 0; cursor: pointer; width: 10px; height: 10px; border-radius: 10px;
    background: rgba(255,255,255,.5); transition: width .3s ease, background .3s ease;
    /* ناحیه‌ی لمس بزرگ‌تر بدون تغییر ظاهر */
    position: relative;
}
.hc-dot::after { content: ''; position: absolute; inset: -10px -4px; }
.hc-dot:hover { background: rgba(255,255,255,.85); }
.hc-dot[aria-current="true"] { width: 30px; background: #fff; }
.hc-pause { --hc-ctrl-size: 36px; }
.hc-pause svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.hc-pause .i-play { display: none; }
.hc-pause[aria-pressed="true"] .i-play { display: block; }
.hc-pause[aria-pressed="true"] .i-pause { display: none; }

/* ---- دسترس‌پذیری ---- */
.hero-carousel :focus { outline: none; }
.hero-carousel :focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--hc-accent); }
.hero-carousel:focus-visible { outline-offset: -6px; }
.hc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 575px) {
    .hc-arrow { display: none; }              /* روی موبایل swipe جایگزین فلش است */
    .hc-content { padding: 56px 22px 92px; }
}

/* ---- احترام به کاهش حرکت ---- */
@media (prefers-reduced-motion: reduce) {
    .hc-track, .hc-track.is-fading { transition: none; }
    .hc-slide.is-active .hc-content > * { animation: none; opacity: 1; }
    .hc-slide:not(.is-active) .hc-content { transition: none; }
    .hc-cta, .hc-btn, .hc-dot { transition: none; }
}
