/* ==========================================================================
   Marche Home — only what cannot be expressed via the precompiled tailwind.css
   ========================================================================== */

/* Page-level bg + lock the document scroll on desktop so anchor jumps only
   scroll the inner marche__content (h-screen overflow-y-auto). Without this,
   the 100vh marche__container leaves a 296px gap below when the document
   auto-scrolls to bring a nested anchor target into view. */
body.page-template-page-marche-home {
    background-color: rgb(254 250 245); /* orange-25 */
}

@media (min-width: 1024px) {
    html,
    body.page-template-page-marche-home {
        overflow: hidden;
        height: 100vh;
    }
}

.marche-body,
.marche-body button,
.marche-body input,
.marche-body select,
.marche-body textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Noto Sans JP', "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

/* Section container — complex breakpoint logic Tailwind can't express via available variants */
.marche-home__container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Mobile: pickup section drops right padding so the next card peeks past the viewport edge */
@media (max-width: 767px) {
    .marche-home__pickup .marche-home__container {
        padding-right: 0;
    }
}

@media (min-width: 768px) {
    .marche-home__container {
        padding: 0 24px;
    }
}

@media (min-width: 1024px) {
    .marche-home__container {
        max-width: none;
        margin: 0;
        padding: 0 32px;
    }
}

/* Events section gradient (no Tailwind preset matches) */
.marche-home__events {
    background: linear-gradient(153deg, #FEF6EE 0%, #FDEAD7 100%);
}

/* Brand grid (Tailwind precompile lacks base grid-cols-2) */
.marche-home__cards--brands {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 40px;
}

@media (min-width: 768px) {
    .marche-home__cards--brands {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

@media (min-width: 1280px) {
    .marche-home__cards--brands {
        /* 3 cols, each capped at 480px max (shrinks below cap on narrower viewports). */
        grid-template-columns: repeat(3, minmax(0, 480px));
        gap: 40px;
        justify-content: start;
    }
}

@media (min-width: 2200px) {
    .marche-home__cards--brands {
        /* Very wide viewports: switch to 4 cols instead of growing cards. */
        grid-template-columns: repeat(4, minmax(0, 480px));
    }
}

/* New items list view (vertical with dividers) */
.marche-home__list-item {
    border-bottom: 1px solid #E8E8EF;
}

.marche-home__list-item:first-child {
    border-top: 1px solid #E8E8EF;
}

.marche-home__list-item a {
    transition: background-color 0.15s ease;
}

.marche-home__list-item:hover {
    background-color: rgba(254, 246, 238, 0.4); /* orange-50 ish */
}

/* 2-column grid on desktop */
@media (min-width: 1024px) {
    .marche-home__list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        column-gap: 32px;
    }
    .marche-home__list-item:nth-child(2) {
        border-top: 1px solid #E8E8EF;
    }
}

/* Horizontal scroll cards (items / events) */
.marche-home__cards--items,
.marche-home__cards--events {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 75%;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Vertical padding gives hover shadow + translate breathing room (overflow-x clips otherwise) */
    padding: 8px 0 24px;
}

.marche-home__cards--items::-webkit-scrollbar,
.marche-home__cards--events::-webkit-scrollbar {
    display: none;
}

.marche-home__cards--items > .marche-home__card,
.marche-home__cards--events > .marche-home__card {
    scroll-snap-align: start;
}

.marche-home__cards--items > .marche-home__card:last-child,
.marche-home__cards--events > .marche-home__card:last-child {
    scroll-snap-align: end;
}

@media (min-width: 768px) {
    .marche-home__cards--items,
    .marche-home__cards--events {
        grid-auto-columns: 320px;
        gap: 16px;
    }
}

@media (min-width: 1280px) {
    .marche-home__cards--items,
    .marche-home__cards--events {
        grid-auto-columns: 380px;
        gap: 20px;
    }
}

/* Scroll buttons — custom positioning + is-disabled toggle */
.marche-home__scroll {
    position: relative;
}

.marche-home__scroll-btn {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    z-index: 2;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.marche-home__scroll-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.marche-home__scroll-btn.is-disabled {
    opacity: 0;
    pointer-events: none;
}

.marche-home__scroll-btn--prev { left: 8px; }
.marche-home__scroll-btn--next { right: 8px; }

@media (min-width: 1024px) {
    .marche-home__scroll-btn {
        display: flex;
    }
}

/* Mobile: offset in-page category anchors so the heading is not hidden behind the
   fixed mobile header (#marcheMobileHeader is ~89px tall). The Tailwind utility on
   the sections is scroll-mt-4 (16px) — far too small — which let the category heading
   and first brand slip under the header on #cat-* navigation. lg uses the JS
   content-scroll path, so this only applies below the lg breakpoint. */
@media (max-width: 1023.98px) {
    .marche-home [id^="cat-"] {
        scroll-margin-top: 100px;
    }
}
