/* =============================================================================
   هیروی صفحه‌ی اصلی — ۴ کارت سه‌بعدی خدمات (components/sections/home/hero.php)
   -----------------------------------------------------------------------------
   ایده: هر خدمت یک «کاشی» روشن با قاب طلایی که مدال سرمه‌ای-طلایی آیکونش
   از سطح کارت بیرون زده (translateZ). دسکتاپ: کارت به سمت موس کج می‌شود؛
   گوشی: ۲×۲ جمع‌وجور (نصف ارتفاع ستون ۴تایی قبلی) + برق طلایی آرام.
   فقط transform/opacity متحرک‌اند. بدون JS و با reduce-motion کامل و ثابت است.
   پیشوند کلاس: .azh
   ========================================================================== */

/* ── بنر پانورامای تمام‌عرض (۱۴۰۵/۰۸/۲۸) — تصویر ۱۹۱۴×۸۲۲ ساخت ChatGPT.
      ۳۰٪ پایین تصویر نوار سرمه‌ای خالی است و در ≥۱۲۸۰ کارت‌ها روی همان می‌نشینند.
      گوشی: قاب ۳:۲ و تصویر ۱۲۵٪ ارتفاع تا نوار خالی پایین بیرون بماند و صحنه درشت شود. ── */
.azh-stage {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin-inline: auto;
}
.azh-frame { position: relative; overflow: hidden; background: #141B2E; }
.azh-stage-img { display: block; width: 100%; height: auto; max-width: none; }

@media (max-width: 767px) {
    .azh-frame { aspect-ratio: 3 / 2; }
    .azh-stage-img {
        position: absolute;
        top: 0;
        left: 62%;
        height: 125%;
        width: auto;
        transform: translateX(-50%);
    }
}

@media (max-width: 1279px) {
    .azh-stage .azh { margin-inline: auto; padding-inline: 16px; }
}

/* فاصله‌ی عنوان زیر بنر — با padding، چون pages/home.php حاشیه‌ی کانتینر هیرو را صفر می‌کند */
.azh-head { padding-top: 36px; }
@media (min-width: 1024px) { .azh-head { padding-top: 48px; } }

/* ── حس سه‌بعدی روی خود صفحه: کج‌شدن آرام بنر با موس (دسکتاپ) + برق طلایی یک‌باره ── */
.azh-frame { perspective: 1400px; }
.azh-stage-img {
    transform-origin: 50% 60%;
    transition: transform .9s cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
}
@media (min-width: 1280px) {
    .azh-stage--tilt .azh-stage-img {
        transform: scale(1.035) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) translate3d(var(--px, 0), var(--py, 0), 0);
    }
}
.azh-frame::after {
    content: "";
    position: absolute;
    inset: -10% auto -10% 0;
    width: 28%;
    background: linear-gradient(100deg, transparent 0%, rgba(233, 210, 154, 0) 25%, rgba(233, 210, 154, .28) 50%, rgba(233, 210, 154, 0) 75%, transparent 100%);
    transform: translateX(-140%) skewX(-16deg);
    pointer-events: none;
    mix-blend-mode: screen;
    animation: azh-stage-sheen 2.4s cubic-bezier(.4, 0, .2, 1) .6s 1 both;
}
@keyframes azh-stage-sheen {
    to { transform: translateX(480%) skewX(-16deg); }
}

@media (min-width: 1280px) {
    .azh-stage .azh-face { min-height: 84px; }
    .azh-stage .azh {
        position: absolute;
        bottom: 3.5%;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 96px);
        margin-top: 0;
    }
}

.azh {
    --azh-navy: #0F172A;
    --azh-navy2: #1E293B;
    --azh-gold: #C8A45D;
    --azh-gold-hi: #E9D29A;
    --azh-gold-ink: #7C6128;
    width: 100%;
    max-width: 1120px;
    margin-top: 2.25rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 1024px) {
    .azh { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 2.75rem; }
}

.azh-card {
    --rx: 0deg;
    --ry: 0deg;
    display: block;
    text-decoration: none !important;
    border-radius: 22px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.azh-face {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 128px;
    padding: 18px 10px 16px;
    border-radius: 22px;
    background:
        radial-gradient(120% 90% at 50% 0%, #FFFFFF 0%, #FDFBF6 55%, #F6F0E2 100%);
    border: 1px solid rgba(200, 164, 93, .42);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .9) inset,
        0 -10px 24px -18px rgba(124, 97, 40, .35) inset,
        0 2px 4px rgba(15, 23, 42, .05),
        0 14px 28px -14px rgba(15, 23, 42, .28);
    transform: perspective(760px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease, border-color .35s ease;
    overflow: hidden;
}

/* لبه‌ی طلایی بالای کارت — ضخامت «کاشی» */
.azh-face::before {
    content: "";
    position: absolute;
    inset: 0 18% auto;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--azh-gold), transparent);
    opacity: .85;
}

/* برق طلایی — فقط transform متحرک است */
.azh-face::after {
    content: "";
    position: absolute;
    top: -20%;
    bottom: -20%;
    width: 38%;
    left: 0;
    background: linear-gradient(100deg, transparent 0%, rgba(233, 210, 154, .0) 20%, rgba(233, 210, 154, .55) 50%, rgba(233, 210, 154, 0) 80%, transparent 100%);
    transform: translateX(-160%) skewX(-18deg);
    pointer-events: none;
}

.azh-medal {
    position: relative;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, #33415A 0%, var(--azh-navy2) 38%, var(--azh-navy) 100%);
    box-shadow:
        0 0 0 2px var(--azh-gold),
        0 0 0 5px rgba(200, 164, 93, .16),
        0 1px 1px rgba(255, 255, 255, .25) inset,
        0 12px 18px -8px rgba(15, 23, 42, .55);
    transform: translateZ(34px);
    transition: transform .45s cubic-bezier(.2, .8, .2, 1);
    flex: 0 0 auto;
}

/* نیم‌ماه براق روی مدال (حس فلز/شیشه) */
.azh-medal::after {
    content: "";
    position: absolute;
    inset: 4px 9px auto;
    height: 40%;
    border-radius: 50% 50% 45% 45%;
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.azh-medal svg { width: 26px; height: 26px; display: block; }
.azh-medal svg [fill]:not([fill="none"]) { fill: var(--azh-gold-hi) !important; }
.azh-medal svg [stroke]:not([stroke="none"]) { stroke: var(--azh-gold-hi) !important; }

.azh-title {
    color: var(--azh-navy);
    font-weight: 800;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
    transform: translateZ(18px);
}

.azh-go {
    display: none;
    color: var(--azh-gold-ink);
    transform: translateZ(14px);
    transition: transform .35s ease;
}

.azh-go svg { width: 26px; height: auto; display: block; }
.azh-go svg path { fill: currentColor !important; }

/* ── دسکتاپ پهن: کارت افقی (مدال راست، عنوان). زیر ۱۲۸۰ عنوان یک‌خطی جا نمی‌شود
      پس همان چیدمان عمودی گوشی (۴ ستونه) می‌ماند. ── */
@media (min-width: 1280px) {
    .azh-face {
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        min-height: 96px;
        padding: 16px 18px;
    }
    .azh-face { justify-content: center; padding: 16px 14px; }
    /* عنوان یک‌خطی اولویت دارد؛ فلش جا را تنگ می‌کرد و برداشته شد. */
    .azh-title { text-align: right; font-size: 16px; flex: 0 1 auto; white-space: nowrap; }
}

/* ── تعامل ── */
@media (hover: hover) and (pointer: fine) {
    .azh-card:hover .azh-face {
        border-color: rgba(200, 164, 93, .9);
        box-shadow:
            0 1px 0 rgba(255, 255, 255, .9) inset,
            0 -10px 24px -18px rgba(124, 97, 40, .45) inset,
            0 4px 8px rgba(15, 23, 42, .06),
            0 26px 40px -18px rgba(15, 23, 42, .38);
        transition: transform .12s linear, box-shadow .35s ease, border-color .35s ease;
    }
    .azh-card:hover .azh-medal { transform: translateZ(48px) scale(1.06); }
    .azh-card:hover .azh-go { transform: translateZ(14px) translateX(-6px); }
    .azh-card:hover .azh-face::after { animation: azh-sheen .9s ease-out; }
}

.azh-card:active .azh-face { transform: perspective(760px) scale(.97); }

.azh-card:focus-visible .azh-face {
    border-color: var(--azh-gold);
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--azh-gold-ink), 0 14px 28px -14px rgba(15, 23, 42, .28);
}

/* ── ورود: کاشی‌ها یکی‌یکی از عمق بالا می‌آیند (فقط وقتی JS آماده است) ── */
.azh--armed .azh-card { opacity: 0; }
.azh--in .azh-card {
    animation: azh-rise .8s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--i, 0) * 110ms);
}

/* برق دوره‌ای آرام بعد از ورود — روی گوشی هم زندگی دارد */
.azh--in .azh-face::after {
    animation: azh-sheen 1.1s ease-out 1;
    animation-delay: calc(.7s + var(--i, 0) * 160ms);
}

@keyframes azh-rise {
    from { opacity: 0; transform: perspective(800px) translateY(28px) rotateX(-28deg); }
    to   { opacity: 1; transform: none; }
}

@keyframes azh-sheen {
    from { transform: translateX(-160%) skewX(-18deg); }
    to   { transform: translateX(330%) skewX(-18deg); }
}

/* متن توضیح زیر کارت‌ها */
.azh-desc {
    margin-top: 1.6rem;
    max-width: 760px;
    text-align: center;
    color: #4B5563;
    font-size: 15px;
    line-height: 2;
}

@media (min-width: 1024px) { .azh-desc { font-size: 16px; margin-top: 2rem; } }

@media (prefers-reduced-motion: reduce) {
    .azh--armed .azh-card { opacity: 1; }
    .azh--in .azh-card,
    .azh--in .azh-face::after,
    .azh-card:hover .azh-face::after { animation: none !important; }
    .azh-face, .azh-medal, .azh-go { transition: none; }
    .azh-frame::after { animation: none; display: none; }
    .azh-stage-img { transition: none; }
}
