/* =========================================================
   v2.4.9 — Critical mobile storefront fix
   ---------------------------------------------------------
   One final mobile layer loaded last. It keeps the hamburger
   tappable, shows categories inside the mobile drawer, and
   improves product-card text readability on shop/category pages.
   ========================================================= */

@media (max-width: 900px) {
  body.vlg-theme .vlg-site-header {
    position: relative;
    z-index: 9000 !important;
  }

  body.vlg-theme .vlg-main-header,
  body.vlg-theme .vlg-main-header-inner,
  body.vlg-theme .vlg-header-brand-row {
    overflow: visible !important;
  }

  body.vlg-theme .vlg-mobile-toggle {
    display: inline-grid !important;
    place-items: center !important;
    position: relative !important;
    z-index: 9300 !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    border: 1px solid #dbe5f1 !important;
    border-radius: 15px !important;
    background: #fff !important;
    color: #071224 !important;
    box-shadow: 0 10px 24px rgba(7,18,36,.08) !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
  }

  body.vlg-theme .vlg-mobile-toggle.is-open {
    border-color: rgba(242,138,0,.48) !important;
    background: #fff7ed !important;
  }

  body.vlg-theme .vlg-mobile-backdrop:not([hidden]) {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    z-index: 9100 !important;
    background: rgba(7,18,36,.48) !important;
    backdrop-filter: blur(4px) saturate(120%);
  }

  body.vlg-theme .vlg-nav:not(.is-open) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.vlg-theme .vlg-nav.is-open {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: min(88dvh, 720px) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(218,228,240,.96) !important;
    border-radius: 26px 26px 20px 20px !important;
    background: #fff !important;
    box-shadow: 0 -18px 70px rgba(7,18,36,.32) !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 9200 !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-nav-inner {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: min(88dvh, 720px) !important;
    padding: 10px 12px 14px !important;
    overflow: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
  }

  body.vlg-theme .vlg-mobile-nav-head {
    display: flex !important;
    position: sticky !important;
    top: -10px !important;
    z-index: 2 !important;
    padding: 8px 0 10px !important;
    background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,.94) 100%) !important;
  }

  body.vlg-theme .vlg-mobile-quick-links {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.vlg-theme .vlg-mobile-quick-links a {
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-menu,
  body.vlg-theme .vlg-nav.is-open .vlg-category-menu.is-open {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-button {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 54px !important;
    margin: 0 !important;
    padding: 0 15px !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #071224 0%, #112340 100%) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 950 !important;
    pointer-events: auto !important;
  }

  /* On phones the category list is intentionally visible inside the menu. */
  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown,
  body.vlg-theme .vlg-nav.is-open .vlg-category-menu .vlg-category-dropdown,
  body.vlg-theme .vlg-nav.is-open .vlg-category-menu.is-open .vlg-category-dropdown,
  body.vlg-theme .vlg-nav.is-open .vlg-category-button[aria-expanded="true"] + .vlg-category-dropdown {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 9px 0 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    grid-template-rows: 1fr !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown > ul,
  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown > .vlg-cat-dropdown-list {
    display: grid !important;
    gap: 7px !important;
    max-height: min(46dvh, 390px) !important;
    min-height: 120px !important;
    overflow: auto !important;
    margin: 0 !important;
    padding: 8px !important;
    border: 1px solid #dbe5f1 !important;
    border-radius: 18px !important;
    background: #f8fafc !important;
    list-style: none !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-category-dropdown a,
  body.vlg-theme .vlg-nav.is-open .vlg-cat-link {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    padding: 10px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 15px !important;
    background: #fff !important;
    color: #0f172a !important;
    font-size: 14px !important;
    line-height: 1.22 !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    box-shadow: 0 5px 14px rgba(15,23,42,.035) !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-title {
    color: #0f172a !important;
    font-size: 14px !important;
    line-height: 1.22 !important;
    font-weight: 900 !important;
    overflow-wrap: anywhere !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-cat-count {
    color: #64748b !important;
    font-size: 12px !important;
  }

  body.vlg-theme .vlg-nav.is-open .vlg-primary-menu {
    display: grid !important;
    gap: 7px !important;
  }
}

@media (max-width: 991px) {
  body.vlg-theme.post-type-archive-product .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_cat .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_tag .vlg-shop-products ul.products,
  body.vlg-theme.search-results .vlg-shop-products ul.products,
  body.vlg-theme .vlg-shop-products ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-product-card.product,
  body.vlg-theme ul.products .vlg-product-card.product {
    min-width: 0 !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    background: #fff !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-content,
  body.vlg-theme ul.products .vlg-card-content {
    display: grid !important;
    gap: 6px !important;
    min-width: 0 !important;
    padding: 11px 10px 7px !important;
    background: #fff !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-content h2,
  body.vlg-theme .vlg-shop-products .woocommerce-loop-product__title,
  body.vlg-theme ul.products .vlg-card-content h2,
  body.vlg-theme ul.products .woocommerce-loop-product__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    min-height: 54px !important;
    max-height: none !important;
    margin: 0 0 5px !important;
    padding: 0 !important;
    overflow: hidden !important;
    color: #071224 !important;
    font-size: 14px !important;
    line-height: 1.28 !important;
    letter-spacing: -.01em !important;
    font-weight: 900 !important;
    text-shadow: none !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-category,
  body.vlg-theme ul.products .vlg-card-category {
    color: #b95d00 !important;
    font-size: 10.5px !important;
    line-height: 1.2 !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-price,
  body.vlg-theme .vlg-shop-products .price,
  body.vlg-theme ul.products .vlg-card-price,
  body.vlg-theme ul.products .price {
    color: #071224 !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-actions,
  body.vlg-theme ul.products .vlg-card-actions {
    padding: 8px 10px 11px !important;
    background: #fff !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-cart,
  body.vlg-theme .vlg-shop-products .button,
  body.vlg-theme ul.products .vlg-card-cart,
  body.vlg-theme ul.products .button {
    min-height: 42px !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
    white-space: normal !important;
  }
}

@media (max-width: 380px) {
  body.vlg-theme.post-type-archive-product .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_cat .vlg-shop-products ul.products,
  body.vlg-theme.tax-product_tag .vlg-shop-products ul.products,
  body.vlg-theme.search-results .vlg-shop-products ul.products,
  body.vlg-theme .vlg-shop-products ul.products {
    grid-template-columns: 1fr !important;
  }

  body.vlg-theme .vlg-shop-products .vlg-card-content h2,
  body.vlg-theme .vlg-shop-products .woocommerce-loop-product__title,
  body.vlg-theme ul.products .vlg-card-content h2,
  body.vlg-theme ul.products .woocommerce-loop-product__title {
    min-height: auto !important;
    font-size: 15px !important;
  }
}
