/**
 * MAXSOFT Home Device Layout v36.7
 * Dois modos visuais: desktop amplo e mobile com experiência de aplicativo.
 */

.ms-home-mobile-only {
    display: none !important;
}

.ms-home-desktop-only {
    display: block;
}

@media (min-width: 768px) {
    html[data-ms-home-layout="desktop"] .ms-home {
        --ms-home-layout-mode: desktop;
    }

    .ms-home .ms-home-hero,
    .ms-home .ms-home-features,
    .ms-home .ms-home-sections {
        position: relative;
    }
}

@media (max-width: 767px) {
    :root {
        --ms-mobile-home-gutter: 10px;
        --ms-mobile-home-radius: 16px;
        --ms-mobile-home-line: #e7ebf1;
        --ms-mobile-home-ink: #172033;
        --ms-mobile-home-muted: #667085;
        --ms-mobile-home-blue: #2563eb;
    }

    html[data-ms-home-layout="mobile"] {
        scroll-padding-top: 96px;
    }

    body.is-ms-mobile-home {
        background: #f2f4f7;
    }

    .ms-home-mobile-only {
        display: block !important;
    }

    .ms-home-desktop-only {
        display: none !important;
    }

    .ms-home {
        padding-bottom: max(92px, calc(74px + env(safe-area-inset-bottom)));
        overflow-x: clip;
        background:
            linear-gradient(180deg, #f8fbff 0, #f3f5f8 300px, #f3f5f8 100%);
    }

    .ms-home__ambient {
        height: 310px;
        opacity: .55;
    }

    /* Banner próprio para celular: largura total, mais baixo e sem setas. */
    .ms-home-hero {
        position: relative;
        z-index: 3;
    }

    .ms-home .ms-hero-wrap {
        width: 100%;
        margin: 0;
    }

    .ms-home .ms-hero {
        border: 0;
        border-radius: 0 0 20px 20px;
        box-shadow: 0 12px 28px rgba(15, 39, 71, .11);
    }

    .ms-home .ms-hero__media {
        min-height: 154px;
        aspect-ratio: 16 / 6.6;
    }

    .ms-home .ms-hero__image {
        object-position: center;
    }

    .ms-home .ms-hero__counter {
        right: 9px;
        bottom: 8px;
    }

    /* Navegação exclusiva do celular. */
    .ms-mobile-discovery {
        width: calc(100% - (var(--ms-mobile-home-gutter) * 2));
        margin: 10px auto 0;
        padding: 13px 11px 11px;
        position: relative;
        z-index: 7;
        overflow: hidden;
        border: 1px solid var(--ms-mobile-home-line);
        border-radius: var(--ms-mobile-home-radius);
        background: rgba(255, 255, 255, .98);
        box-shadow: 0 7px 22px rgba(15, 23, 42, .055);
    }

    .ms-mobile-discovery__heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .ms-mobile-discovery__heading span {
        display: block;
        color: var(--ms-mobile-home-blue);
        font-size: 7.5px;
        font-weight: 900;
        letter-spacing: .09em;
        text-transform: uppercase;
    }

    .ms-mobile-discovery__heading strong {
        display: block;
        margin-top: 2px;
        color: var(--ms-mobile-home-ink);
        font-size: 14px;
        line-height: 1.15;
        font-weight: 900;
        letter-spacing: -.025em;
    }

    .ms-mobile-discovery__heading > a {
        min-height: 30px;
        padding: 0 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex: 0 0 auto;
        border: 1px solid #d7e5fb;
        border-radius: 9px;
        color: #1d4ed8;
        background: #f4f8ff;
        font-size: 8px;
        font-weight: 900;
        text-decoration: none;
    }

    .ms-mobile-quick-links {
        margin-top: 11px;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 69px;
        gap: 7px;
        overflow-x: auto;
        padding: 1px 0 5px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .ms-mobile-quick-links::-webkit-scrollbar,
    .ms-mobile-category-strip::-webkit-scrollbar {
        display: none;
    }

    .ms-mobile-quick-link {
        min-width: 0;
        min-height: 70px;
        padding: 7px 4px 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        border: 1px solid #edf0f4;
        border-radius: 12px;
        color: #344054;
        background: #fff;
        text-decoration: none;
        scroll-snap-align: start;
    }

    .ms-mobile-quick-link > span {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 1px solid var(--shortcut-line, #dbe8fb);
        border-radius: 11px;
        color: var(--shortcut-accent, #2563eb);
        background: var(--shortcut-soft, #eff6ff);
        font-size: 13px;
    }

    .ms-mobile-quick-link small {
        width: 100%;
        overflow: hidden;
        color: #344054;
        font-size: 7.5px;
        font-weight: 800;
        line-height: 1.1;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ms-mobile-quick-link.is-active {
        border-color: #bfd3f5;
        box-shadow: 0 5px 13px rgba(37, 99, 235, .09);
    }

    .ms-mobile-quick-link--yellow { --shortcut-accent:#d97706; --shortcut-soft:#fffbeb; --shortcut-line:#fde68a; }
    .ms-mobile-quick-link--blue { --shortcut-accent:#2563eb; --shortcut-soft:#eff6ff; --shortcut-line:#bfdbfe; }
    .ms-mobile-quick-link--green { --shortcut-accent:#059669; --shortcut-soft:#ecfdf5; --shortcut-line:#a7f3d0; }
    .ms-mobile-quick-link--violet { --shortcut-accent:#7c3aed; --shortcut-soft:#f5f3ff; --shortcut-line:#ddd6fe; }
    .ms-mobile-quick-link--navy { --shortcut-accent:#0f3b76; --shortcut-soft:#edf4fb; --shortcut-line:#c8d9ec; }
    .ms-mobile-quick-link--rose { --shortcut-accent:#db2777; --shortcut-soft:#fff1f7; --shortcut-line:#fbcfe8; }

    .ms-mobile-category-strip {
        margin-top: 9px;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(142px, 44vw);
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .ms-mobile-category-chip {
        min-width: 0;
        min-height: 52px;
        padding: 6px 8px;
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        border: 1px solid #edf0f4;
        border-radius: 12px;
        color: #344054;
        background: #fafbfc;
        text-decoration: none;
        scroll-snap-align: start;
    }

    .ms-mobile-category-chip__visual {
        width: 38px;
        height: 38px;
        overflow: hidden;
        display: grid;
        place-items: center;
        border: 1px solid #dce8fa;
        border-radius: 10px;
        color: #2563eb;
        background: #eff6ff;
        font-size: 13px;
    }

    .ms-mobile-category-chip__visual img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .ms-mobile-category-chip__copy {
        min-width: 0;
    }

    .ms-mobile-category-chip__copy strong,
    .ms-mobile-category-chip__copy small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ms-mobile-category-chip__copy strong {
        color: #273348;
        font-size: 8.5px;
        font-weight: 850;
    }

    .ms-mobile-category-chip__copy small {
        margin-top: 3px;
        color: #98a2b3;
        font-size: 7px;
        font-weight: 700;
    }

    /* Features: layout de aplicativo, sem sobreposição no banner. */
    .ms-home-features {
        margin: 10px 0 2px;
    }

    .ms-home .ms-feature-shell {
        width: 100%;
        margin: 0;
        padding: 0 var(--ms-mobile-home-gutter);
    }

    .ms-home .ms-feature-grid {
        grid-auto-columns: minmax(150px, 45.5vw);
        gap: 8px;
        padding: 1px 0 6px;
        scroll-padding-inline: var(--ms-mobile-home-gutter);
    }

    .ms-home .ms-feature-card {
        height: 205px;
        padding: 10px 9px 9px;
        border-radius: 13px;
        box-shadow: 0 6px 18px rgba(15, 39, 71, .075);
    }

    .ms-home .ms-feature-card:hover {
        transform: none;
    }

    .ms-home .ms-feature-card__title {
        min-height: 16px;
        margin-bottom: 6px;
        font-size: 10px;
    }

    .ms-home .ms-feature-card__media,
    .ms-home .ms-feature-card__icon-wrap {
        height: 72px;
        flex-basis: 72px;
        margin-bottom: 7px;
    }

    .ms-home .ms-feature-card__icon {
        width: 58px;
        height: 58px;
        font-size: 21px;
    }

    .ms-home .ms-feature-card__product-name,
    .ms-home .ms-feature-card__text {
        min-height: 27px;
        font-size: 9px;
        line-height: 1.35;
    }

    .ms-home .ms-feature-card__price {
        min-height: 18px;
        margin-top: 4px;
        font-size: 14px;
    }

    .ms-home .ms-feature-card__shipping {
        min-height: 12px;
        margin-top: 3px;
        font-size: 7.5px;
    }

    .ms-home .ms-feature-card__action {
        min-height: 27px;
        border-radius: 7px;
        font-size: 8px;
    }

    .ms-home .ms-feature-arrow {
        display: none !important;
    }

    /* Feed mobile: cada vitrine vira um módulo compacto, separado e tocável. */
    .ms-home-sections {
        width: 100%;
        margin-top: 8px;
        padding: 0 var(--ms-mobile-home-gutter);
        gap: 10px;
    }

    .ms-home-section {
        width: 100%;
    }

    .ms-home .elite-card-container,
    .ms-home .ms-market-section,
    .ms-home .ms-marketplace-intro {
        border-radius: var(--ms-mobile-home-radius) !important;
        box-shadow: 0 5px 18px rgba(15, 23, 42, .045) !important;
    }

    .ms-home .ms-market-section > .ms-market-head,
    .ms-home .elite-card-container > div:first-child {
        min-height: 58px;
        padding: 10px 11px !important;
    }

    .ms-home .ms-market-head__main {
        gap: 8px;
    }

    .ms-home .ms-market-head__icon {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        border-radius: 10px;
        font-size: 12px;
    }

    .ms-home .ms-market-head__eyebrow {
        display: none;
    }

    .ms-home .ms-market-head__copy h2 {
        font-size: 14px !important;
        line-height: 1.15;
    }

    .ms-home .ms-market-head__copy p {
        max-width: 62vw;
        margin-top: 3px;
        display: -webkit-box;
        overflow: hidden;
        font-size: 7.5px;
        line-height: 1.3;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
    }

    .ms-home .ms-market-head__link {
        width: 32px;
        min-height: 32px;
        padding: 0;
        border-radius: 9px;
    }

    .ms-home .ms-market-body,
    .ms-home .elite-card-container > div:nth-child(2) {
        padding: 8px 8px 11px !important;
    }

    .ms-home .swiper-nav-glass,
    .ms-home .swiper-button-next,
    .ms-home .swiper-button-prev {
        display: none !important;
    }

    .ms-home .ms-carousel-progress {
        width: 34%;
        height: 3px;
        margin: 8px auto 0;
    }

    /* Cards de produto próprios para o celular. */
    .ms-home .ms-product-card {
        border-radius: 12px;
        box-shadow: 0 3px 10px rgba(15, 23, 42, .035);
    }

    .ms-home .ms-product-card:hover {
        transform: none;
    }

    .ms-home .ms-product-card__image-wrap {
        padding: 10px;
    }

    .ms-home .ms-product-card__favorite {
        top: 6px;
        right: 6px;
        width: 29px;
        height: 29px;
        font-size: 11px;
    }

    .ms-home .ms-product-card__badge {
        top: 6px;
        left: 6px;
        min-height: 20px;
        padding: 0 6px;
        max-width: calc(100% - 45px);
        border-radius: 6px;
        font-size: 6px;
    }

    .ms-home .ms-product-card__content {
        min-height: 148px !important;
        padding: 8px !important;
    }

    .ms-home .ms-product-card__meta-row {
        min-height: 17px;
        margin-bottom: 5px;
    }

    .ms-home .ms-product-card__official,
    .ms-home .ms-product-card__new {
        font-size: 6px;
    }

    .ms-home .ms-product-card__title {
        min-height: 31px;
        margin-bottom: 6px;
        font-size: 9px !important;
        line-height: 1.35;
    }

    .ms-home .ms-product-card__old-price {
        min-height: 13px;
        font-size: 7px;
    }

    .ms-home .ms-product-card__price-currency {
        margin-top: 3px;
        font-size: 8px;
    }

    .ms-home .ms-product-card__price-main {
        font-size: 18px !important;
    }

    .ms-home .ms-product-card__price-cents {
        font-size: 8px;
    }

    .ms-home .ms-product-card__installment {
        margin-top: 4px;
        font-size: 7px;
    }

    .ms-home .ms-product-card__footer {
        margin-top: 7px;
        padding-top: 6px;
    }

    .ms-home .ms-product-card__delivery {
        padding: 0 5px;
        font-size: 5.8px;
    }

    .ms-home .ms-product-card__sold {
        display: none;
    }

    /* Tudo em um só lugar: conteúdo mais direto no celular. */
    .ms-home .ms-marketplace-intro {
        width: 100%;
        padding: 14px 11px;
    }

    .ms-home .ms-marketplace-intro__top {
        gap: 9px;
    }

    .ms-home .ms-marketplace-intro h1 {
        font-size: 19px;
    }

    .ms-home .ms-marketplace-intro__top p {
        font-size: 8px;
    }

    .ms-home .ms-marketplace-intro__catalog {
        min-height: 36px;
        font-size: 8px;
    }

    .ms-home .ms-marketplace-stats {
        margin-top: 11px;
        padding: 6px;
    }

    .ms-home .ms-marketplace-stat {
        min-height: 49px;
        padding: 6px 5px;
        gap: 6px;
    }

    .ms-home .ms-marketplace-stat__icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 9px;
        font-size: 10px;
    }

    .ms-home .ms-marketplace-stat strong {
        font-size: 9px;
    }

    .ms-home .ms-marketplace-stat small {
        font-size: 6px;
    }

    .ms-home .ms-marketplace-category-rail {
        grid-auto-columns: 78%;
    }

    /* Diretório final de categorias vira carrossel no celular. */
    .ms-home .ms-home-category-directory {
        display: grid;
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 78%;
        gap: 7px;
        overflow-x: auto;
        padding: 8px !important;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .ms-home .ms-home-category-directory::-webkit-scrollbar {
        display: none;
    }

    .ms-home .ms-home-category-directory__item {
        min-height: 54px;
        scroll-snap-align: start;
    }

    /* Resultados de busca também ganham densidade mobile. */
    .ms-search {
        width: calc(100% - 16px);
    }

    .ms-search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}

@media (max-width: 390px) {
    .ms-home .ms-feature-grid {
        grid-auto-columns: minmax(142px, 46vw);
    }

    .ms-mobile-category-strip {
        grid-auto-columns: minmax(134px, 46vw);
    }

    .ms-home .ms-market-head__copy p {
        display: none;
    }
}


/* MAXSOFT v36.6 - carregamento garantido de todas as vitrines no celular */
@media (max-width: 767px) {
    .ms-home .ms-home-sections,
    .ms-home .ms-home-section,
    .ms-home .ms-market-section,
    .ms-home .elite-card-container,
    .ms-home .ms-market-body {
        max-height: none !important;
        height: auto;
        overflow-y: visible !important;
        content-visibility: visible !important;
        contain: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    /* Enquanto o Swiper ainda entra na fila, o usuário já enxerga e pode
       deslizar os produtos. Quando inicializado, o Swiper assume novamente. */
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized)::-webkit-scrollbar {
        display: none;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-wrapper {
        width: max-content !important;
        display: flex !important;
        gap: 8px;
        transform: none !important;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-slide {
        width: min(43vw, 170px) !important;
        flex: 0 0 min(43vw, 170px) !important;
        scroll-snap-align: start;
    }
}

/* ========================================================================== 
   MAXSOFT Home Device Layout v36.7
   Ajustes finos de rolagem, carregamento e consistência entre PC e mobile.
   ========================================================================== */

@media (min-width: 768px) {
    .ms-home-sections {
        gap: 18px;
    }

    .ms-home .ms-market-section,
    .ms-home .elite-card-container {
        scroll-margin-top: 178px;
    }

    .ms-home .ms-market-body {
        position: relative;
        overflow: hidden;
    }

    .ms-home .ms-market-body > .swiper-nav-glass.glass-left {
        left: 12px !important;
        right: auto !important;
    }

    .ms-home .ms-market-body > .swiper-nav-glass.glass-right {
        right: 12px !important;
        left: auto !important;
    }

    .ms-home .swiper-nav-glass {
        width: 42px;
        height: 42px;
        border-color: rgba(203, 213, 225, .9);
        box-shadow: 0 8px 22px rgba(15, 23, 42, .13);
    }

    .ms-home .ms-product-card,
    .ms-home .ms-market-section,
    .ms-home .elite-card-container {
        backface-visibility: hidden;
        -webkit-font-smoothing: antialiased;
    }
}

@media (max-width: 767px) {
    html[data-ms-home-layout="mobile"],
    body.is-ms-mobile-home {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
        overscroll-behavior-x: none;
        overscroll-behavior-y: auto;
    }

    body.is-ms-mobile-home {
        overflow-y: auto !important;
        touch-action: pan-x pan-y;
    }

    .ms-home {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        padding-bottom: max(102px, calc(82px + env(safe-area-inset-bottom)));
    }

    .ms-home .ms-home-sections,
    .ms-home .ms-home-section {
        display: block !important;
        width: 100%;
        max-width: 100%;
        height: auto !important;
        min-height: 0;
        max-height: none !important;
        overflow: visible !important;
        content-visibility: visible !important;
        contain: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .ms-home .ms-home-section + .ms-home-section {
        margin-top: 10px;
    }

    .ms-home .ms-market-section,
    .ms-home .elite-card-container {
        display: block !important;
        width: 100%;
        max-width: 100%;
        height: auto !important;
        min-height: 0;
        max-height: none !important;
        overflow: hidden !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        scroll-margin-top: calc(var(--ms-header-mobile, 132px) + 12px);
    }

    .ms-home .ms-market-body,
    .ms-home .elite-card-container > div:nth-child(2) {
        width: 100%;
        max-width: 100%;
        height: auto !important;
        min-height: 0;
        max-height: none !important;
        overflow: visible !important;
    }

    /*
     * Os carrosséis de produto usam rolagem nativa no celular. Isso elimina
     * falhas de inicialização, reduz uso de memória e mantém a rolagem vertical
     * fluida mesmo em páginas com muitas vitrines.
     */
    .ms-home .ms-market-body .swiper.ms-native-carousel,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: auto;
        scroll-padding-inline: 1px;
        scroll-snap-type: x proximity;
        overscroll-behavior-inline: contain;
        overscroll-behavior-block: auto;
        touch-action: pan-x pan-y;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .ms-home .ms-market-body .swiper.ms-native-carousel::-webkit-scrollbar,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized)::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .ms-home .ms-market-body .swiper.ms-native-carousel .swiper-wrapper,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-wrapper {
        width: max-content !important;
        min-width: 100% !important;
        height: auto !important;
        display: flex !important;
        align-items: stretch;
        gap: 8px;
        transform: none !important;
        transition: none !important;
    }

    .ms-home .ms-market-body .swiper.ms-native-carousel .swiper-slide,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-slide {
        width: clamp(140px, calc((100vw - 50px) / 2), 176px) !important;
        min-width: 0 !important;
        height: auto !important;
        flex: 0 0 clamp(140px, calc((100vw - 50px) / 2), 176px) !important;
        scroll-snap-align: start;
        scroll-snap-stop: normal;
    }

    .ms-home .ms-market-body.has-enhanced-carousel .ms-carousel-progress,
    .ms-home .ms-carousel-progress {
        display: none !important;
    }

    .ms-home .ms-feature-grid,
    .ms-mobile-quick-links,
    .ms-mobile-category-strip,
    .ms-home .ms-home-category-directory,
    .ms-home .ms-marketplace-category-rail {
        scroll-snap-type: x proximity !important;
        overscroll-behavior-inline: contain;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .ms-home .ms-feature-grid {
        max-width: 100%;
        scroll-behavior: auto;
    }

    .ms-home .ms-market-head__copy {
        min-width: 0;
    }

    .ms-home .ms-market-head__copy h2,
    .ms-home .ms-market-head__copy p {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ms-home .ms-market-head__link {
        flex: 0 0 32px;
    }

    .ms-home .ms-product-card {
        height: 100%;
        overflow: hidden;
    }

    .ms-home .ms-product-card__image-wrap {
        aspect-ratio: 1 / 1;
        min-height: 0;
    }

    .ms-home .ms-product-card__image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .ms-mobile-discovery,
    .ms-home-features,
    .ms-home-sections {
        isolation: isolate;
    }
}

@media (max-width: 359px) {
    .ms-home .ms-market-body .swiper.ms-native-carousel .swiper-slide,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-slide {
        width: 138px !important;
        flex-basis: 138px !important;
    }

    .ms-home .ms-feature-grid {
        grid-auto-columns: minmax(138px, 46vw);
    }
}

/* O PWA também deve permitir rolagem natural da home inteira. */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
    html[data-ms-home-layout="mobile"],
    body.is-ms-mobile-home {
        height: auto !important;
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    body.is-ms-mobile-home .maxsoft-app-content {
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ms-home *,
    .ms-home *::before,
    .ms-home *::after {
        scroll-behavior: auto !important;
    }
}

/* Espaçamento consistente entre todas as vitrines produzidas pelo mesmo feed. */
.ms-home .ms-home-section {
    display: grid;
    gap: 16px;
}

@media (max-width: 767px) {
    .ms-home .ms-home-section {
        display: grid !important;
        gap: 10px;
    }

    .ms-home .ms-home-section + .ms-home-section {
        margin-top: 0;
    }
}

/* Fallback visual no desktop caso o CDN do Swiper demore ou fique indisponível. */
@media (min-width: 768px) {
    .ms-home .ms-market-body .swiper:not(.swiper-initialized) {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized)::-webkit-scrollbar {
        display: none;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-wrapper {
        width: max-content;
        min-width: 100%;
        display: flex;
        align-items: stretch;
        gap: 15px;
        transform: none !important;
    }

    .ms-home .ms-market-body .swiper:not(.swiper-initialized) .swiper-slide {
        width: clamp(190px, 19vw, 228px);
        flex: 0 0 clamp(190px, 19vw, 228px);
        scroll-snap-align: start;
    }
}


/* ========================================================================== 
   MAXSOFT Home Device Layout v36.8
   Correção definitiva de salto/retorno da rolagem vertical no celular.
   ========================================================================== */
@media (max-width: 767px) {
    html[data-ms-home-layout="mobile"],
    body.is-ms-mobile-home,
    body.is-ms-mobile-home .ms-home {
        scroll-behavior: auto !important;
        overscroll-behavior-y: auto !important;
    }

    /* Elementos carregados acima da área visível não podem reposicionar a página. */
    body.is-ms-mobile-home .ms-home,
    body.is-ms-mobile-home .ms-home-sections,
    body.is-ms-mobile-home .ms-home-section,
    body.is-ms-mobile-home .ms-market-section,
    body.is-ms-mobile-home .elite-card-container {
        overflow-anchor: none;
    }

    /* A página controla o gesto vertical; somente as faixas usam o eixo horizontal. */
    body.is-ms-mobile-home {
        touch-action: auto !important;
    }

    .ms-home .ms-market-body .swiper.ms-native-carousel,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized),
    .ms-home .ms-feature-grid,
    .ms-mobile-quick-links,
    .ms-mobile-category-strip,
    .ms-home .ms-home-category-directory,
    .ms-home .ms-marketplace-category-rail {
        scroll-behavior: auto !important;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
        touch-action: pan-x pan-y;
    }

    /* Evita que elementos focáveis artificiais sejam trazidos à tela pelo navegador. */
    .ms-home .swiper[tabindex],
    .ms-home .ms-feature-grid[tabindex],
    .ms-mobile-quick-links[tabindex],
    .ms-mobile-category-strip[tabindex] {
        outline: none;
    }
}


/* ========================================================================== 
   MAXSOFT Home Device Layout v36.9
   Correção do bloqueio vertical próximo à vitrine Novidades.
   O gesto vertical sempre pertence à página; o arraste horizontal é tratado
   pelo JavaScript somente quando o movimento é claramente lateral.
   ========================================================================== */
@media (max-width: 767px) {
    html[data-ms-home-layout="mobile"],
    body.ms-original-marketplace.is-ms-mobile-home {
        height: auto !important;
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: auto !important;
        scroll-snap-type: none !important;
    }

    body.ms-original-marketplace.is-ms-mobile-home .maxsoft-app-content {
        height: auto !important;
        min-height: 100dvh !important;
        max-height: none !important;
        overflow: visible !important;
        overscroll-behavior: auto !important;
        scroll-behavior: auto !important;
        -webkit-overflow-scrolling: auto !important;
    }

    body.is-ms-mobile-home .ms-home,
    body.is-ms-mobile-home .ms-home-sections,
    body.is-ms-mobile-home .ms-home-section,
    body.is-ms-mobile-home .ms-market-section,
    body.is-ms-mobile-home .elite-card-container {
        overflow-anchor: auto !important;
    }

    .ms-home .ms-market-body .swiper.ms-native-carousel,
    .ms-home .ms-market-body .swiper:not(.swiper-initialized),
    .ms-home .ms-feature-grid,
    .ms-mobile-quick-links,
    .ms-mobile-category-strip,
    .ms-home .ms-home-category-directory,
    .ms-home .ms-marketplace-category-rail {
        scroll-snap-type: none !important;
        scroll-snap-stop: normal !important;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
        touch-action: pan-y pinch-zoom !important;
    }

    .ms-home .ms-market-section,
    .ms-home .elite-card-container,
    .ms-home .ms-market-body,
    .ms-home .swiper-wrapper,
    .ms-home .swiper-slide {
        touch-action: pan-y pinch-zoom;
    }

    .ms-home .ms-market-head__icon {
        position: relative;
        z-index: 1;
        pointer-events: none;
    }

    .ms-home .ms-market-head__icon i {
        display: inline-block;
        line-height: 1;
    }

    .ms-home [data-ms-horizontal-drag="1"] {
        cursor: grab;
        -webkit-user-drag: none;
    }

    .ms-home [data-ms-horizontal-drag="1"].is-ms-dragging {
        cursor: grabbing;
        user-select: none;
    }
}
