/* ==========================================================
   Sprint 1 — Bloco 6
   Home Marketplace final polish
   Camada visual de baixo risco, carregada após style.css e marketplace-responsive.css.
   ========================================================== */

:root {
    --home-polish-gap-mobile: 0.42rem;
    --home-polish-page-pad-mobile: 0.72rem;
    --home-polish-radius-card: 18px;
}

/* Ritmo visual geral da home */
.stores-section,
.market-strip,
.products-section {
    margin-bottom: clamp(1rem, 2.4vw, 1.8rem);
}

.section-header,
.market-strip-header {
    margin-bottom: 0.72rem;
}

.section-header h3,
.market-strip-header h3 {
    letter-spacing: -0.025em;
    line-height: 1.08;
}

.section-subtitle {
    line-height: 1.35;
}

/* Lojas: visual mais limpo e com toque confortável */
.stores-section {
    overflow: hidden;
}

.stores-grid {
    scroll-padding-inline: var(--home-polish-page-pad-mobile);
}

.store-card {
    user-select: none;
}

.store-logo-wrapper {
    background: #fff;
}

/* Carrosséis: compactos, com início do próximo card sugerido visualmente */
.market-strip {
    position: relative;
}

.market-strip-scroller {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.market-strip-track {
    align-items: stretch;
}

.market-strip .product-card,
.market-strip .marketplace-product-card {
    scroll-snap-align: start;
}

/* Produtos: leitura clara, sem card “gritando” */
.product-card,
.marketplace-product-card {
    border-color: rgba(226, 232, 240, 0.92);
}

.product-card:hover,
.marketplace-product-card:hover {
    transform: translateY(-1px);
}

/* Grade da vitrine */
.product-grid {
    align-items: stretch;
}

/* Busca e modal/autocomplete: sensação mais nativa */
.search-suggestions {
    border-radius: 18px;
}

.suggestion-item {
    min-height: 46px;
}

/* Mobile oficial: 380px+ */
@media (max-width: 640px) {
    .stores-section,
    .market-strip,
    .products-section {
        margin-left: calc(var(--home-polish-page-pad-mobile) * -1);
        margin-right: calc(var(--home-polish-page-pad-mobile) * -1);
        padding-left: var(--home-polish-page-pad-mobile);
        padding-right: var(--home-polish-page-pad-mobile);
    }

    .section-header,
    .market-strip-header {
        padding-left: 0.05rem;
        padding-right: 0.05rem;
        margin-bottom: 0.58rem;
    }

    .section-header h3,
    .market-strip-header h3 {
        font-size: 1.12rem;
    }

    .section-subtitle {
        font-size: 0.84rem;
        color: #64748b;
    }

    .stores-grid {
        gap: 0.62rem;
        padding-bottom: 0.15rem;
    }

    .store-card {
        min-width: 58px;
        gap: 0.25rem;
    }

    .store-logo-wrapper {
        width: 50px;
        height: 50px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    }

    .store-name {
        font-size: 0.72rem;
        max-width: 70px;
        text-align: center;
    }

    .market-strip {
        overflow: visible;
        margin-top: 0.15rem;
    }

    .market-strip-scroller {
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0.52rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .market-strip-scroller::-webkit-scrollbar {
        display: none;
    }

    .market-strip-track {
        gap: var(--home-polish-gap-mobile);
        min-height: auto;
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 1.18rem) / 2);
        min-width: 148px;
        max-width: 188px;
        border-radius: var(--home-polish-radius-card);
    }

    .product-grid,
    .marketplace-grid,
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--home-polish-gap-mobile);
    }

    .product-card,
    .marketplace-product-card {
        border-radius: var(--home-polish-radius-card);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
    }

    .product-card h3,
    .marketplace-product-card h3,
    .product-card .product-title,
    .marketplace-product-card .product-title {
        font-size: 0.86rem;
        line-height: 1.22;
        letter-spacing: -0.012em;
    }

    .product-card .price,
    .product-card .product-price,
    .marketplace-product-card .price,
    .marketplace-product-card .product-price {
        font-size: 0.96rem;
        line-height: 1.12;
    }

    .marketplace-card-official-badge {
        color: #16a34a;
    }
}

@media (max-width: 430px) {
    :root {
        --home-polish-gap-mobile: 0.34rem;
        --home-polish-page-pad-mobile: 0.62rem;
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 1rem) / 2);
        min-width: 146px;
        max-width: 184px;
    }

    .section-header h3,
    .market-strip-header h3 {
        font-size: 1.06rem;
    }

    .section-subtitle {
        font-size: 0.80rem;
    }
}

@media (max-width: 380px) {
    :root {
        --home-polish-gap-mobile: 0.30rem;
        --home-polish-page-pad-mobile: 0.56rem;
    }

    .product-grid,
    .marketplace-grid,
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--home-polish-gap-mobile);
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 0.86rem) / 2);
        min-width: 142px;
        max-width: 178px;
    }

    .store-logo-wrapper {
        width: 48px;
        height: 48px;
    }
}

/* Desktop/tablet: deixar a home mais premium sem mexer no fluxo */
@media (min-width: 900px) {
    .market-strip {
        border-radius: 24px;
    }

    .market-strip-scroller {
        padding-bottom: 0.85rem;
    }

    .product-grid {
        gap: 1rem;
    }
}


/* ==========================================================
   Sprint 1 — Bloco 6.1
   Carrosséis mobile com "peek" do terceiro card.
   Mantém tablet e desktop sem alteração.
   ========================================================== */

@media (max-width: 640px) {
    /* A seção encosta mais na lateral esquerda para o usuário perceber
       que existe continuação horizontal sem precisar de texto. */
    .market-strip {
        margin-left: calc(var(--home-polish-page-pad-mobile) * -1) !important;
        margin-right: calc(var(--home-polish-page-pad-mobile) * -1) !important;
        padding-left: 0.42rem !important;
        padding-right: 0 !important;
        overflow: hidden !important;
    }

    .market-strip-header {
        padding-left: 0.20rem !important;
        padding-right: 0.72rem !important;
    }

    .market-strip-scroller {
        padding-left: 0 !important;
        padding-right: 0 !important;
        scroll-padding-left: 0 !important;
        overflow-x: auto !important;
    }

    .market-strip-track {
        gap: 0.30rem !important;
        padding-left: 0 !important;
        padding-right: 0.72rem !important;
    }

    /* Tamanho pensado para 2 cards bem visíveis + parte do terceiro card. */
    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 2.70rem) / 2) !important;
        min-width: 148px !important;
        max-width: 176px !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 430px) {
    .market-strip {
        padding-left: 0.34rem !important;
    }

    .market-strip-track {
        gap: 0.26rem !important;
        padding-right: 0.66rem !important;
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 2.55rem) / 2) !important;
        min-width: 146px !important;
        max-width: 174px !important;
    }
}

@media (max-width: 390px) {
    .market-strip {
        padding-left: 0.28rem !important;
    }

    .market-strip-track {
        gap: 0.22rem !important;
        padding-right: 0.62rem !important;
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 2.34rem) / 2) !important;
        min-width: 144px !important;
        max-width: 170px !important;
    }
}

@media (max-width: 380px) {
    .market-strip {
        padding-left: 0.24rem !important;
    }

    .market-strip-track {
        gap: 0.20rem !important;
        padding-right: 0.58rem !important;
    }

    .market-strip .product-card,
    .market-strip .marketplace-product-card,
    .market-strip-skeleton-card {
        width: calc((100vw - 2.20rem) / 2) !important;
        min-width: 142px !important;
        max-width: 168px !important;
    }
}

/* Tablet e desktop continuam usando o comportamento anterior. */
@media (min-width: 641px) {
    .market-strip-scroller {
        overflow-x: auto;
    }
}

/* PWA/public app polish */
html.is-pwa-standalone .market-header,
body.is-pwa-standalone .market-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

html.is-pwa-standalone .main-nav,
body.is-pwa-standalone .main-nav {
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(12px);
}

@media (display-mode: standalone), (display-mode: fullscreen) {
    .market-main {
        min-height: 100svh;
    }

    .market-search input::placeholder {
        color: #64748b;
    }

    .mobile-bottom-nav {
        box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.10);
    }
}

@media (max-width: 640px) {
    html.is-pwa-standalone .market-main,
    body.is-pwa-standalone .market-main {
        padding-top: 0.45rem;
    }

    html.is-pwa-standalone .market-logo,
    body.is-pwa-standalone .market-logo {
        max-height: 46px;
    }

    html.is-pwa-standalone .market-search,
    body.is-pwa-standalone .market-search {
        min-height: 44px;
        border-radius: 16px;
    }

    .market-strip-nav {
        display: none !important;
    }

    .product-grid .marketplace-product-card,
    .product-grid .product-card {
        min-width: 0;
    }

    .marketplace-product-card img,
    .product-card img {
        background: #f1f5f9;
    }
}

@media (max-width: 380px) {
    .market-search input {
        font-size: 16px;
    }

    .stores-section,
    .market-strip,
    .products-section {
        padding-left: 0.48rem;
        padding-right: 0.48rem;
    }

    .section-header h3,
    .market-strip-header h3 {
        font-size: 1rem;
    }
}
