/**
 * ECOIA — Hero Section (Full Redesign)
 * Cinematic Dark Luxury
 * Video BG | Grain | Labels | SplitType Title | Marquee | Stats Strip
 */

/* ════════════════════════════════════════════════════════════
   ۱. Hero Wrapper
════════════════════════════════════════════════════════════ */

.hero {
    position:   relative;
    width:      100%;
    height:     100vh;
    min-height: 600px;
    overflow:   hidden;
    background: var(--bg-void, #070707);
    display:    flex;
    flex-direction: column;
    /* header fixed روی بالا است — بدون padding-top */
}

/* ════════════════════════════════════════════════════════════
   ۲. لایه ① — Video Background
════════════════════════════════════════════════════════════ */

.hero__video-wrap {
    position: absolute;
    inset:    0;
    z-index:  1;
    overflow: hidden;
}

.hero__video {
    width:      100%;
    height:     100%;
    object-fit: cover;
    object-position: center center;
    /* کاهش روشنایی + افزایش کنتراست برای تم تاریک */
    filter:     brightness(0.4) contrast(1.1);
    /* کمی بزرگ‌تر برای parallax بدون لبه سفید */
    transform:  scale(1.04);
    will-change: transform;
}

/* Fallback: اگر ویدیو بارگذاری نشد، poster محلی */
.hero__video-wrap::after {
    content:    '';
    position:   absolute;
    inset:      0;
    background-image:    url('/assets/images/hero/hero-poster.jpg');
    background-size:     cover;
    background-position: center;
    filter:     brightness(0.4) contrast(1.1);
    z-index:    -1;
}

/* ════════════════════════════════════════════════════════════
   ۳. لایه ② — Gradient Overlay (پایین تاریک‌تر)
════════════════════════════════════════════════════════════ */

.hero__overlay {
    position: absolute;
    inset:    0;
    z-index:  2;
    background: linear-gradient(
        to bottom,
        rgba(7, 7, 7, 0.25) 0%,
        rgba(7, 7, 7, 0.45) 45%,
        rgba(7, 7, 7, 0.92) 85%,
        rgba(7, 7, 7, 1.00) 100%
    );
    pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   ۴. لایه ③ — Grain Texture (بافت لوکس، خیلی ظریف)
════════════════════════════════════════════════════════════ */

.hero__grain {
    position:           absolute;
    inset:              0;
    z-index:            3;
    background-image:   url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-repeat:  repeat;
    background-size:    200px 200px;
    opacity:            0.030;
    pointer-events:     none;
    mix-blend-mode:     overlay;
}

/* ════════════════════════════════════════════════════════════
   ۵. لایه ④ — محتوای اصلی Hero
   کمی بالاتر از مرکز عمودی (translateY -5%)
════════════════════════════════════════════════════════════ */

.hero__body {
    position:        absolute;
    inset:           0;
    z-index:         10;
    display:         flex;
    align-items:     center;
    justify-content: center;
    /* بالاتر از مرکز — فضای بیشتر برای stats strip پایین */
    padding-bottom:  clamp(80px, 12vh, 140px);
    padding-top:     var(--header-height, 80px);
}

.hero__content {
    width:      100%;
    max-width:  var(--container, min(1280px, calc(100% - 48px)));
    margin:     0 auto;
    padding:    0 var(--container-pad, 24px);
    text-align: center;
}

/* ─── Label بالایی ───────────────────────────────────────── */

.hero__label {
    display:         inline-flex;
    flex-direction:  column;
    align-items:     center;
    gap:             12px;
    margin-bottom:   clamp(24px, 3vh, 36px);

    /* GSAP: ابتدا invisible */
    opacity: 0;
}

.hero__label-text {
    font-family:    var(--font-body-en, 'DM Sans', sans-serif);
    font-size:      var(--text-label, 11px);
    font-weight:    500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color:          var(--gold, #C8A951);
    line-height:    1;
}

/* خط طلایی ۴۰px که رشد می‌کند — GSAP scaleX 0→1 */
.hero__label-line {
    display:          block;
    width:            40px;
    height:           1px;
    background:       var(--gold, #C8A951);
    transform:        scaleX(0);
    transform-origin: center;
    box-shadow:       0 0 8px rgba(200, 169, 81, 0.5);
}

/* ─── عنوان فارسی — SplitType Target ────────────────────── */

.hero__title {
    font-family:   var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:     clamp(40px, 6vw, 84px);
    font-weight:   900;
    line-height:   1.2;
    letter-spacing: var(--tracking-tight, -0.02em);
    color:         var(--text-primary, #F0EDE8);
    margin-bottom: clamp(20px, 2.5vh, 32px);

    /* overflow hidden برای SplitType line reveal */
    overflow: hidden;
}

/* هر word که SplitType می‌سازد */
.hero__title .word {
    display:        inline-block;
    overflow:       hidden;
    vertical-align: bottom;
    /* GSAP: y: "110%" → "0%" */
}

/* ─── Tagline — با border طلایی سمت راست ────────────────── */

.hero__tagline {
    display:       inline-block;
    font-family:   var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:     clamp(15px, 1.8vw, 20px);
    font-weight:   300;
    color:         var(--text-secondary, #9A9590);
    letter-spacing: 0.02em;
    line-height:   1.5;
    border-right:  3px solid var(--gold, #C8A951);
    padding-right: 20px;
    margin-bottom: clamp(32px, 4vh, 48px);

    /* GSAP: opacity 0 → 1 با delay */
    opacity: 0;
}

/* ─── CTA Buttons ────────────────────────────────────────── */

.hero__actions {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             clamp(12px, 2vw, 20px);
    flex-wrap:       wrap;

    /* GSAP: opacity 0 → 1 */
    opacity: 0;
}

/* ── دکمه اصلی — طلایی premium ── */
.hero-btn--primary {
    display:         inline-flex;
    align-items:     center;
    gap:             10px;
    padding:         clamp(14px, 2vh, 18px) clamp(28px, 3vw, 44px);
    background:      linear-gradient(135deg, #D4B860 0%, #A07828 100%);
    color:           #0A0800;
    font-family:     var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:       clamp(14px, 1.5vw, 16px);
    font-weight:     700;
    letter-spacing:  0.01em;
    border:          none;
    border-radius:   var(--radius-md, 4px);
    text-decoration: none;
    cursor:          none;
    white-space:     nowrap;
    position:        relative;
    overflow:        hidden;
    box-shadow:      0 4px 24px rgba(200,169,81,0.22),
                     inset 0 1px 0 rgba(255,255,255,0.18);
    transition:      transform 0.35s cubic-bezier(0.23,1,0.32,1),
                     box-shadow 0.35s cubic-bezier(0.23,1,0.32,1),
                     background 0.35s ease;
}

.hero-btn--primary:hover {
    background: linear-gradient(135deg, #E8D580 0%, #C8A951 55%, #8B6914 100%);
    transform:  translateY(-2px) scale(1.015);
    box-shadow: 0 10px 48px rgba(200,169,81,0.42),
                0 3px 16px rgba(200,169,81,0.22),
                inset 0 1px 0 rgba(255,255,255,0.22);
    color:           #0A0800;

}

.hero-btn--primary:active {
    transform:  translateY(0) scale(0.985);
    box-shadow: 0 4px 16px rgba(200,169,81,0.25);
    transition-duration: 0.12s;
}

/* shimmer sweep */
.hero-btn--primary::after {
    content:    '';
    position:   absolute;
    top:        -10%;
    right:      -90%;
    width:      55%;
    height:     120%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255,255,255,0.22) 50%,
        transparent 100%
    );
    transform:  skewX(-18deg);
    transition: right 0.55s cubic-bezier(0.23,1,0.32,1);
    pointer-events: none;
}
.hero-btn--primary:hover::after { right: 120%; }

/* ── دکمه ثانویه — glass premium ── */
.hero-btn--secondary {
    display:          inline-flex;
    align-items:      center;
    gap:              10px;
    padding:          clamp(13px, 2vh, 17px) clamp(28px, 3vw, 44px);
    background:       rgba(255,255,255,0.04);
    color:            rgba(240,237,232,0.90);
    font-family:      var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:        clamp(14px, 1.5vw, 16px);
    font-weight:      500;
    letter-spacing:   0.01em;
    border:           1px solid rgba(200,169,81,0.28);
    border-radius:    var(--radius-md, 4px);
    text-decoration:  none;
    cursor:           none;
    white-space:      nowrap;
    position:         relative;
    overflow:         hidden;
    backdrop-filter:  blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow:       inset 0 0 0 0 rgba(200,169,81,0);
    transition:       border-color 0.35s ease,
                      color        0.35s ease,
                      background   0.35s ease,
                      transform    0.35s cubic-bezier(0.23,1,0.32,1),
                      box-shadow   0.35s ease;
}

/* glow fill — scale in from center */
.hero-btn--secondary::before {
    content:    '';
    position:   absolute;
    inset:      0;
    background: radial-gradient(ellipse at center,
                    rgba(200,169,81,0.14) 0%,
                    transparent 70%);
    opacity:    0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.hero-btn--secondary:hover {
    border-color: rgba(200,169,81,0.60);
    color:        var(--gold-light, #E8D5A0);
    background:   rgba(200,169,81,0.07);
    transform:    translateY(-2px);
    box-shadow:   0 0 24px rgba(200,169,81,0.14),
                  inset 0 0 0 1px rgba(200,169,81,0.10);
}
.hero-btn--secondary:hover::before { opacity: 1; }

.hero-btn--secondary:active {
    transform:         translateY(0);
    transition-duration: 0.12s;
}

/* ════════════════════════════════════════════════════════════
   ۶. لایه ⑤ — Scroll Indicator
════════════════════════════════════════════════════════════ */

.hero__scroll {
    position:        absolute;
    bottom:          clamp(100px, 13vh, 140px);  /* بالاتر از marquee */
    left:            50%;
    transform:       translateX(-50%);
    z-index:         10;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    gap:             10px;
    text-decoration: none;
    cursor:          none;

    /* GSAP */
    opacity: 0;
}

.hero__scroll-label {
    font-family:    var(--font-body-en, 'DM Sans', sans-serif);
    font-size:      9px;
    font-weight:    500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color:          var(--text-muted, #4A4845);
    line-height:    1;
}

/* خط عمودی متحرک */
.hero__scroll-line {
    width:            1px;
    height:           60px;
    position:         relative;
    background:       rgba(200, 169, 81, 0.12);
    overflow:         hidden;
}

.hero__scroll-line::after {
    content:          '';
    position:         absolute;
    top:              -100%;
    left:             0;
    width:            100%;
    height:           100%;
    background:       linear-gradient(
        to bottom,
        transparent 0%,
        var(--gold, #C8A951) 50%,
        transparent 100%
    );
    animation:        scroll-line-anim 2s ease-in-out infinite;
}

@keyframes scroll-line-anim {
    0%   { top: -100%; opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { top: 100%;  opacity: 0; }
}

/* ════════════════════════════════════════════════════════════
   ۷. لایه ⑥ — Marquee نوار متحرک (RTL-friendly: چپ به راست)
════════════════════════════════════════════════════════════ */

.hero__marquee {
    position:    absolute;
    bottom:      0;
    left:        0;
    right:       0;
    z-index:     15;
    height:      clamp(44px, 5.5vh, 56px);
    background:  rgba(200, 169, 81, 0.05);
    border-top:  1px solid rgba(200, 169, 81, 0.14);
    overflow:    hidden;
    display:     flex;
    align-items: center;
    /* LTR layout برای coordinate system یکنواخت — جهت حرکت از animation کنترل می‌شود */
    direction:   ltr;
}

.hero__marquee-track {
    display:            flex;
    align-items:        center;
    white-space:        nowrap;
    direction:          ltr;
    flex-shrink:        0;
    animation:          marquee-rtl 28s linear infinite;
    will-change:        transform;
    /* جلوگیری از flash در لحظه reset انیمیشن */
    backface-visibility: hidden;
}

/* pause روی hover */
.hero__marquee:hover .hero__marquee-track {
    animation-play-state: paused;
}

.hero__marquee-item {
    display:        inline-flex;
    align-items:    center;
    flex-shrink:    0;
    font-family:    var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:      clamp(11px, 1.2vw, 14px);
    font-weight:    600;
    letter-spacing: 0.04em;
    color:          rgba(200, 169, 81, 0.70);
    line-height:    1;
}

/* نقطه جداکننده — margin متقارن */
.hero__marquee-sep {
    display:       inline-block;
    width:         4px;
    height:        4px;
    border-radius: 50%;
    background:    rgba(200, 169, 81, 0.45);
    flex-shrink:   0;
    margin:        0 clamp(20px, 3vw, 36px);
    vertical-align: middle;
}

/* RTL loop: از -25% به 0% — track به راست حرکت می‌کند
   متن از سمت چپ وارد می‌شود و به راست خارج می‌شود (مناسب فارسی)
   -25% = یک ست کامل به چپ viewport، در 0% ست بعدی جایش را می‌گیرد → seamless */
@keyframes marquee-rtl {
    0%   { transform: translateX(-25%); }
    100% { transform: translateX(0%);   }
}

/* ════════════════════════════════════════════════════════════
   ۸. Stats Strip — روی مرز Hero (margin-top: -90px)
════════════════════════════════════════════════════════════ */

.stats-strip {
    position:   relative;
    z-index:    20;
    margin-top: -90px;
}

.stats-strip__grid {
    display:               grid;
    grid-template-columns: repeat(4, 1fr);
    gap:                   10px;
}

/* کارت آمار */
.stat-card {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    background:      rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border:          1px solid var(--border-gold, rgba(200,169,81,0.18));
    border-top:      2px solid var(--gold, #C8A951);
    padding:         clamp(16px, 2vh, 24px) clamp(16px, 2vw, 24px);
    position:        relative;
    overflow:        hidden;
    transition:      background var(--transition-base, 350ms),
                     border-color var(--transition-base, 350ms);

    /* GSAP: opacity 0 → 1, y: 20 → 0, stagger */
    opacity: 0;
}

.stat-card:hover {
    background:   rgba(14, 14, 14, 0.96);
    border-color: rgba(200, 169, 81, 0.35);
}

/* نقطه نورانی بالای کارت روی hover */
.stat-card::before {
    content:    '';
    position:   absolute;
    top:        0;
    left:       50%;
    transform:  translateX(-50%);
    width:      60%;
    height:     1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(200, 169, 81, 0.5),
        transparent
    );
    opacity:    0;
    transition: opacity var(--transition-base, 350ms);
}

.stat-card:hover::before {
    opacity: 1;
}

/* عدد — Vazirmatn bold */
.stat-card__number {
    display:         flex;
    align-items:     baseline;
    justify-content: center;
    gap:             3px;
    margin-bottom:   6px;
}

.stat-card__value {
    font-family:          var(--font-fa, 'Vazirmatn', sans-serif);
    font-style:           normal;
    font-weight:          700;
    font-size:            clamp(30px, 3.2vw, 44px);
    color:                var(--gold-light, #E8D5A0);
    line-height:          1;
    letter-spacing:       -0.03em;
    font-variant-numeric: tabular-nums;
}

.stat-card__suffix {
    font-family:  var(--font-fa, 'Vazirmatn', sans-serif);
    font-style:   normal;
    font-weight:  700;
    font-size:    clamp(16px, 1.8vw, 22px);
    color:        var(--gold, #C8A951);
    line-height:  1;
    align-self:   flex-start;
    margin-top:   4px;
    letter-spacing: -0.02em;
}

/* label فارسی */
.stat-card__label {
    font-family: var(--font-fa, 'Vazirmatn', sans-serif);
    font-size:   clamp(11px, 1.1vw, 13px);
    font-weight: 400;
    color:       var(--text-secondary, #9A9590);
    line-height: 1.4;
    text-align:  center;
}

/* ════════════════════════════════════════════════════════════
   HERO PREMIUM UPGRADES
════════════════════════════════════════════════════════════ */

/* Grain texture — کمی پررنگ‌تر برای جلوه سینماتیک */
.hero__grain {
    opacity: 0.040;
}

/* Bottom fade: از محتوا به stats strip */
.hero__overlay {
    background: linear-gradient(
        to bottom,
        rgba(7, 7, 7, 0.18) 0%,
        rgba(7, 7, 7, 0.38) 35%,
        rgba(7, 7, 7, 0.80) 72%,
        rgba(7, 7, 7, 0.97) 90%,
        rgba(7, 7, 7, 1.00) 100%
    );
}

/* Stat card top border: gold با glow */
.stat-card {
    border-top: 2px solid var(--gold, #C8A951);
    box-shadow: 0 -1px 0 0 rgba(200,169,81,0.25),
                0 2px 32px rgba(0,0,0,0.5);
}

/* Hero label text: uppercase refined */
.hero__label-text {
    letter-spacing: 0.30em;
    font-size:      10px;
}

/* Tagline border: برق‌دار */
.hero__tagline {
    border-right-width: 2px;
    border-image: linear-gradient(to bottom,
        transparent,
        var(--gold, #C8A951) 25%,
        var(--gold, #C8A951) 75%,
        transparent) 1;
    padding-right: 22px;
}

/* Stats: value alignment */
.stat-card__number {
    gap: 2px;
}

/* ════════════════════════════════════════════════════════════
   GSAP Fallback — اگر JS لود نشود عناصر پنهان نمانند
   body.gsap-ready توسط gsap-init.js ست می‌شود (init → classList.add)
   اگر این کلاس نباشد یعنی GSAP لود نشده → عناصر رو نشان بده
════════════════════════════════════════════════════════════ */

body:not(.gsap-ready) .hero__label,
body:not(.gsap-ready) .hero__tagline,
body:not(.gsap-ready) .hero__actions,
body:not(.gsap-ready) .hero__scroll,
body:not(.gsap-ready) .stat-card {
    opacity:   1 !important;
    transform: none !important;
}

/* ════════════════════════════════════════════════════════════
   ۹. Responsive
════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .stats-strip__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card:nth-child(3) {
        border-left: 1px solid var(--border-gold);
    }

    .stats-strip {
        margin-top: -60px;
    }
}

@media (max-width: 768px) {
    .hero__title {
        font-size: clamp(32px, 8vw, 56px);
    }

    .hero__tagline {
        font-size: 15px;
    }

    .hero__actions {
        flex-direction: column;
        align-items:    stretch;
        max-width:      320px;
        margin:         0 auto;
    }

    .hero-btn--primary,
    .hero-btn--secondary {
        width:          100%;
        justify-content: center;
        padding:        16px 28px;
    }

    .stats-strip__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-strip {
        margin-top: -40px;
    }

    .hero__video {
        transform: scale(1.1);  /* کمی بیشتر برای پوشش عمودی موبایل */
    }
}

@media (max-width: 480px) {
    .hero__marquee {
        display: none;  /* موبایل کوچک: حذف marquee */
    }

    .stats-strip {
        margin-top: 0;
    }

    .stats-strip__grid {
        grid-template-columns: 1fr 1fr;
    }
}
