/* NØSEN KategoriFlow v1.0.4 — optional V3 mobile featured product pattern.
   Enqueued only for WooCommerce product category archives when enabled.
   The Typesense product list is React-rendered; :nth-child responds to changes
   in results without JavaScript observers or product order manipulation.
   Baseline: two cards per row; every seventh card spans both columns.
   Other screens, native WooCommerce products, and search remain untouched. */

@media (max-width: 560px) {
  /* Typesense produces vvts-hits__list, with one list child per result. */
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  /* Positions 7, 14, 21...; positions 1–6 etc. stay in two columns. */
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card {
    height: auto !important;
  }

  /* Tall enough to show narrow tools and long saws at a useful scale. */
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__image {
    width: 100% !important;
    aspect-ratio: 5 / 4 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transform: scale(1.12) !important;
  }

  /* Avoid the equal-height card rules reserving unused white space. */
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__link,
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__body {
    flex: 0 0 auto !important;
  }

  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__body {
    padding: 10px 12px 14px !important;
    gap: 6px !important;
  }

  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__title {
    font-size: 15px !important;
    line-height: 1.35 !important;
    min-height: 0 !important;
    -webkit-line-clamp: 3 !important;
  }

  /* Preserve stock, ratings, and the existing price data/markup. */
  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__price {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    column-gap: 6px !important;
    row-gap: 3px !important;
  }

  #vvts-app.vvts-app .vvts-hits .vvts-hits__list > :nth-child(7n) .vvts-product-card__price .vvts-price-current {
    flex-basis: 100% !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }
}
