/* ==========================================================================
   Juvo storefront — mobile & cross-device polish + smooth transitions.
   Loaded after juvo.css; layout-preserving, progressive enhancement only.
   ========================================================================== */

:root {
    --jv-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --jv-tap: rgba(246, 139, 30, 0.14);
}

/* ---- Device-level smoothness ---- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
}

body {
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    max-width: 100%;
}

a, button, .jv-action, .jv-btn, .jv-add-cart, input, select, textarea {
    touch-action: manipulation;
}

/* Avoid the iOS zoom-on-focus jump */
@media (max-width: 820px) {
    input, select, textarea { font-size: 16px; }
}

/* ---- Smoother imagery ---- */
.jv-main img {
    transition: opacity 0.5s var(--jv-ease);
}
.jv-img-pending { opacity: 0; }
.jv-product-media img { transition: transform 0.55s var(--jv-ease), opacity 0.5s var(--jv-ease); }
.jv-product:hover .jv-product-media img { transform: scale(1.06); }

/* ---- Touch feedback ---- */
.jv-btn, .jv-add-cart, .jv-action, .jv-allcat, .jv-navlink {
    transition: transform 0.15s var(--jv-ease), background-color 0.2s var(--jv-ease),
                color 0.2s var(--jv-ease), box-shadow 0.2s var(--jv-ease);
}
.jv-btn:active, .jv-add-cart:active, .jv-allcat:active { transform: scale(0.97); }

/* ---- Momentum scrolling for horizontal strips ---- */
.jv-catstrip, .jv-hm-tiles, .jv-hm-trust, .jv-hm-promo-grid, .slick-track, .jv-product-rail {
    -webkit-overflow-scrolling: touch;
}
.jv-catstrip, .jv-hm-tiles, .jv-hm-trust, .jv-hm-promo-grid { scroll-behavior: smooth; }

/* ---- Sticky header shadow once scrolled ---- */
.jv-header { transition: box-shadow 0.25s var(--jv-ease); }
.jv-header.jv-scrolled { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.1); }

/* ---- Back-to-top button ---- */
.jv-top-btn {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 1040;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: var(--jv-orange);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 8px 22px rgba(246, 139, 30, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s var(--jv-ease), transform 0.3s var(--jv-ease), visibility 0.3s;
    cursor: pointer;
}
.jv-top-btn.jv-show { opacity: 1; visibility: visible; transform: translateY(0); }
.jv-top-btn:active { transform: scale(0.94); }

/* ---- Mobile refinements ---- */
@media (max-width: 820px) {
    .jv-main { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
    body.jv-sc-visible .jv-main { padding-bottom: calc(72px + 24px + env(safe-area-inset-bottom)); }
    .jv-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
    .jv-top-btn { bottom: calc(16px + env(safe-area-inset-bottom)); }

    .jv-topstrip .container { gap: 6px; }
    .jv-topstrip a { font-size: 12px; }

    .jv-header-row { gap: 10px; }

    .jv-grid, .jv-grid-3 { gap: 10px; }
    .jv-product-body { padding: 10px; }
    .jv-product-name { font-size: 13px; }

    .jv-listing { gap: 14px; }
    .jv-side { border-radius: var(--jv-radius); }

    /* Full-width, comfortable primary actions */
    .jv-add-cart { padding: 11px 10px; }

    .jv-reviews { padding: 6px 14px 18px; }
    .jv-thankyou { margin: 24px 12px; padding: 36px 20px; }

    /* Home carousels: each rail is its own full-bleed swipe area on phones so
       they no longer read as one cramped container. */
    .jv-main > .container > .jv-section { margin-top: 22px; }
    .jv-main > .container > .jv-section:first-of-type { margin-top: 0; }
    .jv-main > .container > .jv-hm-hero + .jv-section,
    .jv-main > .container > .jv-section + .jv-section { margin-top: 22px; }
    .jv-section .jv-product-slider,
    .jv-section .jv-rail { margin-left: -12px; margin-right: -12px; }
}

@media (max-width: 520px) {
    .jv-notice { font-size: 12px; padding: 7px 12px; }
    .jv-header-row { padding: 10px 0; }
    .jv-actions { gap: 12px; }
    .jv-search input { font-size: 15px; }
    .jv-product-body { padding: 9px; }
    .jv-price { font-size: 15px; }
    .jv-product .jv-price-row { flex-direction: column; align-items: flex-start; gap: 1px; }
    .jv-product .jv-price-old { line-height: 1.15; }
}

@media (max-width: 380px) {
    .jv-grid, .jv-grid-3, .jv-flash-grid { gap: 8px; }
    .jv-product-body { padding: 8px; }
    .jv-add-cart { font-size: 12px; padding: 9px 6px; }
}

/* ---- Sticky mobile add-to-cart bar (PDP) ---- */
.jv-sticky-cart { display: none; }

@media (max-width: 820px) {
    .jv-sticky-cart {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: env(safe-area-inset-bottom);
        z-index: 1040;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--jv-line);
        box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.1);
        transform: translateY(140%);
        transition: transform 0.32s var(--jv-ease);
        will-change: transform;
    }
    .jv-sticky-cart.jv-show { transform: translateY(0); }

    .jv-sc-media {
        flex: 0 0 auto;
        width: 42px;
        height: 42px;
        border-radius: 6px;
        overflow: hidden;
        border: 1px solid var(--jv-line);
        background: #fff;
    }
    .jv-sc-media img { width: 100%; height: 100%; object-fit: contain; }
    .jv-sc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
    .jv-sc-name { font-size: 12px; color: var(--jv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .jv-sc-price { font-size: 16px; font-weight: 800; color: var(--jv-orange); }
    .jv-sc-btn { flex: 0 0 auto; padding: 11px 16px; font-size: 14px; border: none; border-radius: 8px; background: var(--jv-orange); color: #fff; }
    .jv-sc-btn:active { transform: scale(0.97); }
}

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .jv-product-media img,
    .jv-product:hover .jv-product-media img { transition: none; transform: none; }
    .jv-top-btn, .jv-header,
    .jv-sticky-cart, .jv-btn, .jv-add-cart, .jv-action, .jv-allcat, .jv-navlink { transition: none; }
    .jv-btn:active, .jv-add-cart:active, .jv-allcat:active,
    .jv-sc-btn:active { transform: none; }
}
