/* MaBapu responsive layout remaster: shared rhythm, usable widths and dock-safe actions. */
:root {
    --mb-shell: 1440px;
    --mb-reading: 1240px;
    --mb-gutter: clamp(16px, 3vw, 32px);
    --mb-card-radius: clamp(16px, 2vw, 22px);
    --mb-card-border: var(--theme-border, #e7e5e4);
    --mb-card-shadow: 0 12px 34px rgba(28, 25, 23, 0.07);
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

.container {
    width: min(100% - (2 * var(--mb-gutter)), var(--mb-shell));
    margin-inline: auto;
}

a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--theme-focus, #0f766e);
    outline-offset: 3px;
}

/* Recipe: keep the title and primary actions in the first desktop viewport. */
@media (min-width: 768px) {
    .rp > .rp-hero-wrap,
    .rp > .rp-hero-none,
    .rp > .rp-tband {
        width: min(calc(100% - (2 * var(--mb-gutter))), var(--mb-shell)) !important;
        margin-inline: auto;
    }

    .rp > .rp-hero-wrap,
    .rp > .rp-hero-none {
        margin-top: 24px;
        border-radius: 24px 24px 0 0;
    }

    .rp > .rp-tband {
        border-radius: 0 0 24px 24px;
    }

    .rp-hero-img {
        height: clamp(330px, 35vw, 470px) !important;
    }
}

.rp-timing {
    top: 72px !important;
}

.rp-grid {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 330px) !important;
    gap: clamp(24px, 3vw, 40px) !important;
}

.rp-sc,
.rp-side-card,
.nature-card,
.harvest-card {
    border-radius: var(--mb-card-radius) !important;
    box-shadow: var(--mb-card-shadow) !important;
}

/* Marketplace: a balanced hero, compact controls and predictable card columns. */
.harvest-hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    min-height: 340px;
}

.harvest-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 680px;
}

.harvest-hero-explorer {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
}

.harvest-hero-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 13px 16px;
    color: inherit;
    text-decoration: none;
    background: color-mix(in srgb, var(--theme-surface, #fff) 12%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
    border-radius: 14px;
    backdrop-filter: blur(8px);
    transition: transform 180ms ease, background-color 180ms ease;
}

.harvest-hero-tile:hover {
    color: inherit;
    background: color-mix(in srgb, var(--theme-surface, #fff) 20%, transparent);
    transform: translateX(-4px);
}

.harvest-hero-tile svg {
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    stroke-width: 1.8;
}

.harvest-hero-tile span,
.harvest-hero-tile small {
    display: block;
}

.harvest-hero-tile strong {
    font-size: 14px;
}

.harvest-hero-tile small {
    margin-top: 2px;
    color: var(--theme-hero-muted, rgba(255,255,255,.75));
    font-size: 11.5px;
}

.app-control-station {
    position: sticky;
    top: 84px;
    z-index: 20;
}

.marketplace-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: clamp(16px, 2vw, 24px) !important;
}

.product-card-container > * {
    overflow: hidden;
}

/* Product detail: prevent the page from becoming one narrow, oversized column. */
@media (min-width: 1100px) {
    .farmer-adaptive-layout {
        grid-template-columns: minmax(0, 1.65fr) minmax(340px, .85fr) !important;
        gap: 36px !important;
    }
}

.gallery-main {
    max-height: 620px;
}

.action-buttons > *,
.action-buttons form,
.action-buttons a,
.action-buttons button {
    min-width: 0;
}

/* Cart: compact the promise strip and keep totals/action area visually dominant. */
.harvest-cart-scaffold > .container {
    max-width: 1180px !important;
}

.eco-promise-carousel {
    min-height: 92px !important;
    padding: 16px 22px 22px !important;
    margin-bottom: 22px !important;
}

.eco-slides-wrapper {
    min-height: 58px !important;
}

.harvest-summary-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
}

/* Checkout: denser header and a stable form/receipt split. */
.harvest-checkout-scaffold {
    padding-top: clamp(22px, 4vw, 42px) !important;
}

.checkout-header {
    margin-bottom: 24px !important;
    padding-bottom: 18px !important;
}

.checkout-icon {
    width: 52px !important;
    height: 52px !important;
}

.checkout-title {
    font-size: clamp(1.9rem, 4vw, 2.35rem) !important;
}

/* Job landing/detail shells align with the same usable page width. */
.job-show-container {
    width: min(100% - (2 * var(--mb-gutter)), var(--mb-reading)) !important;
}

@media (max-width: 1199px) {
    .marketplace-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 1023px) {
    .rp-timing {
        top: 72px !important;
    }

    .rp-grid {
        grid-template-columns: 1fr !important;
    }

    .harvest-hero-card {
        grid-template-columns: minmax(0, 1fr) minmax(260px, .75fr);
        min-height: 300px;
        padding: 34px 30px !important;
    }

    .marketplace-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .app-control-station {
        position: relative;
        top: auto;
    }

    .harvest-summary-wrap {
        grid-template-columns: 1fr;
    }

    .mobile-sticky-bottom-cta {
        bottom: calc(var(--mobile-dock-clearance, 94px) + 6px) !important;
        width: min(calc(100% - 24px), 560px) !important;
        padding: 10px 12px !important;
        border-radius: 16px !important;
    }
}

@media (min-width: 820px) and (max-width: 1023px) {
    .harvest-checkout-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1.35fr) minmax(280px, .75fr);
        gap: 24px !important;
    }

    .checkout-main-column,
    .checkout-sticky-column {
        width: auto !important;
        max-width: none !important;
    }

    .sticky-receipt-wrapper {
        position: sticky !important;
        top: 90px !important;
    }
}

@media (max-width: 767px) {
    :root {
        --mb-gutter: 14px;
    }

    .rp > .rp-hero-wrap,
    .rp > .rp-hero-none {
        margin: 12px 12px 0;
        width: calc(100% - 24px) !important;
        border-radius: 18px 18px 0 0;
    }

    .rp > .rp-tband {
        margin-inline: 12px;
        width: calc(100% - 24px) !important;
        border-radius: 0 0 18px 18px;
    }

    .rp-hero-img {
        height: clamp(220px, 62vw, 310px) !important;
    }

    .rp-tband-inner > div:first-child {
        min-width: 0 !important;
    }

    .rp-tband-actions,
    .rp-tband-actions > * {
        width: 100%;
    }

    .harvest-hero-card {
        display: block;
        min-height: 0;
        padding: 28px 22px !important;
    }

    .harvest-hero-explorer {
        margin-top: 24px;
    }

    .harvest-hero-tile {
        min-height: 60px;
    }

    .marketplace-grid {
        grid-template-columns: 1fr !important;
    }

    .app-search-form,
    .app-search-form select,
    .search-input-box {
        width: 100% !important;
        max-width: none !important;
    }

    .cart-header-matrix {
        align-items: flex-start !important;
        gap: 14px;
    }

    .cart-header-matrix h1 {
        font-size: 1.55rem !important;
    }

    .eco-promise-carousel {
        min-height: 170px !important;
    }

    .harvest-card {
        padding: 22px 18px !important;
    }

    .mobile-sticky-bottom-cta {
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
    }
}

@media (max-width: 420px) {
    .mobile-sticky-bottom-cta .mobile-cta-price .price-label,
    .mobile-sticky-bottom-cta .price-label {
        display: none;
    }

    .mobile-sticky-bottom-cta .btn {
        padding-inline: 12px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
