/* Default desktop: mobile-only product galleries remain hidden. */
body.products-page .mobile-product-gallery,
.kivaro-mobile-product-viewer{
  display:none;
}

/* =========================================================
   KIVARO Products mobile refine
   Scope: products.html only. Desktop intentionally preserved.
   ========================================================= */
@media (max-width: 900px),
       (min-width: 901px) and (max-width: 1180px) and (orientation: portrait) {
  body.products-page {
    overflow-x: hidden;
  }
  body.products-page .container {
    width: min(100% - 24px, 1280px) !important;
  }

  /* P-01: Products banner uses desktop original image ratio, with copy card over image. */
  body.products-page .products-hero {
    padding: 14px 0 16px !important;
  }
  body.products-page .products-hero .container {
    width: min(100% - 24px, 1360px) !important;
  }
  body.products-page .products-hero .hero-banner {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1600 / 760 !important;
    border-radius: 26px !important;
    overflow: hidden !important;
    background: #E7DCC6 !important;
  }
  body.products-page .products-hero .hero-banner > img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
  }
  body.products-page .products-hero .hero-copy {
    position: absolute !important;
    left: 14px !important;
    bottom: 14px !important;
    width: min(78%, 340px) !important;
    margin: 0 !important;
    padding: 16px !important;
    border-radius: 20px !important;
    background: rgba(247, 243, 238, .88) !important;
    border: 1px solid rgba(61, 43, 31, .10) !important;
    box-shadow: 0 16px 34px rgba(61,43,31,.12) !important;
    backdrop-filter: blur(6px) !important;
  }
  body.products-page .products-hero .hero-copy .section-eyebrow {
    margin-bottom: 8px !important;
    font-size: 11px !important;
    letter-spacing: .12em !important;
    color: #C8A27A !important;
  }
  body.products-page .products-hero .hero-copy h1 {
    max-width: 100% !important;
    margin: 0 0 8px !important;
    font-size: clamp(22px, 6vw, 30px) !important;
    line-height: 1.08 !important;
  }
  body.products-page .products-hero .hero-copy p {
    margin: 0 0 12px !important;
    font-size: 13px !important;
    line-height: 1.48 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  body.products-page .products-hero .hero-copy .btn {
    width: 100% !important;
    min-height: 42px !important;
    font-size: 11px !important;
    padding: 0 14px !important;
  }

  /* P-02: Product Collections category nav: scroll chips + expandable category menu. */
  body.products-page .layout {
    display: block !important;
  }
  body.products-page aside.sidebar {
    position: sticky !important;
    top: 72px !important;
    z-index: 42 !important;
    width: 100% !important;
    margin: 0 0 16px !important;
    padding: 12px 12px 14px !important;
    border-radius: 20px !important;
    background: rgba(247,243,238,.96) !important;
    border: 1px solid rgba(61,43,31,.10) !important;
    box-shadow: 0 10px 24px rgba(61,43,31,.07) !important;
    backdrop-filter: blur(10px) !important;
  }
  body.products-page aside.sidebar h3 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin: 0 0 12px !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
  }
  body.products-page .product-collections-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(61,43,31,.14);
    background: #F7F3EE;
    color: #3D2B1F;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  body.products-page aside.sidebar .sidebar-label,
  body.products-page aside.sidebar .sidebar-sep,
  body.products-page aside.sidebar .sidebar-group:nth-of-type(2) {
    display: none !important;
  }
  body.products-page aside.sidebar .sidebar-group:first-of-type {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 4px 2px 0 !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  body.products-page aside.sidebar .sidebar-group:first-of-type::-webkit-scrollbar {
    display: none !important;
  }
  body.products-page aside.sidebar .menu-link,
  body.products-page aside.sidebar .menu-link.utility-link {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    height: 44px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(61,43,31,.14) !important;
    background: rgba(255,255,255,.54) !important;
    color: #3D2B1F !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }
  body.products-page aside.sidebar .menu-link.is-active,
  body.products-page aside.sidebar .menu-link[aria-current="true"] {
    background: #E7DCC6 !important;
    border-color: rgba(200,162,122,.55) !important;
  }
  body.products-page aside.sidebar.is-expanded .sidebar-group:first-of-type {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: visible !important;
    gap: 10px !important;
  }
  body.products-page aside.sidebar.is-expanded .menu-link {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Product cards: stable mobile reading. */
  body.products-page .content-sections {
    gap: 16px !important;
  }
  body.products-page .product-card {
    border-radius: 24px !important;
    scroll-margin-top: 138px !important;
  }
  body.products-page .product-grid {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  body.products-page .product-visual {
    position: relative !important;
    padding: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(61,43,31,.10) !important;
    background: #F7F3EE !important;
  }
  body.products-page .product-visual > img,
  body.products-page .product-visual > img.kivaro-flip-base,
  body.products-page .product-visual > img.kivaro-flip-alt {
    display: none !important;
  }

  /* P-03: Mobile product main gallery: 4:3, arrows/dots, click-to-viewer handled by JS. */
  body.products-page .mobile-product-gallery {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    background: #fff !important;
    overflow: hidden !important;
    border-radius: 24px 24px 0 0 !important;
  }
  body.products-page .mobile-product-gallery__img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: #fff !important;
  }
  body.products-page .mobile-product-gallery__btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(61,43,31,.12) !important;
    background: rgba(247,243,238,.88) !important;
    color: #3D2B1F !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    line-height: 1 !important;
    z-index: 3 !important;
    box-shadow: 0 8px 18px rgba(61,43,31,.10) !important;
  }
  body.products-page .mobile-product-gallery__btn.prev { left: 10px !important; }
  body.products-page .mobile-product-gallery__btn.next { right: 10px !important; }
  body.products-page .mobile-product-gallery__dots {
    position: absolute !important;
    left: 50% !important;
    bottom: 10px !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 6px !important;
    z-index: 3 !important;
    padding: 6px 8px !important;
    border-radius: 999px !important;
    background: rgba(247,243,238,.72) !important;
    backdrop-filter: blur(5px) !important;
  }
  body.products-page .mobile-product-gallery__dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 999px !important;
    background: rgba(61,43,31,.26) !important;
  }
  body.products-page .mobile-product-gallery__dot.is-active {
    width: 18px !important;
    background: #3D2B1F !important;
  }

  body.products-page .product-content {
    padding: 16px 16px 18px !important;
    gap: 0 !important;
  }
  body.products-page .product-content .section-eyebrow {
    margin-bottom: 10px !important;
    font-size: 11px !important;
    letter-spacing: .13em !important;
    color: #C8A27A !important;
  }
  body.products-page .product-content h2 {
    margin: 0 0 8px !important;
    font-size: 28px !important;
    line-height: 1.08 !important;
  }
  body.products-page .product-content .lead {
    margin: 0 0 14px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  body.products-page .meta-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  body.products-page .meta-item {
    padding: 10px 12px !important;
    border-radius: 14px !important;
  }
  body.products-page .meta-item strong {
    display: inline !important;
    margin-right: 8px !important;
    font-size: 12px !important;
  }
  body.products-page .meta-item span {
    display: inline !important;
    font-size: 13px !important;
  }
  body.products-page .bullet-list,
  body.products-page .action-row,
  body.products-page .carousel-block {
    display: none !important;
  }

  /* Mobile gallery lightbox. */
  .kivaro-mobile-product-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(25,18,13,.78);
  }
  .kivaro-mobile-product-viewer.is-open { display: flex; }
  .kivaro-mobile-product-viewer__panel {
    position: relative;
    width: min(100%, 920px);
    height: min(78vh, 760px);
    border-radius: 22px;
    background: #fff;
    overflow: hidden;
  }
  .kivaro-mobile-product-viewer__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
  }
  .kivaro-mobile-product-viewer__close,
  .kivaro-mobile-product-viewer__prev,
  .kivaro-mobile-product-viewer__next {
    position: absolute;
    border: 0;
    border-radius: 999px;
    background: rgba(61,43,31,.86);
    color: #F7F3EE;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
  }
  .kivaro-mobile-product-viewer__close { top: 12px; right: 12px; }
  .kivaro-mobile-product-viewer__prev,
  .kivaro-mobile-product-viewer__next { top: 50%; transform: translateY(-50%); }
  .kivaro-mobile-product-viewer__prev { left: 12px; }
  .kivaro-mobile-product-viewer__next { right: 12px; }
}

/* Products mobile quick fix: hide banner copy card on mobile / iPad portrait. */
@media (max-width: 900px),
       (min-width: 901px) and (max-width: 1180px) and (orientation: portrait) {
  body.products-page .products-hero .hero-copy {
    display: none !important;
  }
  body.products-page .products-hero .hero-banner {
    aspect-ratio: 1600 / 760 !important;
    min-height: 0 !important;
    height: auto !important;
  }
}

/* Final: Product Collections sidebar must not show an extra hamburger button. */
body.products-page .product-collections-toggle,
body.products-page aside.sidebar h3 .product-collections-toggle,
body.products-page .secondary-nav-toggle{
  display:none !important;
  visibility:hidden !important;
  width:0 !important;
  height:0 !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  overflow:hidden !important;
}
body.products-page aside.sidebar h3{
  display:block !important;
}
