/**
 * VENTO Mobile UX 5.2.0 — shop archive, type-flow, uncropped cards, home rail
 * Loaded after mobile-chic so it wins on product framing.
 */

@media (max-width: 980px) {
  html, body {
    overflow-x: clip !important;
    max-width: 100vw !important;
  }
  .site-main,
  main#content,
  .vento-woo,
  .container {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .container {
    width: min(100%, calc(100% - 24px)) !important;
    padding-inline: 0 !important;
    margin-inline: auto !important;
  }
  body.m-layout-chic .container {
    width: calc(100% - (var(--m-gutter, 14px) * 2)) !important;
  }

  .shop-layout,
  .shop-layout.has-sidebar,
  .shop-layout.shop-drawer,
  .shop-layout.no-sidebar,
  .container.shop-layout {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip !important;
    grid-template-columns: none !important;
  }
  .shop-layout > .shop-main,
  .shop-layout .shop-main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    float: none !important;
    overflow-x: clip !important;
  }

  /* —— Archive head —— */
  .shop-archive-head {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    min-width: 0 !important;
  }
  .shop-crumbs {
    margin: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .shop-crumbs ol {
    margin: 0 !important;
    padding: 6px 10px !important;
    font-size: 11px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
  }
  .shop-archive-row {
    display: grid !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  .shop-archive-title {
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
    letter-spacing: -0.03em !important;
    color: var(--midnight, #06101f) !important;
  }
  .shop-archive-count .woocommerce-result-count {
    font-size: 11px !important;
    margin: 0 !important;
  }
  .shop-archive-tools {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px !important;
    border-radius: 12px !important;
    background: #fff !important;
    border: 1px solid rgba(8, 20, 38, 0.08) !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }
  .shop-archive-tools .woocommerce-ordering {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  .shop-archive-tools select.orderby,
  .shop-archive-tools .woocommerce-ordering select {
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 12px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }
  .shop-cols button {
    min-width: 32px !important;
    height: 32px !important;
  }
  .shop-filter-bar {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .shop-filter-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: var(--cyan, #196f93) !important;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 12.5px !important;
    box-shadow: 0 4px 12px rgba(25, 111, 147, 0.22) !important;
  }

  /* —— Type flow —— */
  .vento-type-flow {
    margin: 0 0 8px !important;
    padding: 4px 0 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    border-block-end: 1px solid rgba(8, 20, 38, 0.06) !important;
  }
  .vento-type-flow__head {
    margin: 0 0 6px !important;
  }
  .vento-type-flow__eyebrow {
    font-size: 11px !important;
    margin: 0 !important;
    color: var(--cyan, #196f93) !important;
  }
  .vento-type-flow__context {
    margin: 2px 0 0 !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
  }
  .vento-type-flow__hint {
    display: none !important;
  }
  .vento-type-flow__list {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  .vento-type-card {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 72px !important;
    padding: 8px 7px !important;
    gap: 4px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }
  .vento-type-card.is-active,
  .vento-type-card[aria-current="page"] {
    border-color: var(--cyan, #196f93) !important;
    box-shadow:
      0 0 0 1px var(--cyan, #196f93),
      0 6px 16px rgba(25, 111, 147, 0.12) !important;
  }
  .vento-type-card__icon {
    width: 24px !important;
    height: 24px !important;
  }
  .vento-type-card__icon svg {
    width: 20px !important;
    height: 20px !important;
  }
  .vento-type-card__label {
    font-size: 12px !important;
  }
  .vento-type-card__hint {
    display: none !important;
  }

  /* —— Product grid —— */
  .vento-woo ul.products,
  .woocommerce ul.products,
  ul.products.columns-2,
  ul.products.columns-3,
  ul.products.columns-4,
  .woocommerce.columns-2 ul.products,
  .woocommerce.columns-3 ul.products,
  .woocommerce.columns-4 ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .vento-woo ul.products li.product,
  .woocommerce ul.products li.product,
  ul.products li.product {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    float: none !important;
    margin: 0 !important;
    clear: none !important;
    box-sizing: border-box !important;
  }
  body.vento-woo[style*="--shop-now-m: 1"] ul.products,
  body.vento-woo[style*="--shop-now-m:1"] ul.products {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* —— Uncropped product photos (override chic 1:1) —— */
  .product-card .product-media,
  .product-card.style-vegas .product-media,
  .product-card .product-image,
  body.m-layout-chic .product-card .product-media,
  body.m-layout-chic .product-card .product-image,
  body.m-layout-chic .product-image {
    aspect-ratio: 4 / 5 !important;
    overflow: hidden !important;
    background: #eef2f5 !important;
    position: relative !important;
  }
  .product-card .product-image-main,
  .product-card.style-vegas .product-image-main,
  body.m-layout-chic .product-card .product-image-main,
  body.m-layout-chic .product-image-main {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
  }
  .product-card .product-media img,
  .product-card .product-main-img,
  .product-card .product-image img,
  .mosaic-cell img,
  body.m-layout-chic .product-image img,
  body.m-layout-chic .product-media img,
  body.m-layout-chic .product-main-img,
  .woocommerce ul.products li.product img {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    transform: none !important;
  }

  /* —— Home bestsellers rail —— */
  .section-products.m-mode-rail,
  body.m-layout-chic .section-products.m-mode-rail {
    --m-p-visible: 1.22 !important;
    --p-visible: 1.22 !important;
  }
  .section-products.m-mode-rail .products-rail-track,
  .section-products.m-mode-rail .product-grid,
  body.m-layout-chic .section-products.m-mode-rail .products-rail-track,
  body.m-layout-chic .section-products.m-mode-rail .product-grid {
    grid-auto-columns: minmax(220px, calc((100% - 10px) / 1.22)) !important;
    gap: 10px !important;
  }
  .products-rail,
  .products-rail-viewport {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .products-rail-viewport {
    overflow-x: auto !important;
    mask-image: none !important;
  }

  .product-card.style-vegas,
  body.m-layout-chic .product-card {
    border-radius: 14px !important;
  }
  .product-card.style-vegas .product-body,
  body.m-layout-chic .product-body {
    padding: 10px 8px 12px !important;
  }
  .product-card.style-vegas .product-title,
  .product-card.style-vegas .product-body h3,
  body.m-layout-chic .product-body h3 {
    font-size: 12.5px !important;
    line-height: 1.35 !important;
  }
  .product-card.style-vegas .product-price,
  body.m-layout-chic .product-price {
    font-size: 12.5px !important;
  }
}

@media (max-width: 380px) {
  .shop-archive-title {
    font-size: 18px !important;
  }
  .vento-woo ul.products,
  .woocommerce ul.products {
    gap: 8px !important;
  }
  .section-products.m-mode-rail,
  body.m-layout-chic .section-products.m-mode-rail {
    --m-p-visible: 1.12 !important;
  }
  .section-products.m-mode-rail .products-rail-track,
  body.m-layout-chic .section-products.m-mode-rail .products-rail-track {
    grid-auto-columns: minmax(200px, calc(100% / 1.12)) !important;
  }
  .vento-type-card {
    width: min(40vw, 110px) !important;
    min-width: 96px !important;
  }
}
