/* ==========================================================================
   Machine detail pages - mobile layout (< 992px). Desktop is not touched.
   Used by: jcb-*.html (EN + IT). Body carries the class "machine-page".
   ========================================================================== */

/* Mobile-only pieces are hidden everywhere else (desktop shows the original layout). */
.m-gallery, .m-chips, .m-readmore, .m-actionbar { display: none; }

@media (max-width: 991.98px) {

    .machine-page { padding-bottom: 76px; }          /* room for the fixed action bar */
    .machine-page .whatsapp-float { display: none !important; }   /* the bar already has WhatsApp */

    /* --- Remove what only made sense on desktop ------------------------------ */
    .machine-page .m-hero-stats,
    .machine-page .m-cta-band { display: none !important; }

    /* --- Back link: small text link instead of a big green button ------------ */
    .machine-page .m-back { margin: 0 0 .75rem !important; }
    .machine-page .m-back .btn {
        background: none; border: 0; box-shadow: none; padding: 0 !important;
        color: #367c2b; font-weight: 600; font-size: .95rem;
    }

    /* --- Tighter page rhythm ------------------------------------------------- */
    .machine-page .container-xxl.py-5 { padding-top: 1rem !important; padding-bottom: 1.5rem !important; }
    .machine-page .row.g-5 { --bs-gutter-x: 0; --bs-gutter-y: 1rem; }   /* text lines up with the container padding */

    /* --- Swipeable gallery, full width -------------------------------------- */
    /* full-bleed: as wide as the screen, whatever the container insets are */
    .m-gallery { display: block; position: relative; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
    .m-slider {
        display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .m-slider::-webkit-scrollbar { display: none; }
    .m-slide { flex: 0 0 100%; scroll-snap-align: center; display: block; }
    .m-slide img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: #e9ecef; }
    .m-counter {
        position: absolute; right: 12px; bottom: 34px; background: rgba(0,0,0,.6); color: #fff;
        font-size: .78rem; padding: 2px 10px; border-radius: 12px; pointer-events: none;
    }
    .m-dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 2px; }
    .m-dots span { width: 7px; height: 7px; border-radius: 50%; background: #c9d3cb; transition: background .2s, transform .2s; }
    .m-dots span.on { background: #348E38; transform: scale(1.25); }

    /* --- Price, title ------------------------------------------------------- */
    .machine-page .info-col h3.display-6 { font-size: 1.9rem; margin-top: .25rem; }
    .machine-page .info-col h1 { font-size: 1.25rem; line-height: 1.3; }

    /* --- Key facts as chips ------------------------------------------------- */
    .m-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1rem; }
    .m-chip {
        background: #E8F5E9; color: #0F4229; border: 1px solid #c3e6cb; border-radius: 20px;
        padding: 5px 12px; font-size: .85rem; white-space: nowrap;
    }
    .m-chip b { font-weight: 700; margin-right: 3px; }

    /* --- Description: short by default, expandable -------------------------- */
    .machine-page .m-desc { margin-bottom: .4rem !important; }
    .machine-page .m-desc:not(.expanded) {
        display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    }
    .m-readmore {
        display: inline-block; background: none; border: 0; padding: 0; margin: 0 0 1.25rem;
        color: #348E38; font-weight: 700; font-size: .95rem;
    }

    /* --- Spec table full width, buttons stacked ----------------------------- */
    .machine-page .spec-table { width: 100%; }
    .machine-page .info-col > a.btn { display: block; width: 100%; margin: 0 0 .6rem !important; padding: .75rem 1rem !important; text-align: center; }

    /* --- Fixed action bar --------------------------------------------------- */
    .m-actionbar {
        display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #fff;
        box-shadow: 0 -3px 14px rgba(0,0,0,.14);
    }
    .m-actionbar a {
        flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
        padding: 12px 6px; border-radius: 8px; font-weight: 700; font-size: .95rem;
        text-decoration: none; color: #fff; line-height: 1;
    }
    .m-actionbar .m-call  { background: #0F4229; }
    .m-actionbar .m-wa    { background: #25D366; }
    .m-actionbar .m-quote { background: #348E38; }

    /* --- Compact footer ----------------------------------------------------- */
    .machine-page .footer { margin-top: 1.5rem !important; padding-top: 0 !important; padding-bottom: 0 !important; }
    .machine-page .footer > .container { padding-top: 1.75rem !important; padding-bottom: 1rem !important; }
    .machine-page .footer .row { --bs-gutter-y: 1.25rem; }
    .machine-page .footer h4 { font-size: 1.05rem; margin-bottom: .75rem !important; }
    .machine-page .footer .row > div:nth-child(n+3) { width: 50%; }
    .machine-page .footer .btn.btn-link { padding: 3px 0; font-size: .9rem; }
}

/* ---- "Delivery or Collection?" window (#id01) ---- */
.machine-page #id01 { z-index: 2000; padding-top: 72px; }           /* above the sticky nav and the action bar */
.machine-page #id01 .modal-content {
    width: 92%; max-width: 640px; margin: 0 auto 28px; border: 0; border-radius: 12px; overflow: hidden;
    box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.machine-page #id01 .close {
    position: absolute; top: 14px; right: 18px; z-index: 1; font-size: 2.2rem; line-height: 1; color: #fff; cursor: pointer;
}
.machine-page #id01 .imgcontainer { padding-top: 1.1rem !important; padding-bottom: .4rem !important; }
.machine-page #id01 .imgcontainer img { display: inline-block; width: auto; height: 72px; }
.machine-page #id01 .modal-content .container { max-width: none; padding-left: 1.4rem; padding-right: 1.4rem; }
.machine-page #id01 p { font-size: .96rem; line-height: 1.65; }
@media (min-width: 576px) and (max-width: 991.98px) { .machine-page #id01 .modal-content { width: 78%; } }
@media (min-width: 992px) { .machine-page #id01 .modal-content { width: 50%; } }
@media (max-width: 575.98px) {
    .machine-page #id01 { padding-top: 60px; }
    .machine-page #id01 .modal-content { width: 94%; }
    .machine-page #id01 .close { top: 10px; right: 14px; }
}
