/*
  MinaFit Home Mobile Order
  CSS-only, no inline style, no JS.
  موبایل: اول عکس هوم، بعد متن خوش‌آمدگویی
*/

@media (max-width: 768px) {
    body:not(.admin-body):not(.admin-page) main > section:first-of-type,
    body:not(.admin-body):not(.admin-page) main > section:first-of-type > .container,
    body:not(.admin-body):not(.admin-page) main > section:first-of-type .row,
    body:not(.admin-body):not(.admin-page) .hero-wrap,
    body:not(.admin-body):not(.admin-page) .home-hero,
    body:not(.admin-body):not(.admin-page) .ha-hero,
    body:not(.admin-body):not(.admin-page) .ha-hero-wrap,
    body:not(.admin-body):not(.admin-page) .ha-hero-card,
    body:not(.admin-body):not(.admin-page) .ha-hero-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(
        .hero-img,
        .hero-image,
        .hero-media,
        .hero-photo,
        .home-slider,
        .home-hero-media,
        .home-hero-image,
        .ha-media,
        .ha-image,
        .ha-photo,
        .ha-visual,
        .ha-hero-media,
        .ha-hero-image,
        .carousel
    ) {
        order: 1 !important;
        width: 100% !important;
        margin-top: 0 !important;
        margin-bottom: 18px !important;
    }

    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(
        .hero-card:not(:has(img)),
        .hero-content,
        .hero-text,
        .home-hero-content,
        .home-hero-text,
        .ha-copy,
        .ha-content,
        .ha-text,
        .ha-hero-copy,
        .ha-hero-content
    ) {
        order: 2 !important;
        width: 100% !important;
    }

    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(
        .hero-img,
        .hero-image,
        .hero-media,
        .hero-photo,
        .home-slider,
        .ha-media,
        .ha-image,
        .ha-photo,
        .ha-visual,
        .ha-hero-media,
        .ha-hero-image,
        .carousel
    ) img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
    }

    /* fallback برای ساختارهایی که کلاس مشخص ندارند ولی h1 و img در همان بخش هستند */
    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(.row, .container, .ha-hero-card, .hero-wrap):has(img):has(h1) {
        display: flex !important;
        flex-direction: column !important;
    }

    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(.row, .container, .ha-hero-card, .hero-wrap):has(img):has(h1) > *:has(img) {
        order: 1 !important;
    }

    body:not(.admin-body):not(.admin-page) main > section:first-of-type :is(.row, .container, .ha-hero-card, .hero-wrap):has(img):has(h1) > *:has(h1) {
        order: 2 !important;
    }
}
